amber-cli.js 2.2 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define('__wrap__', function (requirejs) {
  4. var module = void 0; // Bad UMDs workaround
  5. requirejs.resolve = require.resolve;
  6. require = requirejs;
  7. /*!
  8. * @overview es6-promise - a tiny implementation of Promises/A+.
  9. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  10. * @license Licensed under MIT license
  11. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  12. * @version v4.2.5+7f2b526d
  13. */
  14. (function (global, factory) {
  15. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  16. typeof define === 'function' && define.amd ? define('amber/es6-promise',factory) :
  17. (global.ES6Promise = factory());
  18. }(this, (function () { 'use strict';
  19. function objectOrFunction(x) {
  20. var type = typeof x;
  21. return x !== null && (type === 'object' || type === 'function');
  22. }
  23. function isFunction(x) {
  24. return typeof x === 'function';
  25. }
  26. var _isArray = void 0;
  27. if (Array.isArray) {
  28. _isArray = Array.isArray;
  29. } else {
  30. _isArray = function (x) {
  31. return Object.prototype.toString.call(x) === '[object Array]';
  32. };
  33. }
  34. var isArray = _isArray;
  35. var len = 0;
  36. var vertxNext = void 0;
  37. var customSchedulerFn = void 0;
  38. var asap = function asap(callback, arg) {
  39. queue[len] = callback;
  40. queue[len + 1] = arg;
  41. len += 2;
  42. if (len === 2) {
  43. // If len is 2, that means that we need to schedule an async flush.
  44. // If additional callbacks are queued before the queue is flushed, they
  45. // will be processed by this flush that we are scheduling.
  46. if (customSchedulerFn) {
  47. customSchedulerFn(flush);
  48. } else {
  49. scheduleFlush();
  50. }
  51. }
  52. };
  53. function setScheduler(scheduleFn) {
  54. customSchedulerFn = scheduleFn;
  55. }
  56. function setAsap(asapFn) {
  57. asap = asapFn;
  58. }
  59. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  60. var browserGlobal = browserWindow || {};
  61. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  62. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
  63. // test for web worker but not in IE10
  64. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  65. // node
  66. function useNextTick() {
  67. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  68. // see https://github.com/cujojs/when/issues/410 for details
  69. return function () {
  70. return process.nextTick(flush);
  71. };
  72. }
  73. // vertx
  74. function useVertxTimer() {
  75. if (typeof vertxNext !== 'undefined') {
  76. return function () {
  77. vertxNext(flush);
  78. };
  79. }
  80. return useSetTimeout();
  81. }
  82. function useMutationObserver() {
  83. var iterations = 0;
  84. var observer = new BrowserMutationObserver(flush);
  85. var node = document.createTextNode('');
  86. observer.observe(node, { characterData: true });
  87. return function () {
  88. node.data = iterations = ++iterations % 2;
  89. };
  90. }
  91. // web worker
  92. function useMessageChannel() {
  93. var channel = new MessageChannel();
  94. channel.port1.onmessage = flush;
  95. return function () {
  96. return channel.port2.postMessage(0);
  97. };
  98. }
  99. function useSetTimeout() {
  100. // Store setTimeout reference so es6-promise will be unaffected by
  101. // other code modifying setTimeout (like sinon.useFakeTimers())
  102. var globalSetTimeout = setTimeout;
  103. return function () {
  104. return globalSetTimeout(flush, 1);
  105. };
  106. }
  107. var queue = new Array(1000);
  108. function flush() {
  109. for (var i = 0; i < len; i += 2) {
  110. var callback = queue[i];
  111. var arg = queue[i + 1];
  112. callback(arg);
  113. queue[i] = undefined;
  114. queue[i + 1] = undefined;
  115. }
  116. len = 0;
  117. }
  118. function attemptVertx() {
  119. try {
  120. var vertx = Function('return this')().require('vertx');
  121. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  122. return useVertxTimer();
  123. } catch (e) {
  124. return useSetTimeout();
  125. }
  126. }
  127. var scheduleFlush = void 0;
  128. // Decide what async method to use to triggering processing of queued callbacks:
  129. if (isNode) {
  130. scheduleFlush = useNextTick();
  131. } else if (BrowserMutationObserver) {
  132. scheduleFlush = useMutationObserver();
  133. } else if (isWorker) {
  134. scheduleFlush = useMessageChannel();
  135. } else if (browserWindow === undefined && typeof require === 'function') {
  136. scheduleFlush = attemptVertx();
  137. } else {
  138. scheduleFlush = useSetTimeout();
  139. }
  140. function then(onFulfillment, onRejection) {
  141. var parent = this;
  142. var child = new this.constructor(noop);
  143. if (child[PROMISE_ID] === undefined) {
  144. makePromise(child);
  145. }
  146. var _state = parent._state;
  147. if (_state) {
  148. var callback = arguments[_state - 1];
  149. asap(function () {
  150. return invokeCallback(_state, child, callback, parent._result);
  151. });
  152. } else {
  153. subscribe(parent, child, onFulfillment, onRejection);
  154. }
  155. return child;
  156. }
  157. /**
  158. `Promise.resolve` returns a promise that will become resolved with the
  159. passed `value`. It is shorthand for the following:
  160. ```javascript
  161. let promise = new Promise(function(resolve, reject){
  162. resolve(1);
  163. });
  164. promise.then(function(value){
  165. // value === 1
  166. });
  167. ```
  168. Instead of writing the above, your code now simply becomes the following:
  169. ```javascript
  170. let promise = Promise.resolve(1);
  171. promise.then(function(value){
  172. // value === 1
  173. });
  174. ```
  175. @method resolve
  176. @static
  177. @param {Any} value value that the returned promise will be resolved with
  178. Useful for tooling.
  179. @return {Promise} a promise that will become fulfilled with the given
  180. `value`
  181. */
  182. function resolve$1(object) {
  183. /*jshint validthis:true */
  184. var Constructor = this;
  185. if (object && typeof object === 'object' && object.constructor === Constructor) {
  186. return object;
  187. }
  188. var promise = new Constructor(noop);
  189. resolve(promise, object);
  190. return promise;
  191. }
  192. var PROMISE_ID = Math.random().toString(36).substring(2);
  193. function noop() {}
  194. var PENDING = void 0;
  195. var FULFILLED = 1;
  196. var REJECTED = 2;
  197. var TRY_CATCH_ERROR = { error: null };
  198. function selfFulfillment() {
  199. return new TypeError("You cannot resolve a promise with itself");
  200. }
  201. function cannotReturnOwn() {
  202. return new TypeError('A promises callback cannot return that same promise.');
  203. }
  204. function getThen(promise) {
  205. try {
  206. return promise.then;
  207. } catch (error) {
  208. TRY_CATCH_ERROR.error = error;
  209. return TRY_CATCH_ERROR;
  210. }
  211. }
  212. function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
  213. try {
  214. then$$1.call(value, fulfillmentHandler, rejectionHandler);
  215. } catch (e) {
  216. return e;
  217. }
  218. }
  219. function handleForeignThenable(promise, thenable, then$$1) {
  220. asap(function (promise) {
  221. var sealed = false;
  222. var error = tryThen(then$$1, thenable, function (value) {
  223. if (sealed) {
  224. return;
  225. }
  226. sealed = true;
  227. if (thenable !== value) {
  228. resolve(promise, value);
  229. } else {
  230. fulfill(promise, value);
  231. }
  232. }, function (reason) {
  233. if (sealed) {
  234. return;
  235. }
  236. sealed = true;
  237. reject(promise, reason);
  238. }, 'Settle: ' + (promise._label || ' unknown promise'));
  239. if (!sealed && error) {
  240. sealed = true;
  241. reject(promise, error);
  242. }
  243. }, promise);
  244. }
  245. function handleOwnThenable(promise, thenable) {
  246. if (thenable._state === FULFILLED) {
  247. fulfill(promise, thenable._result);
  248. } else if (thenable._state === REJECTED) {
  249. reject(promise, thenable._result);
  250. } else {
  251. subscribe(thenable, undefined, function (value) {
  252. return resolve(promise, value);
  253. }, function (reason) {
  254. return reject(promise, reason);
  255. });
  256. }
  257. }
  258. function handleMaybeThenable(promise, maybeThenable, then$$1) {
  259. if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
  260. handleOwnThenable(promise, maybeThenable);
  261. } else {
  262. if (then$$1 === TRY_CATCH_ERROR) {
  263. reject(promise, TRY_CATCH_ERROR.error);
  264. TRY_CATCH_ERROR.error = null;
  265. } else if (then$$1 === undefined) {
  266. fulfill(promise, maybeThenable);
  267. } else if (isFunction(then$$1)) {
  268. handleForeignThenable(promise, maybeThenable, then$$1);
  269. } else {
  270. fulfill(promise, maybeThenable);
  271. }
  272. }
  273. }
  274. function resolve(promise, value) {
  275. if (promise === value) {
  276. reject(promise, selfFulfillment());
  277. } else if (objectOrFunction(value)) {
  278. handleMaybeThenable(promise, value, getThen(value));
  279. } else {
  280. fulfill(promise, value);
  281. }
  282. }
  283. function publishRejection(promise) {
  284. if (promise._onerror) {
  285. promise._onerror(promise._result);
  286. }
  287. publish(promise);
  288. }
  289. function fulfill(promise, value) {
  290. if (promise._state !== PENDING) {
  291. return;
  292. }
  293. promise._result = value;
  294. promise._state = FULFILLED;
  295. if (promise._subscribers.length !== 0) {
  296. asap(publish, promise);
  297. }
  298. }
  299. function reject(promise, reason) {
  300. if (promise._state !== PENDING) {
  301. return;
  302. }
  303. promise._state = REJECTED;
  304. promise._result = reason;
  305. asap(publishRejection, promise);
  306. }
  307. function subscribe(parent, child, onFulfillment, onRejection) {
  308. var _subscribers = parent._subscribers;
  309. var length = _subscribers.length;
  310. parent._onerror = null;
  311. _subscribers[length] = child;
  312. _subscribers[length + FULFILLED] = onFulfillment;
  313. _subscribers[length + REJECTED] = onRejection;
  314. if (length === 0 && parent._state) {
  315. asap(publish, parent);
  316. }
  317. }
  318. function publish(promise) {
  319. var subscribers = promise._subscribers;
  320. var settled = promise._state;
  321. if (subscribers.length === 0) {
  322. return;
  323. }
  324. var child = void 0,
  325. callback = void 0,
  326. detail = promise._result;
  327. for (var i = 0; i < subscribers.length; i += 3) {
  328. child = subscribers[i];
  329. callback = subscribers[i + settled];
  330. if (child) {
  331. invokeCallback(settled, child, callback, detail);
  332. } else {
  333. callback(detail);
  334. }
  335. }
  336. promise._subscribers.length = 0;
  337. }
  338. function tryCatch(callback, detail) {
  339. try {
  340. return callback(detail);
  341. } catch (e) {
  342. TRY_CATCH_ERROR.error = e;
  343. return TRY_CATCH_ERROR;
  344. }
  345. }
  346. function invokeCallback(settled, promise, callback, detail) {
  347. var hasCallback = isFunction(callback),
  348. value = void 0,
  349. error = void 0,
  350. succeeded = void 0,
  351. failed = void 0;
  352. if (hasCallback) {
  353. value = tryCatch(callback, detail);
  354. if (value === TRY_CATCH_ERROR) {
  355. failed = true;
  356. error = value.error;
  357. value.error = null;
  358. } else {
  359. succeeded = true;
  360. }
  361. if (promise === value) {
  362. reject(promise, cannotReturnOwn());
  363. return;
  364. }
  365. } else {
  366. value = detail;
  367. succeeded = true;
  368. }
  369. if (promise._state !== PENDING) {
  370. // noop
  371. } else if (hasCallback && succeeded) {
  372. resolve(promise, value);
  373. } else if (failed) {
  374. reject(promise, error);
  375. } else if (settled === FULFILLED) {
  376. fulfill(promise, value);
  377. } else if (settled === REJECTED) {
  378. reject(promise, value);
  379. }
  380. }
  381. function initializePromise(promise, resolver) {
  382. try {
  383. resolver(function resolvePromise(value) {
  384. resolve(promise, value);
  385. }, function rejectPromise(reason) {
  386. reject(promise, reason);
  387. });
  388. } catch (e) {
  389. reject(promise, e);
  390. }
  391. }
  392. var id = 0;
  393. function nextId() {
  394. return id++;
  395. }
  396. function makePromise(promise) {
  397. promise[PROMISE_ID] = id++;
  398. promise._state = undefined;
  399. promise._result = undefined;
  400. promise._subscribers = [];
  401. }
  402. function validationError() {
  403. return new Error('Array Methods must be provided an Array');
  404. }
  405. var Enumerator = function () {
  406. function Enumerator(Constructor, input) {
  407. this._instanceConstructor = Constructor;
  408. this.promise = new Constructor(noop);
  409. if (!this.promise[PROMISE_ID]) {
  410. makePromise(this.promise);
  411. }
  412. if (isArray(input)) {
  413. this.length = input.length;
  414. this._remaining = input.length;
  415. this._result = new Array(this.length);
  416. if (this.length === 0) {
  417. fulfill(this.promise, this._result);
  418. } else {
  419. this.length = this.length || 0;
  420. this._enumerate(input);
  421. if (this._remaining === 0) {
  422. fulfill(this.promise, this._result);
  423. }
  424. }
  425. } else {
  426. reject(this.promise, validationError());
  427. }
  428. }
  429. Enumerator.prototype._enumerate = function _enumerate(input) {
  430. for (var i = 0; this._state === PENDING && i < input.length; i++) {
  431. this._eachEntry(input[i], i);
  432. }
  433. };
  434. Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {
  435. var c = this._instanceConstructor;
  436. var resolve$$1 = c.resolve;
  437. if (resolve$$1 === resolve$1) {
  438. var _then = getThen(entry);
  439. if (_then === then && entry._state !== PENDING) {
  440. this._settledAt(entry._state, i, entry._result);
  441. } else if (typeof _then !== 'function') {
  442. this._remaining--;
  443. this._result[i] = entry;
  444. } else if (c === Promise$1) {
  445. var promise = new c(noop);
  446. handleMaybeThenable(promise, entry, _then);
  447. this._willSettleAt(promise, i);
  448. } else {
  449. this._willSettleAt(new c(function (resolve$$1) {
  450. return resolve$$1(entry);
  451. }), i);
  452. }
  453. } else {
  454. this._willSettleAt(resolve$$1(entry), i);
  455. }
  456. };
  457. Enumerator.prototype._settledAt = function _settledAt(state, i, value) {
  458. var promise = this.promise;
  459. if (promise._state === PENDING) {
  460. this._remaining--;
  461. if (state === REJECTED) {
  462. reject(promise, value);
  463. } else {
  464. this._result[i] = value;
  465. }
  466. }
  467. if (this._remaining === 0) {
  468. fulfill(promise, this._result);
  469. }
  470. };
  471. Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {
  472. var enumerator = this;
  473. subscribe(promise, undefined, function (value) {
  474. return enumerator._settledAt(FULFILLED, i, value);
  475. }, function (reason) {
  476. return enumerator._settledAt(REJECTED, i, reason);
  477. });
  478. };
  479. return Enumerator;
  480. }();
  481. /**
  482. `Promise.all` accepts an array of promises, and returns a new promise which
  483. is fulfilled with an array of fulfillment values for the passed promises, or
  484. rejected with the reason of the first passed promise to be rejected. It casts all
  485. elements of the passed iterable to promises as it runs this algorithm.
  486. Example:
  487. ```javascript
  488. let promise1 = resolve(1);
  489. let promise2 = resolve(2);
  490. let promise3 = resolve(3);
  491. let promises = [ promise1, promise2, promise3 ];
  492. Promise.all(promises).then(function(array){
  493. // The array here would be [ 1, 2, 3 ];
  494. });
  495. ```
  496. If any of the `promises` given to `all` are rejected, the first promise
  497. that is rejected will be given as an argument to the returned promises's
  498. rejection handler. For example:
  499. Example:
  500. ```javascript
  501. let promise1 = resolve(1);
  502. let promise2 = reject(new Error("2"));
  503. let promise3 = reject(new Error("3"));
  504. let promises = [ promise1, promise2, promise3 ];
  505. Promise.all(promises).then(function(array){
  506. // Code here never runs because there are rejected promises!
  507. }, function(error) {
  508. // error.message === "2"
  509. });
  510. ```
  511. @method all
  512. @static
  513. @param {Array} entries array of promises
  514. @param {String} label optional string for labeling the promise.
  515. Useful for tooling.
  516. @return {Promise} promise that is fulfilled when all `promises` have been
  517. fulfilled, or rejected if any of them become rejected.
  518. @static
  519. */
  520. function all(entries) {
  521. return new Enumerator(this, entries).promise;
  522. }
  523. /**
  524. `Promise.race` returns a new promise which is settled in the same way as the
  525. first passed promise to settle.
  526. Example:
  527. ```javascript
  528. let promise1 = new Promise(function(resolve, reject){
  529. setTimeout(function(){
  530. resolve('promise 1');
  531. }, 200);
  532. });
  533. let promise2 = new Promise(function(resolve, reject){
  534. setTimeout(function(){
  535. resolve('promise 2');
  536. }, 100);
  537. });
  538. Promise.race([promise1, promise2]).then(function(result){
  539. // result === 'promise 2' because it was resolved before promise1
  540. // was resolved.
  541. });
  542. ```
  543. `Promise.race` is deterministic in that only the state of the first
  544. settled promise matters. For example, even if other promises given to the
  545. `promises` array argument are resolved, but the first settled promise has
  546. become rejected before the other promises became fulfilled, the returned
  547. promise will become rejected:
  548. ```javascript
  549. let promise1 = new Promise(function(resolve, reject){
  550. setTimeout(function(){
  551. resolve('promise 1');
  552. }, 200);
  553. });
  554. let promise2 = new Promise(function(resolve, reject){
  555. setTimeout(function(){
  556. reject(new Error('promise 2'));
  557. }, 100);
  558. });
  559. Promise.race([promise1, promise2]).then(function(result){
  560. // Code here never runs
  561. }, function(reason){
  562. // reason.message === 'promise 2' because promise 2 became rejected before
  563. // promise 1 became fulfilled
  564. });
  565. ```
  566. An example real-world use case is implementing timeouts:
  567. ```javascript
  568. Promise.race([ajax('foo.json'), timeout(5000)])
  569. ```
  570. @method race
  571. @static
  572. @param {Array} promises array of promises to observe
  573. Useful for tooling.
  574. @return {Promise} a promise which settles in the same way as the first passed
  575. promise to settle.
  576. */
  577. function race(entries) {
  578. /*jshint validthis:true */
  579. var Constructor = this;
  580. if (!isArray(entries)) {
  581. return new Constructor(function (_, reject) {
  582. return reject(new TypeError('You must pass an array to race.'));
  583. });
  584. } else {
  585. return new Constructor(function (resolve, reject) {
  586. var length = entries.length;
  587. for (var i = 0; i < length; i++) {
  588. Constructor.resolve(entries[i]).then(resolve, reject);
  589. }
  590. });
  591. }
  592. }
  593. /**
  594. `Promise.reject` returns a promise rejected with the passed `reason`.
  595. It is shorthand for the following:
  596. ```javascript
  597. let promise = new Promise(function(resolve, reject){
  598. reject(new Error('WHOOPS'));
  599. });
  600. promise.then(function(value){
  601. // Code here doesn't run because the promise is rejected!
  602. }, function(reason){
  603. // reason.message === 'WHOOPS'
  604. });
  605. ```
  606. Instead of writing the above, your code now simply becomes the following:
  607. ```javascript
  608. let promise = Promise.reject(new Error('WHOOPS'));
  609. promise.then(function(value){
  610. // Code here doesn't run because the promise is rejected!
  611. }, function(reason){
  612. // reason.message === 'WHOOPS'
  613. });
  614. ```
  615. @method reject
  616. @static
  617. @param {Any} reason value that the returned promise will be rejected with.
  618. Useful for tooling.
  619. @return {Promise} a promise rejected with the given `reason`.
  620. */
  621. function reject$1(reason) {
  622. /*jshint validthis:true */
  623. var Constructor = this;
  624. var promise = new Constructor(noop);
  625. reject(promise, reason);
  626. return promise;
  627. }
  628. function needsResolver() {
  629. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  630. }
  631. function needsNew() {
  632. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  633. }
  634. /**
  635. Promise objects represent the eventual result of an asynchronous operation. The
  636. primary way of interacting with a promise is through its `then` method, which
  637. registers callbacks to receive either a promise's eventual value or the reason
  638. why the promise cannot be fulfilled.
  639. Terminology
  640. -----------
  641. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  642. - `thenable` is an object or function that defines a `then` method.
  643. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  644. - `exception` is a value that is thrown using the throw statement.
  645. - `reason` is a value that indicates why a promise was rejected.
  646. - `settled` the final resting state of a promise, fulfilled or rejected.
  647. A promise can be in one of three states: pending, fulfilled, or rejected.
  648. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  649. state. Promises that are rejected have a rejection reason and are in the
  650. rejected state. A fulfillment value is never a thenable.
  651. Promises can also be said to *resolve* a value. If this value is also a
  652. promise, then the original promise's settled state will match the value's
  653. settled state. So a promise that *resolves* a promise that rejects will
  654. itself reject, and a promise that *resolves* a promise that fulfills will
  655. itself fulfill.
  656. Basic Usage:
  657. ------------
  658. ```js
  659. let promise = new Promise(function(resolve, reject) {
  660. // on success
  661. resolve(value);
  662. // on failure
  663. reject(reason);
  664. });
  665. promise.then(function(value) {
  666. // on fulfillment
  667. }, function(reason) {
  668. // on rejection
  669. });
  670. ```
  671. Advanced Usage:
  672. ---------------
  673. Promises shine when abstracting away asynchronous interactions such as
  674. `XMLHttpRequest`s.
  675. ```js
  676. function getJSON(url) {
  677. return new Promise(function(resolve, reject){
  678. let xhr = new XMLHttpRequest();
  679. xhr.open('GET', url);
  680. xhr.onreadystatechange = handler;
  681. xhr.responseType = 'json';
  682. xhr.setRequestHeader('Accept', 'application/json');
  683. xhr.send();
  684. function handler() {
  685. if (this.readyState === this.DONE) {
  686. if (this.status === 200) {
  687. resolve(this.response);
  688. } else {
  689. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  690. }
  691. }
  692. };
  693. });
  694. }
  695. getJSON('/posts.json').then(function(json) {
  696. // on fulfillment
  697. }, function(reason) {
  698. // on rejection
  699. });
  700. ```
  701. Unlike callbacks, promises are great composable primitives.
  702. ```js
  703. Promise.all([
  704. getJSON('/posts'),
  705. getJSON('/comments')
  706. ]).then(function(values){
  707. values[0] // => postsJSON
  708. values[1] // => commentsJSON
  709. return values;
  710. });
  711. ```
  712. @class Promise
  713. @param {Function} resolver
  714. Useful for tooling.
  715. @constructor
  716. */
  717. var Promise$1 = function () {
  718. function Promise(resolver) {
  719. this[PROMISE_ID] = nextId();
  720. this._result = this._state = undefined;
  721. this._subscribers = [];
  722. if (noop !== resolver) {
  723. typeof resolver !== 'function' && needsResolver();
  724. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  725. }
  726. }
  727. /**
  728. The primary way of interacting with a promise is through its `then` method,
  729. which registers callbacks to receive either a promise's eventual value or the
  730. reason why the promise cannot be fulfilled.
  731. ```js
  732. findUser().then(function(user){
  733. // user is available
  734. }, function(reason){
  735. // user is unavailable, and you are given the reason why
  736. });
  737. ```
  738. Chaining
  739. --------
  740. The return value of `then` is itself a promise. This second, 'downstream'
  741. promise is resolved with the return value of the first promise's fulfillment
  742. or rejection handler, or rejected if the handler throws an exception.
  743. ```js
  744. findUser().then(function (user) {
  745. return user.name;
  746. }, function (reason) {
  747. return 'default name';
  748. }).then(function (userName) {
  749. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  750. // will be `'default name'`
  751. });
  752. findUser().then(function (user) {
  753. throw new Error('Found user, but still unhappy');
  754. }, function (reason) {
  755. throw new Error('`findUser` rejected and we're unhappy');
  756. }).then(function (value) {
  757. // never reached
  758. }, function (reason) {
  759. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  760. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  761. });
  762. ```
  763. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  764. ```js
  765. findUser().then(function (user) {
  766. throw new PedagogicalException('Upstream error');
  767. }).then(function (value) {
  768. // never reached
  769. }).then(function (value) {
  770. // never reached
  771. }, function (reason) {
  772. // The `PedgagocialException` is propagated all the way down to here
  773. });
  774. ```
  775. Assimilation
  776. ------------
  777. Sometimes the value you want to propagate to a downstream promise can only be
  778. retrieved asynchronously. This can be achieved by returning a promise in the
  779. fulfillment or rejection handler. The downstream promise will then be pending
  780. until the returned promise is settled. This is called *assimilation*.
  781. ```js
  782. findUser().then(function (user) {
  783. return findCommentsByAuthor(user);
  784. }).then(function (comments) {
  785. // The user's comments are now available
  786. });
  787. ```
  788. If the assimliated promise rejects, then the downstream promise will also reject.
  789. ```js
  790. findUser().then(function (user) {
  791. return findCommentsByAuthor(user);
  792. }).then(function (comments) {
  793. // If `findCommentsByAuthor` fulfills, we'll have the value here
  794. }, function (reason) {
  795. // If `findCommentsByAuthor` rejects, we'll have the reason here
  796. });
  797. ```
  798. Simple Example
  799. --------------
  800. Synchronous Example
  801. ```javascript
  802. let result;
  803. try {
  804. result = findResult();
  805. // success
  806. } catch(reason) {
  807. // failure
  808. }
  809. ```
  810. Errback Example
  811. ```js
  812. findResult(function(result, err){
  813. if (err) {
  814. // failure
  815. } else {
  816. // success
  817. }
  818. });
  819. ```
  820. Promise Example;
  821. ```javascript
  822. findResult().then(function(result){
  823. // success
  824. }, function(reason){
  825. // failure
  826. });
  827. ```
  828. Advanced Example
  829. --------------
  830. Synchronous Example
  831. ```javascript
  832. let author, books;
  833. try {
  834. author = findAuthor();
  835. books = findBooksByAuthor(author);
  836. // success
  837. } catch(reason) {
  838. // failure
  839. }
  840. ```
  841. Errback Example
  842. ```js
  843. function foundBooks(books) {
  844. }
  845. function failure(reason) {
  846. }
  847. findAuthor(function(author, err){
  848. if (err) {
  849. failure(err);
  850. // failure
  851. } else {
  852. try {
  853. findBoooksByAuthor(author, function(books, err) {
  854. if (err) {
  855. failure(err);
  856. } else {
  857. try {
  858. foundBooks(books);
  859. } catch(reason) {
  860. failure(reason);
  861. }
  862. }
  863. });
  864. } catch(error) {
  865. failure(err);
  866. }
  867. // success
  868. }
  869. });
  870. ```
  871. Promise Example;
  872. ```javascript
  873. findAuthor().
  874. then(findBooksByAuthor).
  875. then(function(books){
  876. // found books
  877. }).catch(function(reason){
  878. // something went wrong
  879. });
  880. ```
  881. @method then
  882. @param {Function} onFulfilled
  883. @param {Function} onRejected
  884. Useful for tooling.
  885. @return {Promise}
  886. */
  887. /**
  888. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  889. as the catch block of a try/catch statement.
  890. ```js
  891. function findAuthor(){
  892. throw new Error('couldn't find that author');
  893. }
  894. // synchronous
  895. try {
  896. findAuthor();
  897. } catch(reason) {
  898. // something went wrong
  899. }
  900. // async with promises
  901. findAuthor().catch(function(reason){
  902. // something went wrong
  903. });
  904. ```
  905. @method catch
  906. @param {Function} onRejection
  907. Useful for tooling.
  908. @return {Promise}
  909. */
  910. Promise.prototype.catch = function _catch(onRejection) {
  911. return this.then(null, onRejection);
  912. };
  913. /**
  914. `finally` will be invoked regardless of the promise's fate just as native
  915. try/catch/finally behaves
  916. Synchronous example:
  917. ```js
  918. findAuthor() {
  919. if (Math.random() > 0.5) {
  920. throw new Error();
  921. }
  922. return new Author();
  923. }
  924. try {
  925. return findAuthor(); // succeed or fail
  926. } catch(error) {
  927. return findOtherAuther();
  928. } finally {
  929. // always runs
  930. // doesn't affect the return value
  931. }
  932. ```
  933. Asynchronous example:
  934. ```js
  935. findAuthor().catch(function(reason){
  936. return findOtherAuther();
  937. }).finally(function(){
  938. // author was either found, or not
  939. });
  940. ```
  941. @method finally
  942. @param {Function} callback
  943. @return {Promise}
  944. */
  945. Promise.prototype.finally = function _finally(callback) {
  946. var promise = this;
  947. var constructor = promise.constructor;
  948. if (isFunction(callback)) {
  949. return promise.then(function (value) {
  950. return constructor.resolve(callback()).then(function () {
  951. return value;
  952. });
  953. }, function (reason) {
  954. return constructor.resolve(callback()).then(function () {
  955. throw reason;
  956. });
  957. });
  958. }
  959. return promise.then(callback, callback);
  960. };
  961. return Promise;
  962. }();
  963. Promise$1.prototype.then = then;
  964. Promise$1.all = all;
  965. Promise$1.race = race;
  966. Promise$1.resolve = resolve$1;
  967. Promise$1.reject = reject$1;
  968. Promise$1._setScheduler = setScheduler;
  969. Promise$1._setAsap = setAsap;
  970. Promise$1._asap = asap;
  971. /*global self*/
  972. function polyfill() {
  973. var local = void 0;
  974. if (typeof global !== 'undefined') {
  975. local = global;
  976. } else if (typeof self !== 'undefined') {
  977. local = self;
  978. } else {
  979. try {
  980. local = Function('return this')();
  981. } catch (e) {
  982. throw new Error('polyfill failed because global object is unavailable in this environment');
  983. }
  984. }
  985. var P = local.Promise;
  986. if (P) {
  987. var promiseToString = null;
  988. try {
  989. promiseToString = Object.prototype.toString.call(P.resolve());
  990. } catch (e) {
  991. // silently ignored
  992. }
  993. if (promiseToString === '[object Promise]' && !P.cast) {
  994. return;
  995. }
  996. }
  997. local.Promise = Promise$1;
  998. }
  999. // Strange compat..
  1000. Promise$1.polyfill = polyfill;
  1001. Promise$1.Promise = Promise$1;
  1002. return Promise$1;
  1003. })));
  1004. //# sourceMappingURL=es6-promise.map
  1005. ;
  1006. (function () {
  1007. define('app',["require", "amber/es6-promise"], function (require, promiseLib) {
  1008. promiseLib.polyfill();
  1009. return new Promise(function (resolve, reject) {
  1010. require(["__app__"], resolve, reject);
  1011. });
  1012. });
  1013. }());
  1014. //jshint eqnull:true
  1015. define('amber/kernel-runtime',[],function () {
  1016. "use strict";
  1017. function defineMethod (klass, name, method) {
  1018. Object.defineProperty(klass.prototype, name, {
  1019. value: method,
  1020. enumerable: false, configurable: true, writable: true
  1021. });
  1022. }
  1023. function installJSMethod (obj, jsSelector, fn) {
  1024. Object.defineProperty(obj, jsSelector, {
  1025. value: fn,
  1026. enumerable: false, configurable: true, writable: true
  1027. });
  1028. }
  1029. RuntimeSelectorsBrik.deps = ["selectors", "selectorConversion", "smalltalkGlobals", "classes"];
  1030. function RuntimeSelectorsBrik (brikz, st) {
  1031. var selectors = brikz.selectors.selectors;
  1032. var globals = brikz.smalltalkGlobals.globals;
  1033. var nilAsClass = brikz.classes.nilAsClass;
  1034. var st2js = brikz.selectorConversion.st2js;
  1035. var jsSelectors = this.jsSelectors = [];
  1036. /* Method not implemented handlers */
  1037. function installNewSelectors (newSelectors, targetClasses) {
  1038. newSelectors.forEach(function (selector) {
  1039. var jsSelector = st2js(selector);
  1040. jsSelectors.push(jsSelector);
  1041. var fn = createDnuHandler(selector);
  1042. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  1043. targetClasses.forEach(function (target) {
  1044. installJSMethod(target.fn.prototype, jsSelector, fn);
  1045. });
  1046. });
  1047. }
  1048. this.installNewSelectors = installNewSelectors;
  1049. /* Dnu handler method */
  1050. function createDnuHandler (stSelector) {
  1051. return function () {
  1052. return globals.Message._selector_arguments_notUnderstoodBy_(
  1053. stSelector, [].slice.call(arguments), this
  1054. );
  1055. };
  1056. }
  1057. installNewSelectors(selectors, []);
  1058. }
  1059. RuntimeClassesBrik.deps = ["event", "smalltalkGlobals", "runtimeSelectors", "behaviors", "classes", "runtimeMethods"];
  1060. function RuntimeClassesBrik (brikz, st) {
  1061. var globals = brikz.smalltalkGlobals.globals;
  1062. var jsSelectors = brikz.runtimeSelectors.jsSelectors;
  1063. var installNewSelectors = brikz.runtimeSelectors.installNewSelectors;
  1064. var installMethod = brikz.runtimeMethods.installMethod;
  1065. var traitsOrClasses = brikz.behaviors.traitsOrClasses;
  1066. var wireKlass = brikz.classes.wireKlass;
  1067. var emit = brikz.event.emit;
  1068. var detachedRootClasses = [];
  1069. function markClassDetachedRoot (klass) {
  1070. klass.detachedRoot = true;
  1071. detachedRootClasses = traitsOrClasses.filter(function (klass) {
  1072. return klass.detachedRoot;
  1073. });
  1074. }
  1075. emit.selectorsAdded = function (newSelectors) {
  1076. installNewSelectors(newSelectors, detachedRootClasses);
  1077. };
  1078. /* Initialize a class in its class hierarchy. Handle both classes and
  1079. metaclasses. */
  1080. function initClassAndMetaclass (klass) {
  1081. initClass(klass);
  1082. if (klass.a$cls && !klass.meta) {
  1083. initClass(klass.a$cls);
  1084. }
  1085. }
  1086. traitsOrClasses.forEach(function (traitOrClass) {
  1087. if (!traitOrClass.trait) initClassAndMetaclass(traitOrClass);
  1088. });
  1089. emit.classAdded = function (klass) {
  1090. initClassAndMetaclass(klass);
  1091. klass._enterOrganization();
  1092. };
  1093. emit.traitAdded = function (trait) {
  1094. trait._enterOrganization();
  1095. };
  1096. emit.classRemoved = function (klass) {
  1097. klass._leaveOrganization();
  1098. };
  1099. emit.traitRemoved = function (trait) {
  1100. trait._leaveOrganization();
  1101. };
  1102. function initClass (klass) {
  1103. wireKlass(klass);
  1104. if (klass.detachedRoot) {
  1105. copySuperclass(klass);
  1106. }
  1107. installMethods(klass);
  1108. }
  1109. function copySuperclass (klass) {
  1110. var myproto = klass.fn.prototype,
  1111. superproto = klass.superclass.fn.prototype;
  1112. jsSelectors.forEach(function (jsSelector) {
  1113. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  1114. });
  1115. }
  1116. function installMethods (klass) {
  1117. var methods = klass.methods;
  1118. Object.keys(methods).forEach(function (selector) {
  1119. installMethod(methods[selector], klass);
  1120. });
  1121. }
  1122. /* Create an alias for an existing class */
  1123. st.alias = function (traitOrClass, alias) {
  1124. globals[alias] = traitOrClass;
  1125. };
  1126. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  1127. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  1128. markClassDetachedRoot(klass);
  1129. klass.fn = constructor;
  1130. initClass(klass);
  1131. };
  1132. }
  1133. FrameBindingBrik.deps = ["smalltalkGlobals", "runtimeClasses"];
  1134. function FrameBindingBrik (brikz, st) {
  1135. var globals = brikz.smalltalkGlobals.globals;
  1136. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1137. setClassConstructor(globals.Number, Number);
  1138. setClassConstructor(globals.BlockClosure, Function);
  1139. setClassConstructor(globals.Boolean, Boolean);
  1140. setClassConstructor(globals.Date, Date);
  1141. setClassConstructor(globals.String, String);
  1142. setClassConstructor(globals.Array, Array);
  1143. setClassConstructor(globals.RegularExpression, RegExp);
  1144. setClassConstructor(globals.Error, Error);
  1145. setClassConstructor(globals.Promise, Promise);
  1146. this.__init__ = function () {
  1147. st.alias(globals.Array, "OrderedCollection");
  1148. st.alias(globals.Date, "Time");
  1149. }
  1150. }
  1151. RuntimeMethodsBrik.deps = ["event", "selectorConversion"];
  1152. function RuntimeMethodsBrik (brikz, st) {
  1153. var st2js = brikz.selectorConversion.st2js;
  1154. var emit = brikz.event.emit;
  1155. function installMethod (method, klass) {
  1156. var jsSelector = method.jsSelector;
  1157. if (!jsSelector) {
  1158. jsSelector = method.jsSelector = st2js(method.selector);
  1159. }
  1160. installJSMethod(klass.fn.prototype, jsSelector, method.fn);
  1161. }
  1162. this.installMethod = installMethod;
  1163. emit.behaviorMethodAdded = function (method, klass) {
  1164. installMethod(method, klass);
  1165. propagateMethodChange(klass, method, klass);
  1166. };
  1167. emit.behaviorMethodRemoved = function (method, klass) {
  1168. delete klass.fn.prototype[method.jsSelector];
  1169. propagateMethodChange(klass, method, null);
  1170. };
  1171. emit.methodReplaced = function (newMethod, oldMethod, traitOrBehavior) {
  1172. traitOrBehavior._methodOrganizationEnter_andLeave_(newMethod, oldMethod);
  1173. };
  1174. function propagateMethodChange (klass, method, exclude) {
  1175. var selector = method.selector;
  1176. var jsSelector = method.jsSelector;
  1177. st.traverseClassTree(klass, function (subclass, sentinel) {
  1178. if (subclass === exclude) return;
  1179. if (subclass.methods[selector]) return sentinel;
  1180. if (subclass.detachedRoot) {
  1181. installJSMethod(subclass.fn.prototype, jsSelector, subclass.superclass.fn.prototype[jsSelector]);
  1182. }
  1183. });
  1184. }
  1185. }
  1186. PrimitivesBrik.deps = ["smalltalkGlobals"];
  1187. function PrimitivesBrik (brikz, st) {
  1188. var globals = brikz.smalltalkGlobals.globals;
  1189. /* Converts a JavaScript object to valid Smalltalk Object */
  1190. st.readJSObject = function (js) {
  1191. if (js == null) return null;
  1192. else if (Array.isArray(js)) return js.map(st.readJSObject);
  1193. else if (js.constructor !== Object) return js;
  1194. var pairs = [];
  1195. for (var i in js) {
  1196. pairs.push(i, st.readJSObject(js[i]));
  1197. }
  1198. return globals.Dictionary._newFromPairs_(pairs);
  1199. };
  1200. /* Boolean assertion */
  1201. st.assert = function (shouldBeBoolean) {
  1202. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1203. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  1204. shouldBeBoolean = shouldBeBoolean.valueOf();
  1205. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1206. }
  1207. globals.NonBooleanReceiver._signalOn_(shouldBeBoolean);
  1208. };
  1209. }
  1210. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  1211. function RuntimeBrik (brikz, st) {
  1212. var globals = brikz.smalltalkGlobals.globals;
  1213. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1214. function SmalltalkMethodContext (home, setup) {
  1215. // TODO lazy fill of .sendIdx
  1216. this.sendIdx = {};
  1217. // TODO very likely .senderContext, not .homeContext here
  1218. this.homeContext = home;
  1219. this.setup = setup;
  1220. }
  1221. // Fallbacks
  1222. SmalltalkMethodContext.prototype.supercall = false;
  1223. SmalltalkMethodContext.prototype.locals = Object.freeze({});
  1224. SmalltalkMethodContext.prototype.receiver = null;
  1225. SmalltalkMethodContext.prototype.selector = null;
  1226. SmalltalkMethodContext.prototype.lookupClass = null;
  1227. SmalltalkMethodContext.prototype.outerContext = null;
  1228. SmalltalkMethodContext.prototype.index = 0;
  1229. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals, lookupClass) {
  1230. this.receiver = receiver;
  1231. this.selector = selector;
  1232. if (locals != null) this.locals = locals;
  1233. this.lookupClass = lookupClass;
  1234. if (this.homeContext) {
  1235. this.homeContext.evaluatedSelector = selector;
  1236. }
  1237. });
  1238. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  1239. if (locals != null) this.locals = locals;
  1240. this.outerContext = ctx;
  1241. if (index) this.index = index;
  1242. });
  1243. defineMethod(SmalltalkMethodContext, "method", function () {
  1244. var method;
  1245. var lookup = this.lookupClass || this.receiver.a$cls;
  1246. while (!method && lookup) {
  1247. method = lookup.methods[st.js2st(this.selector)];
  1248. lookup = lookup.superclass;
  1249. }
  1250. return method;
  1251. });
  1252. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  1253. /* This is the current call context object.
  1254. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  1255. In JS code, use api.getThisContext() (see below).
  1256. */
  1257. var thisContext = null;
  1258. /*
  1259. Runs worker function so that error handler is not set up
  1260. if there isn't one. This is accomplished by unconditional
  1261. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  1262. which then stops error handler setup (see st.withContext above).
  1263. The effect is, $core.seamless(fn)'s exceptions are not
  1264. handed into ST error handler and caller should process them.
  1265. */
  1266. st.seamless = function (worker) {
  1267. var oldContext = thisContext;
  1268. thisContext = new SmalltalkMethodContext(thisContext, function (ctx) {
  1269. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  1270. });
  1271. var result = worker(thisContext);
  1272. thisContext = oldContext;
  1273. return result;
  1274. };
  1275. function resultWithErrorHandling (worker) {
  1276. try {
  1277. return worker(thisContext);
  1278. } catch (error) {
  1279. globals.ErrorHandler._handleError_(error);
  1280. thisContext = null;
  1281. // Rethrow the error in any case.
  1282. throw error;
  1283. }
  1284. }
  1285. /*
  1286. Standard way to run within context.
  1287. Sets up error handler if entering first ST context in a stack.
  1288. */
  1289. st.withContext = function (worker, setup) {
  1290. var oldContext = thisContext;
  1291. thisContext = new SmalltalkMethodContext(thisContext, setup);
  1292. var result = oldContext == null ? resultWithErrorHandling(worker) : worker(thisContext);
  1293. thisContext = oldContext;
  1294. return result;
  1295. };
  1296. /* Handle thisContext pseudo variable */
  1297. st.getThisContext = function () {
  1298. if (!thisContext) return null;
  1299. for (var frame = thisContext; frame; frame = frame.homeContext) {
  1300. frame.setup(frame);
  1301. }
  1302. return thisContext;
  1303. };
  1304. }
  1305. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  1306. function MessageSendBrik (brikz, st) {
  1307. var globals = brikz.smalltalkGlobals.globals;
  1308. var nilAsReceiver = brikz.root.nilAsReceiver;
  1309. /* Send message programmatically. Used to implement #perform: & Co. */
  1310. st.send2 = function (self, selector, args, klass) {
  1311. if (self == null) {
  1312. self = nilAsReceiver;
  1313. }
  1314. var method = klass ? klass.fn.prototype[st.st2js(selector)] : self.a$cls && self[st.st2js(selector)];
  1315. return method != null ?
  1316. method.apply(self, args || []) :
  1317. globals.Message._selector_arguments_notUnderstoodBy_(
  1318. selector, [].slice.call(args), self.a$cls ? self : wrapJavaScript(self)
  1319. );
  1320. };
  1321. function wrapJavaScript (o) {
  1322. return globals.JSObjectProxy._on_(o);
  1323. }
  1324. st.wrapJavaScript = wrapJavaScript;
  1325. /* If the object property is a function, then call it, except if it starts with
  1326. an uppercase character (we probably want to answer the function itself in this
  1327. case and send it #new from Amber).
  1328. */
  1329. st.accessJavaScript = function (self, propertyName, args) {
  1330. var propertyValue = self[propertyName];
  1331. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  1332. return propertyValue.apply(self, args || []);
  1333. } else if (args.length === 0) {
  1334. return propertyValue;
  1335. } else {
  1336. self[propertyName] = args[0];
  1337. return self;
  1338. }
  1339. };
  1340. }
  1341. function SelectorConversionBrik (brikz, st) {
  1342. var st2jsMemo = Object.create(null);
  1343. /* Convert a Smalltalk selector into a JS selector */
  1344. function st2js (string) {
  1345. return '_' + string
  1346. .replace(/:/g, '_')
  1347. .replace(/[\&]/g, '_and')
  1348. .replace(/[\|]/g, '_or')
  1349. .replace(/[+]/g, '_plus')
  1350. .replace(/-/g, '_minus')
  1351. .replace(/[*]/g, '_star')
  1352. .replace(/[\/]/g, '_slash')
  1353. .replace(/[\\]/g, '_backslash')
  1354. .replace(/[\~]/g, '_tild')
  1355. .replace(/%/g, '_percent')
  1356. .replace(/>/g, '_gt')
  1357. .replace(/</g, '_lt')
  1358. .replace(/=/g, '_eq')
  1359. .replace(/,/g, '_comma')
  1360. .replace(/[@]/g, '_at');
  1361. };
  1362. st.st2js = function (stSelector) {
  1363. return st2jsMemo[stSelector] || st2js(stSelector);
  1364. };
  1365. this.st2js = function (stSelector) {
  1366. return st2jsMemo[stSelector] || (st2jsMemo[stSelector] = st2js(stSelector));
  1367. };
  1368. /* Convert a string to a valid smalltalk selector.
  1369. if you modify the following functions, also change st2js
  1370. accordingly */
  1371. st.js2st = function (selector) {
  1372. if (selector.match(/^__/)) {
  1373. return binaryJsToSt(selector);
  1374. } else {
  1375. return keywordJsToSt(selector);
  1376. }
  1377. };
  1378. function keywordJsToSt (selector) {
  1379. return selector.replace(/^_/, '').replace(/_/g, ':');
  1380. }
  1381. function binaryJsToSt (selector) {
  1382. return selector
  1383. .replace(/^_/, '')
  1384. .replace(/_and/g, '&')
  1385. .replace(/_or/g, '|')
  1386. .replace(/_plus/g, '+')
  1387. .replace(/_minus/g, '-')
  1388. .replace(/_star/g, '*')
  1389. .replace(/_slash/g, '/')
  1390. .replace(/_backslash/g, '\\')
  1391. .replace(/_tild/g, '~')
  1392. .replace(/_percent/g, '%')
  1393. .replace(/_gt/g, '>')
  1394. .replace(/_lt/g, '<')
  1395. .replace(/_eq/g, '=')
  1396. .replace(/_comma/g, ',')
  1397. .replace(/_at/g, '@');
  1398. }
  1399. st.st2prop = function (stSelector) {
  1400. var colonPosition = stSelector.indexOf(':');
  1401. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1402. };
  1403. }
  1404. StartImageBrik.deps = ["smalltalkGlobals"];
  1405. function StartImageBrik (brikz, st) {
  1406. var globals = brikz.smalltalkGlobals.globals;
  1407. this.run = function () {
  1408. return globals.AmberBootstrapInitialization._run();
  1409. };
  1410. }
  1411. /* Making smalltalk that can run */
  1412. function configureWithRuntime (brikz) {
  1413. brikz.runtimeSelectors = RuntimeSelectorsBrik;
  1414. brikz.runtimeClasses = RuntimeClassesBrik;
  1415. brikz.frameBinding = FrameBindingBrik;
  1416. brikz.runtimeMethods = RuntimeMethodsBrik;
  1417. brikz.messageSend = MessageSendBrik;
  1418. brikz.runtime = RuntimeBrik;
  1419. brikz.primitives = PrimitivesBrik;
  1420. brikz.selectorConversion = SelectorConversionBrik;
  1421. brikz.startImage = StartImageBrik;
  1422. brikz.rebuild();
  1423. }
  1424. return configureWithRuntime;
  1425. });
  1426. // Depend on each module that is loaded lazily.
  1427. // Add to packager tasks as dependency,
  1428. // so the lazy-loaded modules are included.
  1429. define('amber/lazypack',['./kernel-runtime'], {});
  1430. //jshint eqnull:true
  1431. define('amber/kernel-checks',[],function () {
  1432. "use strict";
  1433. function assert (fn) {
  1434. try {
  1435. if (fn()) return;
  1436. } catch (ex) {
  1437. throw new Error("Error:\n" + ex + "in assertion:\n" + fn);
  1438. }
  1439. throw new Error("Assertion failed:\n" + fn);
  1440. }
  1441. assert(function () {
  1442. return !("hasOwnProperty" in Object.create(null));
  1443. });
  1444. assert(function () {
  1445. return Object.getPrototypeOf(Object.create(null)) === null;
  1446. });
  1447. assert(function () {
  1448. var p = {};
  1449. return Object.getPrototypeOf(Object.create(p)) === p;
  1450. });
  1451. // assert(function () {
  1452. // return new Function("return this")().Object === Object;
  1453. // });
  1454. // assert(function () {
  1455. // return Object.create(new Function("return this")()).Object === Object;
  1456. // });
  1457. assert(function () {
  1458. return typeof global !== "undefined";
  1459. });
  1460. assert(function () {
  1461. return global.Object === Object;
  1462. });
  1463. assert(function () {
  1464. return Object.create(global).Object === Object;
  1465. });
  1466. assert(function () {
  1467. return (function () {
  1468. return this;
  1469. }).apply(void 0) === void 0;
  1470. });
  1471. assert(function () {
  1472. return (function () {
  1473. return this;
  1474. }).apply(null) === null;
  1475. });
  1476. assert(function () {
  1477. return (function () {
  1478. return this;
  1479. }).apply(3) === 3;
  1480. });
  1481. assert(function () {
  1482. return (function () {
  1483. return this;
  1484. }).apply("foo") === "foo";
  1485. });
  1486. assert(function () {
  1487. return (function () {
  1488. return this;
  1489. }).apply(true) === true;
  1490. });
  1491. assert(function () {
  1492. var o = Object.freeze({});
  1493. try {
  1494. o.foo = "bar";
  1495. } catch (ex) {
  1496. }
  1497. return o.foo == null;
  1498. });
  1499. assert(function () {
  1500. return typeof Promise === "function";
  1501. });
  1502. assert(function () {
  1503. return typeof Promise.resolve === "function";
  1504. });
  1505. assert(function () {
  1506. return typeof Promise.reject === "function";
  1507. });
  1508. assert(function () {
  1509. return typeof new Promise(function () {
  1510. }).then === "function";
  1511. });
  1512. });
  1513. define('amber/brikz',[], function () {
  1514. return function Brikz(api, apiKey, initKey) {
  1515. "use strict";
  1516. //jshint eqnull:true
  1517. var brikz = this,
  1518. backup = {};
  1519. apiKey = apiKey || 'exports';
  1520. initKey = initKey || '__init__';
  1521. function mixin(src, target, what) {
  1522. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  1523. if (src == null) {
  1524. target[keys[i]] = undefined;
  1525. } else {
  1526. var value = src[keys[i]];
  1527. if (typeof value !== "undefined") {
  1528. target[keys[i]] = value;
  1529. }
  1530. }
  1531. }
  1532. return target;
  1533. }
  1534. Object.defineProperties(this, {
  1535. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  1536. });
  1537. var exclude = mixin(this, {});
  1538. this.rebuild = function () {
  1539. Object.keys(backup).forEach(function (key) {
  1540. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  1541. });
  1542. var oapi = mixin(api, {}),
  1543. order = [],
  1544. chk = {};
  1545. function ensure(key) {
  1546. if (key in exclude) {
  1547. return null;
  1548. }
  1549. var b = brikz[key],
  1550. bak = backup[key];
  1551. mixin(null, api, api);
  1552. while (typeof b === "function") {
  1553. (b.deps || []).forEach(ensure);
  1554. b = new b(brikz, api, bak);
  1555. }
  1556. brikz[key] = b;
  1557. if (b && !chk[key]) {
  1558. chk[key] = true;
  1559. order.push(b);
  1560. }
  1561. if (b && !b[apiKey]) {
  1562. b[apiKey] = mixin(api, {});
  1563. }
  1564. }
  1565. Object.keys(brikz).forEach(ensure);
  1566. mixin(oapi, mixin(null, api, api));
  1567. order.forEach(function (brik) {
  1568. mixin(brik[apiKey] || {}, api);
  1569. });
  1570. order.forEach(function (brik) {
  1571. if (brik[initKey]) {
  1572. brik[initKey]();
  1573. if (brik[initKey].once) {
  1574. delete brik[initKey];
  1575. }
  1576. }
  1577. });
  1578. backup = mixin(brikz, {});
  1579. };
  1580. };
  1581. });
  1582. /* ====================================================================
  1583. |
  1584. | Amber Smalltalk
  1585. | http://amber-lang.net
  1586. |
  1587. ======================================================================
  1588. ======================================================================
  1589. |
  1590. | Copyright (c) 2010-2014
  1591. | Nicolas Petton <petton.nicolas@gmail.com>
  1592. |
  1593. | Copyright (c) 2012-2017
  1594. | The Amber team https://lolg.it/org/amber/members
  1595. | Amber contributors (see /CONTRIBUTORS)
  1596. |
  1597. | Amber is released under the MIT license
  1598. |
  1599. | Permission is hereby granted, free of charge, to any person obtaining
  1600. | a copy of this software and associated documentation files (the
  1601. | 'Software'), to deal in the Software without restriction, including
  1602. | without limitation the rights to use, copy, modify, merge, publish,
  1603. | distribute, sublicense, and/or sell copies of the Software, and to
  1604. | permit persons to whom the Software is furnished to do so, subject to
  1605. | the following conditions:
  1606. |
  1607. | The above copyright notice and this permission notice shall be
  1608. | included in all copies or substantial portions of the Software.
  1609. |
  1610. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1611. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1612. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1613. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1614. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1615. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1616. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1617. |
  1618. ==================================================================== */
  1619. //jshint eqnull:true
  1620. define('amber/kernel-fundamentals',[],function () {
  1621. "use strict";
  1622. function inherits (child, parent) {
  1623. child.prototype = Object.create(parent.prototype, {
  1624. constructor: {
  1625. value: child,
  1626. enumerable: false, configurable: true, writable: true
  1627. }
  1628. });
  1629. return child;
  1630. }
  1631. function SmalltalkGlobalsBrik (brikz, st) {
  1632. var globals = Object.create(global);
  1633. globals.SmalltalkSettings = {};
  1634. this.globals = globals;
  1635. }
  1636. function EventBrik (brikz, st) {
  1637. var emit = {};
  1638. this.emit = emit;
  1639. this.declareEvent = function (event) {
  1640. if (!emit[event]) emit[event] = function () {
  1641. };
  1642. }
  1643. }
  1644. function RootBrik (brikz, st) {
  1645. /* Smalltalk foundational objects */
  1646. var coreFns = this.coreFns = {};
  1647. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1648. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1649. Detached roots (eg. wrapped JS classes like Number or Date)
  1650. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1651. function SmalltalkRoot () {
  1652. }
  1653. function SmalltalkProtoObject () {
  1654. }
  1655. function SmalltalkObject () {
  1656. }
  1657. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1658. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1659. this.Root = SmalltalkRoot;
  1660. this.Object = SmalltalkObject;
  1661. }
  1662. function SelectorsBrik (brikz, st) {
  1663. var selectorSet = Object.create(null);
  1664. var selectors = this.selectors = [];
  1665. this.registerSelector = function (stSelector) {
  1666. if (selectorSet[stSelector]) return false;
  1667. selectors.push(stSelector);
  1668. return selectorSet[stSelector] = true;
  1669. };
  1670. st.allSelectors = function () {
  1671. return selectors;
  1672. };
  1673. }
  1674. function PackagesBrik (brikz, st) {
  1675. st.packages = st.packageDescriptors = {};
  1676. /* Add a package load descriptor to the system */
  1677. st.addPackage = function (name, properties) {
  1678. if (!name) return null;
  1679. return st.packageDescriptors[name] = {properties: properties};
  1680. };
  1681. }
  1682. BehaviorsBrik.deps = ["root", "smalltalkGlobals", "arraySet"];
  1683. function BehaviorsBrik (brikz, st) {
  1684. var globals = brikz.smalltalkGlobals.globals;
  1685. var addElement = brikz.arraySet.addElement;
  1686. var removeElement = brikz.arraySet.removeElement;
  1687. /* Smalltalk classes and traits */
  1688. var traitsOrClasses = [];
  1689. this.buildTraitOrClass = function (category, builder) {
  1690. var traitOrClass = globals.hasOwnProperty(builder.name) && globals[builder.name];
  1691. if (traitOrClass) {
  1692. builder.updateExisting(traitOrClass);
  1693. } else {
  1694. traitOrClass = builder.make();
  1695. traitOrClass.category = category;
  1696. addTraitOrClass(traitOrClass);
  1697. }
  1698. return traitOrClass;
  1699. };
  1700. function addTraitOrClass (traitOrClass) {
  1701. globals[traitOrClass.name] = traitOrClass;
  1702. addElement(traitsOrClasses, traitOrClass);
  1703. traitOrClass.added();
  1704. }
  1705. function removeTraitOrClass (traitOrClass) {
  1706. traitOrClass.removed();
  1707. removeElement(traitsOrClasses, traitOrClass);
  1708. delete globals[traitOrClass.name];
  1709. }
  1710. this.removeTraitOrClass = removeTraitOrClass;
  1711. st.traitsOrClasses = this.traitsOrClasses = traitsOrClasses;
  1712. }
  1713. MethodsBrik.deps = ["event", "selectors", "root"];
  1714. function MethodsBrik (brikz, st) {
  1715. var registerSelector = brikz.selectors.registerSelector;
  1716. var SmalltalkObject = brikz.root.Object;
  1717. var coreFns = brikz.root.coreFns;
  1718. var emit = brikz.event.emit;
  1719. var declareEvent = brikz.event.declareEvent;
  1720. function SmalltalkMethod () {
  1721. }
  1722. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1723. /* Smalltalk method object. To add a method to a class,
  1724. use api.addMethod() */
  1725. st.method = function (spec) {
  1726. var that = new SmalltalkMethod();
  1727. var selector = spec.selector;
  1728. that.selector = selector;
  1729. that.args = spec.args || [];
  1730. that.protocol = spec.protocol;
  1731. that.source = spec.source;
  1732. that.messageSends = spec.messageSends || [];
  1733. // TODO remove .referencedClasses, have .referencedGlobals
  1734. that.referencedClasses = spec.referencedClasses || [];
  1735. that.fn = spec.fn;
  1736. return that;
  1737. };
  1738. /* Add/remove a method to/from a class */
  1739. st.addMethod = function (method, traitOrBehavior) {
  1740. if (method.owner != null) {
  1741. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.owner);
  1742. }
  1743. method.owner = traitOrBehavior;
  1744. // TODO deprecation helper; remove
  1745. Object.defineProperty(method, "methodClass", {
  1746. get: function () {
  1747. console.warn("Use of .methodClass deprecated, use .owner");
  1748. return method.owner;
  1749. },
  1750. set: function (v) {
  1751. console.warn("Use of .methodClass= deprecated, use .owner=");
  1752. method.owner = v;
  1753. }
  1754. });
  1755. registerNewSelectors(method);
  1756. traitOrBehavior.localMethods[method.selector] = method;
  1757. updateMethod(method.selector, traitOrBehavior);
  1758. };
  1759. declareEvent("selectorsAdded");
  1760. function registerNewSelectors (method) {
  1761. var newSelectors = [];
  1762. function selectorInUse (stSelector) {
  1763. if (registerSelector(stSelector)) {
  1764. newSelectors.push(stSelector);
  1765. }
  1766. }
  1767. selectorInUse(method.selector);
  1768. method.messageSends.forEach(selectorInUse);
  1769. emit.selectorsAdded(newSelectors);
  1770. }
  1771. st.removeMethod = function (method, traitOrBehavior) {
  1772. if (traitOrBehavior.localMethods[method.selector] !== method) return;
  1773. delete traitOrBehavior.localMethods[method.selector];
  1774. updateMethod(method.selector, traitOrBehavior);
  1775. };
  1776. this.setupMethods = function (traitOrBehavior) {
  1777. traitOrBehavior.localMethods = Object.create(null);
  1778. traitOrBehavior.methods = Object.create(null);
  1779. };
  1780. declareEvent("methodReplaced");
  1781. function updateMethod (selector, traitOrBehavior) {
  1782. var oldMethod = traitOrBehavior.methods[selector],
  1783. newMethod = traitOrBehavior.localMethods[selector];
  1784. if (oldMethod == null && newMethod == null) {
  1785. console.warn("Removal of nonexistent method " + traitOrBehavior + " >> " + selector);
  1786. return;
  1787. }
  1788. if (newMethod === oldMethod) return;
  1789. if (newMethod != null) {
  1790. traitOrBehavior.methods[selector] = newMethod;
  1791. traitOrBehavior.methodAdded(newMethod);
  1792. } else {
  1793. delete traitOrBehavior.methods[selector];
  1794. traitOrBehavior.methodRemoved(oldMethod);
  1795. }
  1796. emit.methodReplaced(newMethod, oldMethod, traitOrBehavior);
  1797. }
  1798. this.updateMethod = updateMethod;
  1799. }
  1800. function ArraySetBrik (brikz, st) {
  1801. st.addElement = this.addElement = function (array, el) {
  1802. if (typeof el === 'undefined') {
  1803. return;
  1804. }
  1805. if (array.indexOf(el) === -1) {
  1806. array.push(el);
  1807. }
  1808. };
  1809. st.removeElement = this.removeElement = function (array, el) {
  1810. var i = array.indexOf(el);
  1811. if (i !== -1) {
  1812. array.splice(i, 1);
  1813. }
  1814. };
  1815. }
  1816. NilBrik.deps = ["root"];
  1817. function NilBrik (brikz, st) {
  1818. var SmalltalkObject = brikz.root.Object;
  1819. var coreFns = brikz.root.coreFns;
  1820. function SmalltalkNil () {
  1821. }
  1822. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1823. this.nilAsReceiver = new SmalltalkNil();
  1824. this.nilAsValue = this.nilAsReceiver; // TODO null
  1825. // Adds an `a$nil` (and legacy `isNil`) property to the `nil` object. When sending
  1826. // nil objects from one environment to another, doing
  1827. // `anObject == nil` (in JavaScript) does not always answer
  1828. // true as the referenced nil object might come from the other
  1829. // environment.
  1830. Object.defineProperty(this.nilAsReceiver, 'a$nil', {
  1831. value: true,
  1832. enumerable: false, configurable: false, writable: false
  1833. });
  1834. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1835. value: true,
  1836. enumerable: false, configurable: false, writable: false
  1837. });
  1838. }
  1839. /* Making smalltalk that has basic building blocks */
  1840. function configureWithFundamentals (brikz) {
  1841. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1842. brikz.root = RootBrik;
  1843. brikz.nil = NilBrik;
  1844. brikz.event = EventBrik;
  1845. brikz.arraySet = ArraySetBrik;
  1846. brikz.selectors = SelectorsBrik;
  1847. brikz.packages = PackagesBrik;
  1848. brikz.behaviors = BehaviorsBrik;
  1849. brikz.methods = MethodsBrik;
  1850. brikz.rebuild();
  1851. }
  1852. return configureWithFundamentals;
  1853. });
  1854. /* ====================================================================
  1855. |
  1856. | Amber Smalltalk
  1857. | http://amber-lang.net
  1858. |
  1859. ======================================================================
  1860. ======================================================================
  1861. |
  1862. | Copyright (c) 2010-2014
  1863. | Nicolas Petton <petton.nicolas@gmail.com>
  1864. |
  1865. | Copyright (c) 2012-2017
  1866. | The Amber team https://lolg.it/org/amber/members
  1867. | Amber contributors (see /CONTRIBUTORS)
  1868. |
  1869. | Amber is released under the MIT license
  1870. |
  1871. | Permission is hereby granted, free of charge, to any person obtaining
  1872. | a copy of this software and associated documentation files (the
  1873. | 'Software'), to deal in the Software without restriction, including
  1874. | without limitation the rights to use, copy, modify, merge, publish,
  1875. | distribute, sublicense, and/or sell copies of the Software, and to
  1876. | permit persons to whom the Software is furnished to do so, subject to
  1877. | the following conditions:
  1878. |
  1879. | The above copyright notice and this permission notice shall be
  1880. | included in all copies or substantial portions of the Software.
  1881. |
  1882. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1883. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1884. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1885. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1886. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1887. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1888. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1889. |
  1890. ==================================================================== */
  1891. //jshint eqnull:true
  1892. define('amber/kernel-language',[],function () {
  1893. "use strict";
  1894. function inherits (child, parent) {
  1895. child.prototype = Object.create(parent.prototype, {
  1896. constructor: {
  1897. value: child,
  1898. enumerable: false, configurable: true, writable: true
  1899. }
  1900. });
  1901. return child;
  1902. }
  1903. function defineMethod (klass, name, method) {
  1904. Object.defineProperty(klass.prototype, name, {
  1905. value: method,
  1906. enumerable: false, configurable: true, writable: true
  1907. });
  1908. }
  1909. TraitsBrik.deps = ["event", "behaviors", "methods", "composition", "root"];
  1910. function TraitsBrik (brikz, st) {
  1911. var coreFns = brikz.root.coreFns;
  1912. var SmalltalkObject = brikz.root.Object;
  1913. var setupMethods = brikz.methods.setupMethods;
  1914. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1915. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1916. var emit = brikz.event.emit;
  1917. var declareEvent = brikz.event.declareEvent;
  1918. function SmalltalkTrait () {
  1919. }
  1920. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkObject);
  1921. SmalltalkTrait.prototype.trait = true;
  1922. defineMethod(SmalltalkTrait, "toString", function () {
  1923. return 'Smalltalk Trait ' + this.name;
  1924. });
  1925. declareEvent("traitAdded");
  1926. defineMethod(SmalltalkTrait, "added", function () {
  1927. emit.traitAdded(this);
  1928. });
  1929. declareEvent("traitRemoved");
  1930. defineMethod(SmalltalkTrait, "removed", function () {
  1931. emit.traitRemoved(this);
  1932. });
  1933. declareEvent("traitMethodAdded");
  1934. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1935. var self = this;
  1936. this.traitUsers.forEach(function (each) {
  1937. traitMethodChanged(method.selector, method, self, each);
  1938. });
  1939. emit.traitMethodAdded(method, this);
  1940. });
  1941. declareEvent("traitMethodRemoved");
  1942. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1943. var self = this;
  1944. this.traitUsers.forEach(function (each) {
  1945. traitMethodChanged(method.selector, null, self, each);
  1946. });
  1947. emit.traitMethodRemoved(method, this);
  1948. });
  1949. function traitBuilder (traitName) {
  1950. return {
  1951. name: traitName,
  1952. make: function () {
  1953. var that = new SmalltalkTrait();
  1954. // TODO deprecation helper; remove
  1955. Object.defineProperty(that, "className", {
  1956. get: function () {
  1957. console.warn("Use of .className deprecated, use .name");
  1958. return that.name;
  1959. },
  1960. set: function (v) {
  1961. console.warn("Use of .className= deprecated, use .name=");
  1962. that.name = v;
  1963. }
  1964. });
  1965. that.name = traitName;
  1966. that.traitUsers = [];
  1967. setupMethods(that);
  1968. return that;
  1969. },
  1970. updateExisting: function (trait) {
  1971. }
  1972. };
  1973. }
  1974. st.addTrait = function (className, category) {
  1975. return buildTraitOrClass(category, traitBuilder(className));
  1976. };
  1977. }
  1978. MethodCompositionBrik.deps = ["methods", "arraySet"];
  1979. function MethodCompositionBrik (brikz, st) {
  1980. var updateMethod = brikz.methods.updateMethod;
  1981. var addElement = brikz.arraySet.addElement;
  1982. var removeElement = brikz.arraySet.removeElement;
  1983. function aliased (selector, method) {
  1984. if (method.selector === selector) return method;
  1985. var result = st.method({
  1986. selector: selector,
  1987. args: method.args,
  1988. protocol: method.protocol,
  1989. source: '"Aliased as ' + selector + '"\n' + method.source,
  1990. messageSends: method.messageSends,
  1991. referencesClasses: method.referencedClasses,
  1992. fn: method.fn
  1993. });
  1994. result.owner = method.owner;
  1995. return result;
  1996. }
  1997. function deleteKeysFrom (keys, obj) {
  1998. keys.forEach(function (each) {
  1999. delete obj[each];
  2000. });
  2001. }
  2002. function fillTraitTransformation (traitTransformation, obj) {
  2003. // assert(Object.getOwnProperties(obj).length === 0)
  2004. var traitMethods = traitTransformation.trait.methods;
  2005. Object.keys(traitMethods).forEach(function (selector) {
  2006. obj[selector] = traitMethods[selector];
  2007. });
  2008. var traitAliases = traitTransformation.aliases;
  2009. if (traitAliases) {
  2010. Object.keys(traitAliases).forEach(function (aliasSelector) {
  2011. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  2012. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  2013. // else delete obj[aliasSelector]; // semantically correct; optimized away
  2014. });
  2015. }
  2016. var traitExclusions = traitTransformation.exclusions;
  2017. if (traitExclusions) {
  2018. deleteKeysFrom(traitExclusions, obj);
  2019. }
  2020. return obj;
  2021. }
  2022. function buildCompositionChain (traitComposition) {
  2023. return traitComposition.reduce(function (soFar, each) {
  2024. return fillTraitTransformation(each, Object.create(soFar));
  2025. }, null);
  2026. }
  2027. st.setTraitComposition = function (traitComposition, traitOrBehavior) {
  2028. var oldLocalMethods = traitOrBehavior.localMethods,
  2029. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  2030. Object.keys(oldLocalMethods).forEach(function (selector) {
  2031. newLocalMethods[selector] = oldLocalMethods[selector];
  2032. });
  2033. var selector;
  2034. traitOrBehavior.localMethods = newLocalMethods;
  2035. for (selector in newLocalMethods) {
  2036. updateMethod(selector, traitOrBehavior);
  2037. }
  2038. for (selector in oldLocalMethods) {
  2039. updateMethod(selector, traitOrBehavior);
  2040. }
  2041. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  2042. removeElement(each.trait.traitUsers, traitOrBehavior);
  2043. });
  2044. traitOrBehavior.traitComposition = traitComposition && traitComposition.length ? traitComposition : null;
  2045. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  2046. addElement(each.trait.traitUsers, traitOrBehavior);
  2047. });
  2048. };
  2049. function aliasesOfSelector (selector, traitAliases) {
  2050. if (!traitAliases) return [selector];
  2051. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  2052. return traitAliases[aliasSelector] === selector
  2053. });
  2054. if (!traitAliases[selector]) result.push(selector);
  2055. return result;
  2056. }
  2057. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  2058. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2059. changes.forEach(function (aliasSelector) {
  2060. obj[aliasSelector] = aliased(aliasSelector, method);
  2061. });
  2062. var traitExclusions = traitTransformation.exclusions;
  2063. if (traitExclusions) {
  2064. deleteKeysFrom(traitExclusions, obj);
  2065. }
  2066. return changes;
  2067. }
  2068. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  2069. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2070. deleteKeysFrom(changes, obj);
  2071. return changes;
  2072. }
  2073. function traitMethodChanged (selector, method, trait, traitOrBehavior) {
  2074. var traitComposition = traitOrBehavior.traitComposition,
  2075. chain = traitOrBehavior.localMethods,
  2076. changes = [];
  2077. for (var i = traitComposition.length - 1; i >= 0; --i) {
  2078. chain = Object.getPrototypeOf(chain);
  2079. var traitTransformation = traitComposition[i];
  2080. if (traitTransformation.trait !== trait) continue;
  2081. changes.push.apply(changes, method ?
  2082. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  2083. applyTraitMethodDeletion(selector, traitTransformation, chain));
  2084. }
  2085. // assert(chain === null);
  2086. changes.forEach(function (each) {
  2087. updateMethod(each, traitOrBehavior);
  2088. });
  2089. }
  2090. this.traitMethodChanged = traitMethodChanged;
  2091. }
  2092. ClassesBrik.deps = ["root", "event", "behaviors", "methods", "arraySet", "smalltalkGlobals"];
  2093. function ClassesBrik (brikz, st) {
  2094. var SmalltalkRoot = brikz.root.Root;
  2095. var coreFns = brikz.root.coreFns;
  2096. var globals = brikz.smalltalkGlobals.globals;
  2097. var SmalltalkObject = brikz.root.Object;
  2098. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  2099. var setupMethods = brikz.methods.setupMethods;
  2100. var removeTraitOrClass = brikz.behaviors.removeTraitOrClass;
  2101. var addElement = brikz.arraySet.addElement;
  2102. var removeElement = brikz.arraySet.removeElement;
  2103. var emit = brikz.event.emit;
  2104. var declareEvent = brikz.event.declareEvent;
  2105. function SmalltalkBehavior () {
  2106. }
  2107. function SmalltalkClass () {
  2108. }
  2109. function SmalltalkMetaclass () {
  2110. }
  2111. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkObject);
  2112. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  2113. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  2114. // Fake root class of the system.
  2115. // Effective superclass of all classes created with `nil subclass: ...`.
  2116. var nilAsClass = this.nilAsClass = {
  2117. fn: SmalltalkRoot,
  2118. a$cls: {fn: SmalltalkClass},
  2119. klass: {fn: SmalltalkClass}
  2120. };
  2121. SmalltalkMetaclass.prototype.meta = true;
  2122. defineMethod(SmalltalkClass, "toString", function () {
  2123. return 'Smalltalk ' + this.name;
  2124. });
  2125. defineMethod(SmalltalkMetaclass, "toString", function () {
  2126. return 'Smalltalk Metaclass ' + this.instanceClass.name;
  2127. });
  2128. declareEvent("classAdded");
  2129. defineMethod(SmalltalkClass, "added", function () {
  2130. addSubclass(this);
  2131. emit.classAdded(this);
  2132. });
  2133. declareEvent("classRemoved");
  2134. defineMethod(SmalltalkClass, "removed", function () {
  2135. emit.classRemoved(this);
  2136. removeSubclass(this);
  2137. });
  2138. declareEvent("behaviorMethodAdded");
  2139. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  2140. emit.behaviorMethodAdded(method, this);
  2141. });
  2142. declareEvent("behaviorMethodRemove");
  2143. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  2144. emit.behaviorMethodRemoved(method, this);
  2145. });
  2146. this.bootstrapHierarchy = function () {
  2147. var nilSubclasses = [globals.ProtoObject];
  2148. nilAsClass.a$cls = nilAsClass.klass = globals.Class;
  2149. nilSubclasses.forEach(function (each) {
  2150. each.a$cls.superclass = globals.Class;
  2151. addSubclass(each.a$cls);
  2152. });
  2153. };
  2154. /* Smalltalk class creation. A class is an instance of an automatically
  2155. created metaclass object. Newly created classes (not their metaclass)
  2156. should be added to the system, see smalltalk.addClass().
  2157. Superclass linking is *not* handled here, see api.initialize() */
  2158. function classBuilder (className, superclass, iVarNames, fn) {
  2159. var logicalSuperclass = superclass;
  2160. if (superclass == null || superclass.a$nil) {
  2161. superclass = nilAsClass;
  2162. logicalSuperclass = null;
  2163. }
  2164. function klass () {
  2165. var that = metaclass().instanceClass;
  2166. that.superclass = logicalSuperclass;
  2167. that.fn = fn || inherits(function () {
  2168. }, superclass.fn);
  2169. that.iVarNames = iVarNames || [];
  2170. // TODO deprecation helper; remove
  2171. Object.defineProperty(that, "className", {
  2172. get: function () {
  2173. console.warn("Use of .className deprecated, use .name");
  2174. return that.name;
  2175. },
  2176. set: function (v) {
  2177. console.warn("Use of .className= deprecated, use .name=");
  2178. that.name = v;
  2179. }
  2180. });
  2181. that.name = className;
  2182. that.subclasses = [];
  2183. setupMethods(that);
  2184. return that;
  2185. }
  2186. function metaclass () {
  2187. var that = new SmalltalkMetaclass();
  2188. that.superclass = superclass.a$cls;
  2189. that.fn = inherits(function () {
  2190. }, that.superclass.fn);
  2191. that.iVarNames = [];
  2192. that.instanceClass = new that.fn();
  2193. wireKlass(that);
  2194. setupMethods(that);
  2195. return that;
  2196. }
  2197. return {
  2198. name: className,
  2199. make: klass,
  2200. updateExisting: function (klass) {
  2201. if (klass.superclass == logicalSuperclass && (!fn || fn === klass.fn)) {
  2202. if (iVarNames) klass.iVarNames = iVarNames;
  2203. } else throw new Error("Incompatible change of class: " + klass.name);
  2204. }
  2205. };
  2206. }
  2207. function wireKlass (klass) {
  2208. Object.defineProperty(klass.fn.prototype, "a$cls", {
  2209. value: klass,
  2210. enumerable: false, configurable: true, writable: true
  2211. });
  2212. Object.defineProperty(klass.fn.prototype, "klass", {
  2213. value: klass,
  2214. enumerable: false, configurable: true, writable: true
  2215. });
  2216. }
  2217. this.wireKlass = wireKlass;
  2218. /* Add a class to the system, creating a new one if needed.
  2219. A Package is lazily created if one with given name does not exist. */
  2220. st.addClass = function (className, superclass, iVarNames, category) {
  2221. // While subclassing nil is allowed, it might be an error, so
  2222. // warn about it.
  2223. if (typeof superclass === 'undefined' || superclass && superclass.a$nil) {
  2224. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  2225. }
  2226. return buildTraitOrClass(category, classBuilder(className, superclass, iVarNames, coreFns[className]));
  2227. };
  2228. st.removeClass = removeTraitOrClass;
  2229. function addSubclass (klass) {
  2230. if (klass.superclass) {
  2231. addElement(klass.superclass.subclasses, klass);
  2232. }
  2233. }
  2234. function removeSubclass (klass) {
  2235. if (klass.superclass) {
  2236. removeElement(klass.superclass.subclasses, klass);
  2237. }
  2238. }
  2239. function metaSubclasses (metaclass) {
  2240. return metaclass.instanceClass.subclasses
  2241. .filter(function (each) {
  2242. return !each.meta;
  2243. })
  2244. .map(function (each) {
  2245. return each.a$cls;
  2246. });
  2247. }
  2248. st.metaSubclasses = metaSubclasses;
  2249. st.traverseClassTree = function (klass, fn) {
  2250. var queue = [klass], sentinel = {};
  2251. for (var i = 0; i < queue.length; ++i) {
  2252. var item = queue[i];
  2253. if (fn(item, sentinel) === sentinel) continue;
  2254. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  2255. queue.push.apply(queue, subclasses);
  2256. }
  2257. };
  2258. }
  2259. /* Making smalltalk that can load */
  2260. function configureWithHierarchy (brikz) {
  2261. brikz.traits = TraitsBrik;
  2262. brikz.composition = MethodCompositionBrik;
  2263. brikz.classes = ClassesBrik;
  2264. brikz.rebuild();
  2265. }
  2266. return configureWithHierarchy;
  2267. });
  2268. /* ====================================================================
  2269. |
  2270. | Amber Smalltalk
  2271. | http://amber-lang.net
  2272. |
  2273. ======================================================================
  2274. ======================================================================
  2275. |
  2276. | Copyright (c) 2010-2014
  2277. | Nicolas Petton <petton.nicolas@gmail.com>
  2278. |
  2279. | Copyright (c) 2012-2017
  2280. | The Amber team https://lolg.it/org/amber/members
  2281. | Amber contributors (see /CONTRIBUTORS)
  2282. |
  2283. | Amber is released under the MIT license
  2284. |
  2285. | Permission is hereby granted, free of charge, to any person obtaining
  2286. | a copy of this software and associated documentation files (the
  2287. | 'Software'), to deal in the Software without restriction, including
  2288. | without limitation the rights to use, copy, modify, merge, publish,
  2289. | distribute, sublicense, and/or sell copies of the Software, and to
  2290. | permit persons to whom the Software is furnished to do so, subject to
  2291. | the following conditions:
  2292. |
  2293. | The above copyright notice and this permission notice shall be
  2294. | included in all copies or substantial portions of the Software.
  2295. |
  2296. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  2297. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2298. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  2299. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  2300. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  2301. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  2302. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  2303. |
  2304. ==================================================================== */
  2305. //jshint eqnull:true
  2306. define('amber/boot',[
  2307. 'require', './kernel-checks', './brikz', './kernel-fundamentals', './kernel-language'
  2308. ], function (require, _, Brikz, configureWithFundamentals, configureWithHierarchy) {
  2309. "use strict";
  2310. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  2311. require(['./kernel-runtime'], resolve, reject);
  2312. });
  2313. function SmalltalkInitBrik (brikz, st) {
  2314. var initialized = false;
  2315. /* Smalltalk initialization. Called on page load */
  2316. st.initialize = function () {
  2317. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  2318. if (initialized) return;
  2319. brikz.classes.bootstrapHierarchy();
  2320. configureWithRuntime(brikz);
  2321. // TODO deprecation helper; remove
  2322. Object.defineProperty(st, "packages", {
  2323. get: function () {
  2324. console.warn("Use of .packages deprecated, use .packageDescriptors");
  2325. return st.packageDescriptors;
  2326. },
  2327. set: function (v) {
  2328. console.trace();
  2329. throw new Error("No one should be setting st.packages directly on initialized Amber.");
  2330. }
  2331. });
  2332. return Promise.resolve(brikz.startImage.run())
  2333. .then(function () {
  2334. initialized = true;
  2335. });
  2336. });
  2337. };
  2338. }
  2339. /* Adds AMD and requirejs related methods to the api */
  2340. function AMDBrik (brikz, st) {
  2341. st.amdRequire = require;
  2342. st.defaultTransportType = st.defaultTransportType || "amd";
  2343. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  2344. }
  2345. /* Defines asReceiver to be present at load time */
  2346. /* (logically it belongs more to PrimitiveBrik) */
  2347. AsReceiverBrik.deps = ["nil"];
  2348. function AsReceiverBrik (brikz, st) {
  2349. var nilAsReceiver = brikz.nil.nilAsReceiver;
  2350. /**
  2351. * This function is used all over the compiled amber code.
  2352. * It takes any value (JavaScript or Smalltalk)
  2353. * and returns a proper Amber Smalltalk receiver.
  2354. *
  2355. * null or undefined -> nilAsReceiver,
  2356. * object having Smalltalk signature -> unchanged,
  2357. * otherwise wrapped foreign (JS) object
  2358. */
  2359. this.asReceiver = function (o) {
  2360. if (o == null) return nilAsReceiver;
  2361. else if (o.a$cls != null) return o;
  2362. else return st.wrapJavaScript(o);
  2363. };
  2364. }
  2365. var api = {};
  2366. var brikz = new Brikz(api);
  2367. configureWithFundamentals(brikz);
  2368. configureWithHierarchy(brikz);
  2369. brikz.asReceiver = AsReceiverBrik;
  2370. brikz.stInit = SmalltalkInitBrik;
  2371. brikz.amd = AMDBrik;
  2372. brikz.rebuild();
  2373. // TODO deprecated, remove
  2374. Object.defineProperty(brikz.smalltalkGlobals.globals, "CharacterArray", {
  2375. enumerable: true,
  2376. configurable: true,
  2377. get: function () {
  2378. return this.String;
  2379. }
  2380. });
  2381. return {
  2382. api: api,
  2383. nilAsReceiver: brikz.nil.nilAsReceiver,
  2384. nilAsValue: brikz.nil.nilAsValue,
  2385. nilAsClass: brikz.classes.nilAsClass,
  2386. globals: brikz.smalltalkGlobals.globals,
  2387. asReceiver: brikz.asReceiver.asReceiver
  2388. };
  2389. });
  2390. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  2391. var globals = boot.globals,
  2392. exports = {},
  2393. api = boot.api,
  2394. nil = boot.nilAsReceiver;
  2395. // API
  2396. exports.popupHelios = function () {
  2397. require(['helios/index'], function (helios) {
  2398. helios.popup();
  2399. }, function (err) {
  2400. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  2401. });
  2402. };
  2403. Object.defineProperty(exports, "api", {
  2404. value: api,
  2405. enumerable: true, configurable: true, writable: false
  2406. });
  2407. Object.defineProperty(exports, "globals", {
  2408. value: globals,
  2409. enumerable: true, configurable: true, writable: false
  2410. });
  2411. Object.defineProperty(exports, "nil", {
  2412. value: nil,
  2413. enumerable: true, configurable: true, writable: false
  2414. });
  2415. function mixinToSettings (source) {
  2416. var settings = globals.SmalltalkSettings;
  2417. Object.keys(source).forEach(function (key) {
  2418. settings[key] = source[key];
  2419. });
  2420. }
  2421. function settingsInLocalStorage () {
  2422. //jshint evil:true
  2423. var storage = 'localStorage' in global && global.localStorage;
  2424. if (storage) {
  2425. var fromStorage;
  2426. try {
  2427. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  2428. } catch (ex) {
  2429. // pass
  2430. }
  2431. mixinToSettings(fromStorage || {});
  2432. if (typeof window !== "undefined") {
  2433. window.addEventListener('beforeunload', function () {
  2434. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  2435. });
  2436. }
  2437. }
  2438. }
  2439. exports.initialize = function (options) {
  2440. return new Promise(function (resolve) {
  2441. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  2442. settingsInLocalStorage();
  2443. mixinToSettings(options || {});
  2444. resolve(api.initialize());
  2445. });
  2446. };
  2447. exports.loadPackages = function (modules) {
  2448. return new Promise(function (resolve, reject) {
  2449. require(modules, resolve, reject);
  2450. }).then(function () {
  2451. return globals.Smalltalk._postLoad();
  2452. });
  2453. };
  2454. // Exports
  2455. return exports;
  2456. });
  2457. define('amber_core/Kernel-Helpers',["amber/boot"], function($boot){"use strict";
  2458. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2459. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2460. $core.addPackage("Kernel-Helpers");
  2461. ($core.packageDescriptors||$core.packages)["Kernel-Helpers"].innerEval = function (expr) { return eval(expr); };
  2462. ($core.packageDescriptors||$core.packages)["Kernel-Helpers"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2463. $core.addTrait("TSubclassable", "Kernel-Helpers");
  2464. $core.addMethod(
  2465. $core.method({
  2466. selector: "subclass:",
  2467. protocol: "class creation",
  2468. fn: function (aString){
  2469. var self=this,$self=this;
  2470. return $core.withContext(function($ctx1) {
  2471. return $self._subclass_instanceVariableNames_package_(aString,"",nil);
  2472. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.TSubclassable)});
  2473. },
  2474. args: ["aString"],
  2475. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  2476. referencedClasses: [],
  2477. messageSends: ["subclass:instanceVariableNames:package:"]
  2478. }),
  2479. $globals.TSubclassable);
  2480. $core.addMethod(
  2481. $core.method({
  2482. selector: "subclass:instanceVariableNames:",
  2483. protocol: "class creation",
  2484. fn: function (aString,anotherString){
  2485. var self=this,$self=this;
  2486. return $core.withContext(function($ctx1) {
  2487. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  2488. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.TSubclassable)});
  2489. },
  2490. args: ["aString", "anotherString"],
  2491. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  2492. referencedClasses: [],
  2493. messageSends: ["subclass:instanceVariableNames:package:"]
  2494. }),
  2495. $globals.TSubclassable);
  2496. $core.addMethod(
  2497. $core.method({
  2498. selector: "subclass:instanceVariableNames:category:",
  2499. protocol: "class creation",
  2500. fn: function (aString,aString2,aString3){
  2501. var self=this,$self=this;
  2502. return $core.withContext(function($ctx1) {
  2503. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2504. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2505. },
  2506. args: ["aString", "aString2", "aString3"],
  2507. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2508. referencedClasses: [],
  2509. messageSends: ["subclass:instanceVariableNames:package:"]
  2510. }),
  2511. $globals.TSubclassable);
  2512. $core.addMethod(
  2513. $core.method({
  2514. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2515. protocol: "class creation",
  2516. fn: function (aString,aString2,classVars,pools,aString3){
  2517. var self=this,$self=this;
  2518. return $core.withContext(function($ctx1) {
  2519. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2520. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2521. },
  2522. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  2523. 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",
  2524. referencedClasses: [],
  2525. messageSends: ["subclass:instanceVariableNames:package:"]
  2526. }),
  2527. $globals.TSubclassable);
  2528. $core.addMethod(
  2529. $core.method({
  2530. selector: "subclass:instanceVariableNames:package:",
  2531. protocol: "class creation",
  2532. fn: function (aString,aString2,aString3){
  2533. var self=this,$self=this;
  2534. return $core.withContext(function($ctx1) {
  2535. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  2536. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2537. },
  2538. args: ["aString", "aString2", "aString3"],
  2539. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  2540. referencedClasses: ["ClassBuilder"],
  2541. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  2542. }),
  2543. $globals.TSubclassable);
  2544. $core.addMethod(
  2545. $core.method({
  2546. selector: "subclass:uses:",
  2547. protocol: "class creation",
  2548. fn: function (aString,aTraitCompositionDescription){
  2549. var self=this,$self=this;
  2550. return $core.withContext(function($ctx1) {
  2551. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  2552. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.TSubclassable)});
  2553. },
  2554. args: ["aString", "aTraitCompositionDescription"],
  2555. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  2556. referencedClasses: [],
  2557. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2558. }),
  2559. $globals.TSubclassable);
  2560. $core.addMethod(
  2561. $core.method({
  2562. selector: "subclass:uses:instanceVariableNames:",
  2563. protocol: "class creation",
  2564. fn: function (aString,aTraitCompositionDescription,anotherString){
  2565. var self=this,$self=this;
  2566. return $core.withContext(function($ctx1) {
  2567. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  2568. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.TSubclassable)});
  2569. },
  2570. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  2571. 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",
  2572. referencedClasses: [],
  2573. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2574. }),
  2575. $globals.TSubclassable);
  2576. $core.addMethod(
  2577. $core.method({
  2578. selector: "subclass:uses:instanceVariableNames:category:",
  2579. protocol: "class creation",
  2580. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2581. var self=this,$self=this;
  2582. return $core.withContext(function($ctx1) {
  2583. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2584. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2585. },
  2586. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2587. 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",
  2588. referencedClasses: [],
  2589. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2590. }),
  2591. $globals.TSubclassable);
  2592. $core.addMethod(
  2593. $core.method({
  2594. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2595. protocol: "class creation",
  2596. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  2597. var self=this,$self=this;
  2598. return $core.withContext(function($ctx1) {
  2599. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2600. }, 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)});
  2601. },
  2602. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  2603. 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",
  2604. referencedClasses: [],
  2605. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2606. }),
  2607. $globals.TSubclassable);
  2608. $core.addMethod(
  2609. $core.method({
  2610. selector: "subclass:uses:instanceVariableNames:package:",
  2611. protocol: "class creation",
  2612. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2613. var self=this,$self=this;
  2614. var cls;
  2615. return $core.withContext(function($ctx1) {
  2616. cls=$self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2617. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  2618. return cls;
  2619. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.TSubclassable)});
  2620. },
  2621. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2622. 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",
  2623. referencedClasses: [],
  2624. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  2625. }),
  2626. $globals.TSubclassable);
  2627. });
  2628. define('amber_core/Kernel-Objects',["amber/boot", "amber_core/Kernel-Helpers"], function($boot){"use strict";
  2629. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2630. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2631. $core.addPackage("Kernel-Objects");
  2632. ($core.packageDescriptors||$core.packages)["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  2633. ($core.packageDescriptors||$core.packages)["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2634. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2635. $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.";
  2636. $core.addMethod(
  2637. $core.method({
  2638. selector: "=",
  2639. protocol: "comparing",
  2640. fn: function (anObject){
  2641. var self=this,$self=this;
  2642. return $core.withContext(function($ctx1) {
  2643. return $self.__eq_eq(anObject);
  2644. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  2645. },
  2646. args: ["anObject"],
  2647. source: "= anObject\x0a\x09^ self == anObject",
  2648. referencedClasses: [],
  2649. messageSends: ["=="]
  2650. }),
  2651. $globals.ProtoObject);
  2652. $core.addMethod(
  2653. $core.method({
  2654. selector: "==",
  2655. protocol: "comparing",
  2656. fn: function (anObject){
  2657. var self=this,$self=this;
  2658. return $core.withContext(function($ctx1) {
  2659. return self === anObject;
  2660. return self;
  2661. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  2662. },
  2663. args: ["anObject"],
  2664. source: "== anObject\x0a<inlineJS: 'return self === anObject'>",
  2665. referencedClasses: [],
  2666. messageSends: []
  2667. }),
  2668. $globals.ProtoObject);
  2669. $core.addMethod(
  2670. $core.method({
  2671. selector: "asString",
  2672. protocol: "converting",
  2673. fn: function (){
  2674. var self=this,$self=this;
  2675. return $core.withContext(function($ctx1) {
  2676. return $self._printString();
  2677. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  2678. },
  2679. args: [],
  2680. source: "asString\x0a\x09^ self printString",
  2681. referencedClasses: [],
  2682. messageSends: ["printString"]
  2683. }),
  2684. $globals.ProtoObject);
  2685. $core.addMethod(
  2686. $core.method({
  2687. selector: "class",
  2688. protocol: "accessing",
  2689. fn: function (){
  2690. var self=this,$self=this;
  2691. return $core.withContext(function($ctx1) {
  2692. return $self.a$cls;
  2693. return self;
  2694. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  2695. },
  2696. args: [],
  2697. source: "class\x0a\x09<inlineJS: 'return $self.a$cls'>",
  2698. referencedClasses: [],
  2699. messageSends: []
  2700. }),
  2701. $globals.ProtoObject);
  2702. $core.addMethod(
  2703. $core.method({
  2704. selector: "doesNotUnderstand:",
  2705. protocol: "error handling",
  2706. fn: function (aMessage){
  2707. var self=this,$self=this;
  2708. return $core.withContext(function($ctx1) {
  2709. var $1;
  2710. $1=$recv($globals.MessageNotUnderstood)._new();
  2711. $recv($1)._receiver_(self);
  2712. $recv($1)._message_(aMessage);
  2713. $recv($1)._signal();
  2714. return self;
  2715. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  2716. },
  2717. args: ["aMessage"],
  2718. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2719. referencedClasses: ["MessageNotUnderstood"],
  2720. messageSends: ["receiver:", "new", "message:", "signal"]
  2721. }),
  2722. $globals.ProtoObject);
  2723. $core.addMethod(
  2724. $core.method({
  2725. selector: "evaluate:on:",
  2726. protocol: "evaluating",
  2727. fn: function (aString,anEvaluator){
  2728. var self=this,$self=this;
  2729. return $core.withContext(function($ctx1) {
  2730. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2731. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  2732. },
  2733. args: ["aString", "anEvaluator"],
  2734. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2735. referencedClasses: [],
  2736. messageSends: ["evaluate:receiver:"]
  2737. }),
  2738. $globals.ProtoObject);
  2739. $core.addMethod(
  2740. $core.method({
  2741. selector: "identityHash",
  2742. protocol: "accessing",
  2743. fn: function (){
  2744. var self=this,$self=this;
  2745. return $core.withContext(function($ctx1) {
  2746. self._deprecatedAPI();
  2747. var hash=self.identityHash;
  2748. if (hash) return hash;
  2749. hash=$core.nextId();
  2750. Object.defineProperty(self, 'identityHash', {value:hash});
  2751. return hash;
  2752. ;
  2753. return self;
  2754. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  2755. },
  2756. args: [],
  2757. 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'>",
  2758. referencedClasses: [],
  2759. messageSends: []
  2760. }),
  2761. $globals.ProtoObject);
  2762. $core.addMethod(
  2763. $core.method({
  2764. selector: "ifNil:",
  2765. protocol: "testing",
  2766. fn: function (aBlock){
  2767. var self=this,$self=this;
  2768. return self;
  2769. },
  2770. args: ["aBlock"],
  2771. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2772. referencedClasses: [],
  2773. messageSends: []
  2774. }),
  2775. $globals.ProtoObject);
  2776. $core.addMethod(
  2777. $core.method({
  2778. selector: "ifNil:ifNotNil:",
  2779. protocol: "testing",
  2780. fn: function (aBlock,anotherBlock){
  2781. var self=this,$self=this;
  2782. return $core.withContext(function($ctx1) {
  2783. return $recv(anotherBlock)._value_(self);
  2784. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2785. },
  2786. args: ["aBlock", "anotherBlock"],
  2787. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2788. referencedClasses: [],
  2789. messageSends: ["value:"]
  2790. }),
  2791. $globals.ProtoObject);
  2792. $core.addMethod(
  2793. $core.method({
  2794. selector: "ifNotNil:",
  2795. protocol: "testing",
  2796. fn: function (aBlock){
  2797. var self=this,$self=this;
  2798. return $core.withContext(function($ctx1) {
  2799. return $recv(aBlock)._value_(self);
  2800. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  2801. },
  2802. args: ["aBlock"],
  2803. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2804. referencedClasses: [],
  2805. messageSends: ["value:"]
  2806. }),
  2807. $globals.ProtoObject);
  2808. $core.addMethod(
  2809. $core.method({
  2810. selector: "ifNotNil:ifNil:",
  2811. protocol: "testing",
  2812. fn: function (aBlock,anotherBlock){
  2813. var self=this,$self=this;
  2814. return $core.withContext(function($ctx1) {
  2815. return $recv(aBlock)._value_(self);
  2816. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2817. },
  2818. args: ["aBlock", "anotherBlock"],
  2819. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2820. referencedClasses: [],
  2821. messageSends: ["value:"]
  2822. }),
  2823. $globals.ProtoObject);
  2824. $core.addMethod(
  2825. $core.method({
  2826. selector: "initialize",
  2827. protocol: "initialization",
  2828. fn: function (){
  2829. var self=this,$self=this;
  2830. return self;
  2831. },
  2832. args: [],
  2833. source: "initialize",
  2834. referencedClasses: [],
  2835. messageSends: []
  2836. }),
  2837. $globals.ProtoObject);
  2838. $core.addMethod(
  2839. $core.method({
  2840. selector: "inspect",
  2841. protocol: "inspecting",
  2842. fn: function (){
  2843. var self=this,$self=this;
  2844. return $core.withContext(function($ctx1) {
  2845. $recv($globals.Inspector)._inspect_(self);
  2846. return self;
  2847. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  2848. },
  2849. args: [],
  2850. source: "inspect\x0a\x09Inspector inspect: self",
  2851. referencedClasses: ["Inspector"],
  2852. messageSends: ["inspect:"]
  2853. }),
  2854. $globals.ProtoObject);
  2855. $core.addMethod(
  2856. $core.method({
  2857. selector: "inspectOn:",
  2858. protocol: "inspecting",
  2859. fn: function (anInspector){
  2860. var self=this,$self=this;
  2861. return self;
  2862. },
  2863. args: ["anInspector"],
  2864. source: "inspectOn: anInspector",
  2865. referencedClasses: [],
  2866. messageSends: []
  2867. }),
  2868. $globals.ProtoObject);
  2869. $core.addMethod(
  2870. $core.method({
  2871. selector: "instVarAt:",
  2872. protocol: "accessing",
  2873. fn: function (aString){
  2874. var self=this,$self=this;
  2875. return $core.withContext(function($ctx1) {
  2876. return $self['@'+aString];
  2877. return self;
  2878. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  2879. },
  2880. args: ["aString"],
  2881. source: "instVarAt: aString\x0a\x09<inlineJS: 'return $self[''@''+aString]'>",
  2882. referencedClasses: [],
  2883. messageSends: []
  2884. }),
  2885. $globals.ProtoObject);
  2886. $core.addMethod(
  2887. $core.method({
  2888. selector: "instVarAt:put:",
  2889. protocol: "accessing",
  2890. fn: function (aString,anObject){
  2891. var self=this,$self=this;
  2892. return $core.withContext(function($ctx1) {
  2893. $self['@' + aString] = anObject;
  2894. return self;
  2895. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  2896. },
  2897. args: ["aString", "anObject"],
  2898. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: '$self[''@'' + aString] = anObject'>",
  2899. referencedClasses: [],
  2900. messageSends: []
  2901. }),
  2902. $globals.ProtoObject);
  2903. $core.addMethod(
  2904. $core.method({
  2905. selector: "isKindOf:",
  2906. protocol: "testing",
  2907. fn: function (aClass){
  2908. var self=this,$self=this;
  2909. return $core.withContext(function($ctx1) {
  2910. var $1;
  2911. $1=$self._isMemberOf_(aClass);
  2912. if($core.assert($1)){
  2913. return true;
  2914. } else {
  2915. return $recv($self._class())._inheritsFrom_(aClass);
  2916. }
  2917. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  2918. },
  2919. args: ["aClass"],
  2920. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  2921. referencedClasses: [],
  2922. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  2923. }),
  2924. $globals.ProtoObject);
  2925. $core.addMethod(
  2926. $core.method({
  2927. selector: "isNil",
  2928. protocol: "testing",
  2929. fn: function (){
  2930. var self=this,$self=this;
  2931. return false;
  2932. },
  2933. args: [],
  2934. source: "isNil\x0a\x09^ false",
  2935. referencedClasses: [],
  2936. messageSends: []
  2937. }),
  2938. $globals.ProtoObject);
  2939. $core.addMethod(
  2940. $core.method({
  2941. selector: "notNil",
  2942. protocol: "testing",
  2943. fn: function (){
  2944. var self=this,$self=this;
  2945. return $core.withContext(function($ctx1) {
  2946. return $recv($self._isNil())._not();
  2947. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2948. },
  2949. args: [],
  2950. source: "notNil\x0a\x09^ self isNil not",
  2951. referencedClasses: [],
  2952. messageSends: ["not", "isNil"]
  2953. }),
  2954. $globals.ProtoObject);
  2955. $core.addMethod(
  2956. $core.method({
  2957. selector: "perform:",
  2958. protocol: "message handling",
  2959. fn: function (aString){
  2960. var self=this,$self=this;
  2961. return $core.withContext(function($ctx1) {
  2962. return $self._perform_withArguments_(aString,[]);
  2963. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2964. },
  2965. args: ["aString"],
  2966. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2967. referencedClasses: [],
  2968. messageSends: ["perform:withArguments:"]
  2969. }),
  2970. $globals.ProtoObject);
  2971. $core.addMethod(
  2972. $core.method({
  2973. selector: "perform:withArguments:",
  2974. protocol: "message handling",
  2975. fn: function (aString,aCollection){
  2976. var self=this,$self=this;
  2977. return $core.withContext(function($ctx1) {
  2978. return $core.send2(self, aString, aCollection);
  2979. return self;
  2980. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2981. },
  2982. args: ["aString", "aCollection"],
  2983. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  2984. referencedClasses: [],
  2985. messageSends: []
  2986. }),
  2987. $globals.ProtoObject);
  2988. $core.addMethod(
  2989. $core.method({
  2990. selector: "printOn:",
  2991. protocol: "printing",
  2992. fn: function (aStream){
  2993. var self=this,$self=this;
  2994. return $core.withContext(function($ctx1) {
  2995. var $5,$4,$3,$2,$1;
  2996. $5=$self._class();
  2997. $ctx1.sendIdx["class"]=1;
  2998. $4=$recv($5)._name();
  2999. $ctx1.sendIdx["name"]=1;
  3000. $3=$recv($4)._first();
  3001. $2=$recv($3)._isVowel();
  3002. if($core.assert($2)){
  3003. $1="an ";
  3004. } else {
  3005. $1="a ";
  3006. }
  3007. $recv(aStream)._nextPutAll_($1);
  3008. $ctx1.sendIdx["nextPutAll:"]=1;
  3009. $recv(aStream)._nextPutAll_($recv($self._class())._name());
  3010. return self;
  3011. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  3012. },
  3013. args: ["aStream"],
  3014. 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",
  3015. referencedClasses: [],
  3016. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  3017. }),
  3018. $globals.ProtoObject);
  3019. $core.addMethod(
  3020. $core.method({
  3021. selector: "printString",
  3022. protocol: "printing",
  3023. fn: function (){
  3024. var self=this,$self=this;
  3025. return $core.withContext(function($ctx1) {
  3026. return $recv($globals.String)._streamContents_((function(str){
  3027. return $core.withContext(function($ctx2) {
  3028. return $self._printOn_(str);
  3029. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3030. }));
  3031. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  3032. },
  3033. args: [],
  3034. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  3035. referencedClasses: ["String"],
  3036. messageSends: ["streamContents:", "printOn:"]
  3037. }),
  3038. $globals.ProtoObject);
  3039. $core.addMethod(
  3040. $core.method({
  3041. selector: "yourself",
  3042. protocol: "accessing",
  3043. fn: function (){
  3044. var self=this,$self=this;
  3045. return self;
  3046. },
  3047. args: [],
  3048. source: "yourself\x0a\x09^ self",
  3049. referencedClasses: [],
  3050. messageSends: []
  3051. }),
  3052. $globals.ProtoObject);
  3053. $core.addMethod(
  3054. $core.method({
  3055. selector: "~=",
  3056. protocol: "comparing",
  3057. fn: function (anObject){
  3058. var self=this,$self=this;
  3059. return $core.withContext(function($ctx1) {
  3060. var $1;
  3061. $1=$recv($self.__eq(anObject)).__eq(false);
  3062. $ctx1.sendIdx["="]=1;
  3063. return $1;
  3064. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  3065. },
  3066. args: ["anObject"],
  3067. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  3068. referencedClasses: [],
  3069. messageSends: ["="]
  3070. }),
  3071. $globals.ProtoObject);
  3072. $core.addMethod(
  3073. $core.method({
  3074. selector: "~~",
  3075. protocol: "comparing",
  3076. fn: function (anObject){
  3077. var self=this,$self=this;
  3078. return $core.withContext(function($ctx1) {
  3079. return $recv($self.__eq_eq(anObject)).__eq(false);
  3080. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  3081. },
  3082. args: ["anObject"],
  3083. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  3084. referencedClasses: [],
  3085. messageSends: ["=", "=="]
  3086. }),
  3087. $globals.ProtoObject);
  3088. $core.addMethod(
  3089. $core.method({
  3090. selector: "initialize",
  3091. protocol: "initialization",
  3092. fn: function (){
  3093. var self=this,$self=this;
  3094. return self;
  3095. },
  3096. args: [],
  3097. source: "initialize",
  3098. referencedClasses: [],
  3099. messageSends: []
  3100. }),
  3101. $globals.ProtoObject.a$cls);
  3102. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  3103. $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.";
  3104. $core.addMethod(
  3105. $core.method({
  3106. selector: "->",
  3107. protocol: "converting",
  3108. fn: function (anObject){
  3109. var self=this,$self=this;
  3110. return $core.withContext(function($ctx1) {
  3111. return $recv($globals.Association)._key_value_(self,anObject);
  3112. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  3113. },
  3114. args: ["anObject"],
  3115. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  3116. referencedClasses: ["Association"],
  3117. messageSends: ["key:value:"]
  3118. }),
  3119. $globals.Object);
  3120. $core.addMethod(
  3121. $core.method({
  3122. selector: "asJSONString",
  3123. protocol: "converting",
  3124. fn: function (){
  3125. var self=this,$self=this;
  3126. return $core.withContext(function($ctx1) {
  3127. return $recv($globals.JSON)._stringify_($self._asJavaScriptObject());
  3128. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  3129. },
  3130. args: [],
  3131. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  3132. referencedClasses: ["JSON"],
  3133. messageSends: ["stringify:", "asJavaScriptObject"]
  3134. }),
  3135. $globals.Object);
  3136. $core.addMethod(
  3137. $core.method({
  3138. selector: "asJavaScriptObject",
  3139. protocol: "converting",
  3140. fn: function (){
  3141. var self=this,$self=this;
  3142. var variables;
  3143. return $core.withContext(function($ctx1) {
  3144. variables=$recv($globals.HashedCollection)._new();
  3145. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  3146. return $core.withContext(function($ctx2) {
  3147. return $recv(variables)._at_put_(each,$recv($self._instVarAt_(each))._asJavaScriptObject());
  3148. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3149. }));
  3150. return variables;
  3151. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables},$globals.Object)});
  3152. },
  3153. args: [],
  3154. 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",
  3155. referencedClasses: ["HashedCollection"],
  3156. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarAt:"]
  3157. }),
  3158. $globals.Object);
  3159. $core.addMethod(
  3160. $core.method({
  3161. selector: "asJavaScriptSource",
  3162. protocol: "converting",
  3163. fn: function (){
  3164. var self=this,$self=this;
  3165. return $core.withContext(function($ctx1) {
  3166. return $self._asString();
  3167. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Object)});
  3168. },
  3169. args: [],
  3170. source: "asJavaScriptSource\x0a\x09^ self asString",
  3171. referencedClasses: [],
  3172. messageSends: ["asString"]
  3173. }),
  3174. $globals.Object);
  3175. $core.addMethod(
  3176. $core.method({
  3177. selector: "basicAt:",
  3178. protocol: "accessing",
  3179. fn: function (aString){
  3180. var self=this,$self=this;
  3181. return $core.withContext(function($ctx1) {
  3182. return self[aString];
  3183. return self;
  3184. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  3185. },
  3186. args: ["aString"],
  3187. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  3188. referencedClasses: [],
  3189. messageSends: []
  3190. }),
  3191. $globals.Object);
  3192. $core.addMethod(
  3193. $core.method({
  3194. selector: "basicAt:put:",
  3195. protocol: "accessing",
  3196. fn: function (aString,anObject){
  3197. var self=this,$self=this;
  3198. return $core.withContext(function($ctx1) {
  3199. return self[aString] = anObject;
  3200. return self;
  3201. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  3202. },
  3203. args: ["aString", "anObject"],
  3204. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  3205. referencedClasses: [],
  3206. messageSends: []
  3207. }),
  3208. $globals.Object);
  3209. $core.addMethod(
  3210. $core.method({
  3211. selector: "basicDelete:",
  3212. protocol: "accessing",
  3213. fn: function (aString){
  3214. var self=this,$self=this;
  3215. return $core.withContext(function($ctx1) {
  3216. delete self[aString]; return aString;
  3217. return self;
  3218. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  3219. },
  3220. args: ["aString"],
  3221. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  3222. referencedClasses: [],
  3223. messageSends: []
  3224. }),
  3225. $globals.Object);
  3226. $core.addMethod(
  3227. $core.method({
  3228. selector: "basicPerform:",
  3229. protocol: "message handling",
  3230. fn: function (aString){
  3231. var self=this,$self=this;
  3232. return $core.withContext(function($ctx1) {
  3233. return $self._basicPerform_withArguments_(aString,[]);
  3234. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  3235. },
  3236. args: ["aString"],
  3237. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  3238. referencedClasses: [],
  3239. messageSends: ["basicPerform:withArguments:"]
  3240. }),
  3241. $globals.Object);
  3242. $core.addMethod(
  3243. $core.method({
  3244. selector: "basicPerform:withArguments:",
  3245. protocol: "message handling",
  3246. fn: function (aString,aCollection){
  3247. var self=this,$self=this;
  3248. return $core.withContext(function($ctx1) {
  3249. return self[aString].apply(self, aCollection);;
  3250. return self;
  3251. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  3252. },
  3253. args: ["aString", "aCollection"],
  3254. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  3255. referencedClasses: [],
  3256. messageSends: []
  3257. }),
  3258. $globals.Object);
  3259. $core.addMethod(
  3260. $core.method({
  3261. selector: "browse",
  3262. protocol: "browsing",
  3263. fn: function (){
  3264. var self=this,$self=this;
  3265. return $core.withContext(function($ctx1) {
  3266. $recv($globals.Finder)._findClass_($self._class());
  3267. return self;
  3268. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  3269. },
  3270. args: [],
  3271. source: "browse\x0a\x09Finder findClass: self class",
  3272. referencedClasses: ["Finder"],
  3273. messageSends: ["findClass:", "class"]
  3274. }),
  3275. $globals.Object);
  3276. $core.addMethod(
  3277. $core.method({
  3278. selector: "copy",
  3279. protocol: "copying",
  3280. fn: function (){
  3281. var self=this,$self=this;
  3282. return $core.withContext(function($ctx1) {
  3283. return $recv($self._shallowCopy())._postCopy();
  3284. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  3285. },
  3286. args: [],
  3287. source: "copy\x0a\x09^ self shallowCopy postCopy",
  3288. referencedClasses: [],
  3289. messageSends: ["postCopy", "shallowCopy"]
  3290. }),
  3291. $globals.Object);
  3292. $core.addMethod(
  3293. $core.method({
  3294. selector: "deepCopy",
  3295. protocol: "copying",
  3296. fn: function (){
  3297. var self=this,$self=this;
  3298. return $core.withContext(function($ctx1) {
  3299. var copy = self.a$cls._new();
  3300. Object.keys(self).forEach(function (i) {
  3301. if(/^@.+/.test(i)) {
  3302. copy[i] = $recv(self[i])._deepCopy();
  3303. }
  3304. });
  3305. return copy;
  3306. ;
  3307. return self;
  3308. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  3309. },
  3310. args: [],
  3311. 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'>",
  3312. referencedClasses: [],
  3313. messageSends: []
  3314. }),
  3315. $globals.Object);
  3316. $core.addMethod(
  3317. $core.method({
  3318. selector: "deprecatedAPI",
  3319. protocol: "error handling",
  3320. fn: function (){
  3321. var self=this,$self=this;
  3322. return $core.withContext(function($ctx1) {
  3323. var $1,$6,$5,$4,$8,$7,$3,$2;
  3324. $1=console;
  3325. $6=$core.getThisContext()._home();
  3326. $ctx1.sendIdx["home"]=1;
  3327. $5=$recv($6)._asString();
  3328. $ctx1.sendIdx["asString"]=1;
  3329. $4=$recv($5).__comma(" is deprecated! (in ");
  3330. $8=$recv($core.getThisContext()._home())._home();
  3331. $ctx1.sendIdx["home"]=2;
  3332. $7=$recv($8)._asString();
  3333. $3=$recv($4).__comma($7);
  3334. $ctx1.sendIdx[","]=2;
  3335. $2=$recv($3).__comma(")");
  3336. $ctx1.sendIdx[","]=1;
  3337. $recv($1)._warn_($2);
  3338. return self;
  3339. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  3340. },
  3341. args: [],
  3342. 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, ')'.",
  3343. referencedClasses: [],
  3344. messageSends: ["warn:", ",", "asString", "home"]
  3345. }),
  3346. $globals.Object);
  3347. $core.addMethod(
  3348. $core.method({
  3349. selector: "deprecatedAPI:",
  3350. protocol: "error handling",
  3351. fn: function (aString){
  3352. var self=this,$self=this;
  3353. return $core.withContext(function($ctx1) {
  3354. var $1,$6,$5,$4,$8,$7,$3,$2;
  3355. $1=console;
  3356. $6=$core.getThisContext()._home();
  3357. $ctx1.sendIdx["home"]=1;
  3358. $5=$recv($6)._asString();
  3359. $ctx1.sendIdx["asString"]=1;
  3360. $4=$recv($5).__comma(" is deprecated! (in ");
  3361. $8=$recv($core.getThisContext()._home())._home();
  3362. $ctx1.sendIdx["home"]=2;
  3363. $7=$recv($8)._asString();
  3364. $3=$recv($4).__comma($7);
  3365. $ctx1.sendIdx[","]=2;
  3366. $2=$recv($3).__comma(")");
  3367. $ctx1.sendIdx[","]=1;
  3368. $recv($1)._warn_($2);
  3369. $ctx1.sendIdx["warn:"]=1;
  3370. $recv(console)._warn_(aString);
  3371. return self;
  3372. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  3373. },
  3374. args: ["aString"],
  3375. 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",
  3376. referencedClasses: [],
  3377. messageSends: ["warn:", ",", "asString", "home"]
  3378. }),
  3379. $globals.Object);
  3380. $core.addMethod(
  3381. $core.method({
  3382. selector: "error:",
  3383. protocol: "error handling",
  3384. fn: function (aString){
  3385. var self=this,$self=this;
  3386. return $core.withContext(function($ctx1) {
  3387. $recv($globals.Error)._signal_(aString);
  3388. return self;
  3389. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  3390. },
  3391. args: ["aString"],
  3392. source: "error: aString\x0a\x09Error signal: aString",
  3393. referencedClasses: ["Error"],
  3394. messageSends: ["signal:"]
  3395. }),
  3396. $globals.Object);
  3397. $core.addMethod(
  3398. $core.method({
  3399. selector: "halt",
  3400. protocol: "error handling",
  3401. fn: function (){
  3402. var self=this,$self=this;
  3403. return $core.withContext(function($ctx1) {
  3404. $recv($globals.Halt)._signal();
  3405. return self;
  3406. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  3407. },
  3408. args: [],
  3409. source: "halt\x0a\x09Halt signal",
  3410. referencedClasses: ["Halt"],
  3411. messageSends: ["signal"]
  3412. }),
  3413. $globals.Object);
  3414. $core.addMethod(
  3415. $core.method({
  3416. selector: "in:",
  3417. protocol: "evaluating",
  3418. fn: function (aValuable){
  3419. var self=this,$self=this;
  3420. return $core.withContext(function($ctx1) {
  3421. return $recv(aValuable)._value_(self);
  3422. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  3423. },
  3424. args: ["aValuable"],
  3425. source: "in: aValuable\x0a\x09^ aValuable value: self",
  3426. referencedClasses: [],
  3427. messageSends: ["value:"]
  3428. }),
  3429. $globals.Object);
  3430. $core.addMethod(
  3431. $core.method({
  3432. selector: "isBehavior",
  3433. protocol: "testing",
  3434. fn: function (){
  3435. var self=this,$self=this;
  3436. return false;
  3437. },
  3438. args: [],
  3439. source: "isBehavior\x0a\x09^ false",
  3440. referencedClasses: [],
  3441. messageSends: []
  3442. }),
  3443. $globals.Object);
  3444. $core.addMethod(
  3445. $core.method({
  3446. selector: "isBoolean",
  3447. protocol: "testing",
  3448. fn: function (){
  3449. var self=this,$self=this;
  3450. return false;
  3451. },
  3452. args: [],
  3453. source: "isBoolean\x0a\x09^ false",
  3454. referencedClasses: [],
  3455. messageSends: []
  3456. }),
  3457. $globals.Object);
  3458. $core.addMethod(
  3459. $core.method({
  3460. selector: "isClass",
  3461. protocol: "testing",
  3462. fn: function (){
  3463. var self=this,$self=this;
  3464. return false;
  3465. },
  3466. args: [],
  3467. source: "isClass\x0a\x09^ false",
  3468. referencedClasses: [],
  3469. messageSends: []
  3470. }),
  3471. $globals.Object);
  3472. $core.addMethod(
  3473. $core.method({
  3474. selector: "isCompiledMethod",
  3475. protocol: "testing",
  3476. fn: function (){
  3477. var self=this,$self=this;
  3478. return false;
  3479. },
  3480. args: [],
  3481. source: "isCompiledMethod\x0a\x09^ false",
  3482. referencedClasses: [],
  3483. messageSends: []
  3484. }),
  3485. $globals.Object);
  3486. $core.addMethod(
  3487. $core.method({
  3488. selector: "isImmutable",
  3489. protocol: "testing",
  3490. fn: function (){
  3491. var self=this,$self=this;
  3492. return false;
  3493. },
  3494. args: [],
  3495. source: "isImmutable\x0a\x09^ false",
  3496. referencedClasses: [],
  3497. messageSends: []
  3498. }),
  3499. $globals.Object);
  3500. $core.addMethod(
  3501. $core.method({
  3502. selector: "isMemberOf:",
  3503. protocol: "testing",
  3504. fn: function (aClass){
  3505. var self=this,$self=this;
  3506. return $core.withContext(function($ctx1) {
  3507. return $recv($self._class()).__eq(aClass);
  3508. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  3509. },
  3510. args: ["aClass"],
  3511. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  3512. referencedClasses: [],
  3513. messageSends: ["=", "class"]
  3514. }),
  3515. $globals.Object);
  3516. $core.addMethod(
  3517. $core.method({
  3518. selector: "isMetaclass",
  3519. protocol: "testing",
  3520. fn: function (){
  3521. var self=this,$self=this;
  3522. return false;
  3523. },
  3524. args: [],
  3525. source: "isMetaclass\x0a\x09^ false",
  3526. referencedClasses: [],
  3527. messageSends: []
  3528. }),
  3529. $globals.Object);
  3530. $core.addMethod(
  3531. $core.method({
  3532. selector: "isNumber",
  3533. protocol: "testing",
  3534. fn: function (){
  3535. var self=this,$self=this;
  3536. return false;
  3537. },
  3538. args: [],
  3539. source: "isNumber\x0a\x09^ false",
  3540. referencedClasses: [],
  3541. messageSends: []
  3542. }),
  3543. $globals.Object);
  3544. $core.addMethod(
  3545. $core.method({
  3546. selector: "isPackage",
  3547. protocol: "testing",
  3548. fn: function (){
  3549. var self=this,$self=this;
  3550. return false;
  3551. },
  3552. args: [],
  3553. source: "isPackage\x0a\x09^ false",
  3554. referencedClasses: [],
  3555. messageSends: []
  3556. }),
  3557. $globals.Object);
  3558. $core.addMethod(
  3559. $core.method({
  3560. selector: "isParseFailure",
  3561. protocol: "testing",
  3562. fn: function (){
  3563. var self=this,$self=this;
  3564. return false;
  3565. },
  3566. args: [],
  3567. source: "isParseFailure\x0a\x09^ false",
  3568. referencedClasses: [],
  3569. messageSends: []
  3570. }),
  3571. $globals.Object);
  3572. $core.addMethod(
  3573. $core.method({
  3574. selector: "isString",
  3575. protocol: "testing",
  3576. fn: function (){
  3577. var self=this,$self=this;
  3578. return false;
  3579. },
  3580. args: [],
  3581. source: "isString\x0a\x09^ false",
  3582. referencedClasses: [],
  3583. messageSends: []
  3584. }),
  3585. $globals.Object);
  3586. $core.addMethod(
  3587. $core.method({
  3588. selector: "isSymbol",
  3589. protocol: "testing",
  3590. fn: function (){
  3591. var self=this,$self=this;
  3592. return false;
  3593. },
  3594. args: [],
  3595. source: "isSymbol\x0a\x09^ false",
  3596. referencedClasses: [],
  3597. messageSends: []
  3598. }),
  3599. $globals.Object);
  3600. $core.addMethod(
  3601. $core.method({
  3602. selector: "postCopy",
  3603. protocol: "copying",
  3604. fn: function (){
  3605. var self=this,$self=this;
  3606. return self;
  3607. },
  3608. args: [],
  3609. source: "postCopy",
  3610. referencedClasses: [],
  3611. messageSends: []
  3612. }),
  3613. $globals.Object);
  3614. $core.addMethod(
  3615. $core.method({
  3616. selector: "putOn:",
  3617. protocol: "streaming",
  3618. fn: function (aStream){
  3619. var self=this,$self=this;
  3620. return $core.withContext(function($ctx1) {
  3621. $recv(aStream)._nextPut_(self);
  3622. return self;
  3623. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  3624. },
  3625. args: ["aStream"],
  3626. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3627. referencedClasses: [],
  3628. messageSends: ["nextPut:"]
  3629. }),
  3630. $globals.Object);
  3631. $core.addMethod(
  3632. $core.method({
  3633. selector: "respondsTo:",
  3634. protocol: "testing",
  3635. fn: function (aSelector){
  3636. var self=this,$self=this;
  3637. return $core.withContext(function($ctx1) {
  3638. return $recv($self._class())._canUnderstand_(aSelector);
  3639. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  3640. },
  3641. args: ["aSelector"],
  3642. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3643. referencedClasses: [],
  3644. messageSends: ["canUnderstand:", "class"]
  3645. }),
  3646. $globals.Object);
  3647. $core.addMethod(
  3648. $core.method({
  3649. selector: "shallowCopy",
  3650. protocol: "copying",
  3651. fn: function (){
  3652. var self=this,$self=this;
  3653. return $core.withContext(function($ctx1) {
  3654. var copy = self.a$cls._new();
  3655. Object.keys(self).forEach(function(i) {
  3656. if(/^@.+/.test(i)) {
  3657. copy[i] = self[i];
  3658. }
  3659. });
  3660. return copy;
  3661. ;
  3662. return self;
  3663. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  3664. },
  3665. args: [],
  3666. 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'>",
  3667. referencedClasses: [],
  3668. messageSends: []
  3669. }),
  3670. $globals.Object);
  3671. $core.addMethod(
  3672. $core.method({
  3673. selector: "shouldNotImplement",
  3674. protocol: "error handling",
  3675. fn: function (){
  3676. var self=this,$self=this;
  3677. return $core.withContext(function($ctx1) {
  3678. $self._error_("This method should not be implemented in ".__comma($recv($self._class())._name()));
  3679. return self;
  3680. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  3681. },
  3682. args: [],
  3683. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3684. referencedClasses: [],
  3685. messageSends: ["error:", ",", "name", "class"]
  3686. }),
  3687. $globals.Object);
  3688. $core.addMethod(
  3689. $core.method({
  3690. selector: "size",
  3691. protocol: "accessing",
  3692. fn: function (){
  3693. var self=this,$self=this;
  3694. return $core.withContext(function($ctx1) {
  3695. $self._error_("Object not indexable");
  3696. return self;
  3697. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  3698. },
  3699. args: [],
  3700. source: "size\x0a\x09self error: 'Object not indexable'",
  3701. referencedClasses: [],
  3702. messageSends: ["error:"]
  3703. }),
  3704. $globals.Object);
  3705. $core.addMethod(
  3706. $core.method({
  3707. selector: "subclassResponsibility",
  3708. protocol: "error handling",
  3709. fn: function (){
  3710. var self=this,$self=this;
  3711. return $core.withContext(function($ctx1) {
  3712. $self._error_("This method is a responsibility of a subclass");
  3713. return self;
  3714. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  3715. },
  3716. args: [],
  3717. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3718. referencedClasses: [],
  3719. messageSends: ["error:"]
  3720. }),
  3721. $globals.Object);
  3722. $core.addMethod(
  3723. $core.method({
  3724. selector: "value",
  3725. protocol: "evaluating",
  3726. fn: function (){
  3727. var self=this,$self=this;
  3728. return $core.withContext(function($ctx1) {
  3729. return self.valueOf();
  3730. return self;
  3731. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  3732. },
  3733. args: [],
  3734. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3735. referencedClasses: [],
  3736. messageSends: []
  3737. }),
  3738. $globals.Object);
  3739. $core.addMethod(
  3740. $core.method({
  3741. selector: "accessorProtocolWith:",
  3742. protocol: "helios",
  3743. fn: function (aGenerator){
  3744. var self=this,$self=this;
  3745. return $core.withContext(function($ctx1) {
  3746. $recv(aGenerator)._accessorProtocolForObject();
  3747. return self;
  3748. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3749. },
  3750. args: ["aGenerator"],
  3751. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3752. referencedClasses: [],
  3753. messageSends: ["accessorProtocolForObject"]
  3754. }),
  3755. $globals.Object.a$cls);
  3756. $core.addMethod(
  3757. $core.method({
  3758. selector: "accessorsSourceCodesWith:",
  3759. protocol: "helios",
  3760. fn: function (aGenerator){
  3761. var self=this,$self=this;
  3762. return $core.withContext(function($ctx1) {
  3763. $recv(aGenerator)._accessorsForObject();
  3764. return self;
  3765. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3766. },
  3767. args: ["aGenerator"],
  3768. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3769. referencedClasses: [],
  3770. messageSends: ["accessorsForObject"]
  3771. }),
  3772. $globals.Object.a$cls);
  3773. $core.addMethod(
  3774. $core.method({
  3775. selector: "initialize",
  3776. protocol: "initialization",
  3777. fn: function (){
  3778. var self=this,$self=this;
  3779. return self;
  3780. },
  3781. args: [],
  3782. source: "initialize\x0a\x09\x22no op\x22",
  3783. referencedClasses: [],
  3784. messageSends: []
  3785. }),
  3786. $globals.Object.a$cls);
  3787. $core.addMethod(
  3788. $core.method({
  3789. selector: "initializeProtocolWith:",
  3790. protocol: "helios",
  3791. fn: function (aGenerator){
  3792. var self=this,$self=this;
  3793. return $core.withContext(function($ctx1) {
  3794. $recv(aGenerator)._initializeProtocolForObject();
  3795. return self;
  3796. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3797. },
  3798. args: ["aGenerator"],
  3799. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3800. referencedClasses: [],
  3801. messageSends: ["initializeProtocolForObject"]
  3802. }),
  3803. $globals.Object.a$cls);
  3804. $core.addMethod(
  3805. $core.method({
  3806. selector: "initializeSourceCodesWith:",
  3807. protocol: "helios",
  3808. fn: function (aGenerator){
  3809. var self=this,$self=this;
  3810. return $core.withContext(function($ctx1) {
  3811. $recv(aGenerator)._initializeForObject();
  3812. return self;
  3813. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3814. },
  3815. args: ["aGenerator"],
  3816. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3817. referencedClasses: [],
  3818. messageSends: ["initializeForObject"]
  3819. }),
  3820. $globals.Object.a$cls);
  3821. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3822. $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: [ ... ]";
  3823. $core.addMethod(
  3824. $core.method({
  3825. selector: "&",
  3826. protocol: "controlling",
  3827. fn: function (aBoolean){
  3828. var self=this,$self=this;
  3829. return $core.withContext(function($ctx1) {
  3830. if(self == true) {
  3831. return aBoolean;
  3832. } else {
  3833. return false;
  3834. }
  3835. ;
  3836. return self;
  3837. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  3838. },
  3839. args: ["aBoolean"],
  3840. 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'>",
  3841. referencedClasses: [],
  3842. messageSends: []
  3843. }),
  3844. $globals.Boolean);
  3845. $core.addMethod(
  3846. $core.method({
  3847. selector: "==",
  3848. protocol: "comparing",
  3849. fn: function (aBoolean){
  3850. var self=this,$self=this;
  3851. return $core.withContext(function($ctx1) {
  3852. if (typeof aBoolean === "boolean") return (self == true) === aBoolean;
  3853. else if (aBoolean != null && typeof aBoolean === "object") return (self == true) === aBoolean.valueOf();
  3854. else return false;;
  3855. return self;
  3856. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  3857. },
  3858. args: ["aBoolean"],
  3859. 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'>",
  3860. referencedClasses: [],
  3861. messageSends: []
  3862. }),
  3863. $globals.Boolean);
  3864. $core.addMethod(
  3865. $core.method({
  3866. selector: "and:",
  3867. protocol: "controlling",
  3868. fn: function (aBlock){
  3869. var self=this,$self=this;
  3870. return $core.withContext(function($ctx1) {
  3871. if($core.assert(self)){
  3872. return $recv(aBlock)._value();
  3873. } else {
  3874. return false;
  3875. }
  3876. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  3877. },
  3878. args: ["aBlock"],
  3879. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  3880. referencedClasses: [],
  3881. messageSends: ["ifTrue:ifFalse:", "value"]
  3882. }),
  3883. $globals.Boolean);
  3884. $core.addMethod(
  3885. $core.method({
  3886. selector: "asBit",
  3887. protocol: "converting",
  3888. fn: function (){
  3889. var self=this,$self=this;
  3890. return $core.withContext(function($ctx1) {
  3891. if($core.assert(self)){
  3892. return (1);
  3893. } else {
  3894. return (0);
  3895. }
  3896. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  3897. },
  3898. args: [],
  3899. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3900. referencedClasses: [],
  3901. messageSends: ["ifTrue:ifFalse:"]
  3902. }),
  3903. $globals.Boolean);
  3904. $core.addMethod(
  3905. $core.method({
  3906. selector: "asJavaScriptObject",
  3907. protocol: "converting",
  3908. fn: function (){
  3909. var self=this,$self=this;
  3910. return self;
  3911. },
  3912. args: [],
  3913. source: "asJavaScriptObject\x0a\x09^ self",
  3914. referencedClasses: [],
  3915. messageSends: []
  3916. }),
  3917. $globals.Boolean);
  3918. $core.addMethod(
  3919. $core.method({
  3920. selector: "asString",
  3921. protocol: "converting",
  3922. fn: function (){
  3923. var self=this,$self=this;
  3924. return $core.withContext(function($ctx1) {
  3925. return self.toString();
  3926. return self;
  3927. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3928. },
  3929. args: [],
  3930. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3931. referencedClasses: [],
  3932. messageSends: []
  3933. }),
  3934. $globals.Boolean);
  3935. $core.addMethod(
  3936. $core.method({
  3937. selector: "deepCopy",
  3938. protocol: "copying",
  3939. fn: function (){
  3940. var self=this,$self=this;
  3941. return self;
  3942. },
  3943. args: [],
  3944. source: "deepCopy\x0a\x09^ self",
  3945. referencedClasses: [],
  3946. messageSends: []
  3947. }),
  3948. $globals.Boolean);
  3949. $core.addMethod(
  3950. $core.method({
  3951. selector: "ifFalse:",
  3952. protocol: "controlling",
  3953. fn: function (aBlock){
  3954. var self=this,$self=this;
  3955. return $core.withContext(function($ctx1) {
  3956. return $self._ifTrue_ifFalse_((function(){
  3957. }),aBlock);
  3958. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3959. },
  3960. args: ["aBlock"],
  3961. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3962. referencedClasses: [],
  3963. messageSends: ["ifTrue:ifFalse:"]
  3964. }),
  3965. $globals.Boolean);
  3966. $core.addMethod(
  3967. $core.method({
  3968. selector: "ifFalse:ifTrue:",
  3969. protocol: "controlling",
  3970. fn: function (aBlock,anotherBlock){
  3971. var self=this,$self=this;
  3972. return $core.withContext(function($ctx1) {
  3973. return $self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3974. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3975. },
  3976. args: ["aBlock", "anotherBlock"],
  3977. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3978. referencedClasses: [],
  3979. messageSends: ["ifTrue:ifFalse:"]
  3980. }),
  3981. $globals.Boolean);
  3982. $core.addMethod(
  3983. $core.method({
  3984. selector: "ifTrue:",
  3985. protocol: "controlling",
  3986. fn: function (aBlock){
  3987. var self=this,$self=this;
  3988. return $core.withContext(function($ctx1) {
  3989. return $self._ifTrue_ifFalse_(aBlock,(function(){
  3990. }));
  3991. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3992. },
  3993. args: ["aBlock"],
  3994. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3995. referencedClasses: [],
  3996. messageSends: ["ifTrue:ifFalse:"]
  3997. }),
  3998. $globals.Boolean);
  3999. $core.addMethod(
  4000. $core.method({
  4001. selector: "ifTrue:ifFalse:",
  4002. protocol: "controlling",
  4003. fn: function (aBlock,anotherBlock){
  4004. var self=this,$self=this;
  4005. return $core.withContext(function($ctx1) {
  4006. if(self == true) {
  4007. return aBlock._value();
  4008. } else {
  4009. return anotherBlock._value();
  4010. }
  4011. ;
  4012. return self;
  4013. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  4014. },
  4015. args: ["aBlock", "anotherBlock"],
  4016. 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'>",
  4017. referencedClasses: [],
  4018. messageSends: []
  4019. }),
  4020. $globals.Boolean);
  4021. $core.addMethod(
  4022. $core.method({
  4023. selector: "isBoolean",
  4024. protocol: "testing",
  4025. fn: function (){
  4026. var self=this,$self=this;
  4027. return true;
  4028. },
  4029. args: [],
  4030. source: "isBoolean\x0a\x09^ true",
  4031. referencedClasses: [],
  4032. messageSends: []
  4033. }),
  4034. $globals.Boolean);
  4035. $core.addMethod(
  4036. $core.method({
  4037. selector: "isImmutable",
  4038. protocol: "testing",
  4039. fn: function (){
  4040. var self=this,$self=this;
  4041. return true;
  4042. },
  4043. args: [],
  4044. source: "isImmutable\x0a\x09^ true",
  4045. referencedClasses: [],
  4046. messageSends: []
  4047. }),
  4048. $globals.Boolean);
  4049. $core.addMethod(
  4050. $core.method({
  4051. selector: "not",
  4052. protocol: "controlling",
  4053. fn: function (){
  4054. var self=this,$self=this;
  4055. return $core.withContext(function($ctx1) {
  4056. return $self.__eq(false);
  4057. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  4058. },
  4059. args: [],
  4060. source: "not\x0a\x09^ self = false",
  4061. referencedClasses: [],
  4062. messageSends: ["="]
  4063. }),
  4064. $globals.Boolean);
  4065. $core.addMethod(
  4066. $core.method({
  4067. selector: "or:",
  4068. protocol: "controlling",
  4069. fn: function (aBlock){
  4070. var self=this,$self=this;
  4071. return $core.withContext(function($ctx1) {
  4072. if($core.assert(self)){
  4073. return true;
  4074. } else {
  4075. return $recv(aBlock)._value();
  4076. }
  4077. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  4078. },
  4079. args: ["aBlock"],
  4080. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  4081. referencedClasses: [],
  4082. messageSends: ["ifTrue:ifFalse:", "value"]
  4083. }),
  4084. $globals.Boolean);
  4085. $core.addMethod(
  4086. $core.method({
  4087. selector: "printOn:",
  4088. protocol: "printing",
  4089. fn: function (aStream){
  4090. var self=this,$self=this;
  4091. return $core.withContext(function($ctx1) {
  4092. $recv(aStream)._nextPutAll_($self._asString());
  4093. return self;
  4094. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  4095. },
  4096. args: ["aStream"],
  4097. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4098. referencedClasses: [],
  4099. messageSends: ["nextPutAll:", "asString"]
  4100. }),
  4101. $globals.Boolean);
  4102. $core.addMethod(
  4103. $core.method({
  4104. selector: "shallowCopy",
  4105. protocol: "copying",
  4106. fn: function (){
  4107. var self=this,$self=this;
  4108. return self;
  4109. },
  4110. args: [],
  4111. source: "shallowCopy\x0a\x09^ self",
  4112. referencedClasses: [],
  4113. messageSends: []
  4114. }),
  4115. $globals.Boolean);
  4116. $core.addMethod(
  4117. $core.method({
  4118. selector: "|",
  4119. protocol: "controlling",
  4120. fn: function (aBoolean){
  4121. var self=this,$self=this;
  4122. return $core.withContext(function($ctx1) {
  4123. if(self == true) {
  4124. return true;
  4125. } else {
  4126. return aBoolean;
  4127. }
  4128. ;
  4129. return self;
  4130. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  4131. },
  4132. args: ["aBoolean"],
  4133. 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'>",
  4134. referencedClasses: [],
  4135. messageSends: []
  4136. }),
  4137. $globals.Boolean);
  4138. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  4139. $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.).";
  4140. $core.addMethod(
  4141. $core.method({
  4142. selector: "+",
  4143. protocol: "arithmetic",
  4144. fn: function (aDate){
  4145. var self=this,$self=this;
  4146. return $core.withContext(function($ctx1) {
  4147. return self + aDate;
  4148. return self;
  4149. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  4150. },
  4151. args: ["aDate"],
  4152. source: "+ aDate\x0a\x09<inlineJS: 'return self + aDate'>",
  4153. referencedClasses: [],
  4154. messageSends: []
  4155. }),
  4156. $globals.Date);
  4157. $core.addMethod(
  4158. $core.method({
  4159. selector: "-",
  4160. protocol: "arithmetic",
  4161. fn: function (aDate){
  4162. var self=this,$self=this;
  4163. return $core.withContext(function($ctx1) {
  4164. return self - aDate;
  4165. return self;
  4166. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  4167. },
  4168. args: ["aDate"],
  4169. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  4170. referencedClasses: [],
  4171. messageSends: []
  4172. }),
  4173. $globals.Date);
  4174. $core.addMethod(
  4175. $core.method({
  4176. selector: "<",
  4177. protocol: "comparing",
  4178. fn: function (aDate){
  4179. var self=this,$self=this;
  4180. return $core.withContext(function($ctx1) {
  4181. return self < aDate;
  4182. return self;
  4183. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  4184. },
  4185. args: ["aDate"],
  4186. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  4187. referencedClasses: [],
  4188. messageSends: []
  4189. }),
  4190. $globals.Date);
  4191. $core.addMethod(
  4192. $core.method({
  4193. selector: "<=",
  4194. protocol: "comparing",
  4195. fn: function (aDate){
  4196. var self=this,$self=this;
  4197. return $core.withContext(function($ctx1) {
  4198. return self <= aDate;
  4199. return self;
  4200. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  4201. },
  4202. args: ["aDate"],
  4203. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  4204. referencedClasses: [],
  4205. messageSends: []
  4206. }),
  4207. $globals.Date);
  4208. $core.addMethod(
  4209. $core.method({
  4210. selector: "=",
  4211. protocol: "comparing",
  4212. fn: function (aDate){
  4213. var self=this,$self=this;
  4214. return $core.withContext(function($ctx1) {
  4215. var $2,$1,$3;
  4216. $2=$recv(aDate)._class();
  4217. $ctx1.sendIdx["class"]=1;
  4218. $1=$recv($2).__eq_eq($self._class());
  4219. $ctx1.sendIdx["=="]=1;
  4220. return $recv($1)._and_((function(){
  4221. return $core.withContext(function($ctx2) {
  4222. $3=$self._asMilliseconds();
  4223. $ctx2.sendIdx["asMilliseconds"]=1;
  4224. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  4225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4226. }));
  4227. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  4228. },
  4229. args: ["aDate"],
  4230. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  4231. referencedClasses: [],
  4232. messageSends: ["and:", "==", "class", "asMilliseconds"]
  4233. }),
  4234. $globals.Date);
  4235. $core.addMethod(
  4236. $core.method({
  4237. selector: ">",
  4238. protocol: "comparing",
  4239. fn: function (aDate){
  4240. var self=this,$self=this;
  4241. return $core.withContext(function($ctx1) {
  4242. return self > aDate;
  4243. return self;
  4244. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  4245. },
  4246. args: ["aDate"],
  4247. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  4248. referencedClasses: [],
  4249. messageSends: []
  4250. }),
  4251. $globals.Date);
  4252. $core.addMethod(
  4253. $core.method({
  4254. selector: ">=",
  4255. protocol: "comparing",
  4256. fn: function (aDate){
  4257. var self=this,$self=this;
  4258. return $core.withContext(function($ctx1) {
  4259. return self >= aDate;
  4260. return self;
  4261. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  4262. },
  4263. args: ["aDate"],
  4264. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  4265. referencedClasses: [],
  4266. messageSends: []
  4267. }),
  4268. $globals.Date);
  4269. $core.addMethod(
  4270. $core.method({
  4271. selector: "asDateString",
  4272. protocol: "converting",
  4273. fn: function (){
  4274. var self=this,$self=this;
  4275. return $core.withContext(function($ctx1) {
  4276. return self.toDateString();
  4277. return self;
  4278. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  4279. },
  4280. args: [],
  4281. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  4282. referencedClasses: [],
  4283. messageSends: []
  4284. }),
  4285. $globals.Date);
  4286. $core.addMethod(
  4287. $core.method({
  4288. selector: "asLocaleString",
  4289. protocol: "converting",
  4290. fn: function (){
  4291. var self=this,$self=this;
  4292. return $core.withContext(function($ctx1) {
  4293. return self.toLocaleString();
  4294. return self;
  4295. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  4296. },
  4297. args: [],
  4298. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  4299. referencedClasses: [],
  4300. messageSends: []
  4301. }),
  4302. $globals.Date);
  4303. $core.addMethod(
  4304. $core.method({
  4305. selector: "asMilliseconds",
  4306. protocol: "converting",
  4307. fn: function (){
  4308. var self=this,$self=this;
  4309. return $core.withContext(function($ctx1) {
  4310. return $self._time();
  4311. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  4312. },
  4313. args: [],
  4314. source: "asMilliseconds\x0a\x09^ self time",
  4315. referencedClasses: [],
  4316. messageSends: ["time"]
  4317. }),
  4318. $globals.Date);
  4319. $core.addMethod(
  4320. $core.method({
  4321. selector: "asNumber",
  4322. protocol: "converting",
  4323. fn: function (){
  4324. var self=this,$self=this;
  4325. return $core.withContext(function($ctx1) {
  4326. return $self._asMilliseconds();
  4327. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  4328. },
  4329. args: [],
  4330. source: "asNumber\x0a\x09^ self asMilliseconds",
  4331. referencedClasses: [],
  4332. messageSends: ["asMilliseconds"]
  4333. }),
  4334. $globals.Date);
  4335. $core.addMethod(
  4336. $core.method({
  4337. selector: "asString",
  4338. protocol: "converting",
  4339. fn: function (){
  4340. var self=this,$self=this;
  4341. return $core.withContext(function($ctx1) {
  4342. return self.toString();
  4343. return self;
  4344. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  4345. },
  4346. args: [],
  4347. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4348. referencedClasses: [],
  4349. messageSends: []
  4350. }),
  4351. $globals.Date);
  4352. $core.addMethod(
  4353. $core.method({
  4354. selector: "asTimeString",
  4355. protocol: "converting",
  4356. fn: function (){
  4357. var self=this,$self=this;
  4358. return $core.withContext(function($ctx1) {
  4359. return self.toTimeString();
  4360. return self;
  4361. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  4362. },
  4363. args: [],
  4364. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  4365. referencedClasses: [],
  4366. messageSends: []
  4367. }),
  4368. $globals.Date);
  4369. $core.addMethod(
  4370. $core.method({
  4371. selector: "day",
  4372. protocol: "accessing",
  4373. fn: function (){
  4374. var self=this,$self=this;
  4375. return $core.withContext(function($ctx1) {
  4376. return $self._dayOfWeek();
  4377. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  4378. },
  4379. args: [],
  4380. source: "day\x0a\x09^ self dayOfWeek",
  4381. referencedClasses: [],
  4382. messageSends: ["dayOfWeek"]
  4383. }),
  4384. $globals.Date);
  4385. $core.addMethod(
  4386. $core.method({
  4387. selector: "day:",
  4388. protocol: "accessing",
  4389. fn: function (aNumber){
  4390. var self=this,$self=this;
  4391. return $core.withContext(function($ctx1) {
  4392. $self._dayOfWeek_(aNumber);
  4393. return self;
  4394. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  4395. },
  4396. args: ["aNumber"],
  4397. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  4398. referencedClasses: [],
  4399. messageSends: ["dayOfWeek:"]
  4400. }),
  4401. $globals.Date);
  4402. $core.addMethod(
  4403. $core.method({
  4404. selector: "dayOfMonth",
  4405. protocol: "accessing",
  4406. fn: function (){
  4407. var self=this,$self=this;
  4408. return $core.withContext(function($ctx1) {
  4409. return self.getDate();
  4410. return self;
  4411. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  4412. },
  4413. args: [],
  4414. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  4415. referencedClasses: [],
  4416. messageSends: []
  4417. }),
  4418. $globals.Date);
  4419. $core.addMethod(
  4420. $core.method({
  4421. selector: "dayOfMonth:",
  4422. protocol: "accessing",
  4423. fn: function (aNumber){
  4424. var self=this,$self=this;
  4425. return $core.withContext(function($ctx1) {
  4426. self.setDate(aNumber);
  4427. return self;
  4428. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  4429. },
  4430. args: ["aNumber"],
  4431. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  4432. referencedClasses: [],
  4433. messageSends: []
  4434. }),
  4435. $globals.Date);
  4436. $core.addMethod(
  4437. $core.method({
  4438. selector: "dayOfWeek",
  4439. protocol: "accessing",
  4440. fn: function (){
  4441. var self=this,$self=this;
  4442. return $core.withContext(function($ctx1) {
  4443. return self.getDay() + 1;
  4444. return self;
  4445. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  4446. },
  4447. args: [],
  4448. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  4449. referencedClasses: [],
  4450. messageSends: []
  4451. }),
  4452. $globals.Date);
  4453. $core.addMethod(
  4454. $core.method({
  4455. selector: "dayOfWeek:",
  4456. protocol: "accessing",
  4457. fn: function (aNumber){
  4458. var self=this,$self=this;
  4459. return $core.withContext(function($ctx1) {
  4460. return self.setDay(aNumber - 1);
  4461. return self;
  4462. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  4463. },
  4464. args: ["aNumber"],
  4465. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  4466. referencedClasses: [],
  4467. messageSends: []
  4468. }),
  4469. $globals.Date);
  4470. $core.addMethod(
  4471. $core.method({
  4472. selector: "hours",
  4473. protocol: "accessing",
  4474. fn: function (){
  4475. var self=this,$self=this;
  4476. return $core.withContext(function($ctx1) {
  4477. return self.getHours();
  4478. return self;
  4479. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  4480. },
  4481. args: [],
  4482. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  4483. referencedClasses: [],
  4484. messageSends: []
  4485. }),
  4486. $globals.Date);
  4487. $core.addMethod(
  4488. $core.method({
  4489. selector: "hours:",
  4490. protocol: "accessing",
  4491. fn: function (aNumber){
  4492. var self=this,$self=this;
  4493. return $core.withContext(function($ctx1) {
  4494. self.setHours(aNumber);
  4495. return self;
  4496. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  4497. },
  4498. args: ["aNumber"],
  4499. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  4500. referencedClasses: [],
  4501. messageSends: []
  4502. }),
  4503. $globals.Date);
  4504. $core.addMethod(
  4505. $core.method({
  4506. selector: "milliseconds",
  4507. protocol: "accessing",
  4508. fn: function (){
  4509. var self=this,$self=this;
  4510. return $core.withContext(function($ctx1) {
  4511. return self.getMilliseconds();
  4512. return self;
  4513. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  4514. },
  4515. args: [],
  4516. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  4517. referencedClasses: [],
  4518. messageSends: []
  4519. }),
  4520. $globals.Date);
  4521. $core.addMethod(
  4522. $core.method({
  4523. selector: "milliseconds:",
  4524. protocol: "accessing",
  4525. fn: function (aNumber){
  4526. var self=this,$self=this;
  4527. return $core.withContext(function($ctx1) {
  4528. self.setMilliseconds(aNumber);
  4529. return self;
  4530. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  4531. },
  4532. args: ["aNumber"],
  4533. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  4534. referencedClasses: [],
  4535. messageSends: []
  4536. }),
  4537. $globals.Date);
  4538. $core.addMethod(
  4539. $core.method({
  4540. selector: "minutes",
  4541. protocol: "accessing",
  4542. fn: function (){
  4543. var self=this,$self=this;
  4544. return $core.withContext(function($ctx1) {
  4545. return self.getMinutes();
  4546. return self;
  4547. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  4548. },
  4549. args: [],
  4550. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  4551. referencedClasses: [],
  4552. messageSends: []
  4553. }),
  4554. $globals.Date);
  4555. $core.addMethod(
  4556. $core.method({
  4557. selector: "minutes:",
  4558. protocol: "accessing",
  4559. fn: function (aNumber){
  4560. var self=this,$self=this;
  4561. return $core.withContext(function($ctx1) {
  4562. self.setMinutes(aNumber);
  4563. return self;
  4564. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  4565. },
  4566. args: ["aNumber"],
  4567. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  4568. referencedClasses: [],
  4569. messageSends: []
  4570. }),
  4571. $globals.Date);
  4572. $core.addMethod(
  4573. $core.method({
  4574. selector: "month",
  4575. protocol: "accessing",
  4576. fn: function (){
  4577. var self=this,$self=this;
  4578. return $core.withContext(function($ctx1) {
  4579. return self.getMonth() + 1;
  4580. return self;
  4581. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  4582. },
  4583. args: [],
  4584. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4585. referencedClasses: [],
  4586. messageSends: []
  4587. }),
  4588. $globals.Date);
  4589. $core.addMethod(
  4590. $core.method({
  4591. selector: "month:",
  4592. protocol: "accessing",
  4593. fn: function (aNumber){
  4594. var self=this,$self=this;
  4595. return $core.withContext(function($ctx1) {
  4596. self.setMonth(aNumber - 1);
  4597. return self;
  4598. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  4599. },
  4600. args: ["aNumber"],
  4601. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4602. referencedClasses: [],
  4603. messageSends: []
  4604. }),
  4605. $globals.Date);
  4606. $core.addMethod(
  4607. $core.method({
  4608. selector: "printOn:",
  4609. protocol: "printing",
  4610. fn: function (aStream){
  4611. var self=this,$self=this;
  4612. return $core.withContext(function($ctx1) {
  4613. $recv(aStream)._nextPutAll_($self._asString());
  4614. return self;
  4615. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  4616. },
  4617. args: ["aStream"],
  4618. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4619. referencedClasses: [],
  4620. messageSends: ["nextPutAll:", "asString"]
  4621. }),
  4622. $globals.Date);
  4623. $core.addMethod(
  4624. $core.method({
  4625. selector: "seconds",
  4626. protocol: "accessing",
  4627. fn: function (){
  4628. var self=this,$self=this;
  4629. return $core.withContext(function($ctx1) {
  4630. return self.getSeconds();
  4631. return self;
  4632. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  4633. },
  4634. args: [],
  4635. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4636. referencedClasses: [],
  4637. messageSends: []
  4638. }),
  4639. $globals.Date);
  4640. $core.addMethod(
  4641. $core.method({
  4642. selector: "seconds:",
  4643. protocol: "accessing",
  4644. fn: function (aNumber){
  4645. var self=this,$self=this;
  4646. return $core.withContext(function($ctx1) {
  4647. self.setSeconds(aNumber);
  4648. return self;
  4649. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  4650. },
  4651. args: ["aNumber"],
  4652. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4653. referencedClasses: [],
  4654. messageSends: []
  4655. }),
  4656. $globals.Date);
  4657. $core.addMethod(
  4658. $core.method({
  4659. selector: "time",
  4660. protocol: "accessing",
  4661. fn: function (){
  4662. var self=this,$self=this;
  4663. return $core.withContext(function($ctx1) {
  4664. return self.getTime();
  4665. return self;
  4666. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  4667. },
  4668. args: [],
  4669. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4670. referencedClasses: [],
  4671. messageSends: []
  4672. }),
  4673. $globals.Date);
  4674. $core.addMethod(
  4675. $core.method({
  4676. selector: "time:",
  4677. protocol: "accessing",
  4678. fn: function (aNumber){
  4679. var self=this,$self=this;
  4680. return $core.withContext(function($ctx1) {
  4681. self.setTime(aNumber);
  4682. return self;
  4683. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  4684. },
  4685. args: ["aNumber"],
  4686. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4687. referencedClasses: [],
  4688. messageSends: []
  4689. }),
  4690. $globals.Date);
  4691. $core.addMethod(
  4692. $core.method({
  4693. selector: "year",
  4694. protocol: "accessing",
  4695. fn: function (){
  4696. var self=this,$self=this;
  4697. return $core.withContext(function($ctx1) {
  4698. return self.getFullYear();
  4699. return self;
  4700. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  4701. },
  4702. args: [],
  4703. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4704. referencedClasses: [],
  4705. messageSends: []
  4706. }),
  4707. $globals.Date);
  4708. $core.addMethod(
  4709. $core.method({
  4710. selector: "year:",
  4711. protocol: "accessing",
  4712. fn: function (aNumber){
  4713. var self=this,$self=this;
  4714. return $core.withContext(function($ctx1) {
  4715. self.setFullYear(aNumber);
  4716. return self;
  4717. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  4718. },
  4719. args: ["aNumber"],
  4720. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4721. referencedClasses: [],
  4722. messageSends: []
  4723. }),
  4724. $globals.Date);
  4725. $core.addMethod(
  4726. $core.method({
  4727. selector: "classTag",
  4728. protocol: "accessing",
  4729. fn: function (){
  4730. var self=this,$self=this;
  4731. return "magnitude";
  4732. },
  4733. args: [],
  4734. 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'",
  4735. referencedClasses: [],
  4736. messageSends: []
  4737. }),
  4738. $globals.Date.a$cls);
  4739. $core.addMethod(
  4740. $core.method({
  4741. selector: "fromMilliseconds:",
  4742. protocol: "instance creation",
  4743. fn: function (aNumber){
  4744. var self=this,$self=this;
  4745. return $core.withContext(function($ctx1) {
  4746. return $self._new_(aNumber);
  4747. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4748. },
  4749. args: ["aNumber"],
  4750. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4751. referencedClasses: [],
  4752. messageSends: ["new:"]
  4753. }),
  4754. $globals.Date.a$cls);
  4755. $core.addMethod(
  4756. $core.method({
  4757. selector: "fromSeconds:",
  4758. protocol: "instance creation",
  4759. fn: function (aNumber){
  4760. var self=this,$self=this;
  4761. return $core.withContext(function($ctx1) {
  4762. return $self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4763. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4764. },
  4765. args: ["aNumber"],
  4766. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4767. referencedClasses: [],
  4768. messageSends: ["fromMilliseconds:", "*"]
  4769. }),
  4770. $globals.Date.a$cls);
  4771. $core.addMethod(
  4772. $core.method({
  4773. selector: "fromString:",
  4774. protocol: "instance creation",
  4775. fn: function (aString){
  4776. var self=this,$self=this;
  4777. return $core.withContext(function($ctx1) {
  4778. return $self._new_(aString);
  4779. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.a$cls)});
  4780. },
  4781. args: ["aString"],
  4782. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4783. referencedClasses: [],
  4784. messageSends: ["new:"]
  4785. }),
  4786. $globals.Date.a$cls);
  4787. $core.addMethod(
  4788. $core.method({
  4789. selector: "millisecondsToRun:",
  4790. protocol: "instance creation",
  4791. fn: function (aBlock){
  4792. var self=this,$self=this;
  4793. var t;
  4794. return $core.withContext(function($ctx1) {
  4795. t=$recv($globals.Date)._now();
  4796. $ctx1.sendIdx["now"]=1;
  4797. $recv(aBlock)._value();
  4798. return $recv($recv($globals.Date)._now()).__minus(t);
  4799. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.a$cls)});
  4800. },
  4801. args: ["aBlock"],
  4802. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4803. referencedClasses: ["Date"],
  4804. messageSends: ["now", "value", "-"]
  4805. }),
  4806. $globals.Date.a$cls);
  4807. $core.addMethod(
  4808. $core.method({
  4809. selector: "new:",
  4810. protocol: "instance creation",
  4811. fn: function (anObject){
  4812. var self=this,$self=this;
  4813. return $core.withContext(function($ctx1) {
  4814. return new Date(anObject);
  4815. return self;
  4816. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.a$cls)});
  4817. },
  4818. args: ["anObject"],
  4819. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  4820. referencedClasses: [],
  4821. messageSends: []
  4822. }),
  4823. $globals.Date.a$cls);
  4824. $core.addMethod(
  4825. $core.method({
  4826. selector: "now",
  4827. protocol: "instance creation",
  4828. fn: function (){
  4829. var self=this,$self=this;
  4830. return $core.withContext(function($ctx1) {
  4831. return $self._today();
  4832. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.a$cls)});
  4833. },
  4834. args: [],
  4835. source: "now\x0a\x09^ self today",
  4836. referencedClasses: [],
  4837. messageSends: ["today"]
  4838. }),
  4839. $globals.Date.a$cls);
  4840. $core.addMethod(
  4841. $core.method({
  4842. selector: "today",
  4843. protocol: "instance creation",
  4844. fn: function (){
  4845. var self=this,$self=this;
  4846. return $core.withContext(function($ctx1) {
  4847. return $self._new();
  4848. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.a$cls)});
  4849. },
  4850. args: [],
  4851. source: "today\x0a\x09^ self new",
  4852. referencedClasses: [],
  4853. messageSends: ["new"]
  4854. }),
  4855. $globals.Date.a$cls);
  4856. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  4857. $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 ].";
  4858. $core.addMethod(
  4859. $core.method({
  4860. selector: "&",
  4861. protocol: "converting",
  4862. fn: function (aNumber){
  4863. var self=this,$self=this;
  4864. return $core.withContext(function($ctx1) {
  4865. return self & aNumber;
  4866. return self;
  4867. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  4868. },
  4869. args: ["aNumber"],
  4870. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  4871. referencedClasses: [],
  4872. messageSends: []
  4873. }),
  4874. $globals.Number);
  4875. $core.addMethod(
  4876. $core.method({
  4877. selector: "*",
  4878. protocol: "arithmetic",
  4879. fn: function (aNumber){
  4880. var self=this,$self=this;
  4881. return $core.withContext(function($ctx1) {
  4882. return self * aNumber;
  4883. return self;
  4884. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  4885. },
  4886. args: ["aNumber"],
  4887. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self * aNumber'>",
  4888. referencedClasses: [],
  4889. messageSends: []
  4890. }),
  4891. $globals.Number);
  4892. $core.addMethod(
  4893. $core.method({
  4894. selector: "**",
  4895. protocol: "mathematical functions",
  4896. fn: function (exponent){
  4897. var self=this,$self=this;
  4898. return $core.withContext(function($ctx1) {
  4899. return $self._raisedTo_(exponent);
  4900. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4901. },
  4902. args: ["exponent"],
  4903. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4904. referencedClasses: [],
  4905. messageSends: ["raisedTo:"]
  4906. }),
  4907. $globals.Number);
  4908. $core.addMethod(
  4909. $core.method({
  4910. selector: "+",
  4911. protocol: "arithmetic",
  4912. fn: function (aNumber){
  4913. var self=this,$self=this;
  4914. return $core.withContext(function($ctx1) {
  4915. return self + aNumber;
  4916. return self;
  4917. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4918. },
  4919. args: ["aNumber"],
  4920. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self + aNumber'>",
  4921. referencedClasses: [],
  4922. messageSends: []
  4923. }),
  4924. $globals.Number);
  4925. $core.addMethod(
  4926. $core.method({
  4927. selector: "-",
  4928. protocol: "arithmetic",
  4929. fn: function (aNumber){
  4930. var self=this,$self=this;
  4931. return $core.withContext(function($ctx1) {
  4932. return self - aNumber;
  4933. return self;
  4934. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4935. },
  4936. args: ["aNumber"],
  4937. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self - aNumber'>",
  4938. referencedClasses: [],
  4939. messageSends: []
  4940. }),
  4941. $globals.Number);
  4942. $core.addMethod(
  4943. $core.method({
  4944. selector: "/",
  4945. protocol: "arithmetic",
  4946. fn: function (aNumber){
  4947. var self=this,$self=this;
  4948. return $core.withContext(function($ctx1) {
  4949. return self / aNumber;
  4950. return self;
  4951. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4952. },
  4953. args: ["aNumber"],
  4954. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self / aNumber'>",
  4955. referencedClasses: [],
  4956. messageSends: []
  4957. }),
  4958. $globals.Number);
  4959. $core.addMethod(
  4960. $core.method({
  4961. selector: "//",
  4962. protocol: "arithmetic",
  4963. fn: function (aNumber){
  4964. var self=this,$self=this;
  4965. return $core.withContext(function($ctx1) {
  4966. return $recv($self.__slash(aNumber))._floor();
  4967. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4968. },
  4969. args: ["aNumber"],
  4970. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4971. referencedClasses: [],
  4972. messageSends: ["floor", "/"]
  4973. }),
  4974. $globals.Number);
  4975. $core.addMethod(
  4976. $core.method({
  4977. selector: "<",
  4978. protocol: "comparing",
  4979. fn: function (aNumber){
  4980. var self=this,$self=this;
  4981. return $core.withContext(function($ctx1) {
  4982. return self < aNumber;
  4983. return self;
  4984. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4985. },
  4986. args: ["aNumber"],
  4987. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self < aNumber'>",
  4988. referencedClasses: [],
  4989. messageSends: []
  4990. }),
  4991. $globals.Number);
  4992. $core.addMethod(
  4993. $core.method({
  4994. selector: "<=",
  4995. protocol: "comparing",
  4996. fn: function (aNumber){
  4997. var self=this,$self=this;
  4998. return $core.withContext(function($ctx1) {
  4999. return self <= aNumber;
  5000. return self;
  5001. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  5002. },
  5003. args: ["aNumber"],
  5004. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self <= aNumber'>",
  5005. referencedClasses: [],
  5006. messageSends: []
  5007. }),
  5008. $globals.Number);
  5009. $core.addMethod(
  5010. $core.method({
  5011. selector: "==",
  5012. protocol: "comparing",
  5013. fn: function (aNumber){
  5014. var self=this,$self=this;
  5015. return $core.withContext(function($ctx1) {
  5016. if (typeof aNumber === "number") return Number(self) === aNumber;
  5017. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  5018. else return false;;
  5019. return self;
  5020. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  5021. },
  5022. args: ["aNumber"],
  5023. 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'>",
  5024. referencedClasses: [],
  5025. messageSends: []
  5026. }),
  5027. $globals.Number);
  5028. $core.addMethod(
  5029. $core.method({
  5030. selector: ">",
  5031. protocol: "comparing",
  5032. fn: function (aNumber){
  5033. var self=this,$self=this;
  5034. return $core.withContext(function($ctx1) {
  5035. return self > aNumber;
  5036. return self;
  5037. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  5038. },
  5039. args: ["aNumber"],
  5040. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self > aNumber'>",
  5041. referencedClasses: [],
  5042. messageSends: []
  5043. }),
  5044. $globals.Number);
  5045. $core.addMethod(
  5046. $core.method({
  5047. selector: ">=",
  5048. protocol: "comparing",
  5049. fn: function (aNumber){
  5050. var self=this,$self=this;
  5051. return $core.withContext(function($ctx1) {
  5052. return self >= aNumber;
  5053. return self;
  5054. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  5055. },
  5056. args: ["aNumber"],
  5057. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self >= aNumber'>",
  5058. referencedClasses: [],
  5059. messageSends: []
  5060. }),
  5061. $globals.Number);
  5062. $core.addMethod(
  5063. $core.method({
  5064. selector: "@",
  5065. protocol: "converting",
  5066. fn: function (aNumber){
  5067. var self=this,$self=this;
  5068. return $core.withContext(function($ctx1) {
  5069. return $recv($globals.Point)._x_y_(self,aNumber);
  5070. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  5071. },
  5072. args: ["aNumber"],
  5073. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  5074. referencedClasses: ["Point"],
  5075. messageSends: ["x:y:"]
  5076. }),
  5077. $globals.Number);
  5078. $core.addMethod(
  5079. $core.method({
  5080. selector: "\x5c\x5c",
  5081. protocol: "arithmetic",
  5082. fn: function (aNumber){
  5083. var self=this,$self=this;
  5084. return $core.withContext(function($ctx1) {
  5085. return self % aNumber;
  5086. return self;
  5087. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  5088. },
  5089. args: ["aNumber"],
  5090. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  5091. referencedClasses: [],
  5092. messageSends: []
  5093. }),
  5094. $globals.Number);
  5095. $core.addMethod(
  5096. $core.method({
  5097. selector: "abs",
  5098. protocol: "arithmetic",
  5099. fn: function (){
  5100. var self=this,$self=this;
  5101. return $core.withContext(function($ctx1) {
  5102. return Math.abs(self);;
  5103. return self;
  5104. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  5105. },
  5106. args: [],
  5107. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  5108. referencedClasses: [],
  5109. messageSends: []
  5110. }),
  5111. $globals.Number);
  5112. $core.addMethod(
  5113. $core.method({
  5114. selector: "arcCos",
  5115. protocol: "mathematical functions",
  5116. fn: function (){
  5117. var self=this,$self=this;
  5118. return $core.withContext(function($ctx1) {
  5119. return Math.acos(self);;
  5120. return self;
  5121. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  5122. },
  5123. args: [],
  5124. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  5125. referencedClasses: [],
  5126. messageSends: []
  5127. }),
  5128. $globals.Number);
  5129. $core.addMethod(
  5130. $core.method({
  5131. selector: "arcSin",
  5132. protocol: "mathematical functions",
  5133. fn: function (){
  5134. var self=this,$self=this;
  5135. return $core.withContext(function($ctx1) {
  5136. return Math.asin(self);;
  5137. return self;
  5138. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  5139. },
  5140. args: [],
  5141. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  5142. referencedClasses: [],
  5143. messageSends: []
  5144. }),
  5145. $globals.Number);
  5146. $core.addMethod(
  5147. $core.method({
  5148. selector: "arcTan",
  5149. protocol: "mathematical functions",
  5150. fn: function (){
  5151. var self=this,$self=this;
  5152. return $core.withContext(function($ctx1) {
  5153. return Math.atan(self);;
  5154. return self;
  5155. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  5156. },
  5157. args: [],
  5158. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  5159. referencedClasses: [],
  5160. messageSends: []
  5161. }),
  5162. $globals.Number);
  5163. $core.addMethod(
  5164. $core.method({
  5165. selector: "arcTan:",
  5166. protocol: "mathematical functions",
  5167. fn: function (aNumber){
  5168. var self=this,$self=this;
  5169. return $core.withContext(function($ctx1) {
  5170. return Math.atan2(self, aNumber);;
  5171. return self;
  5172. }, function($ctx1) {$ctx1.fill(self,"arcTan:",{aNumber:aNumber},$globals.Number)});
  5173. },
  5174. args: ["aNumber"],
  5175. source: "arcTan: aNumber\x0a\x09<inlineJS: 'return Math.atan2(self, aNumber);'>",
  5176. referencedClasses: [],
  5177. messageSends: []
  5178. }),
  5179. $globals.Number);
  5180. $core.addMethod(
  5181. $core.method({
  5182. selector: "asJavaScriptObject",
  5183. protocol: "converting",
  5184. fn: function (){
  5185. var self=this,$self=this;
  5186. return self;
  5187. },
  5188. args: [],
  5189. source: "asJavaScriptObject\x0a\x09^ self",
  5190. referencedClasses: [],
  5191. messageSends: []
  5192. }),
  5193. $globals.Number);
  5194. $core.addMethod(
  5195. $core.method({
  5196. selector: "asJavaScriptSource",
  5197. protocol: "converting",
  5198. fn: function (){
  5199. var self=this,$self=this;
  5200. return $core.withContext(function($ctx1) {
  5201. var $1;
  5202. $1=$recv("(".__comma($self._printString())).__comma(")");
  5203. $ctx1.sendIdx[","]=1;
  5204. return $1;
  5205. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Number)});
  5206. },
  5207. args: [],
  5208. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  5209. referencedClasses: [],
  5210. messageSends: [",", "printString"]
  5211. }),
  5212. $globals.Number);
  5213. $core.addMethod(
  5214. $core.method({
  5215. selector: "asNumber",
  5216. protocol: "converting",
  5217. fn: function (){
  5218. var self=this,$self=this;
  5219. return self;
  5220. },
  5221. args: [],
  5222. source: "asNumber\x0a\x09^ self",
  5223. referencedClasses: [],
  5224. messageSends: []
  5225. }),
  5226. $globals.Number);
  5227. $core.addMethod(
  5228. $core.method({
  5229. selector: "asPoint",
  5230. protocol: "converting",
  5231. fn: function (){
  5232. var self=this,$self=this;
  5233. return $core.withContext(function($ctx1) {
  5234. return $recv($globals.Point)._x_y_(self,self);
  5235. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  5236. },
  5237. args: [],
  5238. source: "asPoint\x0a\x09^ Point x: self y: self",
  5239. referencedClasses: ["Point"],
  5240. messageSends: ["x:y:"]
  5241. }),
  5242. $globals.Number);
  5243. $core.addMethod(
  5244. $core.method({
  5245. selector: "asString",
  5246. protocol: "converting",
  5247. fn: function (){
  5248. var self=this,$self=this;
  5249. return $core.withContext(function($ctx1) {
  5250. return String(self);
  5251. return self;
  5252. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  5253. },
  5254. args: [],
  5255. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  5256. referencedClasses: [],
  5257. messageSends: []
  5258. }),
  5259. $globals.Number);
  5260. $core.addMethod(
  5261. $core.method({
  5262. selector: "atRandom",
  5263. protocol: "converting",
  5264. fn: function (){
  5265. var self=this,$self=this;
  5266. return $core.withContext(function($ctx1) {
  5267. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  5268. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  5269. },
  5270. args: [],
  5271. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  5272. referencedClasses: ["Random"],
  5273. messageSends: ["+", "truncated", "*", "next", "new"]
  5274. }),
  5275. $globals.Number);
  5276. $core.addMethod(
  5277. $core.method({
  5278. selector: "between:and:",
  5279. protocol: "testing",
  5280. fn: function (min,max){
  5281. var self=this,$self=this;
  5282. return $core.withContext(function($ctx1) {
  5283. return $recv($self.__gt_eq(min))._and_((function(){
  5284. return $core.withContext(function($ctx2) {
  5285. return $self.__lt_eq(max);
  5286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5287. }));
  5288. }, function($ctx1) {$ctx1.fill(self,"between:and:",{min:min,max:max},$globals.Number)});
  5289. },
  5290. args: ["min", "max"],
  5291. source: "between: min and: max\x0a ^ self >= min and: [ self <= max ]",
  5292. referencedClasses: [],
  5293. messageSends: ["and:", ">=", "<="]
  5294. }),
  5295. $globals.Number);
  5296. $core.addMethod(
  5297. $core.method({
  5298. selector: "bitAnd:",
  5299. protocol: "converting",
  5300. fn: function (aNumber){
  5301. var self=this,$self=this;
  5302. return $core.withContext(function($ctx1) {
  5303. return self & aNumber;
  5304. return self;
  5305. }, function($ctx1) {$ctx1.fill(self,"bitAnd:",{aNumber:aNumber},$globals.Number)});
  5306. },
  5307. args: ["aNumber"],
  5308. source: "bitAnd: aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  5309. referencedClasses: [],
  5310. messageSends: []
  5311. }),
  5312. $globals.Number);
  5313. $core.addMethod(
  5314. $core.method({
  5315. selector: "bitNot",
  5316. protocol: "converting",
  5317. fn: function (){
  5318. var self=this,$self=this;
  5319. return $core.withContext(function($ctx1) {
  5320. return ~self;
  5321. return self;
  5322. }, function($ctx1) {$ctx1.fill(self,"bitNot",{},$globals.Number)});
  5323. },
  5324. args: [],
  5325. source: "bitNot\x0a\x09<inlineJS: 'return ~self'>",
  5326. referencedClasses: [],
  5327. messageSends: []
  5328. }),
  5329. $globals.Number);
  5330. $core.addMethod(
  5331. $core.method({
  5332. selector: "bitOr:",
  5333. protocol: "converting",
  5334. fn: function (aNumber){
  5335. var self=this,$self=this;
  5336. return $core.withContext(function($ctx1) {
  5337. return self | aNumber;
  5338. return self;
  5339. }, function($ctx1) {$ctx1.fill(self,"bitOr:",{aNumber:aNumber},$globals.Number)});
  5340. },
  5341. args: ["aNumber"],
  5342. source: "bitOr: aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5343. referencedClasses: [],
  5344. messageSends: []
  5345. }),
  5346. $globals.Number);
  5347. $core.addMethod(
  5348. $core.method({
  5349. selector: "bitXor:",
  5350. protocol: "converting",
  5351. fn: function (aNumber){
  5352. var self=this,$self=this;
  5353. return $core.withContext(function($ctx1) {
  5354. return self ^ aNumber;
  5355. return self;
  5356. }, function($ctx1) {$ctx1.fill(self,"bitXor:",{aNumber:aNumber},$globals.Number)});
  5357. },
  5358. args: ["aNumber"],
  5359. source: "bitXor: aNumber\x0a\x09<inlineJS: 'return self ^ aNumber'>",
  5360. referencedClasses: [],
  5361. messageSends: []
  5362. }),
  5363. $globals.Number);
  5364. $core.addMethod(
  5365. $core.method({
  5366. selector: "ceiling",
  5367. protocol: "converting",
  5368. fn: function (){
  5369. var self=this,$self=this;
  5370. return $core.withContext(function($ctx1) {
  5371. return Math.ceil(self);;
  5372. return self;
  5373. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  5374. },
  5375. args: [],
  5376. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  5377. referencedClasses: [],
  5378. messageSends: []
  5379. }),
  5380. $globals.Number);
  5381. $core.addMethod(
  5382. $core.method({
  5383. selector: "copy",
  5384. protocol: "copying",
  5385. fn: function (){
  5386. var self=this,$self=this;
  5387. return self;
  5388. },
  5389. args: [],
  5390. source: "copy\x0a\x09^ self",
  5391. referencedClasses: [],
  5392. messageSends: []
  5393. }),
  5394. $globals.Number);
  5395. $core.addMethod(
  5396. $core.method({
  5397. selector: "cos",
  5398. protocol: "mathematical functions",
  5399. fn: function (){
  5400. var self=this,$self=this;
  5401. return $core.withContext(function($ctx1) {
  5402. return Math.cos(self);;
  5403. return self;
  5404. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  5405. },
  5406. args: [],
  5407. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  5408. referencedClasses: [],
  5409. messageSends: []
  5410. }),
  5411. $globals.Number);
  5412. $core.addMethod(
  5413. $core.method({
  5414. selector: "deepCopy",
  5415. protocol: "copying",
  5416. fn: function (){
  5417. var self=this,$self=this;
  5418. return $core.withContext(function($ctx1) {
  5419. return $self._copy();
  5420. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  5421. },
  5422. args: [],
  5423. source: "deepCopy\x0a\x09^ self copy",
  5424. referencedClasses: [],
  5425. messageSends: ["copy"]
  5426. }),
  5427. $globals.Number);
  5428. $core.addMethod(
  5429. $core.method({
  5430. selector: "degreesToRadians",
  5431. protocol: "converting",
  5432. fn: function (){
  5433. var self=this,$self=this;
  5434. return $core.withContext(function($ctx1) {
  5435. return $self.__star($recv($globals.Number)._radiansPerDegree());
  5436. }, function($ctx1) {$ctx1.fill(self,"degreesToRadians",{},$globals.Number)});
  5437. },
  5438. args: [],
  5439. source: "degreesToRadians\x0a\x09^ self * Number radiansPerDegree",
  5440. referencedClasses: ["Number"],
  5441. messageSends: ["*", "radiansPerDegree"]
  5442. }),
  5443. $globals.Number);
  5444. $core.addMethod(
  5445. $core.method({
  5446. selector: "even",
  5447. protocol: "testing",
  5448. fn: function (){
  5449. var self=this,$self=this;
  5450. return $core.withContext(function($ctx1) {
  5451. return (0).__eq($self.__backslash_backslash((2)));
  5452. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  5453. },
  5454. args: [],
  5455. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  5456. referencedClasses: [],
  5457. messageSends: ["=", "\x5c\x5c"]
  5458. }),
  5459. $globals.Number);
  5460. $core.addMethod(
  5461. $core.method({
  5462. selector: "floor",
  5463. protocol: "converting",
  5464. fn: function (){
  5465. var self=this,$self=this;
  5466. return $core.withContext(function($ctx1) {
  5467. return Math.floor(self);;
  5468. return self;
  5469. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  5470. },
  5471. args: [],
  5472. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  5473. referencedClasses: [],
  5474. messageSends: []
  5475. }),
  5476. $globals.Number);
  5477. $core.addMethod(
  5478. $core.method({
  5479. selector: "isImmutable",
  5480. protocol: "testing",
  5481. fn: function (){
  5482. var self=this,$self=this;
  5483. return true;
  5484. },
  5485. args: [],
  5486. source: "isImmutable\x0a\x09^ true",
  5487. referencedClasses: [],
  5488. messageSends: []
  5489. }),
  5490. $globals.Number);
  5491. $core.addMethod(
  5492. $core.method({
  5493. selector: "isNumber",
  5494. protocol: "testing",
  5495. fn: function (){
  5496. var self=this,$self=this;
  5497. return true;
  5498. },
  5499. args: [],
  5500. source: "isNumber\x0a\x09^ true",
  5501. referencedClasses: [],
  5502. messageSends: []
  5503. }),
  5504. $globals.Number);
  5505. $core.addMethod(
  5506. $core.method({
  5507. selector: "isZero",
  5508. protocol: "testing",
  5509. fn: function (){
  5510. var self=this,$self=this;
  5511. return $core.withContext(function($ctx1) {
  5512. return $self.__eq((0));
  5513. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  5514. },
  5515. args: [],
  5516. source: "isZero\x0a\x09^ self = 0",
  5517. referencedClasses: [],
  5518. messageSends: ["="]
  5519. }),
  5520. $globals.Number);
  5521. $core.addMethod(
  5522. $core.method({
  5523. selector: "ln",
  5524. protocol: "mathematical functions",
  5525. fn: function (){
  5526. var self=this,$self=this;
  5527. return $core.withContext(function($ctx1) {
  5528. return Math.log(self);;
  5529. return self;
  5530. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  5531. },
  5532. args: [],
  5533. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  5534. referencedClasses: [],
  5535. messageSends: []
  5536. }),
  5537. $globals.Number);
  5538. $core.addMethod(
  5539. $core.method({
  5540. selector: "ln1p",
  5541. protocol: "mathematical functions",
  5542. fn: function (){
  5543. var self=this,$self=this;
  5544. return $core.withContext(function($ctx1) {
  5545. return Math.log1p(self);;
  5546. return self;
  5547. }, function($ctx1) {$ctx1.fill(self,"ln1p",{},$globals.Number)});
  5548. },
  5549. args: [],
  5550. source: "ln1p\x0a\x09<inlineJS: 'return Math.log1p(self);'>",
  5551. referencedClasses: [],
  5552. messageSends: []
  5553. }),
  5554. $globals.Number);
  5555. $core.addMethod(
  5556. $core.method({
  5557. selector: "log",
  5558. protocol: "mathematical functions",
  5559. fn: function (){
  5560. var self=this,$self=this;
  5561. return $core.withContext(function($ctx1) {
  5562. return Math.log(self) / Math.LN10;;
  5563. return self;
  5564. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  5565. },
  5566. args: [],
  5567. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  5568. referencedClasses: [],
  5569. messageSends: []
  5570. }),
  5571. $globals.Number);
  5572. $core.addMethod(
  5573. $core.method({
  5574. selector: "log:",
  5575. protocol: "mathematical functions",
  5576. fn: function (aNumber){
  5577. var self=this,$self=this;
  5578. return $core.withContext(function($ctx1) {
  5579. return Math.log(self) / Math.log(aNumber);;
  5580. return self;
  5581. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  5582. },
  5583. args: ["aNumber"],
  5584. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  5585. referencedClasses: [],
  5586. messageSends: []
  5587. }),
  5588. $globals.Number);
  5589. $core.addMethod(
  5590. $core.method({
  5591. selector: "max:",
  5592. protocol: "arithmetic",
  5593. fn: function (aNumber){
  5594. var self=this,$self=this;
  5595. return $core.withContext(function($ctx1) {
  5596. return Math.max(self, aNumber);;
  5597. return self;
  5598. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  5599. },
  5600. args: ["aNumber"],
  5601. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  5602. referencedClasses: [],
  5603. messageSends: []
  5604. }),
  5605. $globals.Number);
  5606. $core.addMethod(
  5607. $core.method({
  5608. selector: "min:",
  5609. protocol: "arithmetic",
  5610. fn: function (aNumber){
  5611. var self=this,$self=this;
  5612. return $core.withContext(function($ctx1) {
  5613. return Math.min(self, aNumber);;
  5614. return self;
  5615. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  5616. },
  5617. args: ["aNumber"],
  5618. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  5619. referencedClasses: [],
  5620. messageSends: []
  5621. }),
  5622. $globals.Number);
  5623. $core.addMethod(
  5624. $core.method({
  5625. selector: "min:max:",
  5626. protocol: "arithmetic",
  5627. fn: function (aMin,aMax){
  5628. var self=this,$self=this;
  5629. return $core.withContext(function($ctx1) {
  5630. return $recv($self._min_(aMin))._max_(aMax);
  5631. }, function($ctx1) {$ctx1.fill(self,"min:max:",{aMin:aMin,aMax:aMax},$globals.Number)});
  5632. },
  5633. args: ["aMin", "aMax"],
  5634. source: "min: aMin max: aMax\x0a\x09^ (self min: aMin) max: aMax",
  5635. referencedClasses: [],
  5636. messageSends: ["max:", "min:"]
  5637. }),
  5638. $globals.Number);
  5639. $core.addMethod(
  5640. $core.method({
  5641. selector: "negated",
  5642. protocol: "arithmetic",
  5643. fn: function (){
  5644. var self=this,$self=this;
  5645. return $core.withContext(function($ctx1) {
  5646. return (0).__minus(self);
  5647. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  5648. },
  5649. args: [],
  5650. source: "negated\x0a\x09^ 0 - self",
  5651. referencedClasses: [],
  5652. messageSends: ["-"]
  5653. }),
  5654. $globals.Number);
  5655. $core.addMethod(
  5656. $core.method({
  5657. selector: "negative",
  5658. protocol: "testing",
  5659. fn: function (){
  5660. var self=this,$self=this;
  5661. return $core.withContext(function($ctx1) {
  5662. return $self.__lt((0));
  5663. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  5664. },
  5665. args: [],
  5666. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5667. referencedClasses: [],
  5668. messageSends: ["<"]
  5669. }),
  5670. $globals.Number);
  5671. $core.addMethod(
  5672. $core.method({
  5673. selector: "odd",
  5674. protocol: "testing",
  5675. fn: function (){
  5676. var self=this,$self=this;
  5677. return $core.withContext(function($ctx1) {
  5678. return $recv($self._even())._not();
  5679. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  5680. },
  5681. args: [],
  5682. source: "odd\x0a\x09^ self even not",
  5683. referencedClasses: [],
  5684. messageSends: ["not", "even"]
  5685. }),
  5686. $globals.Number);
  5687. $core.addMethod(
  5688. $core.method({
  5689. selector: "positive",
  5690. protocol: "testing",
  5691. fn: function (){
  5692. var self=this,$self=this;
  5693. return $core.withContext(function($ctx1) {
  5694. return $self.__gt_eq((0));
  5695. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  5696. },
  5697. args: [],
  5698. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5699. referencedClasses: [],
  5700. messageSends: [">="]
  5701. }),
  5702. $globals.Number);
  5703. $core.addMethod(
  5704. $core.method({
  5705. selector: "printOn:",
  5706. protocol: "printing",
  5707. fn: function (aStream){
  5708. var self=this,$self=this;
  5709. return $core.withContext(function($ctx1) {
  5710. $recv(aStream)._nextPutAll_($self._asString());
  5711. return self;
  5712. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  5713. },
  5714. args: ["aStream"],
  5715. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5716. referencedClasses: [],
  5717. messageSends: ["nextPutAll:", "asString"]
  5718. }),
  5719. $globals.Number);
  5720. $core.addMethod(
  5721. $core.method({
  5722. selector: "printShowingDecimalPlaces:",
  5723. protocol: "printing",
  5724. fn: function (placesDesired){
  5725. var self=this,$self=this;
  5726. return $core.withContext(function($ctx1) {
  5727. return self.toFixed(placesDesired);
  5728. return self;
  5729. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  5730. },
  5731. args: ["placesDesired"],
  5732. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5733. referencedClasses: [],
  5734. messageSends: []
  5735. }),
  5736. $globals.Number);
  5737. $core.addMethod(
  5738. $core.method({
  5739. selector: "printStringBase:",
  5740. protocol: "converting",
  5741. fn: function (aBase){
  5742. var self=this,$self=this;
  5743. return $core.withContext(function($ctx1) {
  5744. return self.toString(aBase);
  5745. return self;
  5746. }, function($ctx1) {$ctx1.fill(self,"printStringBase:",{aBase:aBase},$globals.Number)});
  5747. },
  5748. args: ["aBase"],
  5749. source: "printStringBase: aBase\x0a\x09<inlineJS: 'return self.toString(aBase)'>",
  5750. referencedClasses: [],
  5751. messageSends: []
  5752. }),
  5753. $globals.Number);
  5754. $core.addMethod(
  5755. $core.method({
  5756. selector: "radiansToDegrees",
  5757. protocol: "converting",
  5758. fn: function (){
  5759. var self=this,$self=this;
  5760. return $core.withContext(function($ctx1) {
  5761. return $self.__slash($recv($globals.Number)._radiansPerDegree());
  5762. }, function($ctx1) {$ctx1.fill(self,"radiansToDegrees",{},$globals.Number)});
  5763. },
  5764. args: [],
  5765. source: "radiansToDegrees\x0a\x09^ self / Number radiansPerDegree",
  5766. referencedClasses: ["Number"],
  5767. messageSends: ["/", "radiansPerDegree"]
  5768. }),
  5769. $globals.Number);
  5770. $core.addMethod(
  5771. $core.method({
  5772. selector: "raisedTo:",
  5773. protocol: "mathematical functions",
  5774. fn: function (exponent){
  5775. var self=this,$self=this;
  5776. return $core.withContext(function($ctx1) {
  5777. return Math.pow(self, exponent);;
  5778. return self;
  5779. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  5780. },
  5781. args: ["exponent"],
  5782. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  5783. referencedClasses: [],
  5784. messageSends: []
  5785. }),
  5786. $globals.Number);
  5787. $core.addMethod(
  5788. $core.method({
  5789. selector: "rounded",
  5790. protocol: "converting",
  5791. fn: function (){
  5792. var self=this,$self=this;
  5793. return $core.withContext(function($ctx1) {
  5794. return Math.round(self);;
  5795. return self;
  5796. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  5797. },
  5798. args: [],
  5799. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  5800. referencedClasses: [],
  5801. messageSends: []
  5802. }),
  5803. $globals.Number);
  5804. $core.addMethod(
  5805. $core.method({
  5806. selector: "sign",
  5807. protocol: "mathematical functions",
  5808. fn: function (){
  5809. var self=this,$self=this;
  5810. return $core.withContext(function($ctx1) {
  5811. var $1,$2;
  5812. $1=$self._isZero();
  5813. if($core.assert($1)){
  5814. return (0);
  5815. }
  5816. $2=$self._positive();
  5817. if($core.assert($2)){
  5818. return (1);
  5819. } else {
  5820. return (-1);
  5821. }
  5822. return self;
  5823. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  5824. },
  5825. args: [],
  5826. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5827. referencedClasses: [],
  5828. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5829. }),
  5830. $globals.Number);
  5831. $core.addMethod(
  5832. $core.method({
  5833. selector: "sin",
  5834. protocol: "mathematical functions",
  5835. fn: function (){
  5836. var self=this,$self=this;
  5837. return $core.withContext(function($ctx1) {
  5838. return Math.sin(self);;
  5839. return self;
  5840. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  5841. },
  5842. args: [],
  5843. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  5844. referencedClasses: [],
  5845. messageSends: []
  5846. }),
  5847. $globals.Number);
  5848. $core.addMethod(
  5849. $core.method({
  5850. selector: "sqrt",
  5851. protocol: "mathematical functions",
  5852. fn: function (){
  5853. var self=this,$self=this;
  5854. return $core.withContext(function($ctx1) {
  5855. return Math.sqrt(self);
  5856. return self;
  5857. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  5858. },
  5859. args: [],
  5860. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  5861. referencedClasses: [],
  5862. messageSends: []
  5863. }),
  5864. $globals.Number);
  5865. $core.addMethod(
  5866. $core.method({
  5867. selector: "squared",
  5868. protocol: "mathematical functions",
  5869. fn: function (){
  5870. var self=this,$self=this;
  5871. return $core.withContext(function($ctx1) {
  5872. return $self.__star(self);
  5873. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  5874. },
  5875. args: [],
  5876. source: "squared\x0a\x09^ self * self",
  5877. referencedClasses: [],
  5878. messageSends: ["*"]
  5879. }),
  5880. $globals.Number);
  5881. $core.addMethod(
  5882. $core.method({
  5883. selector: "tan",
  5884. protocol: "mathematical functions",
  5885. fn: function (){
  5886. var self=this,$self=this;
  5887. return $core.withContext(function($ctx1) {
  5888. return Math.tan(self);;
  5889. return self;
  5890. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  5891. },
  5892. args: [],
  5893. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  5894. referencedClasses: [],
  5895. messageSends: []
  5896. }),
  5897. $globals.Number);
  5898. $core.addMethod(
  5899. $core.method({
  5900. selector: "timesRepeat:",
  5901. protocol: "enumerating",
  5902. fn: function (aBlock){
  5903. var self=this,$self=this;
  5904. var count;
  5905. return $core.withContext(function($ctx1) {
  5906. count=(1);
  5907. $recv((function(){
  5908. return $core.withContext(function($ctx2) {
  5909. return $recv(count).__gt(self);
  5910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5911. }))._whileFalse_((function(){
  5912. return $core.withContext(function($ctx2) {
  5913. $recv(aBlock)._value();
  5914. count=$recv(count).__plus((1));
  5915. return count;
  5916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5917. }));
  5918. return self;
  5919. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  5920. },
  5921. args: ["aBlock"],
  5922. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5923. referencedClasses: [],
  5924. messageSends: ["whileFalse:", ">", "value", "+"]
  5925. }),
  5926. $globals.Number);
  5927. $core.addMethod(
  5928. $core.method({
  5929. selector: "to:",
  5930. protocol: "converting",
  5931. fn: function (aNumber){
  5932. var self=this,$self=this;
  5933. var array,first,last,count;
  5934. return $core.withContext(function($ctx1) {
  5935. first=$self._truncated();
  5936. $ctx1.sendIdx["truncated"]=1;
  5937. last=$recv($recv(aNumber)._truncated()).__plus((1));
  5938. $ctx1.sendIdx["+"]=1;
  5939. count=(1);
  5940. array=$recv($globals.Array)._new();
  5941. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  5942. return $core.withContext(function($ctx2) {
  5943. $recv(array)._at_put_(count,first);
  5944. count=$recv(count).__plus((1));
  5945. $ctx2.sendIdx["+"]=2;
  5946. first=$recv(first).__plus((1));
  5947. return first;
  5948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5949. }));
  5950. return array;
  5951. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  5952. },
  5953. args: ["aNumber"],
  5954. 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",
  5955. referencedClasses: ["Array"],
  5956. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5957. }),
  5958. $globals.Number);
  5959. $core.addMethod(
  5960. $core.method({
  5961. selector: "to:by:",
  5962. protocol: "converting",
  5963. fn: function (stop,step){
  5964. var self=this,$self=this;
  5965. var array,value,pos;
  5966. return $core.withContext(function($ctx1) {
  5967. var $1,$2;
  5968. value=self;
  5969. array=$recv($globals.Array)._new();
  5970. pos=(1);
  5971. $1=$recv(step).__eq((0));
  5972. if($core.assert($1)){
  5973. $self._error_("step must be non-zero");
  5974. }
  5975. $2=$recv(step).__lt((0));
  5976. if($core.assert($2)){
  5977. $recv((function(){
  5978. return $core.withContext(function($ctx2) {
  5979. return $recv(value).__gt_eq(stop);
  5980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5981. }))._whileTrue_((function(){
  5982. return $core.withContext(function($ctx2) {
  5983. $recv(array)._at_put_(pos,value);
  5984. $ctx2.sendIdx["at:put:"]=1;
  5985. pos=$recv(pos).__plus((1));
  5986. $ctx2.sendIdx["+"]=1;
  5987. value=$recv(value).__plus(step);
  5988. $ctx2.sendIdx["+"]=2;
  5989. return value;
  5990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5991. }));
  5992. $ctx1.sendIdx["whileTrue:"]=1;
  5993. } else {
  5994. $recv((function(){
  5995. return $core.withContext(function($ctx2) {
  5996. return $recv(value).__lt_eq(stop);
  5997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5998. }))._whileTrue_((function(){
  5999. return $core.withContext(function($ctx2) {
  6000. $recv(array)._at_put_(pos,value);
  6001. pos=$recv(pos).__plus((1));
  6002. $ctx2.sendIdx["+"]=3;
  6003. value=$recv(value).__plus(step);
  6004. return value;
  6005. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6006. }));
  6007. }
  6008. return array;
  6009. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  6010. },
  6011. args: ["stop", "step"],
  6012. 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",
  6013. referencedClasses: ["Array"],
  6014. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  6015. }),
  6016. $globals.Number);
  6017. $core.addMethod(
  6018. $core.method({
  6019. selector: "to:by:do:",
  6020. protocol: "enumerating",
  6021. fn: function (stop,step,aBlock){
  6022. var self=this,$self=this;
  6023. var value;
  6024. return $core.withContext(function($ctx1) {
  6025. var $1,$2;
  6026. value=self;
  6027. $1=$recv(step).__eq((0));
  6028. if($core.assert($1)){
  6029. $self._error_("step must be non-zero");
  6030. }
  6031. $2=$recv(step).__lt((0));
  6032. if($core.assert($2)){
  6033. $recv((function(){
  6034. return $core.withContext(function($ctx2) {
  6035. return $recv(value).__gt_eq(stop);
  6036. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  6037. }))._whileTrue_((function(){
  6038. return $core.withContext(function($ctx2) {
  6039. $recv(aBlock)._value_(value);
  6040. $ctx2.sendIdx["value:"]=1;
  6041. value=$recv(value).__plus(step);
  6042. $ctx2.sendIdx["+"]=1;
  6043. return value;
  6044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  6045. }));
  6046. $ctx1.sendIdx["whileTrue:"]=1;
  6047. } else {
  6048. $recv((function(){
  6049. return $core.withContext(function($ctx2) {
  6050. return $recv(value).__lt_eq(stop);
  6051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  6052. }))._whileTrue_((function(){
  6053. return $core.withContext(function($ctx2) {
  6054. $recv(aBlock)._value_(value);
  6055. value=$recv(value).__plus(step);
  6056. return value;
  6057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6058. }));
  6059. }
  6060. return self;
  6061. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  6062. },
  6063. args: ["stop", "step", "aBlock"],
  6064. 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 ]]",
  6065. referencedClasses: [],
  6066. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  6067. }),
  6068. $globals.Number);
  6069. $core.addMethod(
  6070. $core.method({
  6071. selector: "to:do:",
  6072. protocol: "enumerating",
  6073. fn: function (stop,aBlock){
  6074. var self=this,$self=this;
  6075. var nextValue;
  6076. return $core.withContext(function($ctx1) {
  6077. nextValue=self;
  6078. $recv((function(){
  6079. return $core.withContext(function($ctx2) {
  6080. return $recv(nextValue).__lt_eq(stop);
  6081. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6082. }))._whileTrue_((function(){
  6083. return $core.withContext(function($ctx2) {
  6084. $recv(aBlock)._value_(nextValue);
  6085. nextValue=$recv(nextValue).__plus((1));
  6086. return nextValue;
  6087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6088. }));
  6089. return self;
  6090. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  6091. },
  6092. args: ["stop", "aBlock"],
  6093. 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 ]",
  6094. referencedClasses: [],
  6095. messageSends: ["whileTrue:", "<=", "value:", "+"]
  6096. }),
  6097. $globals.Number);
  6098. $core.addMethod(
  6099. $core.method({
  6100. selector: "truncated",
  6101. protocol: "converting",
  6102. fn: function (){
  6103. var self=this,$self=this;
  6104. return $core.withContext(function($ctx1) {
  6105. if(self >= 0) {
  6106. return Math.floor(self);
  6107. } else {
  6108. return Math.floor(self * (-1)) * (-1);
  6109. };
  6110. ;
  6111. return self;
  6112. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  6113. },
  6114. args: [],
  6115. 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'>",
  6116. referencedClasses: [],
  6117. messageSends: []
  6118. }),
  6119. $globals.Number);
  6120. $core.addMethod(
  6121. $core.method({
  6122. selector: "|",
  6123. protocol: "converting",
  6124. fn: function (aNumber){
  6125. var self=this,$self=this;
  6126. return $core.withContext(function($ctx1) {
  6127. return self | aNumber;
  6128. return self;
  6129. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  6130. },
  6131. args: ["aNumber"],
  6132. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  6133. referencedClasses: [],
  6134. messageSends: []
  6135. }),
  6136. $globals.Number);
  6137. $core.addMethod(
  6138. $core.method({
  6139. selector: "classTag",
  6140. protocol: "accessing",
  6141. fn: function (){
  6142. var self=this,$self=this;
  6143. return "magnitude";
  6144. },
  6145. args: [],
  6146. 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'",
  6147. referencedClasses: [],
  6148. messageSends: []
  6149. }),
  6150. $globals.Number.a$cls);
  6151. $core.addMethod(
  6152. $core.method({
  6153. selector: "e",
  6154. protocol: "instance creation",
  6155. fn: function (){
  6156. var self=this,$self=this;
  6157. return $core.withContext(function($ctx1) {
  6158. return Math.E;;
  6159. return self;
  6160. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.a$cls)});
  6161. },
  6162. args: [],
  6163. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  6164. referencedClasses: [],
  6165. messageSends: []
  6166. }),
  6167. $globals.Number.a$cls);
  6168. $core.addMethod(
  6169. $core.method({
  6170. selector: "pi",
  6171. protocol: "instance creation",
  6172. fn: function (){
  6173. var self=this,$self=this;
  6174. return $core.withContext(function($ctx1) {
  6175. return Math.PI;
  6176. return self;
  6177. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.a$cls)});
  6178. },
  6179. args: [],
  6180. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  6181. referencedClasses: [],
  6182. messageSends: []
  6183. }),
  6184. $globals.Number.a$cls);
  6185. $core.addMethod(
  6186. $core.method({
  6187. selector: "radiansPerDegree",
  6188. protocol: "instance creation",
  6189. fn: function (){
  6190. var self=this,$self=this;
  6191. return $core.withContext(function($ctx1) {
  6192. return $recv($self._pi()).__slash((180));
  6193. }, function($ctx1) {$ctx1.fill(self,"radiansPerDegree",{},$globals.Number.a$cls)});
  6194. },
  6195. args: [],
  6196. source: "radiansPerDegree\x0a\x09^ (self pi) / 180",
  6197. referencedClasses: [],
  6198. messageSends: ["/", "pi"]
  6199. }),
  6200. $globals.Number.a$cls);
  6201. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  6202. $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";
  6203. $core.addMethod(
  6204. $core.method({
  6205. selector: "*",
  6206. protocol: "arithmetic",
  6207. fn: function (aPoint){
  6208. var self=this,$self=this;
  6209. return $core.withContext(function($ctx1) {
  6210. var $2,$4,$3,$1,$6,$5;
  6211. $2=$self._x();
  6212. $ctx1.sendIdx["x"]=1;
  6213. $4=$recv(aPoint)._asPoint();
  6214. $ctx1.sendIdx["asPoint"]=1;
  6215. $3=$recv($4)._x();
  6216. $1=$recv($2).__star($3);
  6217. $ctx1.sendIdx["*"]=1;
  6218. $6=$self._y();
  6219. $ctx1.sendIdx["y"]=1;
  6220. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  6221. return $recv($globals.Point)._x_y_($1,$5);
  6222. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  6223. },
  6224. args: ["aPoint"],
  6225. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  6226. referencedClasses: ["Point"],
  6227. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  6228. }),
  6229. $globals.Point);
  6230. $core.addMethod(
  6231. $core.method({
  6232. selector: "+",
  6233. protocol: "arithmetic",
  6234. fn: function (aPoint){
  6235. var self=this,$self=this;
  6236. return $core.withContext(function($ctx1) {
  6237. var $2,$4,$3,$1,$6,$5;
  6238. $2=$self._x();
  6239. $ctx1.sendIdx["x"]=1;
  6240. $4=$recv(aPoint)._asPoint();
  6241. $ctx1.sendIdx["asPoint"]=1;
  6242. $3=$recv($4)._x();
  6243. $1=$recv($2).__plus($3);
  6244. $ctx1.sendIdx["+"]=1;
  6245. $6=$self._y();
  6246. $ctx1.sendIdx["y"]=1;
  6247. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  6248. return $recv($globals.Point)._x_y_($1,$5);
  6249. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  6250. },
  6251. args: ["aPoint"],
  6252. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  6253. referencedClasses: ["Point"],
  6254. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  6255. }),
  6256. $globals.Point);
  6257. $core.addMethod(
  6258. $core.method({
  6259. selector: "-",
  6260. protocol: "arithmetic",
  6261. fn: function (aPoint){
  6262. var self=this,$self=this;
  6263. return $core.withContext(function($ctx1) {
  6264. var $2,$4,$3,$1,$6,$5;
  6265. $2=$self._x();
  6266. $ctx1.sendIdx["x"]=1;
  6267. $4=$recv(aPoint)._asPoint();
  6268. $ctx1.sendIdx["asPoint"]=1;
  6269. $3=$recv($4)._x();
  6270. $1=$recv($2).__minus($3);
  6271. $ctx1.sendIdx["-"]=1;
  6272. $6=$self._y();
  6273. $ctx1.sendIdx["y"]=1;
  6274. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  6275. return $recv($globals.Point)._x_y_($1,$5);
  6276. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  6277. },
  6278. args: ["aPoint"],
  6279. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  6280. referencedClasses: ["Point"],
  6281. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  6282. }),
  6283. $globals.Point);
  6284. $core.addMethod(
  6285. $core.method({
  6286. selector: "/",
  6287. protocol: "arithmetic",
  6288. fn: function (aPoint){
  6289. var self=this,$self=this;
  6290. return $core.withContext(function($ctx1) {
  6291. var $2,$4,$3,$1,$6,$5;
  6292. $2=$self._x();
  6293. $ctx1.sendIdx["x"]=1;
  6294. $4=$recv(aPoint)._asPoint();
  6295. $ctx1.sendIdx["asPoint"]=1;
  6296. $3=$recv($4)._x();
  6297. $1=$recv($2).__slash($3);
  6298. $ctx1.sendIdx["/"]=1;
  6299. $6=$self._y();
  6300. $ctx1.sendIdx["y"]=1;
  6301. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  6302. return $recv($globals.Point)._x_y_($1,$5);
  6303. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  6304. },
  6305. args: ["aPoint"],
  6306. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6307. referencedClasses: ["Point"],
  6308. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  6309. }),
  6310. $globals.Point);
  6311. $core.addMethod(
  6312. $core.method({
  6313. selector: "<",
  6314. protocol: "comparing",
  6315. fn: function (aPoint){
  6316. var self=this,$self=this;
  6317. return $core.withContext(function($ctx1) {
  6318. var $2,$1,$3;
  6319. $2=$self._x();
  6320. $ctx1.sendIdx["x"]=1;
  6321. $1=$recv($2).__lt($recv(aPoint)._x());
  6322. $ctx1.sendIdx["<"]=1;
  6323. return $recv($1)._and_((function(){
  6324. return $core.withContext(function($ctx2) {
  6325. $3=$self._y();
  6326. $ctx2.sendIdx["y"]=1;
  6327. return $recv($3).__lt($recv(aPoint)._y());
  6328. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6329. }));
  6330. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  6331. },
  6332. args: ["aPoint"],
  6333. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  6334. referencedClasses: [],
  6335. messageSends: ["and:", "<", "x", "y"]
  6336. }),
  6337. $globals.Point);
  6338. $core.addMethod(
  6339. $core.method({
  6340. selector: "<=",
  6341. protocol: "comparing",
  6342. fn: function (aPoint){
  6343. var self=this,$self=this;
  6344. return $core.withContext(function($ctx1) {
  6345. var $2,$1,$3;
  6346. $2=$self._x();
  6347. $ctx1.sendIdx["x"]=1;
  6348. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  6349. $ctx1.sendIdx["<="]=1;
  6350. return $recv($1)._and_((function(){
  6351. return $core.withContext(function($ctx2) {
  6352. $3=$self._y();
  6353. $ctx2.sendIdx["y"]=1;
  6354. return $recv($3).__lt_eq($recv(aPoint)._y());
  6355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6356. }));
  6357. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  6358. },
  6359. args: ["aPoint"],
  6360. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6361. referencedClasses: [],
  6362. messageSends: ["and:", "<=", "x", "y"]
  6363. }),
  6364. $globals.Point);
  6365. $core.addMethod(
  6366. $core.method({
  6367. selector: "=",
  6368. protocol: "comparing",
  6369. fn: function (aPoint){
  6370. var self=this,$self=this;
  6371. return $core.withContext(function($ctx1) {
  6372. var $2,$1,$4,$3,$6,$5;
  6373. $2=$recv(aPoint)._class();
  6374. $ctx1.sendIdx["class"]=1;
  6375. $1=$recv($2).__eq($self._class());
  6376. $ctx1.sendIdx["="]=1;
  6377. return $recv($1)._and_((function(){
  6378. return $core.withContext(function($ctx2) {
  6379. $4=$recv(aPoint)._x();
  6380. $ctx2.sendIdx["x"]=1;
  6381. $3=$recv($4).__eq($self._x());
  6382. $ctx2.sendIdx["="]=2;
  6383. $6=$recv(aPoint)._y();
  6384. $ctx2.sendIdx["y"]=1;
  6385. $5=$recv($6).__eq($self._y());
  6386. return $recv($3).__and($5);
  6387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6388. }));
  6389. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  6390. },
  6391. args: ["aPoint"],
  6392. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6393. referencedClasses: [],
  6394. messageSends: ["and:", "=", "class", "&", "x", "y"]
  6395. }),
  6396. $globals.Point);
  6397. $core.addMethod(
  6398. $core.method({
  6399. selector: ">",
  6400. protocol: "comparing",
  6401. fn: function (aPoint){
  6402. var self=this,$self=this;
  6403. return $core.withContext(function($ctx1) {
  6404. var $2,$1,$3;
  6405. $2=$self._x();
  6406. $ctx1.sendIdx["x"]=1;
  6407. $1=$recv($2).__gt($recv(aPoint)._x());
  6408. $ctx1.sendIdx[">"]=1;
  6409. return $recv($1)._and_((function(){
  6410. return $core.withContext(function($ctx2) {
  6411. $3=$self._y();
  6412. $ctx2.sendIdx["y"]=1;
  6413. return $recv($3).__gt($recv(aPoint)._y());
  6414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6415. }));
  6416. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  6417. },
  6418. args: ["aPoint"],
  6419. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  6420. referencedClasses: [],
  6421. messageSends: ["and:", ">", "x", "y"]
  6422. }),
  6423. $globals.Point);
  6424. $core.addMethod(
  6425. $core.method({
  6426. selector: ">=",
  6427. protocol: "comparing",
  6428. fn: function (aPoint){
  6429. var self=this,$self=this;
  6430. return $core.withContext(function($ctx1) {
  6431. var $2,$1,$3;
  6432. $2=$self._x();
  6433. $ctx1.sendIdx["x"]=1;
  6434. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  6435. $ctx1.sendIdx[">="]=1;
  6436. return $recv($1)._and_((function(){
  6437. return $core.withContext(function($ctx2) {
  6438. $3=$self._y();
  6439. $ctx2.sendIdx["y"]=1;
  6440. return $recv($3).__gt_eq($recv(aPoint)._y());
  6441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6442. }));
  6443. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  6444. },
  6445. args: ["aPoint"],
  6446. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6447. referencedClasses: [],
  6448. messageSends: ["and:", ">=", "x", "y"]
  6449. }),
  6450. $globals.Point);
  6451. $core.addMethod(
  6452. $core.method({
  6453. selector: "angle",
  6454. protocol: "geometry",
  6455. fn: function (){
  6456. var self=this,$self=this;
  6457. return $core.withContext(function($ctx1) {
  6458. return $recv($self._y())._arcTan_($self._x());
  6459. }, function($ctx1) {$ctx1.fill(self,"angle",{},$globals.Point)});
  6460. },
  6461. args: [],
  6462. source: "angle\x0a\x09^ self y arcTan: self x",
  6463. referencedClasses: [],
  6464. messageSends: ["arcTan:", "y", "x"]
  6465. }),
  6466. $globals.Point);
  6467. $core.addMethod(
  6468. $core.method({
  6469. selector: "asPoint",
  6470. protocol: "converting",
  6471. fn: function (){
  6472. var self=this,$self=this;
  6473. return self;
  6474. },
  6475. args: [],
  6476. source: "asPoint\x0a\x09^ self",
  6477. referencedClasses: [],
  6478. messageSends: []
  6479. }),
  6480. $globals.Point);
  6481. $core.addMethod(
  6482. $core.method({
  6483. selector: "corner:",
  6484. protocol: "rectangle creation",
  6485. fn: function (aPoint){
  6486. var self=this,$self=this;
  6487. return $core.withContext(function($ctx1) {
  6488. return $recv($globals.Rectangle)._origin_corner_(self,aPoint);
  6489. }, function($ctx1) {$ctx1.fill(self,"corner:",{aPoint:aPoint},$globals.Point)});
  6490. },
  6491. args: ["aPoint"],
  6492. source: "corner: aPoint\x0a\x09^ Rectangle origin: self corner: aPoint",
  6493. referencedClasses: ["Rectangle"],
  6494. messageSends: ["origin:corner:"]
  6495. }),
  6496. $globals.Point);
  6497. $core.addMethod(
  6498. $core.method({
  6499. selector: "dist:",
  6500. protocol: "transforming",
  6501. fn: function (aPoint){
  6502. var self=this,$self=this;
  6503. var dx,dy;
  6504. return $core.withContext(function($ctx1) {
  6505. var $2,$1;
  6506. dx=$recv($recv(aPoint)._x()).__minus($self["@x"]);
  6507. $ctx1.sendIdx["-"]=1;
  6508. dy=$recv($recv(aPoint)._y()).__minus($self["@y"]);
  6509. $2=$recv(dx).__star(dx);
  6510. $ctx1.sendIdx["*"]=1;
  6511. $1=$recv($2).__plus($recv(dy).__star(dy));
  6512. return $recv($1)._sqrt();
  6513. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  6514. },
  6515. args: ["aPoint"],
  6516. 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",
  6517. referencedClasses: [],
  6518. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6519. }),
  6520. $globals.Point);
  6521. $core.addMethod(
  6522. $core.method({
  6523. selector: "dotProduct:",
  6524. protocol: "point functions",
  6525. fn: function (aPoint){
  6526. var self=this,$self=this;
  6527. return $core.withContext(function($ctx1) {
  6528. var $1;
  6529. $1=$recv($self["@x"]).__star($recv(aPoint)._x());
  6530. $ctx1.sendIdx["*"]=1;
  6531. return $recv($1).__plus($recv($self["@y"]).__star($recv(aPoint)._y()));
  6532. }, function($ctx1) {$ctx1.fill(self,"dotProduct:",{aPoint:aPoint},$globals.Point)});
  6533. },
  6534. args: ["aPoint"],
  6535. source: "dotProduct: aPoint\x0a\x09^ (x * aPoint x) + (y * aPoint y)",
  6536. referencedClasses: [],
  6537. messageSends: ["+", "*", "x", "y"]
  6538. }),
  6539. $globals.Point);
  6540. $core.addMethod(
  6541. $core.method({
  6542. selector: "extent:",
  6543. protocol: "rectangle creation",
  6544. fn: function (aPoint){
  6545. var self=this,$self=this;
  6546. return $core.withContext(function($ctx1) {
  6547. return $recv($globals.Rectangle)._origin_extent_(self,aPoint);
  6548. }, function($ctx1) {$ctx1.fill(self,"extent:",{aPoint:aPoint},$globals.Point)});
  6549. },
  6550. args: ["aPoint"],
  6551. source: "extent: aPoint\x0a\x09^ Rectangle origin: self extent: aPoint",
  6552. referencedClasses: ["Rectangle"],
  6553. messageSends: ["origin:extent:"]
  6554. }),
  6555. $globals.Point);
  6556. $core.addMethod(
  6557. $core.method({
  6558. selector: "normal",
  6559. protocol: "point functions",
  6560. fn: function (){
  6561. var self=this,$self=this;
  6562. var n,d;
  6563. return $core.withContext(function($ctx1) {
  6564. var $4,$3,$6,$5,$2,$1;
  6565. n=$recv($recv($self["@y"])._negated()).__at($self["@x"]);
  6566. $ctx1.sendIdx["@"]=1;
  6567. $4=$recv(n)._x();
  6568. $ctx1.sendIdx["x"]=1;
  6569. $3=$recv($4).__star($recv(n)._x());
  6570. $ctx1.sendIdx["*"]=1;
  6571. $6=$recv(n)._y();
  6572. $ctx1.sendIdx["y"]=1;
  6573. $5=$recv($6).__star($recv(n)._y());
  6574. d=$recv($3).__plus($5);
  6575. $2=d;
  6576. $1=$recv($2).__eq((0));
  6577. if($core.assert($1)){
  6578. return (-1).__at((0));
  6579. }
  6580. return $recv(n).__slash($recv(d)._sqrt());
  6581. }, function($ctx1) {$ctx1.fill(self,"normal",{n:n,d:d},$globals.Point)});
  6582. },
  6583. args: [],
  6584. 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",
  6585. referencedClasses: [],
  6586. messageSends: ["@", "negated", "ifTrue:", "=", "+", "*", "x", "y", "/", "sqrt"]
  6587. }),
  6588. $globals.Point);
  6589. $core.addMethod(
  6590. $core.method({
  6591. selector: "normalized",
  6592. protocol: "point functions",
  6593. fn: function (){
  6594. var self=this,$self=this;
  6595. var r;
  6596. return $core.withContext(function($ctx1) {
  6597. var $1,$2,$3;
  6598. r=$self._r();
  6599. $1=$recv(r).__eq((0));
  6600. if($core.assert($1)){
  6601. $2=$recv($globals.Point)._x_y_((0),(0));
  6602. $ctx1.sendIdx["x:y:"]=1;
  6603. return $2;
  6604. } else {
  6605. $3=$recv($self["@x"]).__slash(r);
  6606. $ctx1.sendIdx["/"]=1;
  6607. return $recv($globals.Point)._x_y_($3,$recv($self["@y"]).__slash(r));
  6608. }
  6609. return self;
  6610. }, function($ctx1) {$ctx1.fill(self,"normalized",{r:r},$globals.Point)});
  6611. },
  6612. args: [],
  6613. 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 ]",
  6614. referencedClasses: ["Point"],
  6615. messageSends: ["r", "ifTrue:ifFalse:", "=", "x:y:", "/"]
  6616. }),
  6617. $globals.Point);
  6618. $core.addMethod(
  6619. $core.method({
  6620. selector: "printOn:",
  6621. protocol: "printing",
  6622. fn: function (aStream){
  6623. var self=this,$self=this;
  6624. return $core.withContext(function($ctx1) {
  6625. var $1;
  6626. $recv($self["@x"])._printOn_(aStream);
  6627. $ctx1.sendIdx["printOn:"]=1;
  6628. $recv(aStream)._nextPutAll_("@");
  6629. $1=$recv($recv($self["@y"])._notNil())._and_((function(){
  6630. return $core.withContext(function($ctx2) {
  6631. return $recv($self["@y"])._negative();
  6632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6633. }));
  6634. if($core.assert($1)){
  6635. $recv(aStream)._space();
  6636. }
  6637. $recv($self["@y"])._printOn_(aStream);
  6638. return self;
  6639. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  6640. },
  6641. args: ["aStream"],
  6642. 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",
  6643. referencedClasses: [],
  6644. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6645. }),
  6646. $globals.Point);
  6647. $core.addMethod(
  6648. $core.method({
  6649. selector: "r",
  6650. protocol: "polar coordinates",
  6651. fn: function (){
  6652. var self=this,$self=this;
  6653. return $core.withContext(function($ctx1) {
  6654. var $2,$1;
  6655. $2=$recv($self["@x"]).__star($self["@x"]);
  6656. $ctx1.sendIdx["*"]=1;
  6657. $1=$recv($2).__plus($recv($self["@y"]).__star($self["@y"]));
  6658. return $recv($1)._sqrt();
  6659. }, function($ctx1) {$ctx1.fill(self,"r",{},$globals.Point)});
  6660. },
  6661. args: [],
  6662. source: "r\x0a\x09^ ((x * x) + (y * y)) sqrt",
  6663. referencedClasses: [],
  6664. messageSends: ["sqrt", "+", "*"]
  6665. }),
  6666. $globals.Point);
  6667. $core.addMethod(
  6668. $core.method({
  6669. selector: "rectangle:",
  6670. protocol: "rectangle creation",
  6671. fn: function (aPoint){
  6672. var self=this,$self=this;
  6673. return $core.withContext(function($ctx1) {
  6674. return $recv($globals.Rectangle)._point_point_(self,aPoint);
  6675. }, function($ctx1) {$ctx1.fill(self,"rectangle:",{aPoint:aPoint},$globals.Point)});
  6676. },
  6677. args: ["aPoint"],
  6678. source: "rectangle: aPoint\x0a\x09^ Rectangle point: self point: aPoint",
  6679. referencedClasses: ["Rectangle"],
  6680. messageSends: ["point:point:"]
  6681. }),
  6682. $globals.Point);
  6683. $core.addMethod(
  6684. $core.method({
  6685. selector: "translateBy:",
  6686. protocol: "transforming",
  6687. fn: function (delta){
  6688. var self=this,$self=this;
  6689. return $core.withContext(function($ctx1) {
  6690. var $1;
  6691. $1=$recv($recv(delta)._x()).__plus($self["@x"]);
  6692. $ctx1.sendIdx["+"]=1;
  6693. return $recv($1).__at($recv($recv(delta)._y()).__plus($self["@y"]));
  6694. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  6695. },
  6696. args: ["delta"],
  6697. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6698. referencedClasses: [],
  6699. messageSends: ["@", "+", "x", "y"]
  6700. }),
  6701. $globals.Point);
  6702. $core.addMethod(
  6703. $core.method({
  6704. selector: "x",
  6705. protocol: "accessing",
  6706. fn: function (){
  6707. var self=this,$self=this;
  6708. return $self["@x"];
  6709. },
  6710. args: [],
  6711. source: "x\x0a\x09^ x",
  6712. referencedClasses: [],
  6713. messageSends: []
  6714. }),
  6715. $globals.Point);
  6716. $core.addMethod(
  6717. $core.method({
  6718. selector: "x:",
  6719. protocol: "accessing",
  6720. fn: function (aNumber){
  6721. var self=this,$self=this;
  6722. $self["@x"]=aNumber;
  6723. return self;
  6724. },
  6725. args: ["aNumber"],
  6726. source: "x: aNumber\x0a\x09x := aNumber",
  6727. referencedClasses: [],
  6728. messageSends: []
  6729. }),
  6730. $globals.Point);
  6731. $core.addMethod(
  6732. $core.method({
  6733. selector: "y",
  6734. protocol: "accessing",
  6735. fn: function (){
  6736. var self=this,$self=this;
  6737. return $self["@y"];
  6738. },
  6739. args: [],
  6740. source: "y\x0a\x09^ y",
  6741. referencedClasses: [],
  6742. messageSends: []
  6743. }),
  6744. $globals.Point);
  6745. $core.addMethod(
  6746. $core.method({
  6747. selector: "y:",
  6748. protocol: "accessing",
  6749. fn: function (aNumber){
  6750. var self=this,$self=this;
  6751. $self["@y"]=aNumber;
  6752. return self;
  6753. },
  6754. args: ["aNumber"],
  6755. source: "y: aNumber\x0a\x09y := aNumber",
  6756. referencedClasses: [],
  6757. messageSends: []
  6758. }),
  6759. $globals.Point);
  6760. $core.addMethod(
  6761. $core.method({
  6762. selector: "classTag",
  6763. protocol: "accessing",
  6764. fn: function (){
  6765. var self=this,$self=this;
  6766. return "magnitude";
  6767. },
  6768. args: [],
  6769. 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'",
  6770. referencedClasses: [],
  6771. messageSends: []
  6772. }),
  6773. $globals.Point.a$cls);
  6774. $core.addMethod(
  6775. $core.method({
  6776. selector: "x:y:",
  6777. protocol: "instance creation",
  6778. fn: function (aNumber,anotherNumber){
  6779. var self=this,$self=this;
  6780. return $core.withContext(function($ctx1) {
  6781. var $1;
  6782. $1=$self._new();
  6783. $recv($1)._x_(aNumber);
  6784. $recv($1)._y_(anotherNumber);
  6785. return $recv($1)._yourself();
  6786. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.a$cls)});
  6787. },
  6788. args: ["aNumber", "anotherNumber"],
  6789. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  6790. referencedClasses: [],
  6791. messageSends: ["x:", "new", "y:", "yourself"]
  6792. }),
  6793. $globals.Point.a$cls);
  6794. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  6795. $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'`.";
  6796. $core.addMethod(
  6797. $core.method({
  6798. selector: "next",
  6799. protocol: "accessing",
  6800. fn: function (){
  6801. var self=this,$self=this;
  6802. return $core.withContext(function($ctx1) {
  6803. return Math.random();
  6804. return self;
  6805. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  6806. },
  6807. args: [],
  6808. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  6809. referencedClasses: [],
  6810. messageSends: []
  6811. }),
  6812. $globals.Random);
  6813. $core.addMethod(
  6814. $core.method({
  6815. selector: "next:",
  6816. protocol: "accessing",
  6817. fn: function (anInteger){
  6818. var self=this,$self=this;
  6819. return $core.withContext(function($ctx1) {
  6820. return $recv((1)._to_(anInteger))._collect_((function(each){
  6821. return $core.withContext(function($ctx2) {
  6822. return $self._next();
  6823. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6824. }));
  6825. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  6826. },
  6827. args: ["anInteger"],
  6828. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  6829. referencedClasses: [],
  6830. messageSends: ["collect:", "to:", "next"]
  6831. }),
  6832. $globals.Random);
  6833. $core.addClass("Rectangle", $globals.Object, ["origin", "corner"], "Kernel-Objects");
  6834. $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.";
  6835. $core.addMethod(
  6836. $core.method({
  6837. selector: "=",
  6838. protocol: "testing",
  6839. fn: function (aRectangle){
  6840. var self=this,$self=this;
  6841. return $core.withContext(function($ctx1) {
  6842. var $1;
  6843. $1=$recv($self["@origin"]).__eq($recv(aRectangle)._origin());
  6844. $ctx1.sendIdx["="]=1;
  6845. return $recv($1)._and_((function(){
  6846. return $core.withContext(function($ctx2) {
  6847. return $recv($self["@corner"]).__eq($recv(aRectangle)._corner());
  6848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6849. }));
  6850. }, function($ctx1) {$ctx1.fill(self,"=",{aRectangle:aRectangle},$globals.Rectangle)});
  6851. },
  6852. args: ["aRectangle"],
  6853. source: "= aRectangle\x0a\x09^ origin = aRectangle origin and: [ corner = aRectangle corner ]",
  6854. referencedClasses: [],
  6855. messageSends: ["and:", "=", "origin", "corner"]
  6856. }),
  6857. $globals.Rectangle);
  6858. $core.addMethod(
  6859. $core.method({
  6860. selector: "containsPoint:",
  6861. protocol: "testing",
  6862. fn: function (aPoint){
  6863. var self=this,$self=this;
  6864. return $core.withContext(function($ctx1) {
  6865. return $recv($recv($self["@origin"]).__lt_eq(aPoint))._and_((function(){
  6866. return $core.withContext(function($ctx2) {
  6867. return $recv($self["@corner"]).__gt_eq(aPoint);
  6868. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6869. }));
  6870. }, function($ctx1) {$ctx1.fill(self,"containsPoint:",{aPoint:aPoint},$globals.Rectangle)});
  6871. },
  6872. args: ["aPoint"],
  6873. source: "containsPoint: aPoint\x0a\x09^ origin <= aPoint and: [ corner >= aPoint ]",
  6874. referencedClasses: [],
  6875. messageSends: ["and:", "<=", ">="]
  6876. }),
  6877. $globals.Rectangle);
  6878. $core.addMethod(
  6879. $core.method({
  6880. selector: "containsRect:",
  6881. protocol: "testing",
  6882. fn: function (aRect){
  6883. var self=this,$self=this;
  6884. return $core.withContext(function($ctx1) {
  6885. return $recv($recv($recv(aRect)._origin()).__gt_eq($self["@origin"]))._and_((function(){
  6886. return $core.withContext(function($ctx2) {
  6887. return $recv($recv(aRect)._corner()).__lt_eq($self["@corner"]);
  6888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6889. }));
  6890. }, function($ctx1) {$ctx1.fill(self,"containsRect:",{aRect:aRect},$globals.Rectangle)});
  6891. },
  6892. args: ["aRect"],
  6893. source: "containsRect: aRect\x0a\x09^ aRect origin >= origin and: [ aRect corner <= corner ]",
  6894. referencedClasses: [],
  6895. messageSends: ["and:", ">=", "origin", "<=", "corner"]
  6896. }),
  6897. $globals.Rectangle);
  6898. $core.addMethod(
  6899. $core.method({
  6900. selector: "corner",
  6901. protocol: "accessing",
  6902. fn: function (){
  6903. var self=this,$self=this;
  6904. return $self["@corner"];
  6905. },
  6906. args: [],
  6907. source: "corner\x0a\x09^ corner",
  6908. referencedClasses: [],
  6909. messageSends: []
  6910. }),
  6911. $globals.Rectangle);
  6912. $core.addMethod(
  6913. $core.method({
  6914. selector: "origin",
  6915. protocol: "accessing",
  6916. fn: function (){
  6917. var self=this,$self=this;
  6918. return $self["@origin"];
  6919. },
  6920. args: [],
  6921. source: "origin\x0a\x09^ origin",
  6922. referencedClasses: [],
  6923. messageSends: []
  6924. }),
  6925. $globals.Rectangle);
  6926. $core.addMethod(
  6927. $core.method({
  6928. selector: "printOn:",
  6929. protocol: "testing",
  6930. fn: function (aStream){
  6931. var self=this,$self=this;
  6932. return $core.withContext(function($ctx1) {
  6933. $recv($self["@origin"])._printOn_(aStream);
  6934. $ctx1.sendIdx["printOn:"]=1;
  6935. $recv(aStream)._nextPutAll_(" corner: ");
  6936. $recv($self["@corner"])._printOn_(aStream);
  6937. return self;
  6938. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Rectangle)});
  6939. },
  6940. args: ["aStream"],
  6941. source: "printOn: aStream\x0a\x09origin printOn: aStream.\x0a\x09aStream nextPutAll: ' corner: '.\x0a\x09corner printOn: aStream.",
  6942. referencedClasses: [],
  6943. messageSends: ["printOn:", "nextPutAll:"]
  6944. }),
  6945. $globals.Rectangle);
  6946. $core.addMethod(
  6947. $core.method({
  6948. selector: "setPoint:point:",
  6949. protocol: "private",
  6950. fn: function (pt1,pt2){
  6951. var self=this,$self=this;
  6952. return $core.withContext(function($ctx1) {
  6953. var $2,$3,$1,$5,$6,$4,$8,$7,$10,$9;
  6954. $2=$recv(pt1)._x();
  6955. $ctx1.sendIdx["x"]=1;
  6956. $3=$recv(pt2)._x();
  6957. $ctx1.sendIdx["x"]=2;
  6958. $1=$recv($2)._min_($3);
  6959. $ctx1.sendIdx["min:"]=1;
  6960. $5=$recv(pt1)._y();
  6961. $ctx1.sendIdx["y"]=1;
  6962. $6=$recv(pt2)._y();
  6963. $ctx1.sendIdx["y"]=2;
  6964. $4=$recv($5)._min_($6);
  6965. $self["@origin"]=$recv($1).__at($4);
  6966. $ctx1.sendIdx["@"]=1;
  6967. $8=$recv(pt1)._x();
  6968. $ctx1.sendIdx["x"]=3;
  6969. $7=$recv($8)._max_($recv(pt2)._x());
  6970. $ctx1.sendIdx["max:"]=1;
  6971. $10=$recv(pt1)._y();
  6972. $ctx1.sendIdx["y"]=3;
  6973. $9=$recv($10)._max_($recv(pt2)._y());
  6974. $self["@corner"]=$recv($7).__at($9);
  6975. return self;
  6976. }, function($ctx1) {$ctx1.fill(self,"setPoint:point:",{pt1:pt1,pt2:pt2},$globals.Rectangle)});
  6977. },
  6978. args: ["pt1", "pt2"],
  6979. 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).",
  6980. referencedClasses: [],
  6981. messageSends: ["@", "min:", "x", "y", "max:"]
  6982. }),
  6983. $globals.Rectangle);
  6984. $core.addMethod(
  6985. $core.method({
  6986. selector: "origin:corner:",
  6987. protocol: "instance creation",
  6988. fn: function (anOrigin,aCorner){
  6989. var self=this,$self=this;
  6990. return $core.withContext(function($ctx1) {
  6991. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6992. }, function($ctx1) {$ctx1.fill(self,"origin:corner:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6993. },
  6994. args: ["anOrigin", "aCorner"],
  6995. source: "origin: anOrigin corner: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  6996. referencedClasses: [],
  6997. messageSends: ["setPoint:point:", "basicNew"]
  6998. }),
  6999. $globals.Rectangle.a$cls);
  7000. $core.addMethod(
  7001. $core.method({
  7002. selector: "origin:extent:",
  7003. protocol: "instance creation",
  7004. fn: function (anOrigin,anExtent){
  7005. var self=this,$self=this;
  7006. return $core.withContext(function($ctx1) {
  7007. return $recv($self._basicNew())._setPoint_point_(anOrigin,$recv(anOrigin).__plus(anExtent));
  7008. }, function($ctx1) {$ctx1.fill(self,"origin:extent:",{anOrigin:anOrigin,anExtent:anExtent},$globals.Rectangle.a$cls)});
  7009. },
  7010. args: ["anOrigin", "anExtent"],
  7011. source: "origin: anOrigin extent: anExtent\x0a\x09^ self basicNew setPoint: anOrigin point: anOrigin + anExtent.",
  7012. referencedClasses: [],
  7013. messageSends: ["setPoint:point:", "basicNew", "+"]
  7014. }),
  7015. $globals.Rectangle.a$cls);
  7016. $core.addMethod(
  7017. $core.method({
  7018. selector: "point:point:",
  7019. protocol: "instance creation",
  7020. fn: function (anOrigin,aCorner){
  7021. var self=this,$self=this;
  7022. return $core.withContext(function($ctx1) {
  7023. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  7024. }, function($ctx1) {$ctx1.fill(self,"point:point:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  7025. },
  7026. args: ["anOrigin", "aCorner"],
  7027. source: "point: anOrigin point: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  7028. referencedClasses: [],
  7029. messageSends: ["setPoint:point:", "basicNew"]
  7030. }),
  7031. $globals.Rectangle.a$cls);
  7032. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  7033. $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`.";
  7034. $core.addMethod(
  7035. $core.method({
  7036. selector: "==",
  7037. protocol: "testing",
  7038. fn: function (anObject){
  7039. var self=this,$self=this;
  7040. return $core.withContext(function($ctx1) {
  7041. return $recv(anObject)._isNil();
  7042. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.UndefinedObject)});
  7043. },
  7044. args: ["anObject"],
  7045. source: "== anObject\x0a\x09^ anObject isNil",
  7046. referencedClasses: [],
  7047. messageSends: ["isNil"]
  7048. }),
  7049. $globals.UndefinedObject);
  7050. $core.addMethod(
  7051. $core.method({
  7052. selector: "asJavaScriptObject",
  7053. protocol: "converting",
  7054. fn: function (){
  7055. var self=this,$self=this;
  7056. return null;
  7057. },
  7058. args: [],
  7059. source: "asJavaScriptObject\x0a\x09^ null",
  7060. referencedClasses: [],
  7061. messageSends: []
  7062. }),
  7063. $globals.UndefinedObject);
  7064. $core.addMethod(
  7065. $core.method({
  7066. selector: "deepCopy",
  7067. protocol: "copying",
  7068. fn: function (){
  7069. var self=this,$self=this;
  7070. return self;
  7071. },
  7072. args: [],
  7073. source: "deepCopy\x0a\x09^ self",
  7074. referencedClasses: [],
  7075. messageSends: []
  7076. }),
  7077. $globals.UndefinedObject);
  7078. $core.addMethod(
  7079. $core.method({
  7080. selector: "identityHash",
  7081. protocol: "accessing",
  7082. fn: function (){
  7083. var self=this,$self=this;
  7084. return "NIL";
  7085. },
  7086. args: [],
  7087. source: "identityHash\x0a\x09^ 'NIL'",
  7088. referencedClasses: [],
  7089. messageSends: []
  7090. }),
  7091. $globals.UndefinedObject);
  7092. $core.addMethod(
  7093. $core.method({
  7094. selector: "ifNil:",
  7095. protocol: "testing",
  7096. fn: function (aBlock){
  7097. var self=this,$self=this;
  7098. return $core.withContext(function($ctx1) {
  7099. return $self._ifNil_ifNotNil_(aBlock,(function(){
  7100. }));
  7101. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  7102. },
  7103. args: ["aBlock"],
  7104. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  7105. referencedClasses: [],
  7106. messageSends: ["ifNil:ifNotNil:"]
  7107. }),
  7108. $globals.UndefinedObject);
  7109. $core.addMethod(
  7110. $core.method({
  7111. selector: "ifNil:ifNotNil:",
  7112. protocol: "testing",
  7113. fn: function (aBlock,anotherBlock){
  7114. var self=this,$self=this;
  7115. return $core.withContext(function($ctx1) {
  7116. return $recv(aBlock)._value();
  7117. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7118. },
  7119. args: ["aBlock", "anotherBlock"],
  7120. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  7121. referencedClasses: [],
  7122. messageSends: ["value"]
  7123. }),
  7124. $globals.UndefinedObject);
  7125. $core.addMethod(
  7126. $core.method({
  7127. selector: "ifNotNil:",
  7128. protocol: "testing",
  7129. fn: function (aBlock){
  7130. var self=this,$self=this;
  7131. return self;
  7132. },
  7133. args: ["aBlock"],
  7134. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  7135. referencedClasses: [],
  7136. messageSends: []
  7137. }),
  7138. $globals.UndefinedObject);
  7139. $core.addMethod(
  7140. $core.method({
  7141. selector: "ifNotNil:ifNil:",
  7142. protocol: "testing",
  7143. fn: function (aBlock,anotherBlock){
  7144. var self=this,$self=this;
  7145. return $core.withContext(function($ctx1) {
  7146. return $recv(anotherBlock)._value();
  7147. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7148. },
  7149. args: ["aBlock", "anotherBlock"],
  7150. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  7151. referencedClasses: [],
  7152. messageSends: ["value"]
  7153. }),
  7154. $globals.UndefinedObject);
  7155. $core.addMethod(
  7156. $core.method({
  7157. selector: "isImmutable",
  7158. protocol: "testing",
  7159. fn: function (){
  7160. var self=this,$self=this;
  7161. return true;
  7162. },
  7163. args: [],
  7164. source: "isImmutable\x0a\x09^ true",
  7165. referencedClasses: [],
  7166. messageSends: []
  7167. }),
  7168. $globals.UndefinedObject);
  7169. $core.addMethod(
  7170. $core.method({
  7171. selector: "isNil",
  7172. protocol: "testing",
  7173. fn: function (){
  7174. var self=this,$self=this;
  7175. return true;
  7176. },
  7177. args: [],
  7178. source: "isNil\x0a\x09^ true",
  7179. referencedClasses: [],
  7180. messageSends: []
  7181. }),
  7182. $globals.UndefinedObject);
  7183. $core.addMethod(
  7184. $core.method({
  7185. selector: "notNil",
  7186. protocol: "testing",
  7187. fn: function (){
  7188. var self=this,$self=this;
  7189. return false;
  7190. },
  7191. args: [],
  7192. source: "notNil\x0a\x09^ false",
  7193. referencedClasses: [],
  7194. messageSends: []
  7195. }),
  7196. $globals.UndefinedObject);
  7197. $core.addMethod(
  7198. $core.method({
  7199. selector: "printOn:",
  7200. protocol: "printing",
  7201. fn: function (aStream){
  7202. var self=this,$self=this;
  7203. return $core.withContext(function($ctx1) {
  7204. $recv(aStream)._nextPutAll_("nil");
  7205. return self;
  7206. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  7207. },
  7208. args: ["aStream"],
  7209. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  7210. referencedClasses: [],
  7211. messageSends: ["nextPutAll:"]
  7212. }),
  7213. $globals.UndefinedObject);
  7214. $core.addMethod(
  7215. $core.method({
  7216. selector: "shallowCopy",
  7217. protocol: "copying",
  7218. fn: function (){
  7219. var self=this,$self=this;
  7220. return self;
  7221. },
  7222. args: [],
  7223. source: "shallowCopy\x0a\x09^ self",
  7224. referencedClasses: [],
  7225. messageSends: []
  7226. }),
  7227. $globals.UndefinedObject);
  7228. $core.addMethod(
  7229. $core.method({
  7230. selector: "value",
  7231. protocol: "evaluating",
  7232. fn: function (){
  7233. var self=this,$self=this;
  7234. return $core.withContext(function($ctx1) {
  7235. return null;
  7236. return self;
  7237. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.UndefinedObject)});
  7238. },
  7239. args: [],
  7240. source: "value\x0a\x09<inlineJS: 'return null'>",
  7241. referencedClasses: [],
  7242. messageSends: []
  7243. }),
  7244. $globals.UndefinedObject);
  7245. $core.addMethod(
  7246. $core.method({
  7247. selector: "new",
  7248. protocol: "instance creation",
  7249. fn: function (){
  7250. var self=this,$self=this;
  7251. return $core.withContext(function($ctx1) {
  7252. $self._error_("You cannot create new instances of UndefinedObject. Use nil");
  7253. return self;
  7254. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.a$cls)});
  7255. },
  7256. args: [],
  7257. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  7258. referencedClasses: [],
  7259. messageSends: ["error:"]
  7260. }),
  7261. $globals.UndefinedObject.a$cls);
  7262. $core.setTraitComposition([{trait: $globals.TSubclassable}], $globals.UndefinedObject);
  7263. });
  7264. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7265. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  7266. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7267. $core.addPackage("Kernel-Collections");
  7268. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  7269. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7270. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7271. $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:`";
  7272. $core.addMethod(
  7273. $core.method({
  7274. selector: "=",
  7275. protocol: "comparing",
  7276. fn: function (anAssociation){
  7277. var self=this,$self=this;
  7278. return $core.withContext(function($ctx1) {
  7279. var $3,$2,$5,$4,$6,$1;
  7280. $3=$self._class();
  7281. $ctx1.sendIdx["class"]=1;
  7282. $2=$recv($3).__eq($recv(anAssociation)._class());
  7283. $ctx1.sendIdx["="]=1;
  7284. $1=$recv($2)._and_((function(){
  7285. return $core.withContext(function($ctx2) {
  7286. $5=$self._key();
  7287. $ctx2.sendIdx["key"]=1;
  7288. $4=$recv($5).__eq($recv(anAssociation)._key());
  7289. $ctx2.sendIdx["="]=2;
  7290. return $recv($4)._and_((function(){
  7291. return $core.withContext(function($ctx3) {
  7292. $6=$self._value();
  7293. $ctx3.sendIdx["value"]=1;
  7294. return $recv($6).__eq($recv(anAssociation)._value());
  7295. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7296. }));
  7297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7298. }));
  7299. $ctx1.sendIdx["and:"]=1;
  7300. return $1;
  7301. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  7302. },
  7303. args: ["anAssociation"],
  7304. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  7305. referencedClasses: [],
  7306. messageSends: ["and:", "=", "class", "key", "value"]
  7307. }),
  7308. $globals.Association);
  7309. $core.addMethod(
  7310. $core.method({
  7311. selector: "key",
  7312. protocol: "accessing",
  7313. fn: function (){
  7314. var self=this,$self=this;
  7315. return $self["@key"];
  7316. },
  7317. args: [],
  7318. source: "key\x0a\x09^ key",
  7319. referencedClasses: [],
  7320. messageSends: []
  7321. }),
  7322. $globals.Association);
  7323. $core.addMethod(
  7324. $core.method({
  7325. selector: "key:",
  7326. protocol: "accessing",
  7327. fn: function (aKey){
  7328. var self=this,$self=this;
  7329. $self["@key"]=aKey;
  7330. return self;
  7331. },
  7332. args: ["aKey"],
  7333. source: "key: aKey\x0a\x09key := aKey",
  7334. referencedClasses: [],
  7335. messageSends: []
  7336. }),
  7337. $globals.Association);
  7338. $core.addMethod(
  7339. $core.method({
  7340. selector: "printOn:",
  7341. protocol: "printing",
  7342. fn: function (aStream){
  7343. var self=this,$self=this;
  7344. return $core.withContext(function($ctx1) {
  7345. $recv($self._key())._printOn_(aStream);
  7346. $ctx1.sendIdx["printOn:"]=1;
  7347. $recv(aStream)._nextPutAll_(" -> ");
  7348. $recv($self._value())._printOn_(aStream);
  7349. return self;
  7350. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  7351. },
  7352. args: ["aStream"],
  7353. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  7354. referencedClasses: [],
  7355. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  7356. }),
  7357. $globals.Association);
  7358. $core.addMethod(
  7359. $core.method({
  7360. selector: "value",
  7361. protocol: "accessing",
  7362. fn: function (){
  7363. var self=this,$self=this;
  7364. return $self["@value"];
  7365. },
  7366. args: [],
  7367. source: "value\x0a\x09^ value",
  7368. referencedClasses: [],
  7369. messageSends: []
  7370. }),
  7371. $globals.Association);
  7372. $core.addMethod(
  7373. $core.method({
  7374. selector: "value:",
  7375. protocol: "accessing",
  7376. fn: function (aValue){
  7377. var self=this,$self=this;
  7378. $self["@value"]=aValue;
  7379. return self;
  7380. },
  7381. args: ["aValue"],
  7382. source: "value: aValue\x0a\x09value := aValue",
  7383. referencedClasses: [],
  7384. messageSends: []
  7385. }),
  7386. $globals.Association);
  7387. $core.addMethod(
  7388. $core.method({
  7389. selector: "key:value:",
  7390. protocol: "instance creation",
  7391. fn: function (aKey,aValue){
  7392. var self=this,$self=this;
  7393. return $core.withContext(function($ctx1) {
  7394. var $1;
  7395. $1=$self._new();
  7396. $recv($1)._key_(aKey);
  7397. $recv($1)._value_(aValue);
  7398. return $recv($1)._yourself();
  7399. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  7400. },
  7401. args: ["aKey", "aValue"],
  7402. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7403. referencedClasses: [],
  7404. messageSends: ["key:", "new", "value:", "yourself"]
  7405. }),
  7406. $globals.Association.a$cls);
  7407. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  7408. $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`.";
  7409. $core.addMethod(
  7410. $core.method({
  7411. selector: "bucketOfElement:",
  7412. protocol: "accessing",
  7413. fn: function (anObject){
  7414. var self=this,$self=this;
  7415. return $core.withContext(function($ctx1) {
  7416. var hash = $self['@hashBlock'](anObject);
  7417. if (!hash) return null;
  7418. var buckets = $self['@buckets'],
  7419. bucket = buckets[hash];
  7420. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  7421. return bucket;
  7422. ;
  7423. return self;
  7424. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  7425. },
  7426. args: ["anObject"],
  7427. 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'>",
  7428. referencedClasses: [],
  7429. messageSends: []
  7430. }),
  7431. $globals.BucketStore);
  7432. $core.addMethod(
  7433. $core.method({
  7434. selector: "do:",
  7435. protocol: "enumerating",
  7436. fn: function (aBlock){
  7437. var self=this,$self=this;
  7438. return $core.withContext(function($ctx1) {
  7439. var buckets = $self['@buckets'];
  7440. var keys = Object.keys(buckets);
  7441. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  7442. ;
  7443. return self;
  7444. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  7445. },
  7446. args: ["aBlock"],
  7447. 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'>",
  7448. referencedClasses: [],
  7449. messageSends: []
  7450. }),
  7451. $globals.BucketStore);
  7452. $core.addMethod(
  7453. $core.method({
  7454. selector: "hashBlock:",
  7455. protocol: "accessing",
  7456. fn: function (aBlock){
  7457. var self=this,$self=this;
  7458. $self["@hashBlock"]=aBlock;
  7459. return self;
  7460. },
  7461. args: ["aBlock"],
  7462. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  7463. referencedClasses: [],
  7464. messageSends: []
  7465. }),
  7466. $globals.BucketStore);
  7467. $core.addMethod(
  7468. $core.method({
  7469. selector: "initialize",
  7470. protocol: "initialization",
  7471. fn: function (){
  7472. var self=this,$self=this;
  7473. return $core.withContext(function($ctx1) {
  7474. (
  7475. $ctx1.supercall = true,
  7476. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7477. $ctx1.supercall = false;
  7478. $self._removeAll();
  7479. return self;
  7480. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  7481. },
  7482. args: [],
  7483. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  7484. referencedClasses: [],
  7485. messageSends: ["initialize", "removeAll"]
  7486. }),
  7487. $globals.BucketStore);
  7488. $core.addMethod(
  7489. $core.method({
  7490. selector: "newBucket",
  7491. protocol: "private",
  7492. fn: function (){
  7493. var self=this,$self=this;
  7494. return $core.withContext(function($ctx1) {
  7495. $self._subclassResponsibility();
  7496. return self;
  7497. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  7498. },
  7499. args: [],
  7500. source: "newBucket\x0a\x09self subclassResponsibility",
  7501. referencedClasses: [],
  7502. messageSends: ["subclassResponsibility"]
  7503. }),
  7504. $globals.BucketStore);
  7505. $core.addMethod(
  7506. $core.method({
  7507. selector: "removeAll",
  7508. protocol: "adding/removing",
  7509. fn: function (){
  7510. var self=this,$self=this;
  7511. return $core.withContext(function($ctx1) {
  7512. $self['@buckets'] = Object.create(null);;
  7513. return self;
  7514. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  7515. },
  7516. args: [],
  7517. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  7518. referencedClasses: [],
  7519. messageSends: []
  7520. }),
  7521. $globals.BucketStore);
  7522. $core.addMethod(
  7523. $core.method({
  7524. selector: "hashBlock:",
  7525. protocol: "instance creation",
  7526. fn: function (aBlock){
  7527. var self=this,$self=this;
  7528. return $core.withContext(function($ctx1) {
  7529. var $1;
  7530. $1=$self._new();
  7531. $recv($1)._hashBlock_(aBlock);
  7532. return $recv($1)._yourself();
  7533. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  7534. },
  7535. args: ["aBlock"],
  7536. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  7537. referencedClasses: [],
  7538. messageSends: ["hashBlock:", "new", "yourself"]
  7539. }),
  7540. $globals.BucketStore.a$cls);
  7541. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  7542. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  7543. $core.addMethod(
  7544. $core.method({
  7545. selector: "newBucket",
  7546. protocol: "private",
  7547. fn: function (){
  7548. var self=this,$self=this;
  7549. return [];
  7550. },
  7551. args: [],
  7552. source: "newBucket\x0a\x09^ #()",
  7553. referencedClasses: [],
  7554. messageSends: []
  7555. }),
  7556. $globals.ArrayBucketStore);
  7557. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  7558. $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.";
  7559. $core.addMethod(
  7560. $core.method({
  7561. selector: ",",
  7562. protocol: "copying",
  7563. fn: function (aCollection){
  7564. var self=this,$self=this;
  7565. return $core.withContext(function($ctx1) {
  7566. var $1;
  7567. $1=$self._copy();
  7568. $recv($1)._addAll_(aCollection);
  7569. return $recv($1)._yourself();
  7570. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  7571. },
  7572. args: ["aCollection"],
  7573. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7574. referencedClasses: [],
  7575. messageSends: ["addAll:", "copy", "yourself"]
  7576. }),
  7577. $globals.Collection);
  7578. $core.addMethod(
  7579. $core.method({
  7580. selector: "add:",
  7581. protocol: "adding/removing",
  7582. fn: function (anObject){
  7583. var self=this,$self=this;
  7584. return $core.withContext(function($ctx1) {
  7585. $self._subclassResponsibility();
  7586. return self;
  7587. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  7588. },
  7589. args: ["anObject"],
  7590. source: "add: anObject\x0a\x09self subclassResponsibility",
  7591. referencedClasses: [],
  7592. messageSends: ["subclassResponsibility"]
  7593. }),
  7594. $globals.Collection);
  7595. $core.addMethod(
  7596. $core.method({
  7597. selector: "addAll:",
  7598. protocol: "adding/removing",
  7599. fn: function (aCollection){
  7600. var self=this,$self=this;
  7601. return $core.withContext(function($ctx1) {
  7602. $recv(aCollection)._do_((function(each){
  7603. return $core.withContext(function($ctx2) {
  7604. return $self._add_(each);
  7605. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7606. }));
  7607. return aCollection;
  7608. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  7609. },
  7610. args: ["aCollection"],
  7611. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  7612. referencedClasses: [],
  7613. messageSends: ["do:", "add:"]
  7614. }),
  7615. $globals.Collection);
  7616. $core.addMethod(
  7617. $core.method({
  7618. selector: "allSatisfy:",
  7619. protocol: "enumerating",
  7620. fn: function (aBlock){
  7621. var self=this,$self=this;
  7622. return $core.withContext(function($ctx1) {
  7623. var $1;
  7624. var $early={};
  7625. try {
  7626. $self._do_((function(each){
  7627. return $core.withContext(function($ctx2) {
  7628. $1=$recv(aBlock)._value_(each);
  7629. if(!$core.assert($1)){
  7630. throw $early=[false];
  7631. }
  7632. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7633. }));
  7634. return true;
  7635. }
  7636. catch(e) {if(e===$early)return e[0]; throw e}
  7637. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  7638. },
  7639. args: ["aBlock"],
  7640. 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",
  7641. referencedClasses: [],
  7642. messageSends: ["do:", "ifFalse:", "value:"]
  7643. }),
  7644. $globals.Collection);
  7645. $core.addMethod(
  7646. $core.method({
  7647. selector: "anyOne",
  7648. protocol: "accessing",
  7649. fn: function (){
  7650. var self=this,$self=this;
  7651. return $core.withContext(function($ctx1) {
  7652. var $early={};
  7653. try {
  7654. $self._ifEmpty_((function(){
  7655. return $core.withContext(function($ctx2) {
  7656. return $self._error_("Collection is empty");
  7657. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7658. }));
  7659. $self._do_((function(each){
  7660. throw $early=[each];
  7661. }));
  7662. return self;
  7663. }
  7664. catch(e) {if(e===$early)return e[0]; throw e}
  7665. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  7666. },
  7667. args: [],
  7668. 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 ]",
  7669. referencedClasses: [],
  7670. messageSends: ["ifEmpty:", "error:", "do:"]
  7671. }),
  7672. $globals.Collection);
  7673. $core.addMethod(
  7674. $core.method({
  7675. selector: "anySatisfy:",
  7676. protocol: "enumerating",
  7677. fn: function (aBlock){
  7678. var self=this,$self=this;
  7679. return $core.withContext(function($ctx1) {
  7680. var $1;
  7681. var $early={};
  7682. try {
  7683. $self._do_((function(each){
  7684. return $core.withContext(function($ctx2) {
  7685. $1=$recv(aBlock)._value_(each);
  7686. if($core.assert($1)){
  7687. throw $early=[true];
  7688. }
  7689. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7690. }));
  7691. return false;
  7692. }
  7693. catch(e) {if(e===$early)return e[0]; throw e}
  7694. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  7695. },
  7696. args: ["aBlock"],
  7697. 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",
  7698. referencedClasses: [],
  7699. messageSends: ["do:", "ifTrue:", "value:"]
  7700. }),
  7701. $globals.Collection);
  7702. $core.addMethod(
  7703. $core.method({
  7704. selector: "asArray",
  7705. protocol: "converting",
  7706. fn: function (){
  7707. var self=this,$self=this;
  7708. return $core.withContext(function($ctx1) {
  7709. return $recv($globals.Array)._withAll_(self);
  7710. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  7711. },
  7712. args: [],
  7713. source: "asArray\x0a\x09^ Array withAll: self",
  7714. referencedClasses: ["Array"],
  7715. messageSends: ["withAll:"]
  7716. }),
  7717. $globals.Collection);
  7718. $core.addMethod(
  7719. $core.method({
  7720. selector: "asJavaScriptObject",
  7721. protocol: "converting",
  7722. fn: function (){
  7723. var self=this,$self=this;
  7724. return $core.withContext(function($ctx1) {
  7725. return $recv($self._asArray())._collect_((function(each){
  7726. return $core.withContext(function($ctx2) {
  7727. return $recv(each)._asJavaScriptObject();
  7728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7729. }));
  7730. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  7731. },
  7732. args: [],
  7733. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  7734. referencedClasses: [],
  7735. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  7736. }),
  7737. $globals.Collection);
  7738. $core.addMethod(
  7739. $core.method({
  7740. selector: "asOrderedCollection",
  7741. protocol: "converting",
  7742. fn: function (){
  7743. var self=this,$self=this;
  7744. return $core.withContext(function($ctx1) {
  7745. return $self._asArray();
  7746. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  7747. },
  7748. args: [],
  7749. source: "asOrderedCollection\x0a\x09^ self asArray",
  7750. referencedClasses: [],
  7751. messageSends: ["asArray"]
  7752. }),
  7753. $globals.Collection);
  7754. $core.addMethod(
  7755. $core.method({
  7756. selector: "asSet",
  7757. protocol: "converting",
  7758. fn: function (){
  7759. var self=this,$self=this;
  7760. return $core.withContext(function($ctx1) {
  7761. return $recv($globals.Set)._withAll_(self);
  7762. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  7763. },
  7764. args: [],
  7765. source: "asSet\x0a\x09^ Set withAll: self",
  7766. referencedClasses: ["Set"],
  7767. messageSends: ["withAll:"]
  7768. }),
  7769. $globals.Collection);
  7770. $core.addMethod(
  7771. $core.method({
  7772. selector: "collect:",
  7773. protocol: "enumerating",
  7774. fn: function (aBlock){
  7775. var self=this,$self=this;
  7776. var stream;
  7777. return $core.withContext(function($ctx1) {
  7778. stream=$recv($recv($self._class())._new())._writeStream();
  7779. $self._do_((function(each){
  7780. return $core.withContext(function($ctx2) {
  7781. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  7782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7783. }));
  7784. return $recv(stream)._contents();
  7785. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  7786. },
  7787. args: ["aBlock"],
  7788. 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",
  7789. referencedClasses: [],
  7790. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  7791. }),
  7792. $globals.Collection);
  7793. $core.addMethod(
  7794. $core.method({
  7795. selector: "copyWith:",
  7796. protocol: "copying",
  7797. fn: function (anObject){
  7798. var self=this,$self=this;
  7799. return $core.withContext(function($ctx1) {
  7800. var $1;
  7801. $1=$self._copy();
  7802. $recv($1)._add_(anObject);
  7803. return $recv($1)._yourself();
  7804. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  7805. },
  7806. args: ["anObject"],
  7807. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  7808. referencedClasses: [],
  7809. messageSends: ["add:", "copy", "yourself"]
  7810. }),
  7811. $globals.Collection);
  7812. $core.addMethod(
  7813. $core.method({
  7814. selector: "copyWithAll:",
  7815. protocol: "copying",
  7816. fn: function (aCollection){
  7817. var self=this,$self=this;
  7818. return $core.withContext(function($ctx1) {
  7819. $self._deprecatedAPI_("Use #, instead.");
  7820. return $self.__comma(aCollection);
  7821. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  7822. },
  7823. args: ["aCollection"],
  7824. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  7825. referencedClasses: [],
  7826. messageSends: ["deprecatedAPI:", ","]
  7827. }),
  7828. $globals.Collection);
  7829. $core.addMethod(
  7830. $core.method({
  7831. selector: "copyWithout:",
  7832. protocol: "copying",
  7833. fn: function (anObject){
  7834. var self=this,$self=this;
  7835. return $core.withContext(function($ctx1) {
  7836. return $self._reject_((function(each){
  7837. return $core.withContext(function($ctx2) {
  7838. return $recv(each).__eq(anObject);
  7839. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7840. }));
  7841. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  7842. },
  7843. args: ["anObject"],
  7844. 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 ]",
  7845. referencedClasses: [],
  7846. messageSends: ["reject:", "="]
  7847. }),
  7848. $globals.Collection);
  7849. $core.addMethod(
  7850. $core.method({
  7851. selector: "copyWithoutAll:",
  7852. protocol: "copying",
  7853. fn: function (aCollection){
  7854. var self=this,$self=this;
  7855. return $core.withContext(function($ctx1) {
  7856. return $self._reject_((function(each){
  7857. return $core.withContext(function($ctx2) {
  7858. return $recv(aCollection)._includes_(each);
  7859. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7860. }));
  7861. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  7862. },
  7863. args: ["aCollection"],
  7864. 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 ]",
  7865. referencedClasses: [],
  7866. messageSends: ["reject:", "includes:"]
  7867. }),
  7868. $globals.Collection);
  7869. $core.addMethod(
  7870. $core.method({
  7871. selector: "deepCopy",
  7872. protocol: "copying",
  7873. fn: function (){
  7874. var self=this,$self=this;
  7875. return $core.withContext(function($ctx1) {
  7876. return $self._collect_((function(each){
  7877. return $core.withContext(function($ctx2) {
  7878. return $recv(each)._deepCopy();
  7879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7880. }));
  7881. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  7882. },
  7883. args: [],
  7884. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  7885. referencedClasses: [],
  7886. messageSends: ["collect:", "deepCopy"]
  7887. }),
  7888. $globals.Collection);
  7889. $core.addMethod(
  7890. $core.method({
  7891. selector: "detect:",
  7892. protocol: "enumerating",
  7893. fn: function (aBlock){
  7894. var self=this,$self=this;
  7895. return $core.withContext(function($ctx1) {
  7896. return $self._detect_ifNone_(aBlock,(function(){
  7897. return $core.withContext(function($ctx2) {
  7898. return $self._errorNotFound();
  7899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7900. }));
  7901. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  7902. },
  7903. args: ["aBlock"],
  7904. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  7905. referencedClasses: [],
  7906. messageSends: ["detect:ifNone:", "errorNotFound"]
  7907. }),
  7908. $globals.Collection);
  7909. $core.addMethod(
  7910. $core.method({
  7911. selector: "detect:ifNone:",
  7912. protocol: "enumerating",
  7913. fn: function (aBlock,anotherBlock){
  7914. var self=this,$self=this;
  7915. return $core.withContext(function($ctx1) {
  7916. var $1;
  7917. var $early={};
  7918. try {
  7919. $self._do_((function(each){
  7920. return $core.withContext(function($ctx2) {
  7921. $1=$recv(aBlock)._value_(each);
  7922. if($core.assert($1)){
  7923. throw $early=[each];
  7924. }
  7925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7926. }));
  7927. return $recv(anotherBlock)._value();
  7928. }
  7929. catch(e) {if(e===$early)return e[0]; throw e}
  7930. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7931. },
  7932. args: ["aBlock", "anotherBlock"],
  7933. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  7934. referencedClasses: [],
  7935. messageSends: ["do:", "ifTrue:", "value:", "value"]
  7936. }),
  7937. $globals.Collection);
  7938. $core.addMethod(
  7939. $core.method({
  7940. selector: "do:",
  7941. protocol: "enumerating",
  7942. fn: function (aBlock){
  7943. var self=this,$self=this;
  7944. return $core.withContext(function($ctx1) {
  7945. $self._subclassResponsibility();
  7946. return self;
  7947. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  7948. },
  7949. args: ["aBlock"],
  7950. source: "do: aBlock\x0a\x09self subclassResponsibility",
  7951. referencedClasses: [],
  7952. messageSends: ["subclassResponsibility"]
  7953. }),
  7954. $globals.Collection);
  7955. $core.addMethod(
  7956. $core.method({
  7957. selector: "do:separatedBy:",
  7958. protocol: "enumerating",
  7959. fn: function (aBlock,anotherBlock){
  7960. var self=this,$self=this;
  7961. var actionBeforeElement;
  7962. return $core.withContext(function($ctx1) {
  7963. actionBeforeElement=(function(){
  7964. actionBeforeElement=anotherBlock;
  7965. return actionBeforeElement;
  7966. });
  7967. $self._do_((function(each){
  7968. return $core.withContext(function($ctx2) {
  7969. $recv(actionBeforeElement)._value();
  7970. return $recv(aBlock)._value_(each);
  7971. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7972. }));
  7973. return self;
  7974. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  7975. },
  7976. args: ["aBlock", "anotherBlock"],
  7977. 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 ]",
  7978. referencedClasses: [],
  7979. messageSends: ["do:", "value", "value:"]
  7980. }),
  7981. $globals.Collection);
  7982. $core.addMethod(
  7983. $core.method({
  7984. selector: "errorNotFound",
  7985. protocol: "error handling",
  7986. fn: function (){
  7987. var self=this,$self=this;
  7988. return $core.withContext(function($ctx1) {
  7989. $self._error_("Object is not in the collection");
  7990. return self;
  7991. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  7992. },
  7993. args: [],
  7994. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  7995. referencedClasses: [],
  7996. messageSends: ["error:"]
  7997. }),
  7998. $globals.Collection);
  7999. $core.addMethod(
  8000. $core.method({
  8001. selector: "ifEmpty:",
  8002. protocol: "testing",
  8003. fn: function (aBlock){
  8004. var self=this,$self=this;
  8005. return $core.withContext(function($ctx1) {
  8006. var $1;
  8007. $1=$self._isEmpty();
  8008. if($core.assert($1)){
  8009. return $recv(aBlock)._value();
  8010. } else {
  8011. return self;
  8012. }
  8013. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  8014. },
  8015. args: ["aBlock"],
  8016. 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 ]",
  8017. referencedClasses: [],
  8018. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  8019. }),
  8020. $globals.Collection);
  8021. $core.addMethod(
  8022. $core.method({
  8023. selector: "ifEmpty:ifNotEmpty:",
  8024. protocol: "testing",
  8025. fn: function (aBlock,anotherBlock){
  8026. var self=this,$self=this;
  8027. return $core.withContext(function($ctx1) {
  8028. var $1;
  8029. $1=$self._isEmpty();
  8030. if($core.assert($1)){
  8031. return $recv(aBlock)._value();
  8032. } else {
  8033. return $recv(anotherBlock)._value_(self);
  8034. }
  8035. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8036. },
  8037. args: ["aBlock", "anotherBlock"],
  8038. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  8039. referencedClasses: [],
  8040. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  8041. }),
  8042. $globals.Collection);
  8043. $core.addMethod(
  8044. $core.method({
  8045. selector: "ifNotEmpty:",
  8046. protocol: "testing",
  8047. fn: function (aBlock){
  8048. var self=this,$self=this;
  8049. return $core.withContext(function($ctx1) {
  8050. var $1;
  8051. $1=$self._notEmpty();
  8052. if($core.assert($1)){
  8053. return $recv(aBlock)._value_(self);
  8054. } else {
  8055. return self;
  8056. }
  8057. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  8058. },
  8059. args: ["aBlock"],
  8060. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  8061. referencedClasses: [],
  8062. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  8063. }),
  8064. $globals.Collection);
  8065. $core.addMethod(
  8066. $core.method({
  8067. selector: "ifNotEmpty:ifEmpty:",
  8068. protocol: "testing",
  8069. fn: function (aBlock,anotherBlock){
  8070. var self=this,$self=this;
  8071. return $core.withContext(function($ctx1) {
  8072. var $1;
  8073. $1=$self._notEmpty();
  8074. if($core.assert($1)){
  8075. return $recv(aBlock)._value_(self);
  8076. } else {
  8077. return $recv(anotherBlock)._value();
  8078. }
  8079. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8080. },
  8081. args: ["aBlock", "anotherBlock"],
  8082. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  8083. referencedClasses: [],
  8084. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  8085. }),
  8086. $globals.Collection);
  8087. $core.addMethod(
  8088. $core.method({
  8089. selector: "includes:",
  8090. protocol: "testing",
  8091. fn: function (anObject){
  8092. var self=this,$self=this;
  8093. return $core.withContext(function($ctx1) {
  8094. return $self._anySatisfy_((function(each){
  8095. return $core.withContext(function($ctx2) {
  8096. return $recv(each).__eq(anObject);
  8097. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8098. }));
  8099. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  8100. },
  8101. args: ["anObject"],
  8102. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  8103. referencedClasses: [],
  8104. messageSends: ["anySatisfy:", "="]
  8105. }),
  8106. $globals.Collection);
  8107. $core.addMethod(
  8108. $core.method({
  8109. selector: "inject:into:",
  8110. protocol: "enumerating",
  8111. fn: function (anObject,aBlock){
  8112. var self=this,$self=this;
  8113. var result;
  8114. return $core.withContext(function($ctx1) {
  8115. result=anObject;
  8116. $self._do_((function(each){
  8117. return $core.withContext(function($ctx2) {
  8118. result=$recv(aBlock)._value_value_(result,each);
  8119. return result;
  8120. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8121. }));
  8122. return result;
  8123. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  8124. },
  8125. args: ["anObject", "aBlock"],
  8126. 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",
  8127. referencedClasses: [],
  8128. messageSends: ["do:", "value:value:"]
  8129. }),
  8130. $globals.Collection);
  8131. $core.addMethod(
  8132. $core.method({
  8133. selector: "intersection:",
  8134. protocol: "enumerating",
  8135. fn: function (aCollection){
  8136. var self=this,$self=this;
  8137. var set,outputSet;
  8138. return $core.withContext(function($ctx1) {
  8139. var $2,$1;
  8140. set=$self._asSet();
  8141. outputSet=$recv($globals.Set)._new();
  8142. $recv(aCollection)._do_((function(each){
  8143. return $core.withContext(function($ctx2) {
  8144. $2=$recv(set)._includes_(each);
  8145. $ctx2.sendIdx["includes:"]=1;
  8146. $1=$recv($2)._and_((function(){
  8147. return $core.withContext(function($ctx3) {
  8148. return $recv($recv(outputSet)._includes_(each))._not();
  8149. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8150. }));
  8151. if($core.assert($1)){
  8152. return $recv(outputSet)._add_(each);
  8153. }
  8154. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8155. }));
  8156. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  8157. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  8158. },
  8159. args: ["aCollection"],
  8160. 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",
  8161. referencedClasses: ["Set"],
  8162. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  8163. }),
  8164. $globals.Collection);
  8165. $core.addMethod(
  8166. $core.method({
  8167. selector: "isEmpty",
  8168. protocol: "testing",
  8169. fn: function (){
  8170. var self=this,$self=this;
  8171. return $core.withContext(function($ctx1) {
  8172. return $recv($self._size()).__eq((0));
  8173. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  8174. },
  8175. args: [],
  8176. source: "isEmpty\x0a\x09^ self size = 0",
  8177. referencedClasses: [],
  8178. messageSends: ["=", "size"]
  8179. }),
  8180. $globals.Collection);
  8181. $core.addMethod(
  8182. $core.method({
  8183. selector: "noneSatisfy:",
  8184. protocol: "enumerating",
  8185. fn: function (aBlock){
  8186. var self=this,$self=this;
  8187. return $core.withContext(function($ctx1) {
  8188. var $1;
  8189. var $early={};
  8190. try {
  8191. $self._do_((function(item){
  8192. return $core.withContext(function($ctx2) {
  8193. $1=$recv(aBlock)._value_(item);
  8194. if($core.assert($1)){
  8195. throw $early=[false];
  8196. }
  8197. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  8198. }));
  8199. return true;
  8200. }
  8201. catch(e) {if(e===$early)return e[0]; throw e}
  8202. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  8203. },
  8204. args: ["aBlock"],
  8205. 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",
  8206. referencedClasses: [],
  8207. messageSends: ["do:", "ifTrue:", "value:"]
  8208. }),
  8209. $globals.Collection);
  8210. $core.addMethod(
  8211. $core.method({
  8212. selector: "notEmpty",
  8213. protocol: "testing",
  8214. fn: function (){
  8215. var self=this,$self=this;
  8216. return $core.withContext(function($ctx1) {
  8217. return $recv($self._isEmpty())._not();
  8218. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  8219. },
  8220. args: [],
  8221. source: "notEmpty\x0a\x09^ self isEmpty not",
  8222. referencedClasses: [],
  8223. messageSends: ["not", "isEmpty"]
  8224. }),
  8225. $globals.Collection);
  8226. $core.addMethod(
  8227. $core.method({
  8228. selector: "occurrencesOf:",
  8229. protocol: "accessing",
  8230. fn: function (anObject){
  8231. var self=this,$self=this;
  8232. var tally;
  8233. return $core.withContext(function($ctx1) {
  8234. var $1;
  8235. tally=(0);
  8236. $self._do_((function(each){
  8237. return $core.withContext(function($ctx2) {
  8238. $1=$recv(anObject).__eq(each);
  8239. if($core.assert($1)){
  8240. tally=$recv(tally).__plus((1));
  8241. return tally;
  8242. }
  8243. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8244. }));
  8245. return tally;
  8246. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  8247. },
  8248. args: ["anObject"],
  8249. 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",
  8250. referencedClasses: [],
  8251. messageSends: ["do:", "ifTrue:", "=", "+"]
  8252. }),
  8253. $globals.Collection);
  8254. $core.addMethod(
  8255. $core.method({
  8256. selector: "putOn:",
  8257. protocol: "streaming",
  8258. fn: function (aStream){
  8259. var self=this,$self=this;
  8260. return $core.withContext(function($ctx1) {
  8261. $self._do_((function(each){
  8262. return $core.withContext(function($ctx2) {
  8263. return $recv(each)._putOn_(aStream);
  8264. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8265. }));
  8266. return self;
  8267. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  8268. },
  8269. args: ["aStream"],
  8270. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  8271. referencedClasses: [],
  8272. messageSends: ["do:", "putOn:"]
  8273. }),
  8274. $globals.Collection);
  8275. $core.addMethod(
  8276. $core.method({
  8277. selector: "reject:",
  8278. protocol: "enumerating",
  8279. fn: function (aBlock){
  8280. var self=this,$self=this;
  8281. return $core.withContext(function($ctx1) {
  8282. return $self._select_((function(each){
  8283. return $core.withContext(function($ctx2) {
  8284. return $recv($recv(aBlock)._value_(each)).__eq(false);
  8285. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8286. }));
  8287. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  8288. },
  8289. args: ["aBlock"],
  8290. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  8291. referencedClasses: [],
  8292. messageSends: ["select:", "=", "value:"]
  8293. }),
  8294. $globals.Collection);
  8295. $core.addMethod(
  8296. $core.method({
  8297. selector: "remove:",
  8298. protocol: "adding/removing",
  8299. fn: function (anObject){
  8300. var self=this,$self=this;
  8301. return $core.withContext(function($ctx1) {
  8302. return $self._remove_ifAbsent_(anObject,(function(){
  8303. return $core.withContext(function($ctx2) {
  8304. return $self._errorNotFound();
  8305. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8306. }));
  8307. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  8308. },
  8309. args: ["anObject"],
  8310. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  8311. referencedClasses: [],
  8312. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  8313. }),
  8314. $globals.Collection);
  8315. $core.addMethod(
  8316. $core.method({
  8317. selector: "remove:ifAbsent:",
  8318. protocol: "adding/removing",
  8319. fn: function (anObject,aBlock){
  8320. var self=this,$self=this;
  8321. return $core.withContext(function($ctx1) {
  8322. $self._subclassResponsibility();
  8323. return self;
  8324. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  8325. },
  8326. args: ["anObject", "aBlock"],
  8327. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8328. referencedClasses: [],
  8329. messageSends: ["subclassResponsibility"]
  8330. }),
  8331. $globals.Collection);
  8332. $core.addMethod(
  8333. $core.method({
  8334. selector: "removeAll",
  8335. protocol: "adding/removing",
  8336. fn: function (){
  8337. var self=this,$self=this;
  8338. return $core.withContext(function($ctx1) {
  8339. $self._subclassResponsibility();
  8340. return self;
  8341. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  8342. },
  8343. args: [],
  8344. source: "removeAll\x0a\x09self subclassResponsibility",
  8345. referencedClasses: [],
  8346. messageSends: ["subclassResponsibility"]
  8347. }),
  8348. $globals.Collection);
  8349. $core.addMethod(
  8350. $core.method({
  8351. selector: "select:",
  8352. protocol: "enumerating",
  8353. fn: function (aBlock){
  8354. var self=this,$self=this;
  8355. var stream;
  8356. return $core.withContext(function($ctx1) {
  8357. var $1;
  8358. stream=$recv($recv($self._class())._new())._writeStream();
  8359. $self._do_((function(each){
  8360. return $core.withContext(function($ctx2) {
  8361. $1=$recv(aBlock)._value_(each);
  8362. if($core.assert($1)){
  8363. return $recv(stream)._nextPut_(each);
  8364. }
  8365. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8366. }));
  8367. return $recv(stream)._contents();
  8368. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  8369. },
  8370. args: ["aBlock"],
  8371. 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",
  8372. referencedClasses: [],
  8373. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8374. }),
  8375. $globals.Collection);
  8376. $core.addMethod(
  8377. $core.method({
  8378. selector: "select:thenCollect:",
  8379. protocol: "enumerating",
  8380. fn: function (selectBlock,collectBlock){
  8381. var self=this,$self=this;
  8382. var stream;
  8383. return $core.withContext(function($ctx1) {
  8384. var $1;
  8385. stream=$recv($recv($self._class())._new())._writeStream();
  8386. $self._do_((function(each){
  8387. return $core.withContext(function($ctx2) {
  8388. $1=$recv(selectBlock)._value_(each);
  8389. $ctx2.sendIdx["value:"]=1;
  8390. if($core.assert($1)){
  8391. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  8392. }
  8393. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8394. }));
  8395. return $recv(stream)._contents();
  8396. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  8397. },
  8398. args: ["selectBlock", "collectBlock"],
  8399. 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",
  8400. referencedClasses: [],
  8401. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8402. }),
  8403. $globals.Collection);
  8404. $core.addMethod(
  8405. $core.method({
  8406. selector: "shallowCopy",
  8407. protocol: "copying",
  8408. fn: function (){
  8409. var self=this,$self=this;
  8410. return $core.withContext(function($ctx1) {
  8411. return $self._collect_((function(each){
  8412. return each;
  8413. }));
  8414. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  8415. },
  8416. args: [],
  8417. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  8418. referencedClasses: [],
  8419. messageSends: ["collect:"]
  8420. }),
  8421. $globals.Collection);
  8422. $core.addMethod(
  8423. $core.method({
  8424. selector: "single",
  8425. protocol: "accessing",
  8426. fn: function (){
  8427. var self=this,$self=this;
  8428. return $core.withContext(function($ctx1) {
  8429. var $1;
  8430. $self._ifEmpty_((function(){
  8431. return $core.withContext(function($ctx2) {
  8432. return $self._error_("Collection is empty");
  8433. $ctx2.sendIdx["error:"]=1;
  8434. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8435. }));
  8436. $1=$recv($self._size()).__gt((1));
  8437. if($core.assert($1)){
  8438. $self._error_("Collection holds more than one element");
  8439. }
  8440. return $self._anyOne();
  8441. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  8442. },
  8443. args: [],
  8444. 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",
  8445. referencedClasses: [],
  8446. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  8447. }),
  8448. $globals.Collection);
  8449. $core.addMethod(
  8450. $core.method({
  8451. selector: "size",
  8452. protocol: "accessing",
  8453. fn: function (){
  8454. var self=this,$self=this;
  8455. return $core.withContext(function($ctx1) {
  8456. $self._subclassResponsibility();
  8457. return self;
  8458. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  8459. },
  8460. args: [],
  8461. source: "size\x0a\x09self subclassResponsibility",
  8462. referencedClasses: [],
  8463. messageSends: ["subclassResponsibility"]
  8464. }),
  8465. $globals.Collection);
  8466. $core.addMethod(
  8467. $core.method({
  8468. selector: "classTag",
  8469. protocol: "accessing",
  8470. fn: function (){
  8471. var self=this,$self=this;
  8472. return "collection";
  8473. },
  8474. args: [],
  8475. 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'",
  8476. referencedClasses: [],
  8477. messageSends: []
  8478. }),
  8479. $globals.Collection.a$cls);
  8480. $core.addMethod(
  8481. $core.method({
  8482. selector: "new:",
  8483. protocol: "instance creation",
  8484. fn: function (anInteger){
  8485. var self=this,$self=this;
  8486. return $core.withContext(function($ctx1) {
  8487. return $self._new();
  8488. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  8489. },
  8490. args: ["anInteger"],
  8491. source: "new: anInteger\x0a\x09^ self new",
  8492. referencedClasses: [],
  8493. messageSends: ["new"]
  8494. }),
  8495. $globals.Collection.a$cls);
  8496. $core.addMethod(
  8497. $core.method({
  8498. selector: "with:",
  8499. protocol: "instance creation",
  8500. fn: function (anObject){
  8501. var self=this,$self=this;
  8502. return $core.withContext(function($ctx1) {
  8503. var $1;
  8504. $1=$self._new();
  8505. $recv($1)._add_(anObject);
  8506. return $recv($1)._yourself();
  8507. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  8508. },
  8509. args: ["anObject"],
  8510. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8511. referencedClasses: [],
  8512. messageSends: ["add:", "new", "yourself"]
  8513. }),
  8514. $globals.Collection.a$cls);
  8515. $core.addMethod(
  8516. $core.method({
  8517. selector: "with:with:",
  8518. protocol: "instance creation",
  8519. fn: function (anObject,anotherObject){
  8520. var self=this,$self=this;
  8521. return $core.withContext(function($ctx1) {
  8522. var $1;
  8523. $1=$self._new();
  8524. $recv($1)._add_(anObject);
  8525. $ctx1.sendIdx["add:"]=1;
  8526. $recv($1)._add_(anotherObject);
  8527. return $recv($1)._yourself();
  8528. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  8529. },
  8530. args: ["anObject", "anotherObject"],
  8531. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8532. referencedClasses: [],
  8533. messageSends: ["add:", "new", "yourself"]
  8534. }),
  8535. $globals.Collection.a$cls);
  8536. $core.addMethod(
  8537. $core.method({
  8538. selector: "with:with:with:",
  8539. protocol: "instance creation",
  8540. fn: function (firstObject,secondObject,thirdObject){
  8541. var self=this,$self=this;
  8542. return $core.withContext(function($ctx1) {
  8543. var $1;
  8544. $1=$self._new();
  8545. $recv($1)._add_(firstObject);
  8546. $ctx1.sendIdx["add:"]=1;
  8547. $recv($1)._add_(secondObject);
  8548. $ctx1.sendIdx["add:"]=2;
  8549. $recv($1)._add_(thirdObject);
  8550. return $recv($1)._yourself();
  8551. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  8552. },
  8553. args: ["firstObject", "secondObject", "thirdObject"],
  8554. 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",
  8555. referencedClasses: [],
  8556. messageSends: ["add:", "new", "yourself"]
  8557. }),
  8558. $globals.Collection.a$cls);
  8559. $core.addMethod(
  8560. $core.method({
  8561. selector: "withAll:",
  8562. protocol: "instance creation",
  8563. fn: function (aCollection){
  8564. var self=this,$self=this;
  8565. return $core.withContext(function($ctx1) {
  8566. var $1;
  8567. $1=$self._new();
  8568. $recv($1)._addAll_(aCollection);
  8569. return $recv($1)._yourself();
  8570. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  8571. },
  8572. args: ["aCollection"],
  8573. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8574. referencedClasses: [],
  8575. messageSends: ["addAll:", "new", "yourself"]
  8576. }),
  8577. $globals.Collection.a$cls);
  8578. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  8579. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  8580. $core.addMethod(
  8581. $core.method({
  8582. selector: "=",
  8583. protocol: "comparing",
  8584. fn: function (anAssocitativeCollection){
  8585. var self=this,$self=this;
  8586. return $core.withContext(function($ctx1) {
  8587. var $2,$1,$4,$3,$5;
  8588. $2=$self._class();
  8589. $ctx1.sendIdx["class"]=1;
  8590. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  8591. $ctx1.sendIdx["="]=1;
  8592. if(!$core.assert($1)){
  8593. return false;
  8594. }
  8595. $4=$self._size();
  8596. $ctx1.sendIdx["size"]=1;
  8597. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  8598. $ctx1.sendIdx["="]=2;
  8599. if(!$core.assert($3)){
  8600. return false;
  8601. }
  8602. $5=$self._associations();
  8603. $ctx1.sendIdx["associations"]=1;
  8604. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  8605. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  8606. },
  8607. args: ["anAssocitativeCollection"],
  8608. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  8609. referencedClasses: [],
  8610. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  8611. }),
  8612. $globals.AssociativeCollection);
  8613. $core.addMethod(
  8614. $core.method({
  8615. selector: "add:",
  8616. protocol: "adding/removing",
  8617. fn: function (anAssociation){
  8618. var self=this,$self=this;
  8619. return $core.withContext(function($ctx1) {
  8620. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  8621. return self;
  8622. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  8623. },
  8624. args: ["anAssociation"],
  8625. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  8626. referencedClasses: [],
  8627. messageSends: ["at:put:", "key", "value"]
  8628. }),
  8629. $globals.AssociativeCollection);
  8630. $core.addMethod(
  8631. $core.method({
  8632. selector: "addAll:",
  8633. protocol: "adding/removing",
  8634. fn: function (anAssociativeCollection){
  8635. var self=this,$self=this;
  8636. return $core.withContext(function($ctx1) {
  8637. (
  8638. $ctx1.supercall = true,
  8639. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  8640. $ctx1.supercall = false;
  8641. return anAssociativeCollection;
  8642. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  8643. },
  8644. args: ["anAssociativeCollection"],
  8645. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  8646. referencedClasses: [],
  8647. messageSends: ["addAll:", "associations"]
  8648. }),
  8649. $globals.AssociativeCollection);
  8650. $core.addMethod(
  8651. $core.method({
  8652. selector: "asDictionary",
  8653. protocol: "converting",
  8654. fn: function (){
  8655. var self=this,$self=this;
  8656. return $core.withContext(function($ctx1) {
  8657. return $recv($globals.Dictionary)._from_($self._associations());
  8658. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  8659. },
  8660. args: [],
  8661. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  8662. referencedClasses: ["Dictionary"],
  8663. messageSends: ["from:", "associations"]
  8664. }),
  8665. $globals.AssociativeCollection);
  8666. $core.addMethod(
  8667. $core.method({
  8668. selector: "asHashedCollection",
  8669. protocol: "converting",
  8670. fn: function (){
  8671. var self=this,$self=this;
  8672. return $core.withContext(function($ctx1) {
  8673. return $recv($globals.HashedCollection)._from_($self._associations());
  8674. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  8675. },
  8676. args: [],
  8677. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  8678. referencedClasses: ["HashedCollection"],
  8679. messageSends: ["from:", "associations"]
  8680. }),
  8681. $globals.AssociativeCollection);
  8682. $core.addMethod(
  8683. $core.method({
  8684. selector: "asJavaScriptObject",
  8685. protocol: "converting",
  8686. fn: function (){
  8687. var self=this,$self=this;
  8688. var hash;
  8689. return $core.withContext(function($ctx1) {
  8690. hash=$recv($globals.HashedCollection)._new();
  8691. $self._keysAndValuesDo_((function(key,value){
  8692. return $core.withContext(function($ctx2) {
  8693. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  8694. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8695. }));
  8696. return hash;
  8697. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  8698. },
  8699. args: [],
  8700. 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",
  8701. referencedClasses: ["HashedCollection"],
  8702. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  8703. }),
  8704. $globals.AssociativeCollection);
  8705. $core.addMethod(
  8706. $core.method({
  8707. selector: "associations",
  8708. protocol: "accessing",
  8709. fn: function (){
  8710. var self=this,$self=this;
  8711. var associations;
  8712. return $core.withContext(function($ctx1) {
  8713. associations=[];
  8714. $self._associationsDo_((function(each){
  8715. return $core.withContext(function($ctx2) {
  8716. return $recv(associations)._add_(each);
  8717. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8718. }));
  8719. return associations;
  8720. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  8721. },
  8722. args: [],
  8723. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  8724. referencedClasses: [],
  8725. messageSends: ["associationsDo:", "add:"]
  8726. }),
  8727. $globals.AssociativeCollection);
  8728. $core.addMethod(
  8729. $core.method({
  8730. selector: "associationsDo:",
  8731. protocol: "enumerating",
  8732. fn: function (aBlock){
  8733. var self=this,$self=this;
  8734. return $core.withContext(function($ctx1) {
  8735. $self._keysAndValuesDo_((function(key,value){
  8736. return $core.withContext(function($ctx2) {
  8737. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  8738. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8739. }));
  8740. return self;
  8741. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8742. },
  8743. args: ["aBlock"],
  8744. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  8745. referencedClasses: ["Association"],
  8746. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  8747. }),
  8748. $globals.AssociativeCollection);
  8749. $core.addMethod(
  8750. $core.method({
  8751. selector: "at:ifPresent:ifAbsent:",
  8752. protocol: "accessing",
  8753. fn: function (aKey,aBlock,anotherBlock){
  8754. var self=this,$self=this;
  8755. return $core.withContext(function($ctx1) {
  8756. var $1;
  8757. $1=$self._includesKey_(aKey);
  8758. if($core.assert($1)){
  8759. return $recv(aBlock)._value_($self._at_(aKey));
  8760. } else {
  8761. return $recv(anotherBlock)._value();
  8762. }
  8763. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8764. },
  8765. args: ["aKey", "aBlock", "anotherBlock"],
  8766. 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 ]",
  8767. referencedClasses: [],
  8768. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  8769. }),
  8770. $globals.AssociativeCollection);
  8771. $core.addMethod(
  8772. $core.method({
  8773. selector: "collect:",
  8774. protocol: "enumerating",
  8775. fn: function (aBlock){
  8776. var self=this,$self=this;
  8777. var newDict;
  8778. return $core.withContext(function($ctx1) {
  8779. newDict=$recv($self._class())._new();
  8780. $self._keysAndValuesDo_((function(key,value){
  8781. return $core.withContext(function($ctx2) {
  8782. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  8783. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8784. }));
  8785. return newDict;
  8786. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  8787. },
  8788. args: ["aBlock"],
  8789. 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",
  8790. referencedClasses: [],
  8791. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  8792. }),
  8793. $globals.AssociativeCollection);
  8794. $core.addMethod(
  8795. $core.method({
  8796. selector: "deepCopy",
  8797. protocol: "copying",
  8798. fn: function (){
  8799. var self=this,$self=this;
  8800. var copy;
  8801. return $core.withContext(function($ctx1) {
  8802. copy=$recv($self._class())._new();
  8803. $self._keysAndValuesDo_((function(key,value){
  8804. return $core.withContext(function($ctx2) {
  8805. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  8806. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8807. }));
  8808. return copy;
  8809. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  8810. },
  8811. args: [],
  8812. 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",
  8813. referencedClasses: [],
  8814. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  8815. }),
  8816. $globals.AssociativeCollection);
  8817. $core.addMethod(
  8818. $core.method({
  8819. selector: "detect:ifNone:",
  8820. protocol: "enumerating",
  8821. fn: function (aBlock,anotherBlock){
  8822. var self=this,$self=this;
  8823. return $core.withContext(function($ctx1) {
  8824. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  8825. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8826. },
  8827. args: ["aBlock", "anotherBlock"],
  8828. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  8829. referencedClasses: [],
  8830. messageSends: ["detect:ifNone:", "values"]
  8831. }),
  8832. $globals.AssociativeCollection);
  8833. $core.addMethod(
  8834. $core.method({
  8835. selector: "do:",
  8836. protocol: "enumerating",
  8837. fn: function (aBlock){
  8838. var self=this,$self=this;
  8839. return $core.withContext(function($ctx1) {
  8840. $self._valuesDo_(aBlock);
  8841. return self;
  8842. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8843. },
  8844. args: ["aBlock"],
  8845. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  8846. referencedClasses: [],
  8847. messageSends: ["valuesDo:"]
  8848. }),
  8849. $globals.AssociativeCollection);
  8850. $core.addMethod(
  8851. $core.method({
  8852. selector: "includes:",
  8853. protocol: "enumerating",
  8854. fn: function (anObject){
  8855. var self=this,$self=this;
  8856. return $core.withContext(function($ctx1) {
  8857. return $recv($self._values())._includes_(anObject);
  8858. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  8859. },
  8860. args: ["anObject"],
  8861. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  8862. referencedClasses: [],
  8863. messageSends: ["includes:", "values"]
  8864. }),
  8865. $globals.AssociativeCollection);
  8866. $core.addMethod(
  8867. $core.method({
  8868. selector: "includesKey:",
  8869. protocol: "testing",
  8870. fn: function (aKey){
  8871. var self=this,$self=this;
  8872. return $core.withContext(function($ctx1) {
  8873. $self._subclassResponsibility();
  8874. return self;
  8875. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  8876. },
  8877. args: ["aKey"],
  8878. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  8879. referencedClasses: [],
  8880. messageSends: ["subclassResponsibility"]
  8881. }),
  8882. $globals.AssociativeCollection);
  8883. $core.addMethod(
  8884. $core.method({
  8885. selector: "indexOf:ifAbsent:",
  8886. protocol: "accessing",
  8887. fn: function (anObject,aBlock){
  8888. var self=this,$self=this;
  8889. return $core.withContext(function($ctx1) {
  8890. return $recv($self._keys())._detect_ifNone_((function(each){
  8891. return $core.withContext(function($ctx2) {
  8892. return $recv($self._at_(each)).__eq(anObject);
  8893. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8894. }),aBlock);
  8895. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  8896. },
  8897. args: ["anObject", "aBlock"],
  8898. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  8899. referencedClasses: [],
  8900. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  8901. }),
  8902. $globals.AssociativeCollection);
  8903. $core.addMethod(
  8904. $core.method({
  8905. selector: "keyAtValue:",
  8906. protocol: "accessing",
  8907. fn: function (anObject){
  8908. var self=this,$self=this;
  8909. return $core.withContext(function($ctx1) {
  8910. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  8911. return $core.withContext(function($ctx2) {
  8912. return $self._errorNotFound();
  8913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8914. }));
  8915. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  8916. },
  8917. args: ["anObject"],
  8918. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  8919. referencedClasses: [],
  8920. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  8921. }),
  8922. $globals.AssociativeCollection);
  8923. $core.addMethod(
  8924. $core.method({
  8925. selector: "keyAtValue:ifAbsent:",
  8926. protocol: "accessing",
  8927. fn: function (anObject,aBlock){
  8928. var self=this,$self=this;
  8929. return $core.withContext(function($ctx1) {
  8930. return $self._indexOf_ifAbsent_(anObject,aBlock);
  8931. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  8932. },
  8933. args: ["anObject", "aBlock"],
  8934. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  8935. referencedClasses: [],
  8936. messageSends: ["indexOf:ifAbsent:"]
  8937. }),
  8938. $globals.AssociativeCollection);
  8939. $core.addMethod(
  8940. $core.method({
  8941. selector: "keys",
  8942. protocol: "accessing",
  8943. fn: function (){
  8944. var self=this,$self=this;
  8945. return $core.withContext(function($ctx1) {
  8946. $self._subclassResponsibility();
  8947. return self;
  8948. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  8949. },
  8950. args: [],
  8951. source: "keys\x0a\x09self subclassResponsibility",
  8952. referencedClasses: [],
  8953. messageSends: ["subclassResponsibility"]
  8954. }),
  8955. $globals.AssociativeCollection);
  8956. $core.addMethod(
  8957. $core.method({
  8958. selector: "keysAndValuesDo:",
  8959. protocol: "enumerating",
  8960. fn: function (aBlock){
  8961. var self=this,$self=this;
  8962. return $core.withContext(function($ctx1) {
  8963. $self._keysDo_((function(each){
  8964. return $core.withContext(function($ctx2) {
  8965. return $recv(aBlock)._value_value_(each,$self._at_(each));
  8966. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8967. }));
  8968. return self;
  8969. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8970. },
  8971. args: ["aBlock"],
  8972. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  8973. referencedClasses: [],
  8974. messageSends: ["keysDo:", "value:value:", "at:"]
  8975. }),
  8976. $globals.AssociativeCollection);
  8977. $core.addMethod(
  8978. $core.method({
  8979. selector: "keysDo:",
  8980. protocol: "enumerating",
  8981. fn: function (aBlock){
  8982. var self=this,$self=this;
  8983. return $core.withContext(function($ctx1) {
  8984. $self._subclassResponsibility();
  8985. return self;
  8986. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8987. },
  8988. args: ["aBlock"],
  8989. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  8990. referencedClasses: [],
  8991. messageSends: ["subclassResponsibility"]
  8992. }),
  8993. $globals.AssociativeCollection);
  8994. $core.addMethod(
  8995. $core.method({
  8996. selector: "printOn:",
  8997. protocol: "printing",
  8998. fn: function (aStream){
  8999. var self=this,$self=this;
  9000. return $core.withContext(function($ctx1) {
  9001. (
  9002. $ctx1.supercall = true,
  9003. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  9004. $ctx1.supercall = false;
  9005. $ctx1.sendIdx["printOn:"]=1;
  9006. $recv(aStream)._nextPutAll_(" (");
  9007. $ctx1.sendIdx["nextPutAll:"]=1;
  9008. $recv($self._associations())._do_separatedBy_((function(each){
  9009. return $core.withContext(function($ctx2) {
  9010. return $recv(each)._printOn_(aStream);
  9011. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9012. }),(function(){
  9013. return $core.withContext(function($ctx2) {
  9014. return $recv(aStream)._nextPutAll_(" , ");
  9015. $ctx2.sendIdx["nextPutAll:"]=2;
  9016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9017. }));
  9018. $recv(aStream)._nextPutAll_(")");
  9019. return self;
  9020. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  9021. },
  9022. args: ["aStream"],
  9023. 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: ')'",
  9024. referencedClasses: [],
  9025. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  9026. }),
  9027. $globals.AssociativeCollection);
  9028. $core.addMethod(
  9029. $core.method({
  9030. selector: "remove:ifAbsent:",
  9031. protocol: "adding/removing",
  9032. fn: function (aKey,aBlock){
  9033. var self=this,$self=this;
  9034. return $core.withContext(function($ctx1) {
  9035. return $self._removeKey_ifAbsent_(aKey,aBlock);
  9036. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9037. },
  9038. args: ["aKey", "aBlock"],
  9039. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  9040. referencedClasses: [],
  9041. messageSends: ["removeKey:ifAbsent:"]
  9042. }),
  9043. $globals.AssociativeCollection);
  9044. $core.addMethod(
  9045. $core.method({
  9046. selector: "removeAll",
  9047. protocol: "adding/removing",
  9048. fn: function (){
  9049. var self=this,$self=this;
  9050. return $core.withContext(function($ctx1) {
  9051. return $recv($self._keys())._do_((function(each){
  9052. return $core.withContext(function($ctx2) {
  9053. return $self._removeKey_(each);
  9054. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9055. }));
  9056. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  9057. },
  9058. args: [],
  9059. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  9060. referencedClasses: [],
  9061. messageSends: ["do:", "keys", "removeKey:"]
  9062. }),
  9063. $globals.AssociativeCollection);
  9064. $core.addMethod(
  9065. $core.method({
  9066. selector: "removeKey:",
  9067. protocol: "adding/removing",
  9068. fn: function (aKey){
  9069. var self=this,$self=this;
  9070. return $core.withContext(function($ctx1) {
  9071. return $self._remove_(aKey);
  9072. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  9073. },
  9074. args: ["aKey"],
  9075. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  9076. referencedClasses: [],
  9077. messageSends: ["remove:"]
  9078. }),
  9079. $globals.AssociativeCollection);
  9080. $core.addMethod(
  9081. $core.method({
  9082. selector: "removeKey:ifAbsent:",
  9083. protocol: "adding/removing",
  9084. fn: function (aKey,aBlock){
  9085. var self=this,$self=this;
  9086. return $core.withContext(function($ctx1) {
  9087. $self._subclassResponsibility();
  9088. return self;
  9089. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9090. },
  9091. args: ["aKey", "aBlock"],
  9092. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9093. referencedClasses: [],
  9094. messageSends: ["subclassResponsibility"]
  9095. }),
  9096. $globals.AssociativeCollection);
  9097. $core.addMethod(
  9098. $core.method({
  9099. selector: "select:",
  9100. protocol: "enumerating",
  9101. fn: function (aBlock){
  9102. var self=this,$self=this;
  9103. var newDict;
  9104. return $core.withContext(function($ctx1) {
  9105. var $1;
  9106. newDict=$recv($self._class())._new();
  9107. $self._keysAndValuesDo_((function(key,value){
  9108. return $core.withContext(function($ctx2) {
  9109. $1=$recv(aBlock)._value_(value);
  9110. if($core.assert($1)){
  9111. return $recv(newDict)._at_put_(key,value);
  9112. }
  9113. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9114. }));
  9115. return newDict;
  9116. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  9117. },
  9118. args: ["aBlock"],
  9119. 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",
  9120. referencedClasses: [],
  9121. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9122. }),
  9123. $globals.AssociativeCollection);
  9124. $core.addMethod(
  9125. $core.method({
  9126. selector: "select:thenCollect:",
  9127. protocol: "enumerating",
  9128. fn: function (selectBlock,collectBlock){
  9129. var self=this,$self=this;
  9130. var newDict;
  9131. return $core.withContext(function($ctx1) {
  9132. var $1;
  9133. newDict=$recv($self._class())._new();
  9134. $self._keysAndValuesDo_((function(key,value){
  9135. return $core.withContext(function($ctx2) {
  9136. $1=$recv(selectBlock)._value_(value);
  9137. $ctx2.sendIdx["value:"]=1;
  9138. if($core.assert($1)){
  9139. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  9140. }
  9141. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9142. }));
  9143. return newDict;
  9144. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  9145. },
  9146. args: ["selectBlock", "collectBlock"],
  9147. 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",
  9148. referencedClasses: [],
  9149. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9150. }),
  9151. $globals.AssociativeCollection);
  9152. $core.addMethod(
  9153. $core.method({
  9154. selector: "shallowCopy",
  9155. protocol: "copying",
  9156. fn: function (){
  9157. var self=this,$self=this;
  9158. var copy;
  9159. return $core.withContext(function($ctx1) {
  9160. copy=$recv($self._class())._new();
  9161. $self._keysAndValuesDo_((function(key,value){
  9162. return $core.withContext(function($ctx2) {
  9163. return $recv(copy)._at_put_(key,value);
  9164. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9165. }));
  9166. return copy;
  9167. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  9168. },
  9169. args: [],
  9170. 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",
  9171. referencedClasses: [],
  9172. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  9173. }),
  9174. $globals.AssociativeCollection);
  9175. $core.addMethod(
  9176. $core.method({
  9177. selector: "size",
  9178. protocol: "accessing",
  9179. fn: function (){
  9180. var self=this,$self=this;
  9181. return $core.withContext(function($ctx1) {
  9182. return $recv($self._keys())._size();
  9183. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  9184. },
  9185. args: [],
  9186. source: "size\x0a\x09^ self keys size",
  9187. referencedClasses: [],
  9188. messageSends: ["size", "keys"]
  9189. }),
  9190. $globals.AssociativeCollection);
  9191. $core.addMethod(
  9192. $core.method({
  9193. selector: "values",
  9194. protocol: "accessing",
  9195. fn: function (){
  9196. var self=this,$self=this;
  9197. return $core.withContext(function($ctx1) {
  9198. $self._subclassResponsibility();
  9199. return self;
  9200. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  9201. },
  9202. args: [],
  9203. source: "values\x0a\x09self subclassResponsibility",
  9204. referencedClasses: [],
  9205. messageSends: ["subclassResponsibility"]
  9206. }),
  9207. $globals.AssociativeCollection);
  9208. $core.addMethod(
  9209. $core.method({
  9210. selector: "valuesDo:",
  9211. protocol: "enumerating",
  9212. fn: function (aBlock){
  9213. var self=this,$self=this;
  9214. return $core.withContext(function($ctx1) {
  9215. $self._subclassResponsibility();
  9216. return self;
  9217. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9218. },
  9219. args: ["aBlock"],
  9220. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  9221. referencedClasses: [],
  9222. messageSends: ["subclassResponsibility"]
  9223. }),
  9224. $globals.AssociativeCollection);
  9225. $core.addMethod(
  9226. $core.method({
  9227. selector: "withIndexDo:",
  9228. protocol: "enumerating",
  9229. fn: function (aBlock){
  9230. var self=this,$self=this;
  9231. return $core.withContext(function($ctx1) {
  9232. $self._keysAndValuesDo_((function(key,value){
  9233. return $core.withContext(function($ctx2) {
  9234. return $recv(aBlock)._value_value_(value,key);
  9235. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9236. }));
  9237. return self;
  9238. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9239. },
  9240. args: ["aBlock"],
  9241. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  9242. referencedClasses: [],
  9243. messageSends: ["keysAndValuesDo:", "value:value:"]
  9244. }),
  9245. $globals.AssociativeCollection);
  9246. $core.addMethod(
  9247. $core.method({
  9248. selector: "from:",
  9249. protocol: "instance creation",
  9250. fn: function (aCollection){
  9251. var self=this,$self=this;
  9252. var newCollection;
  9253. return $core.withContext(function($ctx1) {
  9254. newCollection=$self._new();
  9255. $recv(aCollection)._do_((function(each){
  9256. return $core.withContext(function($ctx2) {
  9257. return $recv(newCollection)._add_(each);
  9258. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9259. }));
  9260. return newCollection;
  9261. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9262. },
  9263. args: ["aCollection"],
  9264. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  9265. referencedClasses: [],
  9266. messageSends: ["new", "do:", "add:"]
  9267. }),
  9268. $globals.AssociativeCollection.a$cls);
  9269. $core.addMethod(
  9270. $core.method({
  9271. selector: "fromPairs:",
  9272. protocol: "instance creation",
  9273. fn: function (aCollection){
  9274. var self=this,$self=this;
  9275. return $core.withContext(function($ctx1) {
  9276. return $self._from_(aCollection);
  9277. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  9278. },
  9279. args: ["aCollection"],
  9280. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  9281. referencedClasses: [],
  9282. messageSends: ["from:"]
  9283. }),
  9284. $globals.AssociativeCollection.a$cls);
  9285. $core.addMethod(
  9286. $core.method({
  9287. selector: "newFromPairs:",
  9288. protocol: "instance creation",
  9289. fn: function (aCollection){
  9290. var self=this,$self=this;
  9291. var newCollection;
  9292. return $core.withContext(function($ctx1) {
  9293. var $2,$1,$3,$4;
  9294. $2=$recv(aCollection)._size();
  9295. $ctx1.sendIdx["size"]=1;
  9296. $1=$recv($2)._even();
  9297. if(!$core.assert($1)){
  9298. $self._error_("#newFromPairs only accepts arrays of an even length");
  9299. }
  9300. newCollection=$self._new();
  9301. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  9302. return $core.withContext(function($ctx2) {
  9303. $3=newCollection;
  9304. $4=$recv(aCollection)._at_(each);
  9305. $ctx2.sendIdx["at:"]=1;
  9306. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  9307. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9308. }));
  9309. return newCollection;
  9310. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9311. },
  9312. args: ["aCollection"],
  9313. 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",
  9314. referencedClasses: [],
  9315. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  9316. }),
  9317. $globals.AssociativeCollection.a$cls);
  9318. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  9319. $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.";
  9320. $core.addMethod(
  9321. $core.method({
  9322. selector: "at:ifAbsent:",
  9323. protocol: "accessing",
  9324. fn: function (aKey,aBlock){
  9325. var self=this,$self=this;
  9326. return $core.withContext(function($ctx1) {
  9327. var index = $self._positionOfKey_(aKey);
  9328. return index >=0 ? $self['@values'][index] : aBlock._value();
  9329. ;
  9330. return self;
  9331. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9332. },
  9333. args: ["aKey", "aBlock"],
  9334. 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'>",
  9335. referencedClasses: [],
  9336. messageSends: []
  9337. }),
  9338. $globals.Dictionary);
  9339. $core.addMethod(
  9340. $core.method({
  9341. selector: "at:put:",
  9342. protocol: "accessing",
  9343. fn: function (aKey,aValue){
  9344. var self=this,$self=this;
  9345. return $core.withContext(function($ctx1) {
  9346. var index = $self._positionOfKey_(aKey);
  9347. if(index === -1) {
  9348. var keys = $self['@keys'];
  9349. index = keys.length;
  9350. keys.push(aKey);
  9351. }
  9352. return $self['@values'][index] = aValue;
  9353. ;
  9354. return self;
  9355. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  9356. },
  9357. args: ["aKey", "aValue"],
  9358. 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'>",
  9359. referencedClasses: [],
  9360. messageSends: []
  9361. }),
  9362. $globals.Dictionary);
  9363. $core.addMethod(
  9364. $core.method({
  9365. selector: "includesKey:",
  9366. protocol: "testing",
  9367. fn: function (aKey){
  9368. var self=this,$self=this;
  9369. return $core.withContext(function($ctx1) {
  9370. return $self._positionOfKey_(aKey) >= 0;;
  9371. return self;
  9372. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  9373. },
  9374. args: ["aKey"],
  9375. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  9376. referencedClasses: [],
  9377. messageSends: []
  9378. }),
  9379. $globals.Dictionary);
  9380. $core.addMethod(
  9381. $core.method({
  9382. selector: "indexOf:ifAbsent:",
  9383. protocol: "accessing",
  9384. fn: function (anObject,aBlock){
  9385. var self=this,$self=this;
  9386. var index;
  9387. return $core.withContext(function($ctx1) {
  9388. var $1;
  9389. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  9390. return (0);
  9391. }));
  9392. $1=$recv(index).__eq((0));
  9393. if($core.assert($1)){
  9394. return $recv(aBlock)._value();
  9395. } else {
  9396. return $recv($self["@keys"])._at_(index);
  9397. }
  9398. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  9399. },
  9400. args: ["anObject", "aBlock"],
  9401. 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 ]",
  9402. referencedClasses: [],
  9403. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  9404. }),
  9405. $globals.Dictionary);
  9406. $core.addMethod(
  9407. $core.method({
  9408. selector: "initialize",
  9409. protocol: "initialization",
  9410. fn: function (){
  9411. var self=this,$self=this;
  9412. return $core.withContext(function($ctx1) {
  9413. (
  9414. $ctx1.supercall = true,
  9415. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9416. $ctx1.supercall = false;
  9417. $self["@keys"]=[];
  9418. $self["@values"]=[];
  9419. return self;
  9420. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  9421. },
  9422. args: [],
  9423. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9424. referencedClasses: [],
  9425. messageSends: ["initialize"]
  9426. }),
  9427. $globals.Dictionary);
  9428. $core.addMethod(
  9429. $core.method({
  9430. selector: "keys",
  9431. protocol: "accessing",
  9432. fn: function (){
  9433. var self=this,$self=this;
  9434. return $core.withContext(function($ctx1) {
  9435. return $recv($self["@keys"])._copy();
  9436. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  9437. },
  9438. args: [],
  9439. source: "keys\x0a\x09^ keys copy",
  9440. referencedClasses: [],
  9441. messageSends: ["copy"]
  9442. }),
  9443. $globals.Dictionary);
  9444. $core.addMethod(
  9445. $core.method({
  9446. selector: "keysAndValuesDo:",
  9447. protocol: "enumerating",
  9448. fn: function (aBlock){
  9449. var self=this,$self=this;
  9450. return $core.withContext(function($ctx1) {
  9451. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  9452. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9453. },
  9454. args: ["aBlock"],
  9455. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  9456. referencedClasses: [],
  9457. messageSends: ["with:do:"]
  9458. }),
  9459. $globals.Dictionary);
  9460. $core.addMethod(
  9461. $core.method({
  9462. selector: "keysDo:",
  9463. protocol: "enumerating",
  9464. fn: function (aBlock){
  9465. var self=this,$self=this;
  9466. return $core.withContext(function($ctx1) {
  9467. return $recv($self["@keys"])._do_(aBlock);
  9468. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  9469. },
  9470. args: ["aBlock"],
  9471. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  9472. referencedClasses: [],
  9473. messageSends: ["do:"]
  9474. }),
  9475. $globals.Dictionary);
  9476. $core.addMethod(
  9477. $core.method({
  9478. selector: "positionOfKey:",
  9479. protocol: "private",
  9480. fn: function (anObject){
  9481. var self=this,$self=this;
  9482. return $core.withContext(function($ctx1) {
  9483. var keys = $self['@keys'];
  9484. for(var i=0;i<keys.length;i++){
  9485. if(keys[i].__eq(anObject)) { return i;}
  9486. }
  9487. return -1;
  9488. ;
  9489. return self;
  9490. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  9491. },
  9492. args: ["anObject"],
  9493. 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'>",
  9494. referencedClasses: [],
  9495. messageSends: []
  9496. }),
  9497. $globals.Dictionary);
  9498. $core.addMethod(
  9499. $core.method({
  9500. selector: "removeAll",
  9501. protocol: "adding/removing",
  9502. fn: function (){
  9503. var self=this,$self=this;
  9504. return $core.withContext(function($ctx1) {
  9505. $recv($self["@keys"])._removeAll();
  9506. $ctx1.sendIdx["removeAll"]=1;
  9507. $recv($self["@values"])._removeAll();
  9508. return self;
  9509. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  9510. },
  9511. args: [],
  9512. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  9513. referencedClasses: [],
  9514. messageSends: ["removeAll"]
  9515. }),
  9516. $globals.Dictionary);
  9517. $core.addMethod(
  9518. $core.method({
  9519. selector: "removeKey:ifAbsent:",
  9520. protocol: "adding/removing",
  9521. fn: function (aKey,aBlock){
  9522. var self=this,$self=this;
  9523. return $core.withContext(function($ctx1) {
  9524. var index = $self._positionOfKey_(aKey);
  9525. if(index === -1) {
  9526. return aBlock._value()
  9527. } else {
  9528. var keys = $self['@keys'], values = $self['@values'];
  9529. var value = values[index], l = keys.length;
  9530. keys[index] = keys[l-1];
  9531. keys.pop();
  9532. values[index] = values[l-1];
  9533. values.pop();
  9534. return value;
  9535. }
  9536. ;
  9537. return self;
  9538. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9539. },
  9540. args: ["aKey", "aBlock"],
  9541. 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'>",
  9542. referencedClasses: [],
  9543. messageSends: []
  9544. }),
  9545. $globals.Dictionary);
  9546. $core.addMethod(
  9547. $core.method({
  9548. selector: "values",
  9549. protocol: "accessing",
  9550. fn: function (){
  9551. var self=this,$self=this;
  9552. return $self["@values"];
  9553. },
  9554. args: [],
  9555. source: "values\x0a\x09^ values",
  9556. referencedClasses: [],
  9557. messageSends: []
  9558. }),
  9559. $globals.Dictionary);
  9560. $core.addMethod(
  9561. $core.method({
  9562. selector: "valuesDo:",
  9563. protocol: "enumerating",
  9564. fn: function (aBlock){
  9565. var self=this,$self=this;
  9566. return $core.withContext(function($ctx1) {
  9567. return $recv($self["@values"])._do_(aBlock);
  9568. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9569. },
  9570. args: ["aBlock"],
  9571. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  9572. referencedClasses: [],
  9573. messageSends: ["do:"]
  9574. }),
  9575. $globals.Dictionary);
  9576. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  9577. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  9578. $core.addMethod(
  9579. $core.method({
  9580. selector: "at:ifAbsent:",
  9581. protocol: "accessing",
  9582. fn: function (aKey,aBlock){
  9583. var self=this,$self=this;
  9584. return $core.withContext(function($ctx1) {
  9585. var $1;
  9586. $1=$self._includesKey_(aKey);
  9587. if($core.assert($1)){
  9588. return $self._basicAt_(aKey);
  9589. } else {
  9590. return $recv(aBlock)._value();
  9591. }
  9592. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9593. },
  9594. args: ["aKey", "aBlock"],
  9595. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  9596. referencedClasses: [],
  9597. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  9598. }),
  9599. $globals.HashedCollection);
  9600. $core.addMethod(
  9601. $core.method({
  9602. selector: "at:put:",
  9603. protocol: "accessing",
  9604. fn: function (aKey,aValue){
  9605. var self=this,$self=this;
  9606. return $core.withContext(function($ctx1) {
  9607. return $self._basicAt_put_(aKey,aValue);
  9608. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  9609. },
  9610. args: ["aKey", "aValue"],
  9611. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  9612. referencedClasses: [],
  9613. messageSends: ["basicAt:put:"]
  9614. }),
  9615. $globals.HashedCollection);
  9616. $core.addMethod(
  9617. $core.method({
  9618. selector: "includesKey:",
  9619. protocol: "testing",
  9620. fn: function (aKey){
  9621. var self=this,$self=this;
  9622. return $core.withContext(function($ctx1) {
  9623. return self.hasOwnProperty(aKey);
  9624. return self;
  9625. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  9626. },
  9627. args: ["aKey"],
  9628. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  9629. referencedClasses: [],
  9630. messageSends: []
  9631. }),
  9632. $globals.HashedCollection);
  9633. $core.addMethod(
  9634. $core.method({
  9635. selector: "keys",
  9636. protocol: "accessing",
  9637. fn: function (){
  9638. var self=this,$self=this;
  9639. return $core.withContext(function($ctx1) {
  9640. return Object.keys(self);
  9641. return self;
  9642. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  9643. },
  9644. args: [],
  9645. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  9646. referencedClasses: [],
  9647. messageSends: []
  9648. }),
  9649. $globals.HashedCollection);
  9650. $core.addMethod(
  9651. $core.method({
  9652. selector: "keysDo:",
  9653. protocol: "enumerating",
  9654. fn: function (aBlock){
  9655. var self=this,$self=this;
  9656. return $core.withContext(function($ctx1) {
  9657. $recv($self._keys())._do_(aBlock);
  9658. return self;
  9659. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9660. },
  9661. args: ["aBlock"],
  9662. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  9663. referencedClasses: [],
  9664. messageSends: ["do:", "keys"]
  9665. }),
  9666. $globals.HashedCollection);
  9667. $core.addMethod(
  9668. $core.method({
  9669. selector: "removeKey:ifAbsent:",
  9670. protocol: "adding/removing",
  9671. fn: function (aKey,aBlock){
  9672. var self=this,$self=this;
  9673. return $core.withContext(function($ctx1) {
  9674. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  9675. return $core.withContext(function($ctx2) {
  9676. $self._basicDelete_(aKey);
  9677. return removed;
  9678. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  9679. }),(function(){
  9680. return $core.withContext(function($ctx2) {
  9681. return $recv(aBlock)._value();
  9682. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9683. }));
  9684. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9685. },
  9686. args: ["aKey", "aBlock"],
  9687. 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 ]",
  9688. referencedClasses: [],
  9689. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  9690. }),
  9691. $globals.HashedCollection);
  9692. $core.addMethod(
  9693. $core.method({
  9694. selector: "values",
  9695. protocol: "accessing",
  9696. fn: function (){
  9697. var self=this,$self=this;
  9698. return $core.withContext(function($ctx1) {
  9699. return $self._keys().map(function(key){
  9700. return $self._at_(key);
  9701. });
  9702. ;
  9703. return self;
  9704. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  9705. },
  9706. args: [],
  9707. 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'>",
  9708. referencedClasses: [],
  9709. messageSends: []
  9710. }),
  9711. $globals.HashedCollection);
  9712. $core.addMethod(
  9713. $core.method({
  9714. selector: "valuesDo:",
  9715. protocol: "enumerating",
  9716. fn: function (aBlock){
  9717. var self=this,$self=this;
  9718. return $core.withContext(function($ctx1) {
  9719. $recv($self._values())._do_(aBlock);
  9720. return self;
  9721. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9722. },
  9723. args: ["aBlock"],
  9724. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  9725. referencedClasses: [],
  9726. messageSends: ["do:", "values"]
  9727. }),
  9728. $globals.HashedCollection);
  9729. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  9730. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  9731. $core.addMethod(
  9732. $core.method({
  9733. selector: "=",
  9734. protocol: "comparing",
  9735. fn: function (aCollection){
  9736. var self=this,$self=this;
  9737. return $core.withContext(function($ctx1) {
  9738. var $3,$2,$4,$1,$5;
  9739. var $early={};
  9740. try {
  9741. $3=$self._class();
  9742. $ctx1.sendIdx["class"]=1;
  9743. $2=$recv($3).__eq($recv(aCollection)._class());
  9744. $ctx1.sendIdx["="]=1;
  9745. $1=$recv($2)._and_((function(){
  9746. return $core.withContext(function($ctx2) {
  9747. $4=$self._size();
  9748. $ctx2.sendIdx["size"]=1;
  9749. return $recv($4).__eq($recv(aCollection)._size());
  9750. $ctx2.sendIdx["="]=2;
  9751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9752. }));
  9753. if(!$core.assert($1)){
  9754. return false;
  9755. }
  9756. $self._withIndexDo_((function(each,i){
  9757. return $core.withContext(function($ctx2) {
  9758. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  9759. if(!$core.assert($5)){
  9760. throw $early=[false];
  9761. }
  9762. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  9763. }));
  9764. return true;
  9765. }
  9766. catch(e) {if(e===$early)return e[0]; throw e}
  9767. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  9768. },
  9769. args: ["aCollection"],
  9770. 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",
  9771. referencedClasses: [],
  9772. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  9773. }),
  9774. $globals.SequenceableCollection);
  9775. $core.addMethod(
  9776. $core.method({
  9777. selector: "addLast:",
  9778. protocol: "adding/removing",
  9779. fn: function (anObject){
  9780. var self=this,$self=this;
  9781. return $core.withContext(function($ctx1) {
  9782. $self._add_(anObject);
  9783. return self;
  9784. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  9785. },
  9786. args: ["anObject"],
  9787. source: "addLast: anObject\x0a\x09self add: anObject",
  9788. referencedClasses: [],
  9789. messageSends: ["add:"]
  9790. }),
  9791. $globals.SequenceableCollection);
  9792. $core.addMethod(
  9793. $core.method({
  9794. selector: "allButFirst",
  9795. protocol: "accessing",
  9796. fn: function (){
  9797. var self=this,$self=this;
  9798. return $core.withContext(function($ctx1) {
  9799. return $self._copyFrom_to_((2),$self._size());
  9800. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  9801. },
  9802. args: [],
  9803. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  9804. referencedClasses: [],
  9805. messageSends: ["copyFrom:to:", "size"]
  9806. }),
  9807. $globals.SequenceableCollection);
  9808. $core.addMethod(
  9809. $core.method({
  9810. selector: "allButLast",
  9811. protocol: "accessing",
  9812. fn: function (){
  9813. var self=this,$self=this;
  9814. return $core.withContext(function($ctx1) {
  9815. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  9816. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  9817. },
  9818. args: [],
  9819. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  9820. referencedClasses: [],
  9821. messageSends: ["copyFrom:to:", "-", "size"]
  9822. }),
  9823. $globals.SequenceableCollection);
  9824. $core.addMethod(
  9825. $core.method({
  9826. selector: "anyOne",
  9827. protocol: "accessing",
  9828. fn: function (){
  9829. var self=this,$self=this;
  9830. return $core.withContext(function($ctx1) {
  9831. return $self._at_((1));
  9832. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  9833. },
  9834. args: [],
  9835. source: "anyOne\x0a\x09^ self at: 1",
  9836. referencedClasses: [],
  9837. messageSends: ["at:"]
  9838. }),
  9839. $globals.SequenceableCollection);
  9840. $core.addMethod(
  9841. $core.method({
  9842. selector: "atRandom",
  9843. protocol: "accessing",
  9844. fn: function (){
  9845. var self=this,$self=this;
  9846. return $core.withContext(function($ctx1) {
  9847. return $self._at_($recv($self._size())._atRandom());
  9848. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  9849. },
  9850. args: [],
  9851. source: "atRandom\x0a\x09^ self at: self size atRandom",
  9852. referencedClasses: [],
  9853. messageSends: ["at:", "atRandom", "size"]
  9854. }),
  9855. $globals.SequenceableCollection);
  9856. $core.addMethod(
  9857. $core.method({
  9858. selector: "beginsWith:",
  9859. protocol: "testing",
  9860. fn: function (prefix){
  9861. var self=this,$self=this;
  9862. return $core.withContext(function($ctx1) {
  9863. var $2,$3,$1;
  9864. $2=$self._size();
  9865. $ctx1.sendIdx["size"]=1;
  9866. $3=$recv(prefix)._size();
  9867. $ctx1.sendIdx["size"]=2;
  9868. $1=$recv($2).__lt($3);
  9869. if($core.assert($1)){
  9870. return false;
  9871. }
  9872. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  9873. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  9874. },
  9875. args: ["prefix"],
  9876. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  9877. referencedClasses: [],
  9878. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  9879. }),
  9880. $globals.SequenceableCollection);
  9881. $core.addMethod(
  9882. $core.method({
  9883. selector: "copyFrom:to:",
  9884. protocol: "copying",
  9885. fn: function (anIndex,anotherIndex){
  9886. var self=this,$self=this;
  9887. return $core.withContext(function($ctx1) {
  9888. $self._subclassResponsibility();
  9889. return self;
  9890. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  9891. },
  9892. args: ["anIndex", "anotherIndex"],
  9893. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  9894. referencedClasses: [],
  9895. messageSends: ["subclassResponsibility"]
  9896. }),
  9897. $globals.SequenceableCollection);
  9898. $core.addMethod(
  9899. $core.method({
  9900. selector: "endsWith:",
  9901. protocol: "testing",
  9902. fn: function (suffix){
  9903. var self=this,$self=this;
  9904. return $core.withContext(function($ctx1) {
  9905. var $2,$3,$1;
  9906. $2=$self._size();
  9907. $ctx1.sendIdx["size"]=1;
  9908. $3=$recv(suffix)._size();
  9909. $ctx1.sendIdx["size"]=2;
  9910. $1=$recv($2).__lt($3);
  9911. if($core.assert($1)){
  9912. return false;
  9913. }
  9914. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  9915. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  9916. },
  9917. args: ["suffix"],
  9918. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  9919. referencedClasses: [],
  9920. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  9921. }),
  9922. $globals.SequenceableCollection);
  9923. $core.addMethod(
  9924. $core.method({
  9925. selector: "first",
  9926. protocol: "accessing",
  9927. fn: function (){
  9928. var self=this,$self=this;
  9929. return $core.withContext(function($ctx1) {
  9930. return $self._at_((1));
  9931. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  9932. },
  9933. args: [],
  9934. source: "first\x0a\x09^ self at: 1",
  9935. referencedClasses: [],
  9936. messageSends: ["at:"]
  9937. }),
  9938. $globals.SequenceableCollection);
  9939. $core.addMethod(
  9940. $core.method({
  9941. selector: "first:",
  9942. protocol: "accessing",
  9943. fn: function (aNumber){
  9944. var self=this,$self=this;
  9945. return $core.withContext(function($ctx1) {
  9946. var $1;
  9947. $1=$recv($self._size()).__lt(aNumber);
  9948. if($core.assert($1)){
  9949. $self._error_("Invalid number of elements");
  9950. }
  9951. return $self._copyFrom_to_((1),aNumber);
  9952. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  9953. },
  9954. args: ["aNumber"],
  9955. 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",
  9956. referencedClasses: [],
  9957. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  9958. }),
  9959. $globals.SequenceableCollection);
  9960. $core.addMethod(
  9961. $core.method({
  9962. selector: "fourth",
  9963. protocol: "accessing",
  9964. fn: function (){
  9965. var self=this,$self=this;
  9966. return $core.withContext(function($ctx1) {
  9967. return $self._at_((4));
  9968. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  9969. },
  9970. args: [],
  9971. source: "fourth\x0a\x09^ self at: 4",
  9972. referencedClasses: [],
  9973. messageSends: ["at:"]
  9974. }),
  9975. $globals.SequenceableCollection);
  9976. $core.addMethod(
  9977. $core.method({
  9978. selector: "includes:",
  9979. protocol: "testing",
  9980. fn: function (anObject){
  9981. var self=this,$self=this;
  9982. return $core.withContext(function($ctx1) {
  9983. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  9984. return nil;
  9985. })))._notNil();
  9986. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  9987. },
  9988. args: ["anObject"],
  9989. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  9990. referencedClasses: [],
  9991. messageSends: ["notNil", "indexOf:ifAbsent:"]
  9992. }),
  9993. $globals.SequenceableCollection);
  9994. $core.addMethod(
  9995. $core.method({
  9996. selector: "indexOf:startingAt:",
  9997. protocol: "accessing",
  9998. fn: function (anObject,start){
  9999. var self=this,$self=this;
  10000. return $core.withContext(function($ctx1) {
  10001. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  10002. return (0);
  10003. }));
  10004. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  10005. },
  10006. args: ["anObject", "start"],
  10007. 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 ]",
  10008. referencedClasses: [],
  10009. messageSends: ["indexOf:startingAt:ifAbsent:"]
  10010. }),
  10011. $globals.SequenceableCollection);
  10012. $core.addMethod(
  10013. $core.method({
  10014. selector: "indexOf:startingAt:ifAbsent:",
  10015. protocol: "accessing",
  10016. fn: function (anObject,start,aBlock){
  10017. var self=this,$self=this;
  10018. return $core.withContext(function($ctx1) {
  10019. $self._subclassResponsibility();
  10020. return self;
  10021. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  10022. },
  10023. args: ["anObject", "start", "aBlock"],
  10024. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  10025. referencedClasses: [],
  10026. messageSends: ["subclassResponsibility"]
  10027. }),
  10028. $globals.SequenceableCollection);
  10029. $core.addMethod(
  10030. $core.method({
  10031. selector: "last",
  10032. protocol: "accessing",
  10033. fn: function (){
  10034. var self=this,$self=this;
  10035. return $core.withContext(function($ctx1) {
  10036. return $self._at_($self._size());
  10037. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  10038. },
  10039. args: [],
  10040. source: "last\x0a\x09^ self at: self size",
  10041. referencedClasses: [],
  10042. messageSends: ["at:", "size"]
  10043. }),
  10044. $globals.SequenceableCollection);
  10045. $core.addMethod(
  10046. $core.method({
  10047. selector: "last:",
  10048. protocol: "accessing",
  10049. fn: function (aNumber){
  10050. var self=this,$self=this;
  10051. return $core.withContext(function($ctx1) {
  10052. var $2,$1,$5,$4,$3;
  10053. $2=$self._size();
  10054. $ctx1.sendIdx["size"]=1;
  10055. $1=$recv($2).__lt(aNumber);
  10056. if($core.assert($1)){
  10057. $self._error_("Invalid number of elements");
  10058. }
  10059. $5=$self._size();
  10060. $ctx1.sendIdx["size"]=2;
  10061. $4=$recv($5).__minus(aNumber);
  10062. $3=$recv($4).__plus((1));
  10063. return $self._copyFrom_to_($3,$self._size());
  10064. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10065. },
  10066. args: ["aNumber"],
  10067. 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",
  10068. referencedClasses: [],
  10069. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  10070. }),
  10071. $globals.SequenceableCollection);
  10072. $core.addMethod(
  10073. $core.method({
  10074. selector: "newStream",
  10075. protocol: "streaming",
  10076. fn: function (){
  10077. var self=this,$self=this;
  10078. return $core.withContext(function($ctx1) {
  10079. return $recv($self._streamClass())._on_(self);
  10080. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  10081. },
  10082. args: [],
  10083. source: "newStream\x0a\x09^ self streamClass on: self",
  10084. referencedClasses: [],
  10085. messageSends: ["on:", "streamClass"]
  10086. }),
  10087. $globals.SequenceableCollection);
  10088. $core.addMethod(
  10089. $core.method({
  10090. selector: "readStream",
  10091. protocol: "streaming",
  10092. fn: function (){
  10093. var self=this,$self=this;
  10094. return $core.withContext(function($ctx1) {
  10095. return $self._stream();
  10096. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  10097. },
  10098. args: [],
  10099. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10100. referencedClasses: [],
  10101. messageSends: ["stream"]
  10102. }),
  10103. $globals.SequenceableCollection);
  10104. $core.addMethod(
  10105. $core.method({
  10106. selector: "removeLast",
  10107. protocol: "adding/removing",
  10108. fn: function (){
  10109. var self=this,$self=this;
  10110. return $core.withContext(function($ctx1) {
  10111. return $self._remove_($self._last());
  10112. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  10113. },
  10114. args: [],
  10115. source: "removeLast\x0a\x09^ self remove: self last",
  10116. referencedClasses: [],
  10117. messageSends: ["remove:", "last"]
  10118. }),
  10119. $globals.SequenceableCollection);
  10120. $core.addMethod(
  10121. $core.method({
  10122. selector: "reverseDo:",
  10123. protocol: "enumerating",
  10124. fn: function (aBlock){
  10125. var self=this,$self=this;
  10126. return $core.withContext(function($ctx1) {
  10127. $recv($self._reversed())._do_(aBlock);
  10128. return self;
  10129. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10130. },
  10131. args: ["aBlock"],
  10132. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  10133. referencedClasses: [],
  10134. messageSends: ["do:", "reversed"]
  10135. }),
  10136. $globals.SequenceableCollection);
  10137. $core.addMethod(
  10138. $core.method({
  10139. selector: "reversed",
  10140. protocol: "converting",
  10141. fn: function (){
  10142. var self=this,$self=this;
  10143. return $core.withContext(function($ctx1) {
  10144. $self._subclassResponsibility();
  10145. return self;
  10146. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  10147. },
  10148. args: [],
  10149. source: "reversed\x0a\x09self subclassResponsibility",
  10150. referencedClasses: [],
  10151. messageSends: ["subclassResponsibility"]
  10152. }),
  10153. $globals.SequenceableCollection);
  10154. $core.addMethod(
  10155. $core.method({
  10156. selector: "second",
  10157. protocol: "accessing",
  10158. fn: function (){
  10159. var self=this,$self=this;
  10160. return $core.withContext(function($ctx1) {
  10161. return $self._at_((2));
  10162. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  10163. },
  10164. args: [],
  10165. source: "second\x0a\x09^ self at: 2",
  10166. referencedClasses: [],
  10167. messageSends: ["at:"]
  10168. }),
  10169. $globals.SequenceableCollection);
  10170. $core.addMethod(
  10171. $core.method({
  10172. selector: "stream",
  10173. protocol: "streaming",
  10174. fn: function (){
  10175. var self=this,$self=this;
  10176. return $core.withContext(function($ctx1) {
  10177. return $self._newStream();
  10178. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  10179. },
  10180. args: [],
  10181. source: "stream\x0a\x09^ self newStream",
  10182. referencedClasses: [],
  10183. messageSends: ["newStream"]
  10184. }),
  10185. $globals.SequenceableCollection);
  10186. $core.addMethod(
  10187. $core.method({
  10188. selector: "streamClass",
  10189. protocol: "streaming",
  10190. fn: function (){
  10191. var self=this,$self=this;
  10192. return $core.withContext(function($ctx1) {
  10193. return $recv($self._class())._streamClass();
  10194. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  10195. },
  10196. args: [],
  10197. source: "streamClass\x0a\x09^ self class streamClass",
  10198. referencedClasses: [],
  10199. messageSends: ["streamClass", "class"]
  10200. }),
  10201. $globals.SequenceableCollection);
  10202. $core.addMethod(
  10203. $core.method({
  10204. selector: "third",
  10205. protocol: "accessing",
  10206. fn: function (){
  10207. var self=this,$self=this;
  10208. return $core.withContext(function($ctx1) {
  10209. return $self._at_((3));
  10210. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  10211. },
  10212. args: [],
  10213. source: "third\x0a\x09^ self at: 3",
  10214. referencedClasses: [],
  10215. messageSends: ["at:"]
  10216. }),
  10217. $globals.SequenceableCollection);
  10218. $core.addMethod(
  10219. $core.method({
  10220. selector: "writeStream",
  10221. protocol: "streaming",
  10222. fn: function (){
  10223. var self=this,$self=this;
  10224. return $core.withContext(function($ctx1) {
  10225. return $self._stream();
  10226. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  10227. },
  10228. args: [],
  10229. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10230. referencedClasses: [],
  10231. messageSends: ["stream"]
  10232. }),
  10233. $globals.SequenceableCollection);
  10234. $core.addMethod(
  10235. $core.method({
  10236. selector: "streamClass",
  10237. protocol: "accessing",
  10238. fn: function (){
  10239. var self=this,$self=this;
  10240. return $globals.Stream;
  10241. },
  10242. args: [],
  10243. source: "streamClass\x0a\x09\x09^ Stream",
  10244. referencedClasses: ["Stream"],
  10245. messageSends: []
  10246. }),
  10247. $globals.SequenceableCollection.a$cls);
  10248. $core.addMethod(
  10249. $core.method({
  10250. selector: "streamContents:",
  10251. protocol: "streaming",
  10252. fn: function (aBlock){
  10253. var self=this,$self=this;
  10254. var stream;
  10255. return $core.withContext(function($ctx1) {
  10256. stream=$recv($self._streamClass())._on_($self._new());
  10257. $recv(aBlock)._value_(stream);
  10258. return $recv(stream)._contents();
  10259. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  10260. },
  10261. args: ["aBlock"],
  10262. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  10263. referencedClasses: [],
  10264. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  10265. }),
  10266. $globals.SequenceableCollection.a$cls);
  10267. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  10268. $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`.";
  10269. $core.addMethod(
  10270. $core.method({
  10271. selector: "add:",
  10272. protocol: "adding/removing",
  10273. fn: function (anObject){
  10274. var self=this,$self=this;
  10275. return $core.withContext(function($ctx1) {
  10276. self.push(anObject); return anObject;;
  10277. return self;
  10278. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  10279. },
  10280. args: ["anObject"],
  10281. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  10282. referencedClasses: [],
  10283. messageSends: []
  10284. }),
  10285. $globals.Array);
  10286. $core.addMethod(
  10287. $core.method({
  10288. selector: "addAll:",
  10289. protocol: "adding/removing",
  10290. fn: function (aCollection){
  10291. var self=this,$self=this;
  10292. return $core.withContext(function($ctx1) {
  10293. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  10294. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  10295. return aCollection;;
  10296. return self;
  10297. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  10298. },
  10299. args: ["aCollection"],
  10300. 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'>",
  10301. referencedClasses: [],
  10302. messageSends: []
  10303. }),
  10304. $globals.Array);
  10305. $core.addMethod(
  10306. $core.method({
  10307. selector: "addFirst:",
  10308. protocol: "adding/removing",
  10309. fn: function (anObject){
  10310. var self=this,$self=this;
  10311. return $core.withContext(function($ctx1) {
  10312. self.unshift(anObject); return anObject;;
  10313. return self;
  10314. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  10315. },
  10316. args: ["anObject"],
  10317. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  10318. referencedClasses: [],
  10319. messageSends: []
  10320. }),
  10321. $globals.Array);
  10322. $core.addMethod(
  10323. $core.method({
  10324. selector: "asJavaScriptSource",
  10325. protocol: "converting",
  10326. fn: function (){
  10327. var self=this,$self=this;
  10328. return $core.withContext(function($ctx1) {
  10329. var $1;
  10330. $1=$recv("[".__comma($recv($self._collect_((function(each){
  10331. return $core.withContext(function($ctx2) {
  10332. return $recv(each)._asJavaScriptSource();
  10333. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10334. })))._join_(", "))).__comma("]");
  10335. $ctx1.sendIdx[","]=1;
  10336. return $1;
  10337. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  10338. },
  10339. args: [],
  10340. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  10341. referencedClasses: [],
  10342. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  10343. }),
  10344. $globals.Array);
  10345. $core.addMethod(
  10346. $core.method({
  10347. selector: "at:put:",
  10348. protocol: "accessing",
  10349. fn: function (anIndex,anObject){
  10350. var self=this,$self=this;
  10351. return $core.withContext(function($ctx1) {
  10352. return self[anIndex - 1] = anObject;
  10353. return self;
  10354. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  10355. },
  10356. args: ["anIndex", "anObject"],
  10357. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  10358. referencedClasses: [],
  10359. messageSends: []
  10360. }),
  10361. $globals.Array);
  10362. $core.addMethod(
  10363. $core.method({
  10364. selector: "collect:",
  10365. protocol: "enumerating",
  10366. fn: function (aBlock){
  10367. var self=this,$self=this;
  10368. return $core.withContext(function($ctx1) {
  10369. return self.map(function(each) {return aBlock._value_(each)});
  10370. return self;
  10371. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  10372. },
  10373. args: ["aBlock"],
  10374. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  10375. referencedClasses: [],
  10376. messageSends: []
  10377. }),
  10378. $globals.Array);
  10379. $core.addMethod(
  10380. $core.method({
  10381. selector: "copyFrom:to:",
  10382. protocol: "copying",
  10383. fn: function (anIndex,anotherIndex){
  10384. var self=this,$self=this;
  10385. return $core.withContext(function($ctx1) {
  10386. if (anIndex >= 1 && anotherIndex <= self.length) {
  10387. return self.slice(anIndex - 1, anotherIndex);
  10388. } else {
  10389. self._at_(anIndex);
  10390. self._at_(self.length + 1);
  10391. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  10392. };
  10393. return self;
  10394. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  10395. },
  10396. args: ["anIndex", "anotherIndex"],
  10397. 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'>",
  10398. referencedClasses: [],
  10399. messageSends: []
  10400. }),
  10401. $globals.Array);
  10402. $core.addMethod(
  10403. $core.method({
  10404. selector: "join:",
  10405. protocol: "enumerating",
  10406. fn: function (aString){
  10407. var self=this,$self=this;
  10408. return $core.withContext(function($ctx1) {
  10409. return self.join(aString);
  10410. return self;
  10411. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  10412. },
  10413. args: ["aString"],
  10414. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  10415. referencedClasses: [],
  10416. messageSends: []
  10417. }),
  10418. $globals.Array);
  10419. $core.addMethod(
  10420. $core.method({
  10421. selector: "printOn:",
  10422. protocol: "printing",
  10423. fn: function (aStream){
  10424. var self=this,$self=this;
  10425. return $core.withContext(function($ctx1) {
  10426. (
  10427. $ctx1.supercall = true,
  10428. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  10429. $ctx1.supercall = false;
  10430. $ctx1.sendIdx["printOn:"]=1;
  10431. $recv(aStream)._nextPutAll_(" (");
  10432. $ctx1.sendIdx["nextPutAll:"]=1;
  10433. $self._do_separatedBy_((function(each){
  10434. return $core.withContext(function($ctx2) {
  10435. return $recv(each)._printOn_(aStream);
  10436. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10437. }),(function(){
  10438. return $core.withContext(function($ctx2) {
  10439. return $recv(aStream)._nextPutAll_(" ");
  10440. $ctx2.sendIdx["nextPutAll:"]=2;
  10441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10442. }));
  10443. $recv(aStream)._nextPutAll_(")");
  10444. return self;
  10445. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  10446. },
  10447. args: ["aStream"],
  10448. 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: ')'",
  10449. referencedClasses: [],
  10450. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  10451. }),
  10452. $globals.Array);
  10453. $core.addMethod(
  10454. $core.method({
  10455. selector: "remove:ifAbsent:",
  10456. protocol: "adding/removing",
  10457. fn: function (anObject,aBlock){
  10458. var self=this,$self=this;
  10459. var index;
  10460. return $core.withContext(function($ctx1) {
  10461. var $1;
  10462. index=$self._indexOf_ifAbsent_(anObject,(function(){
  10463. return (0);
  10464. }));
  10465. $1=$recv(index).__eq((0));
  10466. if($core.assert($1)){
  10467. return $recv(aBlock)._value();
  10468. } else {
  10469. $self._removeIndex_(index);
  10470. return anObject;
  10471. }
  10472. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  10473. },
  10474. args: ["anObject", "aBlock"],
  10475. 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 ]",
  10476. referencedClasses: [],
  10477. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  10478. }),
  10479. $globals.Array);
  10480. $core.addMethod(
  10481. $core.method({
  10482. selector: "removeAll",
  10483. protocol: "adding/removing",
  10484. fn: function (){
  10485. var self=this,$self=this;
  10486. return $core.withContext(function($ctx1) {
  10487. self.length = 0;
  10488. return self;
  10489. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  10490. },
  10491. args: [],
  10492. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  10493. referencedClasses: [],
  10494. messageSends: []
  10495. }),
  10496. $globals.Array);
  10497. $core.addMethod(
  10498. $core.method({
  10499. selector: "removeFrom:to:",
  10500. protocol: "adding/removing",
  10501. fn: function (aNumber,anotherNumber){
  10502. var self=this,$self=this;
  10503. return $core.withContext(function($ctx1) {
  10504. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  10505. return self;
  10506. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  10507. },
  10508. args: ["aNumber", "anotherNumber"],
  10509. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  10510. referencedClasses: [],
  10511. messageSends: []
  10512. }),
  10513. $globals.Array);
  10514. $core.addMethod(
  10515. $core.method({
  10516. selector: "removeIndex:",
  10517. protocol: "adding/removing",
  10518. fn: function (anInteger){
  10519. var self=this,$self=this;
  10520. return $core.withContext(function($ctx1) {
  10521. self.splice(anInteger - 1, 1);
  10522. return self;
  10523. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  10524. },
  10525. args: ["anInteger"],
  10526. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  10527. referencedClasses: [],
  10528. messageSends: []
  10529. }),
  10530. $globals.Array);
  10531. $core.addMethod(
  10532. $core.method({
  10533. selector: "removeLast",
  10534. protocol: "adding/removing",
  10535. fn: function (){
  10536. var self=this,$self=this;
  10537. return $core.withContext(function($ctx1) {
  10538. return self.pop();;
  10539. return self;
  10540. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  10541. },
  10542. args: [],
  10543. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  10544. referencedClasses: [],
  10545. messageSends: []
  10546. }),
  10547. $globals.Array);
  10548. $core.addMethod(
  10549. $core.method({
  10550. selector: "reversed",
  10551. protocol: "converting",
  10552. fn: function (){
  10553. var self=this,$self=this;
  10554. return $core.withContext(function($ctx1) {
  10555. return self.slice().reverse();
  10556. return self;
  10557. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  10558. },
  10559. args: [],
  10560. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  10561. referencedClasses: [],
  10562. messageSends: []
  10563. }),
  10564. $globals.Array);
  10565. $core.addMethod(
  10566. $core.method({
  10567. selector: "select:",
  10568. protocol: "enumerating",
  10569. fn: function (aBlock){
  10570. var self=this,$self=this;
  10571. return $core.withContext(function($ctx1) {
  10572. return self.filter(function(each) {return aBlock._value_(each)});
  10573. return self;
  10574. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  10575. },
  10576. args: ["aBlock"],
  10577. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  10578. referencedClasses: [],
  10579. messageSends: []
  10580. }),
  10581. $globals.Array);
  10582. $core.addMethod(
  10583. $core.method({
  10584. selector: "shallowCopy",
  10585. protocol: "copying",
  10586. fn: function (){
  10587. var self=this,$self=this;
  10588. return $core.withContext(function($ctx1) {
  10589. return self.slice();
  10590. return self;
  10591. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  10592. },
  10593. args: [],
  10594. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  10595. referencedClasses: [],
  10596. messageSends: []
  10597. }),
  10598. $globals.Array);
  10599. $core.addMethod(
  10600. $core.method({
  10601. selector: "sort",
  10602. protocol: "enumerating",
  10603. fn: function (){
  10604. var self=this,$self=this;
  10605. return $core.withContext(function($ctx1) {
  10606. return $self._sort_((function(a,b){
  10607. return $core.withContext(function($ctx2) {
  10608. return $recv(a).__lt(b);
  10609. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  10610. }));
  10611. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  10612. },
  10613. args: [],
  10614. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  10615. referencedClasses: [],
  10616. messageSends: ["sort:", "<"]
  10617. }),
  10618. $globals.Array);
  10619. $core.addMethod(
  10620. $core.method({
  10621. selector: "sort:",
  10622. protocol: "enumerating",
  10623. fn: function (aBlock){
  10624. var self=this,$self=this;
  10625. return $core.withContext(function($ctx1) {
  10626. return self.sort(function(a, b) {
  10627. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  10628. })
  10629. ;
  10630. return self;
  10631. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  10632. },
  10633. args: ["aBlock"],
  10634. 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'>",
  10635. referencedClasses: [],
  10636. messageSends: []
  10637. }),
  10638. $globals.Array);
  10639. $core.addMethod(
  10640. $core.method({
  10641. selector: "sorted",
  10642. protocol: "enumerating",
  10643. fn: function (){
  10644. var self=this,$self=this;
  10645. return $core.withContext(function($ctx1) {
  10646. return $recv($self._copy())._sort();
  10647. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  10648. },
  10649. args: [],
  10650. source: "sorted\x0a\x09^ self copy sort",
  10651. referencedClasses: [],
  10652. messageSends: ["sort", "copy"]
  10653. }),
  10654. $globals.Array);
  10655. $core.addMethod(
  10656. $core.method({
  10657. selector: "sorted:",
  10658. protocol: "enumerating",
  10659. fn: function (aBlock){
  10660. var self=this,$self=this;
  10661. return $core.withContext(function($ctx1) {
  10662. return $recv($self._copy())._sort_(aBlock);
  10663. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  10664. },
  10665. args: ["aBlock"],
  10666. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  10667. referencedClasses: [],
  10668. messageSends: ["sort:", "copy"]
  10669. }),
  10670. $globals.Array);
  10671. $core.addMethod(
  10672. $core.method({
  10673. selector: "new:",
  10674. protocol: "instance creation",
  10675. fn: function (anInteger){
  10676. var self=this,$self=this;
  10677. return $core.withContext(function($ctx1) {
  10678. return new Array(anInteger);
  10679. return self;
  10680. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  10681. },
  10682. args: ["anInteger"],
  10683. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  10684. referencedClasses: [],
  10685. messageSends: []
  10686. }),
  10687. $globals.Array.a$cls);
  10688. $core.addMethod(
  10689. $core.method({
  10690. selector: "with:",
  10691. protocol: "instance creation",
  10692. fn: function (anObject){
  10693. var self=this,$self=this;
  10694. return $core.withContext(function($ctx1) {
  10695. var $1;
  10696. $1=$self._new_((1));
  10697. $recv($1)._at_put_((1),anObject);
  10698. return $recv($1)._yourself();
  10699. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  10700. },
  10701. args: ["anObject"],
  10702. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  10703. referencedClasses: [],
  10704. messageSends: ["at:put:", "new:", "yourself"]
  10705. }),
  10706. $globals.Array.a$cls);
  10707. $core.addMethod(
  10708. $core.method({
  10709. selector: "with:with:",
  10710. protocol: "instance creation",
  10711. fn: function (anObject,anObject2){
  10712. var self=this,$self=this;
  10713. return $core.withContext(function($ctx1) {
  10714. var $1;
  10715. $1=$self._new_((2));
  10716. $recv($1)._at_put_((1),anObject);
  10717. $ctx1.sendIdx["at:put:"]=1;
  10718. $recv($1)._at_put_((2),anObject2);
  10719. return $recv($1)._yourself();
  10720. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  10721. },
  10722. args: ["anObject", "anObject2"],
  10723. 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",
  10724. referencedClasses: [],
  10725. messageSends: ["at:put:", "new:", "yourself"]
  10726. }),
  10727. $globals.Array.a$cls);
  10728. $core.addMethod(
  10729. $core.method({
  10730. selector: "with:with:with:",
  10731. protocol: "instance creation",
  10732. fn: function (anObject,anObject2,anObject3){
  10733. var self=this,$self=this;
  10734. return $core.withContext(function($ctx1) {
  10735. var $1;
  10736. $1=$self._new_((3));
  10737. $recv($1)._at_put_((1),anObject);
  10738. $ctx1.sendIdx["at:put:"]=1;
  10739. $recv($1)._at_put_((2),anObject2);
  10740. $ctx1.sendIdx["at:put:"]=2;
  10741. $recv($1)._at_put_((3),anObject3);
  10742. return $recv($1)._yourself();
  10743. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  10744. },
  10745. args: ["anObject", "anObject2", "anObject3"],
  10746. 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",
  10747. referencedClasses: [],
  10748. messageSends: ["at:put:", "new:", "yourself"]
  10749. }),
  10750. $globals.Array.a$cls);
  10751. $core.addMethod(
  10752. $core.method({
  10753. selector: "withAll:",
  10754. protocol: "instance creation",
  10755. fn: function (aCollection){
  10756. var self=this,$self=this;
  10757. var instance,index;
  10758. return $core.withContext(function($ctx1) {
  10759. index=(1);
  10760. instance=$self._new_($recv(aCollection)._size());
  10761. $recv(aCollection)._do_((function(each){
  10762. return $core.withContext(function($ctx2) {
  10763. $recv(instance)._at_put_(index,each);
  10764. index=$recv(index).__plus((1));
  10765. return index;
  10766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10767. }));
  10768. return instance;
  10769. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  10770. },
  10771. args: ["aCollection"],
  10772. 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",
  10773. referencedClasses: [],
  10774. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  10775. }),
  10776. $globals.Array.a$cls);
  10777. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  10778. $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 >> #,`";
  10779. $core.addMethod(
  10780. $core.method({
  10781. selector: ",",
  10782. protocol: "copying",
  10783. fn: function (aString){
  10784. var self=this,$self=this;
  10785. return $core.withContext(function($ctx1) {
  10786. return String(self) + aString;
  10787. return self;
  10788. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  10789. },
  10790. args: ["aString"],
  10791. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  10792. referencedClasses: [],
  10793. messageSends: []
  10794. }),
  10795. $globals.String);
  10796. $core.addMethod(
  10797. $core.method({
  10798. selector: "<",
  10799. protocol: "comparing",
  10800. fn: function (aString){
  10801. var self=this,$self=this;
  10802. return $core.withContext(function($ctx1) {
  10803. return String(self) < aString._asString();
  10804. return self;
  10805. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  10806. },
  10807. args: ["aString"],
  10808. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  10809. referencedClasses: [],
  10810. messageSends: []
  10811. }),
  10812. $globals.String);
  10813. $core.addMethod(
  10814. $core.method({
  10815. selector: "<=",
  10816. protocol: "comparing",
  10817. fn: function (aString){
  10818. var self=this,$self=this;
  10819. return $core.withContext(function($ctx1) {
  10820. return String(self) <= aString._asString();
  10821. return self;
  10822. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  10823. },
  10824. args: ["aString"],
  10825. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  10826. referencedClasses: [],
  10827. messageSends: []
  10828. }),
  10829. $globals.String);
  10830. $core.addMethod(
  10831. $core.method({
  10832. selector: "=",
  10833. protocol: "comparing",
  10834. fn: function (aString){
  10835. var self=this,$self=this;
  10836. return $core.withContext(function($ctx1) {
  10837. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  10838. return self;
  10839. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  10840. },
  10841. args: ["aString"],
  10842. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  10843. referencedClasses: [],
  10844. messageSends: []
  10845. }),
  10846. $globals.String);
  10847. $core.addMethod(
  10848. $core.method({
  10849. selector: "==",
  10850. protocol: "comparing",
  10851. fn: function (aString){
  10852. var self=this,$self=this;
  10853. return $core.withContext(function($ctx1) {
  10854. if (typeof aString === "string") return String(self) === aString;
  10855. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  10856. else return false;;
  10857. return self;
  10858. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  10859. },
  10860. args: ["aString"],
  10861. 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'>",
  10862. referencedClasses: [],
  10863. messageSends: []
  10864. }),
  10865. $globals.String);
  10866. $core.addMethod(
  10867. $core.method({
  10868. selector: ">",
  10869. protocol: "comparing",
  10870. fn: function (aString){
  10871. var self=this,$self=this;
  10872. return $core.withContext(function($ctx1) {
  10873. return String(self) > aString._asString();
  10874. return self;
  10875. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  10876. },
  10877. args: ["aString"],
  10878. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  10879. referencedClasses: [],
  10880. messageSends: []
  10881. }),
  10882. $globals.String);
  10883. $core.addMethod(
  10884. $core.method({
  10885. selector: ">=",
  10886. protocol: "comparing",
  10887. fn: function (aString){
  10888. var self=this,$self=this;
  10889. return $core.withContext(function($ctx1) {
  10890. return String(self) >= aString._asString();
  10891. return self;
  10892. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  10893. },
  10894. args: ["aString"],
  10895. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  10896. referencedClasses: [],
  10897. messageSends: []
  10898. }),
  10899. $globals.String);
  10900. $core.addMethod(
  10901. $core.method({
  10902. selector: "add:",
  10903. protocol: "adding/removing",
  10904. fn: function (anObject){
  10905. var self=this,$self=this;
  10906. return $core.withContext(function($ctx1) {
  10907. $self._errorReadOnly();
  10908. return self;
  10909. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.String)});
  10910. },
  10911. args: ["anObject"],
  10912. source: "add: anObject\x0a\x09self errorReadOnly",
  10913. referencedClasses: [],
  10914. messageSends: ["errorReadOnly"]
  10915. }),
  10916. $globals.String);
  10917. $core.addMethod(
  10918. $core.method({
  10919. selector: "asJavaScriptMethodName",
  10920. protocol: "converting",
  10921. fn: function (){
  10922. var self=this,$self=this;
  10923. return $core.withContext(function($ctx1) {
  10924. return $core.st2js(self);
  10925. return self;
  10926. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  10927. },
  10928. args: [],
  10929. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  10930. referencedClasses: [],
  10931. messageSends: []
  10932. }),
  10933. $globals.String);
  10934. $core.addMethod(
  10935. $core.method({
  10936. selector: "asJavaScriptObject",
  10937. protocol: "converting",
  10938. fn: function (){
  10939. var self=this,$self=this;
  10940. return self;
  10941. },
  10942. args: [],
  10943. source: "asJavaScriptObject\x0a\x09^ self",
  10944. referencedClasses: [],
  10945. messageSends: []
  10946. }),
  10947. $globals.String);
  10948. $core.addMethod(
  10949. $core.method({
  10950. selector: "asJavaScriptSource",
  10951. protocol: "converting",
  10952. fn: function (){
  10953. var self=this,$self=this;
  10954. return $core.withContext(function($ctx1) {
  10955. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  10956. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  10957. else
  10958. return "\"" + self + "\"";
  10959. ;
  10960. return self;
  10961. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  10962. },
  10963. args: [],
  10964. 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'>",
  10965. referencedClasses: [],
  10966. messageSends: []
  10967. }),
  10968. $globals.String);
  10969. $core.addMethod(
  10970. $core.method({
  10971. selector: "asLowercase",
  10972. protocol: "converting",
  10973. fn: function (){
  10974. var self=this,$self=this;
  10975. return $core.withContext(function($ctx1) {
  10976. return self.toLowerCase();
  10977. return self;
  10978. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  10979. },
  10980. args: [],
  10981. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  10982. referencedClasses: [],
  10983. messageSends: []
  10984. }),
  10985. $globals.String);
  10986. $core.addMethod(
  10987. $core.method({
  10988. selector: "asMutator",
  10989. protocol: "converting",
  10990. fn: function (){
  10991. var self=this,$self=this;
  10992. return $core.withContext(function($ctx1) {
  10993. var $1;
  10994. $1=$recv($self._last()).__eq(":");
  10995. if(!$core.assert($1)){
  10996. return $self.__comma(":");
  10997. }
  10998. return self;
  10999. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  11000. },
  11001. args: [],
  11002. 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",
  11003. referencedClasses: [],
  11004. messageSends: ["ifFalse:", "=", "last", ","]
  11005. }),
  11006. $globals.String);
  11007. $core.addMethod(
  11008. $core.method({
  11009. selector: "asNumber",
  11010. protocol: "converting",
  11011. fn: function (){
  11012. var self=this,$self=this;
  11013. return $core.withContext(function($ctx1) {
  11014. return Number(self);
  11015. return self;
  11016. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  11017. },
  11018. args: [],
  11019. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  11020. referencedClasses: [],
  11021. messageSends: []
  11022. }),
  11023. $globals.String);
  11024. $core.addMethod(
  11025. $core.method({
  11026. selector: "asRegexp",
  11027. protocol: "converting",
  11028. fn: function (){
  11029. var self=this,$self=this;
  11030. return $core.withContext(function($ctx1) {
  11031. return $recv($globals.RegularExpression)._fromString_(self);
  11032. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  11033. },
  11034. args: [],
  11035. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11036. referencedClasses: ["RegularExpression"],
  11037. messageSends: ["fromString:"]
  11038. }),
  11039. $globals.String);
  11040. $core.addMethod(
  11041. $core.method({
  11042. selector: "asString",
  11043. protocol: "converting",
  11044. fn: function (){
  11045. var self=this,$self=this;
  11046. return self;
  11047. },
  11048. args: [],
  11049. source: "asString\x0a\x09^ self",
  11050. referencedClasses: [],
  11051. messageSends: []
  11052. }),
  11053. $globals.String);
  11054. $core.addMethod(
  11055. $core.method({
  11056. selector: "asSymbol",
  11057. protocol: "converting",
  11058. fn: function (){
  11059. var self=this,$self=this;
  11060. return self;
  11061. },
  11062. args: [],
  11063. source: "asSymbol\x0a\x09^ self",
  11064. referencedClasses: [],
  11065. messageSends: []
  11066. }),
  11067. $globals.String);
  11068. $core.addMethod(
  11069. $core.method({
  11070. selector: "asSymbolPrintOn:",
  11071. protocol: "printing",
  11072. fn: function (aStream){
  11073. var self=this,$self=this;
  11074. return $core.withContext(function($ctx1) {
  11075. var $1;
  11076. $recv(aStream)._nextPutAll_("#");
  11077. $1=$recv($self._asString())._isSelector();
  11078. if($core.assert($1)){
  11079. $recv(aStream)._nextPut_(self);
  11080. } else {
  11081. $self._printOn_(aStream);
  11082. }
  11083. return self;
  11084. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.String)});
  11085. },
  11086. args: ["aStream"],
  11087. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  11088. referencedClasses: [],
  11089. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  11090. }),
  11091. $globals.String);
  11092. $core.addMethod(
  11093. $core.method({
  11094. selector: "asUppercase",
  11095. protocol: "converting",
  11096. fn: function (){
  11097. var self=this,$self=this;
  11098. return $core.withContext(function($ctx1) {
  11099. return self.toUpperCase();
  11100. return self;
  11101. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  11102. },
  11103. args: [],
  11104. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  11105. referencedClasses: [],
  11106. messageSends: []
  11107. }),
  11108. $globals.String);
  11109. $core.addMethod(
  11110. $core.method({
  11111. selector: "asciiValue",
  11112. protocol: "accessing",
  11113. fn: function (){
  11114. var self=this,$self=this;
  11115. return $core.withContext(function($ctx1) {
  11116. return self.charCodeAt(0);;
  11117. return self;
  11118. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  11119. },
  11120. args: [],
  11121. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  11122. referencedClasses: [],
  11123. messageSends: []
  11124. }),
  11125. $globals.String);
  11126. $core.addMethod(
  11127. $core.method({
  11128. selector: "at:ifAbsent:",
  11129. protocol: "accessing",
  11130. fn: function (anIndex,aBlock){
  11131. var self=this,$self=this;
  11132. return $core.withContext(function($ctx1) {
  11133. return String(self)[anIndex - 1] || aBlock._value();
  11134. return self;
  11135. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  11136. },
  11137. args: ["anIndex", "aBlock"],
  11138. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  11139. referencedClasses: [],
  11140. messageSends: []
  11141. }),
  11142. $globals.String);
  11143. $core.addMethod(
  11144. $core.method({
  11145. selector: "at:ifPresent:ifAbsent:",
  11146. protocol: "accessing",
  11147. fn: function (anIndex,aBlock,anotherBlock){
  11148. var self=this,$self=this;
  11149. return $core.withContext(function($ctx1) {
  11150. var result = String(self)[anIndex - 1];
  11151. return result ? aBlock._value_(result) : anotherBlock._value();
  11152. ;
  11153. return self;
  11154. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  11155. },
  11156. args: ["anIndex", "aBlock", "anotherBlock"],
  11157. 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'>",
  11158. referencedClasses: [],
  11159. messageSends: []
  11160. }),
  11161. $globals.String);
  11162. $core.addMethod(
  11163. $core.method({
  11164. selector: "at:put:",
  11165. protocol: "accessing",
  11166. fn: function (anIndex,anObject){
  11167. var self=this,$self=this;
  11168. return $core.withContext(function($ctx1) {
  11169. $self._errorReadOnly();
  11170. return self;
  11171. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.String)});
  11172. },
  11173. args: ["anIndex", "anObject"],
  11174. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  11175. referencedClasses: [],
  11176. messageSends: ["errorReadOnly"]
  11177. }),
  11178. $globals.String);
  11179. $core.addMethod(
  11180. $core.method({
  11181. selector: "capitalized",
  11182. protocol: "converting",
  11183. fn: function (){
  11184. var self=this,$self=this;
  11185. return $core.withContext(function($ctx1) {
  11186. return $self._ifNotEmpty_((function(){
  11187. return $core.withContext(function($ctx2) {
  11188. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  11189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11190. }));
  11191. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  11192. },
  11193. args: [],
  11194. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  11195. referencedClasses: [],
  11196. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  11197. }),
  11198. $globals.String);
  11199. $core.addMethod(
  11200. $core.method({
  11201. selector: "charCodeAt:",
  11202. protocol: "accessing",
  11203. fn: function (anInteger){
  11204. var self=this,$self=this;
  11205. return $core.withContext(function($ctx1) {
  11206. return self.charCodeAt(anInteger - 1);
  11207. return self;
  11208. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  11209. },
  11210. args: ["anInteger"],
  11211. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  11212. referencedClasses: [],
  11213. messageSends: []
  11214. }),
  11215. $globals.String);
  11216. $core.addMethod(
  11217. $core.method({
  11218. selector: "copyFrom:to:",
  11219. protocol: "copying",
  11220. fn: function (anIndex,anotherIndex){
  11221. var self=this,$self=this;
  11222. return $core.withContext(function($ctx1) {
  11223. return self.substring(anIndex - 1, anotherIndex);
  11224. return self;
  11225. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  11226. },
  11227. args: ["anIndex", "anotherIndex"],
  11228. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  11229. referencedClasses: [],
  11230. messageSends: []
  11231. }),
  11232. $globals.String);
  11233. $core.addMethod(
  11234. $core.method({
  11235. selector: "crlfSanitized",
  11236. protocol: "converting",
  11237. fn: function (){
  11238. var self=this,$self=this;
  11239. return $core.withContext(function($ctx1) {
  11240. return $recv($self._lines())._join_($recv($globals.String)._lf());
  11241. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  11242. },
  11243. args: [],
  11244. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  11245. referencedClasses: ["String"],
  11246. messageSends: ["join:", "lines", "lf"]
  11247. }),
  11248. $globals.String);
  11249. $core.addMethod(
  11250. $core.method({
  11251. selector: "deepCopy",
  11252. protocol: "copying",
  11253. fn: function (){
  11254. var self=this,$self=this;
  11255. return $core.withContext(function($ctx1) {
  11256. return $self._shallowCopy();
  11257. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  11258. },
  11259. args: [],
  11260. source: "deepCopy\x0a\x09^ self shallowCopy",
  11261. referencedClasses: [],
  11262. messageSends: ["shallowCopy"]
  11263. }),
  11264. $globals.String);
  11265. $core.addMethod(
  11266. $core.method({
  11267. selector: "errorReadOnly",
  11268. protocol: "error handling",
  11269. fn: function (){
  11270. var self=this,$self=this;
  11271. return $core.withContext(function($ctx1) {
  11272. $self._error_("Object is read-only");
  11273. return self;
  11274. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.String)});
  11275. },
  11276. args: [],
  11277. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  11278. referencedClasses: [],
  11279. messageSends: ["error:"]
  11280. }),
  11281. $globals.String);
  11282. $core.addMethod(
  11283. $core.method({
  11284. selector: "escaped",
  11285. protocol: "converting",
  11286. fn: function (){
  11287. var self=this,$self=this;
  11288. return $core.withContext(function($ctx1) {
  11289. return escape(self);
  11290. return self;
  11291. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  11292. },
  11293. args: [],
  11294. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  11295. referencedClasses: [],
  11296. messageSends: []
  11297. }),
  11298. $globals.String);
  11299. $core.addMethod(
  11300. $core.method({
  11301. selector: "includesSubString:",
  11302. protocol: "testing",
  11303. fn: function (subString){
  11304. var self=this,$self=this;
  11305. return $core.withContext(function($ctx1) {
  11306. return self.indexOf(subString) != -1;
  11307. return self;
  11308. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  11309. },
  11310. args: ["subString"],
  11311. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  11312. referencedClasses: [],
  11313. messageSends: []
  11314. }),
  11315. $globals.String);
  11316. $core.addMethod(
  11317. $core.method({
  11318. selector: "isCapitalized",
  11319. protocol: "testing",
  11320. fn: function (){
  11321. var self=this,$self=this;
  11322. return $core.withContext(function($ctx1) {
  11323. var $2,$1;
  11324. $2=$self._first();
  11325. $ctx1.sendIdx["first"]=1;
  11326. $1=$recv($2)._asUppercase();
  11327. return $recv($1).__eq_eq($self._first());
  11328. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  11329. },
  11330. args: [],
  11331. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  11332. referencedClasses: [],
  11333. messageSends: ["==", "asUppercase", "first"]
  11334. }),
  11335. $globals.String);
  11336. $core.addMethod(
  11337. $core.method({
  11338. selector: "isImmutable",
  11339. protocol: "testing",
  11340. fn: function (){
  11341. var self=this,$self=this;
  11342. return true;
  11343. },
  11344. args: [],
  11345. source: "isImmutable\x0a\x09^ true",
  11346. referencedClasses: [],
  11347. messageSends: []
  11348. }),
  11349. $globals.String);
  11350. $core.addMethod(
  11351. $core.method({
  11352. selector: "isSelector",
  11353. protocol: "testing",
  11354. fn: function (){
  11355. var self=this,$self=this;
  11356. return $core.withContext(function($ctx1) {
  11357. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  11358. return self;
  11359. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  11360. },
  11361. args: [],
  11362. 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>",
  11363. referencedClasses: [],
  11364. messageSends: []
  11365. }),
  11366. $globals.String);
  11367. $core.addMethod(
  11368. $core.method({
  11369. selector: "isString",
  11370. protocol: "testing",
  11371. fn: function (){
  11372. var self=this,$self=this;
  11373. return true;
  11374. },
  11375. args: [],
  11376. source: "isString\x0a\x09^ true",
  11377. referencedClasses: [],
  11378. messageSends: []
  11379. }),
  11380. $globals.String);
  11381. $core.addMethod(
  11382. $core.method({
  11383. selector: "isVowel",
  11384. protocol: "testing",
  11385. fn: function (){
  11386. var self=this,$self=this;
  11387. return $core.withContext(function($ctx1) {
  11388. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  11389. return $core.withContext(function($ctx2) {
  11390. return "aeiou"._includes_($self._asLowercase());
  11391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11392. }));
  11393. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  11394. },
  11395. args: [],
  11396. 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 ]",
  11397. referencedClasses: [],
  11398. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  11399. }),
  11400. $globals.String);
  11401. $core.addMethod(
  11402. $core.method({
  11403. selector: "join:",
  11404. protocol: "split join",
  11405. fn: function (aCollection){
  11406. var self=this,$self=this;
  11407. return $core.withContext(function($ctx1) {
  11408. return $recv($globals.String)._streamContents_((function(stream){
  11409. return $core.withContext(function($ctx2) {
  11410. return $recv(aCollection)._do_separatedBy_((function(each){
  11411. return $core.withContext(function($ctx3) {
  11412. return $recv(stream)._nextPutAll_($recv(each)._asString());
  11413. $ctx3.sendIdx["nextPutAll:"]=1;
  11414. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  11415. }),(function(){
  11416. return $core.withContext(function($ctx3) {
  11417. return $recv(stream)._nextPutAll_(self);
  11418. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11419. }));
  11420. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  11421. }));
  11422. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  11423. },
  11424. args: ["aCollection"],
  11425. 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 ]]",
  11426. referencedClasses: ["String"],
  11427. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  11428. }),
  11429. $globals.String);
  11430. $core.addMethod(
  11431. $core.method({
  11432. selector: "lineIndicesDo:",
  11433. protocol: "split join",
  11434. fn: function (aBlock){
  11435. var self=this,$self=this;
  11436. var cr,lf,start,sz,nextLF,nextCR;
  11437. return $core.withContext(function($ctx1) {
  11438. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  11439. var $early={};
  11440. try {
  11441. start=(1);
  11442. sz=$self._size();
  11443. cr=$recv($globals.String)._cr();
  11444. nextCR=$self._indexOf_startingAt_(cr,(1));
  11445. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  11446. lf=$recv($globals.String)._lf();
  11447. nextLF=$self._indexOf_startingAt_(lf,(1));
  11448. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  11449. $recv((function(){
  11450. return $core.withContext(function($ctx2) {
  11451. return $recv(start).__lt_eq(sz);
  11452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11453. }))._whileTrue_((function(){
  11454. return $core.withContext(function($ctx2) {
  11455. $2=$recv(nextLF).__eq((0));
  11456. $ctx2.sendIdx["="]=1;
  11457. $1=$recv($2)._and_((function(){
  11458. return $core.withContext(function($ctx3) {
  11459. return $recv(nextCR).__eq((0));
  11460. $ctx3.sendIdx["="]=2;
  11461. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11462. }));
  11463. $ctx2.sendIdx["and:"]=1;
  11464. if($core.assert($1)){
  11465. $recv(aBlock)._value_value_value_(start,sz,sz);
  11466. $ctx2.sendIdx["value:value:value:"]=1;
  11467. throw $early=[self];
  11468. }
  11469. $4=$recv(nextCR).__eq((0));
  11470. $ctx2.sendIdx["="]=3;
  11471. $3=$recv($4)._or_((function(){
  11472. return $core.withContext(function($ctx3) {
  11473. $5=(0).__lt(nextLF);
  11474. $ctx3.sendIdx["<"]=1;
  11475. return $recv($5)._and_((function(){
  11476. return $core.withContext(function($ctx4) {
  11477. return $recv(nextLF).__lt(nextCR);
  11478. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  11479. }));
  11480. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  11481. }));
  11482. if($core.assert($3)){
  11483. $6=start;
  11484. $7=$recv(nextLF).__minus((1));
  11485. $ctx2.sendIdx["-"]=1;
  11486. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  11487. $ctx2.sendIdx["value:value:value:"]=2;
  11488. start=(1).__plus(nextLF);
  11489. $ctx2.sendIdx["+"]=1;
  11490. nextLF=$self._indexOf_startingAt_(lf,start);
  11491. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  11492. return nextLF;
  11493. } else {
  11494. $9=(1).__plus(nextCR);
  11495. $ctx2.sendIdx["+"]=2;
  11496. $8=$recv($9).__eq(nextLF);
  11497. if($core.assert($8)){
  11498. $10=start;
  11499. $11=$recv(nextCR).__minus((1));
  11500. $ctx2.sendIdx["-"]=2;
  11501. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  11502. $ctx2.sendIdx["value:value:value:"]=3;
  11503. start=(1).__plus(nextLF);
  11504. $ctx2.sendIdx["+"]=3;
  11505. nextCR=$self._indexOf_startingAt_(cr,start);
  11506. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  11507. nextLF=$self._indexOf_startingAt_(lf,start);
  11508. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  11509. return nextLF;
  11510. } else {
  11511. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  11512. start=(1).__plus(nextCR);
  11513. nextCR=$self._indexOf_startingAt_(cr,start);
  11514. return nextCR;
  11515. }
  11516. }
  11517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  11518. }));
  11519. return self;
  11520. }
  11521. catch(e) {if(e===$early)return e[0]; throw e}
  11522. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  11523. },
  11524. args: ["aBlock"],
  11525. 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 ] ]]",
  11526. referencedClasses: ["String"],
  11527. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  11528. }),
  11529. $globals.String);
  11530. $core.addMethod(
  11531. $core.method({
  11532. selector: "lineNumber:",
  11533. protocol: "split join",
  11534. fn: function (anIndex){
  11535. var self=this,$self=this;
  11536. var lineCount;
  11537. return $core.withContext(function($ctx1) {
  11538. var $2,$1;
  11539. var $early={};
  11540. try {
  11541. lineCount=(0);
  11542. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  11543. return $core.withContext(function($ctx2) {
  11544. lineCount=$recv(lineCount).__plus((1));
  11545. $2=lineCount;
  11546. $1=$recv($2).__eq(anIndex);
  11547. if($core.assert($1)){
  11548. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  11549. }
  11550. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  11551. }));
  11552. return nil;
  11553. }
  11554. catch(e) {if(e===$early)return e[0]; throw e}
  11555. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  11556. },
  11557. args: ["anIndex"],
  11558. 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",
  11559. referencedClasses: [],
  11560. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  11561. }),
  11562. $globals.String);
  11563. $core.addMethod(
  11564. $core.method({
  11565. selector: "lines",
  11566. protocol: "split join",
  11567. fn: function (){
  11568. var self=this,$self=this;
  11569. return $core.withContext(function($ctx1) {
  11570. var result = self.split(/\r\n|\r|\n/);
  11571. if (!result[result.length-1]) result.pop();
  11572. return result;;
  11573. return self;
  11574. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  11575. },
  11576. args: [],
  11577. 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'>",
  11578. referencedClasses: [],
  11579. messageSends: []
  11580. }),
  11581. $globals.String);
  11582. $core.addMethod(
  11583. $core.method({
  11584. selector: "linesDo:",
  11585. protocol: "split join",
  11586. fn: function (aBlock){
  11587. var self=this,$self=this;
  11588. return $core.withContext(function($ctx1) {
  11589. $recv($self._lines())._do_(aBlock);
  11590. return self;
  11591. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  11592. },
  11593. args: ["aBlock"],
  11594. 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",
  11595. referencedClasses: [],
  11596. messageSends: ["do:", "lines"]
  11597. }),
  11598. $globals.String);
  11599. $core.addMethod(
  11600. $core.method({
  11601. selector: "match:",
  11602. protocol: "regular expressions",
  11603. fn: function (aRegexp){
  11604. var self=this,$self=this;
  11605. return $core.withContext(function($ctx1) {
  11606. return self.search(aRegexp) != -1;
  11607. return self;
  11608. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  11609. },
  11610. args: ["aRegexp"],
  11611. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  11612. referencedClasses: [],
  11613. messageSends: []
  11614. }),
  11615. $globals.String);
  11616. $core.addMethod(
  11617. $core.method({
  11618. selector: "matchesOf:",
  11619. protocol: "regular expressions",
  11620. fn: function (aRegularExpression){
  11621. var self=this,$self=this;
  11622. return $core.withContext(function($ctx1) {
  11623. return self.match(aRegularExpression);
  11624. return self;
  11625. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  11626. },
  11627. args: ["aRegularExpression"],
  11628. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  11629. referencedClasses: [],
  11630. messageSends: []
  11631. }),
  11632. $globals.String);
  11633. $core.addMethod(
  11634. $core.method({
  11635. selector: "printNl",
  11636. protocol: "printing",
  11637. fn: function (){
  11638. var self=this,$self=this;
  11639. return $core.withContext(function($ctx1) {
  11640. console.log(self);
  11641. return self;
  11642. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  11643. },
  11644. args: [],
  11645. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  11646. referencedClasses: [],
  11647. messageSends: []
  11648. }),
  11649. $globals.String);
  11650. $core.addMethod(
  11651. $core.method({
  11652. selector: "printOn:",
  11653. protocol: "printing",
  11654. fn: function (aStream){
  11655. var self=this,$self=this;
  11656. return $core.withContext(function($ctx1) {
  11657. $recv(aStream)._nextPutAll_("'");
  11658. $ctx1.sendIdx["nextPutAll:"]=1;
  11659. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  11660. $ctx1.sendIdx["nextPutAll:"]=2;
  11661. $recv(aStream)._nextPutAll_("'");
  11662. return self;
  11663. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  11664. },
  11665. args: ["aStream"],
  11666. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  11667. referencedClasses: [],
  11668. messageSends: ["nextPutAll:", "replace:with:"]
  11669. }),
  11670. $globals.String);
  11671. $core.addMethod(
  11672. $core.method({
  11673. selector: "putOn:",
  11674. protocol: "streaming",
  11675. fn: function (aStream){
  11676. var self=this,$self=this;
  11677. return $core.withContext(function($ctx1) {
  11678. $recv(aStream)._nextPutString_(self);
  11679. return self;
  11680. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.String)});
  11681. },
  11682. args: ["aStream"],
  11683. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  11684. referencedClasses: [],
  11685. messageSends: ["nextPutString:"]
  11686. }),
  11687. $globals.String);
  11688. $core.addMethod(
  11689. $core.method({
  11690. selector: "remove:",
  11691. protocol: "adding/removing",
  11692. fn: function (anObject){
  11693. var self=this,$self=this;
  11694. return $core.withContext(function($ctx1) {
  11695. $self._errorReadOnly();
  11696. return self;
  11697. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.String)});
  11698. },
  11699. args: ["anObject"],
  11700. source: "remove: anObject\x0a\x09self errorReadOnly",
  11701. referencedClasses: [],
  11702. messageSends: ["errorReadOnly"]
  11703. }),
  11704. $globals.String);
  11705. $core.addMethod(
  11706. $core.method({
  11707. selector: "remove:ifAbsent:",
  11708. protocol: "adding/removing",
  11709. fn: function (anObject,aBlock){
  11710. var self=this,$self=this;
  11711. return $core.withContext(function($ctx1) {
  11712. $self._errorReadOnly();
  11713. return self;
  11714. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.String)});
  11715. },
  11716. args: ["anObject", "aBlock"],
  11717. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  11718. referencedClasses: [],
  11719. messageSends: ["errorReadOnly"]
  11720. }),
  11721. $globals.String);
  11722. $core.addMethod(
  11723. $core.method({
  11724. selector: "replace:with:",
  11725. protocol: "regular expressions",
  11726. fn: function (aString,anotherString){
  11727. var self=this,$self=this;
  11728. return $core.withContext(function($ctx1) {
  11729. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  11730. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  11731. },
  11732. args: ["aString", "anotherString"],
  11733. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  11734. referencedClasses: ["RegularExpression"],
  11735. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  11736. }),
  11737. $globals.String);
  11738. $core.addMethod(
  11739. $core.method({
  11740. selector: "replaceRegexp:with:",
  11741. protocol: "regular expressions",
  11742. fn: function (aRegexp,aString){
  11743. var self=this,$self=this;
  11744. return $core.withContext(function($ctx1) {
  11745. return self.replace(aRegexp, aString);
  11746. return self;
  11747. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  11748. },
  11749. args: ["aRegexp", "aString"],
  11750. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  11751. referencedClasses: [],
  11752. messageSends: []
  11753. }),
  11754. $globals.String);
  11755. $core.addMethod(
  11756. $core.method({
  11757. selector: "reversed",
  11758. protocol: "converting",
  11759. fn: function (){
  11760. var self=this,$self=this;
  11761. return $core.withContext(function($ctx1) {
  11762. return self.split("").reverse().join("");
  11763. return self;
  11764. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  11765. },
  11766. args: [],
  11767. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  11768. referencedClasses: [],
  11769. messageSends: []
  11770. }),
  11771. $globals.String);
  11772. $core.addMethod(
  11773. $core.method({
  11774. selector: "shallowCopy",
  11775. protocol: "copying",
  11776. fn: function (){
  11777. var self=this,$self=this;
  11778. return self;
  11779. },
  11780. args: [],
  11781. source: "shallowCopy\x0a\x09^ self",
  11782. referencedClasses: [],
  11783. messageSends: []
  11784. }),
  11785. $globals.String);
  11786. $core.addMethod(
  11787. $core.method({
  11788. selector: "subStrings:",
  11789. protocol: "split join",
  11790. fn: function (aString){
  11791. var self=this,$self=this;
  11792. return $core.withContext(function($ctx1) {
  11793. return $self._tokenize_(aString);
  11794. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  11795. },
  11796. args: ["aString"],
  11797. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  11798. referencedClasses: [],
  11799. messageSends: ["tokenize:"]
  11800. }),
  11801. $globals.String);
  11802. $core.addMethod(
  11803. $core.method({
  11804. selector: "symbolPrintString",
  11805. protocol: "printing",
  11806. fn: function (){
  11807. var self=this,$self=this;
  11808. return $core.withContext(function($ctx1) {
  11809. return $recv($globals.String)._streamContents_((function(str){
  11810. return $core.withContext(function($ctx2) {
  11811. return $self._asSymbolPrintOn_(str);
  11812. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  11813. }));
  11814. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.String)});
  11815. },
  11816. args: [],
  11817. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  11818. referencedClasses: ["String"],
  11819. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  11820. }),
  11821. $globals.String);
  11822. $core.addMethod(
  11823. $core.method({
  11824. selector: "tokenize:",
  11825. protocol: "split join",
  11826. fn: function (aString){
  11827. var self=this,$self=this;
  11828. return $core.withContext(function($ctx1) {
  11829. return self.split(aString);
  11830. return self;
  11831. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  11832. },
  11833. args: ["aString"],
  11834. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  11835. referencedClasses: [],
  11836. messageSends: []
  11837. }),
  11838. $globals.String);
  11839. $core.addMethod(
  11840. $core.method({
  11841. selector: "trimBoth",
  11842. protocol: "regular expressions",
  11843. fn: function (){
  11844. var self=this,$self=this;
  11845. return $core.withContext(function($ctx1) {
  11846. return $self._trimBoth_("\x5cs");
  11847. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  11848. },
  11849. args: [],
  11850. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  11851. referencedClasses: [],
  11852. messageSends: ["trimBoth:"]
  11853. }),
  11854. $globals.String);
  11855. $core.addMethod(
  11856. $core.method({
  11857. selector: "trimBoth:",
  11858. protocol: "regular expressions",
  11859. fn: function (separators){
  11860. var self=this,$self=this;
  11861. return $core.withContext(function($ctx1) {
  11862. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  11863. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  11864. },
  11865. args: ["separators"],
  11866. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  11867. referencedClasses: [],
  11868. messageSends: ["trimRight:", "trimLeft:"]
  11869. }),
  11870. $globals.String);
  11871. $core.addMethod(
  11872. $core.method({
  11873. selector: "trimLeft",
  11874. protocol: "regular expressions",
  11875. fn: function (){
  11876. var self=this,$self=this;
  11877. return $core.withContext(function($ctx1) {
  11878. return $self._trimLeft_("\x5cs");
  11879. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  11880. },
  11881. args: [],
  11882. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  11883. referencedClasses: [],
  11884. messageSends: ["trimLeft:"]
  11885. }),
  11886. $globals.String);
  11887. $core.addMethod(
  11888. $core.method({
  11889. selector: "trimLeft:",
  11890. protocol: "regular expressions",
  11891. fn: function (separators){
  11892. var self=this,$self=this;
  11893. return $core.withContext(function($ctx1) {
  11894. var $2,$1;
  11895. $2=$recv("^[".__comma(separators)).__comma("]+");
  11896. $ctx1.sendIdx[","]=1;
  11897. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  11898. return $self._replaceRegexp_with_($1,"");
  11899. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  11900. },
  11901. args: ["separators"],
  11902. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  11903. referencedClasses: ["RegularExpression"],
  11904. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  11905. }),
  11906. $globals.String);
  11907. $core.addMethod(
  11908. $core.method({
  11909. selector: "trimRight",
  11910. protocol: "regular expressions",
  11911. fn: function (){
  11912. var self=this,$self=this;
  11913. return $core.withContext(function($ctx1) {
  11914. return $self._trimRight_("\x5cs");
  11915. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  11916. },
  11917. args: [],
  11918. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  11919. referencedClasses: [],
  11920. messageSends: ["trimRight:"]
  11921. }),
  11922. $globals.String);
  11923. $core.addMethod(
  11924. $core.method({
  11925. selector: "trimRight:",
  11926. protocol: "regular expressions",
  11927. fn: function (separators){
  11928. var self=this,$self=this;
  11929. return $core.withContext(function($ctx1) {
  11930. var $2,$1;
  11931. $2=$recv("[".__comma(separators)).__comma("]+$");
  11932. $ctx1.sendIdx[","]=1;
  11933. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  11934. return $self._replaceRegexp_with_($1,"");
  11935. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  11936. },
  11937. args: ["separators"],
  11938. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  11939. referencedClasses: ["RegularExpression"],
  11940. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  11941. }),
  11942. $globals.String);
  11943. $core.addMethod(
  11944. $core.method({
  11945. selector: "unescaped",
  11946. protocol: "converting",
  11947. fn: function (){
  11948. var self=this,$self=this;
  11949. return $core.withContext(function($ctx1) {
  11950. return unescape(self);
  11951. return self;
  11952. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  11953. },
  11954. args: [],
  11955. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  11956. referencedClasses: [],
  11957. messageSends: []
  11958. }),
  11959. $globals.String);
  11960. $core.addMethod(
  11961. $core.method({
  11962. selector: "uriComponentDecoded",
  11963. protocol: "converting",
  11964. fn: function (){
  11965. var self=this,$self=this;
  11966. return $core.withContext(function($ctx1) {
  11967. return decodeURIComponent(self);
  11968. return self;
  11969. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  11970. },
  11971. args: [],
  11972. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  11973. referencedClasses: [],
  11974. messageSends: []
  11975. }),
  11976. $globals.String);
  11977. $core.addMethod(
  11978. $core.method({
  11979. selector: "uriComponentEncoded",
  11980. protocol: "converting",
  11981. fn: function (){
  11982. var self=this,$self=this;
  11983. return $core.withContext(function($ctx1) {
  11984. return encodeURIComponent(self);
  11985. return self;
  11986. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  11987. },
  11988. args: [],
  11989. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  11990. referencedClasses: [],
  11991. messageSends: []
  11992. }),
  11993. $globals.String);
  11994. $core.addMethod(
  11995. $core.method({
  11996. selector: "uriDecoded",
  11997. protocol: "converting",
  11998. fn: function (){
  11999. var self=this,$self=this;
  12000. return $core.withContext(function($ctx1) {
  12001. return decodeURI(self);
  12002. return self;
  12003. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  12004. },
  12005. args: [],
  12006. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  12007. referencedClasses: [],
  12008. messageSends: []
  12009. }),
  12010. $globals.String);
  12011. $core.addMethod(
  12012. $core.method({
  12013. selector: "uriEncoded",
  12014. protocol: "converting",
  12015. fn: function (){
  12016. var self=this,$self=this;
  12017. return $core.withContext(function($ctx1) {
  12018. return encodeURI(self);
  12019. return self;
  12020. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  12021. },
  12022. args: [],
  12023. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  12024. referencedClasses: [],
  12025. messageSends: []
  12026. }),
  12027. $globals.String);
  12028. $core.addMethod(
  12029. $core.method({
  12030. selector: "value:",
  12031. protocol: "evaluating",
  12032. fn: function (anObject){
  12033. var self=this,$self=this;
  12034. return $core.withContext(function($ctx1) {
  12035. return $recv(anObject)._perform_(self);
  12036. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  12037. },
  12038. args: ["anObject"],
  12039. source: "value: anObject \x0a\x09^ anObject perform: self",
  12040. referencedClasses: [],
  12041. messageSends: ["perform:"]
  12042. }),
  12043. $globals.String);
  12044. $core.addMethod(
  12045. $core.method({
  12046. selector: "cr",
  12047. protocol: "accessing",
  12048. fn: function (){
  12049. var self=this,$self=this;
  12050. return $core.withContext(function($ctx1) {
  12051. return "\r";
  12052. return self;
  12053. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  12054. },
  12055. args: [],
  12056. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  12057. referencedClasses: [],
  12058. messageSends: []
  12059. }),
  12060. $globals.String.a$cls);
  12061. $core.addMethod(
  12062. $core.method({
  12063. selector: "crlf",
  12064. protocol: "accessing",
  12065. fn: function (){
  12066. var self=this,$self=this;
  12067. return $core.withContext(function($ctx1) {
  12068. return "\r\n";
  12069. return self;
  12070. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  12071. },
  12072. args: [],
  12073. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  12074. referencedClasses: [],
  12075. messageSends: []
  12076. }),
  12077. $globals.String.a$cls);
  12078. $core.addMethod(
  12079. $core.method({
  12080. selector: "esc",
  12081. protocol: "accessing",
  12082. fn: function (){
  12083. var self=this,$self=this;
  12084. return $core.withContext(function($ctx1) {
  12085. return $self._fromCharCode_((27));
  12086. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  12087. },
  12088. args: [],
  12089. source: "esc\x0a\x09^ self fromCharCode: 27",
  12090. referencedClasses: [],
  12091. messageSends: ["fromCharCode:"]
  12092. }),
  12093. $globals.String.a$cls);
  12094. $core.addMethod(
  12095. $core.method({
  12096. selector: "fromCharCode:",
  12097. protocol: "instance creation",
  12098. fn: function (anInteger){
  12099. var self=this,$self=this;
  12100. return $core.withContext(function($ctx1) {
  12101. return String.fromCharCode(anInteger);
  12102. return self;
  12103. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  12104. },
  12105. args: ["anInteger"],
  12106. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  12107. referencedClasses: [],
  12108. messageSends: []
  12109. }),
  12110. $globals.String.a$cls);
  12111. $core.addMethod(
  12112. $core.method({
  12113. selector: "fromString:",
  12114. protocol: "instance creation",
  12115. fn: function (aString){
  12116. var self=this,$self=this;
  12117. return $core.withContext(function($ctx1) {
  12118. return String(aString);
  12119. return self;
  12120. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  12121. },
  12122. args: ["aString"],
  12123. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  12124. referencedClasses: [],
  12125. messageSends: []
  12126. }),
  12127. $globals.String.a$cls);
  12128. $core.addMethod(
  12129. $core.method({
  12130. selector: "lf",
  12131. protocol: "accessing",
  12132. fn: function (){
  12133. var self=this,$self=this;
  12134. return $core.withContext(function($ctx1) {
  12135. return "\n";
  12136. return self;
  12137. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  12138. },
  12139. args: [],
  12140. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  12141. referencedClasses: [],
  12142. messageSends: []
  12143. }),
  12144. $globals.String.a$cls);
  12145. $core.addMethod(
  12146. $core.method({
  12147. selector: "random",
  12148. protocol: "random",
  12149. fn: function (){
  12150. var self=this,$self=this;
  12151. return $core.withContext(function($ctx1) {
  12152. return ((10+22*Math.random())/32).toString(32).slice(2);;
  12153. return self;
  12154. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  12155. },
  12156. args: [],
  12157. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return ((10+22*Math.random())/32).toString(32).slice(2);'>",
  12158. referencedClasses: [],
  12159. messageSends: []
  12160. }),
  12161. $globals.String.a$cls);
  12162. $core.addMethod(
  12163. $core.method({
  12164. selector: "randomNotIn:",
  12165. protocol: "random",
  12166. fn: function (aString){
  12167. var self=this,$self=this;
  12168. var result;
  12169. return $core.withContext(function($ctx1) {
  12170. $recv((function(){
  12171. return $core.withContext(function($ctx2) {
  12172. result=$self._random();
  12173. return $recv(aString)._includesSubString_(result);
  12174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12175. }))._whileTrue();
  12176. return result;
  12177. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  12178. },
  12179. args: ["aString"],
  12180. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  12181. referencedClasses: [],
  12182. messageSends: ["whileTrue", "random", "includesSubString:"]
  12183. }),
  12184. $globals.String.a$cls);
  12185. $core.addMethod(
  12186. $core.method({
  12187. selector: "space",
  12188. protocol: "accessing",
  12189. fn: function (){
  12190. var self=this,$self=this;
  12191. return $core.withContext(function($ctx1) {
  12192. return " ";
  12193. return self;
  12194. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  12195. },
  12196. args: [],
  12197. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  12198. referencedClasses: [],
  12199. messageSends: []
  12200. }),
  12201. $globals.String.a$cls);
  12202. $core.addMethod(
  12203. $core.method({
  12204. selector: "streamClass",
  12205. protocol: "accessing",
  12206. fn: function (){
  12207. var self=this,$self=this;
  12208. return $globals.StringStream;
  12209. },
  12210. args: [],
  12211. source: "streamClass\x0a\x09\x09^ StringStream",
  12212. referencedClasses: ["StringStream"],
  12213. messageSends: []
  12214. }),
  12215. $globals.String.a$cls);
  12216. $core.addMethod(
  12217. $core.method({
  12218. selector: "tab",
  12219. protocol: "accessing",
  12220. fn: function (){
  12221. var self=this,$self=this;
  12222. return $core.withContext(function($ctx1) {
  12223. return "\t";
  12224. return self;
  12225. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  12226. },
  12227. args: [],
  12228. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  12229. referencedClasses: [],
  12230. messageSends: []
  12231. }),
  12232. $globals.String.a$cls);
  12233. $core.addMethod(
  12234. $core.method({
  12235. selector: "value:",
  12236. protocol: "instance creation",
  12237. fn: function (aUTFCharCode){
  12238. var self=this,$self=this;
  12239. return $core.withContext(function($ctx1) {
  12240. return String.fromCharCode(aUTFCharCode);;
  12241. return self;
  12242. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  12243. },
  12244. args: ["aUTFCharCode"],
  12245. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  12246. referencedClasses: [],
  12247. messageSends: []
  12248. }),
  12249. $globals.String.a$cls);
  12250. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  12251. $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`.";
  12252. $core.addMethod(
  12253. $core.method({
  12254. selector: "=",
  12255. protocol: "comparing",
  12256. fn: function (aCollection){
  12257. var self=this,$self=this;
  12258. return $core.withContext(function($ctx1) {
  12259. var $2,$1,$4,$3,$5;
  12260. var $early={};
  12261. try {
  12262. $2=$self._class();
  12263. $ctx1.sendIdx["class"]=1;
  12264. $1=$recv($2).__eq($recv(aCollection)._class());
  12265. $ctx1.sendIdx["="]=1;
  12266. if(!$core.assert($1)){
  12267. return false;
  12268. }
  12269. $4=$self._size();
  12270. $ctx1.sendIdx["size"]=1;
  12271. $3=$recv($4).__eq($recv(aCollection)._size());
  12272. if(!$core.assert($3)){
  12273. return false;
  12274. }
  12275. $self._do_((function(each){
  12276. return $core.withContext(function($ctx2) {
  12277. $5=$recv(aCollection)._includes_(each);
  12278. if(!$core.assert($5)){
  12279. throw $early=[false];
  12280. }
  12281. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  12282. }));
  12283. return true;
  12284. }
  12285. catch(e) {if(e===$early)return e[0]; throw e}
  12286. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  12287. },
  12288. args: ["aCollection"],
  12289. 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",
  12290. referencedClasses: [],
  12291. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  12292. }),
  12293. $globals.Set);
  12294. $core.addMethod(
  12295. $core.method({
  12296. selector: "add:",
  12297. protocol: "adding/removing",
  12298. fn: function (anObject){
  12299. var self=this,$self=this;
  12300. var bucket;
  12301. return $core.withContext(function($ctx1) {
  12302. var $1,$receiver;
  12303. bucket=$self._bucketsOfElement_(anObject);
  12304. $1=$recv(bucket)._second();
  12305. if(($receiver = $1) == null || $receiver.a$nil){
  12306. var object,slowBucket;
  12307. object=$recv(bucket)._first();
  12308. $ctx1.sendIdx["first"]=1;
  12309. slowBucket=$recv(bucket)._third();
  12310. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  12311. return $core.withContext(function($ctx2) {
  12312. $recv(slowBucket)._add_(object);
  12313. $self["@size"]=$recv($self["@size"]).__plus((1));
  12314. return $self["@size"];
  12315. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12316. }));
  12317. return object;
  12318. } else {
  12319. var primitiveBucket;
  12320. primitiveBucket=$receiver;
  12321. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  12322. }
  12323. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12324. },
  12325. args: ["anObject"],
  12326. 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 ]",
  12327. referencedClasses: [],
  12328. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  12329. }),
  12330. $globals.Set);
  12331. $core.addMethod(
  12332. $core.method({
  12333. selector: "add:in:",
  12334. protocol: "private",
  12335. fn: function (anObject,anotherObject){
  12336. var self=this,$self=this;
  12337. return $core.withContext(function($ctx1) {
  12338. if (anObject in anotherObject.store) { return anObject; }
  12339. $self['@size']++;
  12340. anotherObject.store[anObject] = true;
  12341. return anObject;
  12342. ;
  12343. return self;
  12344. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12345. },
  12346. args: ["anObject", "anotherObject"],
  12347. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return anObject; }\x0a\x09\x09$self[''@size'']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  12348. referencedClasses: [],
  12349. messageSends: []
  12350. }),
  12351. $globals.Set);
  12352. $core.addMethod(
  12353. $core.method({
  12354. selector: "bucketsOfElement:",
  12355. protocol: "private",
  12356. fn: function (anObject){
  12357. var self=this,$self=this;
  12358. return $core.withContext(function($ctx1) {
  12359. // include nil to well-known objects under "boolean" fastBucket
  12360. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  12361. var prim = anObject.valueOf();
  12362. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  12363. var bucket = null;
  12364. $self['@slowBucketStores'].some(function (store) {
  12365. return bucket = store._bucketOfElement_(anObject);
  12366. });
  12367. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  12368. }
  12369. return [ prim, $self['@fastBuckets'][typeof prim] ];
  12370. ;
  12371. return self;
  12372. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  12373. },
  12374. args: ["anObject"],
  12375. 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'>",
  12376. referencedClasses: [],
  12377. messageSends: []
  12378. }),
  12379. $globals.Set);
  12380. $core.addMethod(
  12381. $core.method({
  12382. selector: "classNameOf:",
  12383. protocol: "private",
  12384. fn: function (anObject){
  12385. var self=this,$self=this;
  12386. return $core.withContext(function($ctx1) {
  12387. return anObject.a$cls != null && anObject.a$cls.name;
  12388. return self;
  12389. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  12390. },
  12391. args: ["anObject"],
  12392. 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'>",
  12393. referencedClasses: [],
  12394. messageSends: []
  12395. }),
  12396. $globals.Set);
  12397. $core.addMethod(
  12398. $core.method({
  12399. selector: "collect:",
  12400. protocol: "enumerating",
  12401. fn: function (aBlock){
  12402. var self=this,$self=this;
  12403. var collection;
  12404. return $core.withContext(function($ctx1) {
  12405. collection=$recv($self._class())._new();
  12406. $self._do_((function(each){
  12407. return $core.withContext(function($ctx2) {
  12408. return $recv(collection)._add_($recv(aBlock)._value_(each));
  12409. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12410. }));
  12411. return collection;
  12412. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12413. },
  12414. args: ["aBlock"],
  12415. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  12416. referencedClasses: [],
  12417. messageSends: ["new", "class", "do:", "add:", "value:"]
  12418. }),
  12419. $globals.Set);
  12420. $core.addMethod(
  12421. $core.method({
  12422. selector: "do:",
  12423. protocol: "enumerating",
  12424. fn: function (aBlock){
  12425. var self=this,$self=this;
  12426. return $core.withContext(function($ctx1) {
  12427. var el, keys, i;
  12428. el = $self['@fastBuckets'];
  12429. keys = Object.keys(el);
  12430. for (i = 0; i < keys.length; ++i) {
  12431. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  12432. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  12433. else { store._do_(aBlock); }
  12434. }
  12435. el = $self['@slowBucketStores'];
  12436. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  12437. $self['@defaultBucket']._do_(aBlock);
  12438. ;
  12439. return self;
  12440. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  12441. },
  12442. args: ["aBlock"],
  12443. 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'>",
  12444. referencedClasses: [],
  12445. messageSends: []
  12446. }),
  12447. $globals.Set);
  12448. $core.addMethod(
  12449. $core.method({
  12450. selector: "includes:",
  12451. protocol: "testing",
  12452. fn: function (anObject){
  12453. var self=this,$self=this;
  12454. var bucket;
  12455. return $core.withContext(function($ctx1) {
  12456. var $1,$2,$3,$receiver;
  12457. bucket=$self._bucketsOfElement_(anObject);
  12458. $1=$recv(bucket)._second();
  12459. if(($receiver = $1) == null || $receiver.a$nil){
  12460. $2=$recv(bucket)._third();
  12461. $3=$recv(bucket)._first();
  12462. $ctx1.sendIdx["first"]=1;
  12463. return $recv($2)._includes_($3);
  12464. } else {
  12465. var primitiveBucket;
  12466. primitiveBucket=$receiver;
  12467. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  12468. }
  12469. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12470. },
  12471. args: ["anObject"],
  12472. 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 ]",
  12473. referencedClasses: [],
  12474. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  12475. }),
  12476. $globals.Set);
  12477. $core.addMethod(
  12478. $core.method({
  12479. selector: "includes:in:",
  12480. protocol: "private",
  12481. fn: function (anObject,anotherObject){
  12482. var self=this,$self=this;
  12483. return $core.withContext(function($ctx1) {
  12484. return anObject in anotherObject.store;
  12485. return self;
  12486. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12487. },
  12488. args: ["anObject", "anotherObject"],
  12489. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  12490. referencedClasses: [],
  12491. messageSends: []
  12492. }),
  12493. $globals.Set);
  12494. $core.addMethod(
  12495. $core.method({
  12496. selector: "initialize",
  12497. protocol: "initialization",
  12498. fn: function (){
  12499. var self=this,$self=this;
  12500. return $core.withContext(function($ctx1) {
  12501. (
  12502. $ctx1.supercall = true,
  12503. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  12504. $ctx1.supercall = false;
  12505. $self["@defaultBucket"]=[];
  12506. $self._initializeSlowBucketStores();
  12507. $self._removeAll();
  12508. return self;
  12509. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  12510. },
  12511. args: [],
  12512. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  12513. referencedClasses: [],
  12514. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  12515. }),
  12516. $globals.Set);
  12517. $core.addMethod(
  12518. $core.method({
  12519. selector: "initializeSlowBucketStores",
  12520. protocol: "initialization",
  12521. fn: function (){
  12522. var self=this,$self=this;
  12523. return $core.withContext(function($ctx1) {
  12524. var $1;
  12525. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  12526. return $core.withContext(function($ctx2) {
  12527. return $self._classNameOf_(x);
  12528. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  12529. }));
  12530. $ctx1.sendIdx["hashBlock:"]=1;
  12531. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  12532. return $core.withContext(function($ctx2) {
  12533. return $self._jsConstructorNameOf_(x);
  12534. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  12535. }))];
  12536. return self;
  12537. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  12538. },
  12539. args: [],
  12540. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  12541. referencedClasses: ["ArrayBucketStore"],
  12542. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  12543. }),
  12544. $globals.Set);
  12545. $core.addMethod(
  12546. $core.method({
  12547. selector: "jsConstructorNameOf:",
  12548. protocol: "private",
  12549. fn: function (anObject){
  12550. var self=this,$self=this;
  12551. return $core.withContext(function($ctx1) {
  12552. return anObject.constructor && anObject.constructor.name;
  12553. return self;
  12554. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  12555. },
  12556. args: ["anObject"],
  12557. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  12558. referencedClasses: [],
  12559. messageSends: []
  12560. }),
  12561. $globals.Set);
  12562. $core.addMethod(
  12563. $core.method({
  12564. selector: "printOn:",
  12565. protocol: "printing",
  12566. fn: function (aStream){
  12567. var self=this,$self=this;
  12568. return $core.withContext(function($ctx1) {
  12569. (
  12570. $ctx1.supercall = true,
  12571. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  12572. $ctx1.supercall = false;
  12573. $ctx1.sendIdx["printOn:"]=1;
  12574. $recv(aStream)._nextPutAll_(" (");
  12575. $ctx1.sendIdx["nextPutAll:"]=1;
  12576. $self._do_separatedBy_((function(each){
  12577. return $core.withContext(function($ctx2) {
  12578. return $recv(each)._printOn_(aStream);
  12579. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12580. }),(function(){
  12581. return $core.withContext(function($ctx2) {
  12582. return $recv(aStream)._nextPutAll_(" ");
  12583. $ctx2.sendIdx["nextPutAll:"]=2;
  12584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12585. }));
  12586. $recv(aStream)._nextPutAll_(")");
  12587. return self;
  12588. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  12589. },
  12590. args: ["aStream"],
  12591. 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: ')'",
  12592. referencedClasses: [],
  12593. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  12594. }),
  12595. $globals.Set);
  12596. $core.addMethod(
  12597. $core.method({
  12598. selector: "remove:ifAbsent:",
  12599. protocol: "adding/removing",
  12600. fn: function (anObject,aBlock){
  12601. var self=this,$self=this;
  12602. var bucket;
  12603. return $core.withContext(function($ctx1) {
  12604. var $1,$2,$3,$receiver;
  12605. var $early={};
  12606. try {
  12607. bucket=$self._bucketsOfElement_(anObject);
  12608. $1=$recv(bucket)._second();
  12609. if(($receiver = $1) == null || $receiver.a$nil){
  12610. $2=$recv(bucket)._third();
  12611. $3=$recv(bucket)._first();
  12612. $ctx1.sendIdx["first"]=1;
  12613. $recv($2)._remove_ifAbsent_($3,(function(){
  12614. return $core.withContext(function($ctx2) {
  12615. throw $early=[$recv(aBlock)._value()];
  12616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12617. }));
  12618. $self["@size"]=$recv($self["@size"]).__minus((1));
  12619. return $self["@size"];
  12620. } else {
  12621. var primitiveBucket;
  12622. primitiveBucket=$receiver;
  12623. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  12624. }
  12625. }
  12626. catch(e) {if(e===$early)return e[0]; throw e}
  12627. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  12628. },
  12629. args: ["anObject", "aBlock"],
  12630. 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 ifAbsent: aBlock ]",
  12631. referencedClasses: [],
  12632. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:ifAbsent:"]
  12633. }),
  12634. $globals.Set);
  12635. $core.addMethod(
  12636. $core.method({
  12637. selector: "remove:in:ifAbsent:",
  12638. protocol: "private",
  12639. fn: function (anObject,anotherObject,aBlock){
  12640. var self=this,$self=this;
  12641. return $core.withContext(function($ctx1) {
  12642. if (anObject in anotherObject.store) {
  12643. delete anotherObject.store[anObject];
  12644. $self['@size']--;
  12645. return anObject;
  12646. } else {
  12647. return aBlock._value();
  12648. };
  12649. return self;
  12650. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock},$globals.Set)});
  12651. },
  12652. args: ["anObject", "anotherObject", "aBlock"],
  12653. source: "remove: anObject in: anotherObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) {\x0a\x09\x09\x09delete anotherObject.store[anObject];\x0a\x09\x09\x09$self[''@size'']--;\x0a\x09\x09\x09return anObject;\x0a\x09\x09} else {\x0a\x09\x09\x09return aBlock._value();\x0a\x09\x09}'>",
  12654. referencedClasses: [],
  12655. messageSends: []
  12656. }),
  12657. $globals.Set);
  12658. $core.addMethod(
  12659. $core.method({
  12660. selector: "removeAll",
  12661. protocol: "adding/removing",
  12662. fn: function (){
  12663. var self=this,$self=this;
  12664. return $core.withContext(function($ctx1) {
  12665. $self['@fastBuckets'] = {
  12666. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  12667. "number": { store: Object.create(null), fn: Number },
  12668. "string": { store: Object.create(null) }
  12669. };
  12670. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  12671. $self['@defaultBucket']._removeAll();
  12672. $self['@size'] = 0;
  12673. ;
  12674. return self;
  12675. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  12676. },
  12677. args: [],
  12678. 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'>",
  12679. referencedClasses: [],
  12680. messageSends: []
  12681. }),
  12682. $globals.Set);
  12683. $core.addMethod(
  12684. $core.method({
  12685. selector: "select:",
  12686. protocol: "enumerating",
  12687. fn: function (aBlock){
  12688. var self=this,$self=this;
  12689. var collection;
  12690. return $core.withContext(function($ctx1) {
  12691. var $1;
  12692. collection=$recv($self._class())._new();
  12693. $self._do_((function(each){
  12694. return $core.withContext(function($ctx2) {
  12695. $1=$recv(aBlock)._value_(each);
  12696. if($core.assert($1)){
  12697. return $recv(collection)._add_(each);
  12698. }
  12699. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12700. }));
  12701. return collection;
  12702. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12703. },
  12704. args: ["aBlock"],
  12705. 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",
  12706. referencedClasses: [],
  12707. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12708. }),
  12709. $globals.Set);
  12710. $core.addMethod(
  12711. $core.method({
  12712. selector: "select:thenCollect:",
  12713. protocol: "enumerating",
  12714. fn: function (selectBlock,collectBlock){
  12715. var self=this,$self=this;
  12716. var collection;
  12717. return $core.withContext(function($ctx1) {
  12718. var $1;
  12719. collection=$recv($self._class())._new();
  12720. $self._do_((function(each){
  12721. return $core.withContext(function($ctx2) {
  12722. $1=$recv(selectBlock)._value_(each);
  12723. $ctx2.sendIdx["value:"]=1;
  12724. if($core.assert($1)){
  12725. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  12726. }
  12727. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12728. }));
  12729. return collection;
  12730. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  12731. },
  12732. args: ["selectBlock", "collectBlock"],
  12733. 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",
  12734. referencedClasses: [],
  12735. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12736. }),
  12737. $globals.Set);
  12738. $core.addMethod(
  12739. $core.method({
  12740. selector: "size",
  12741. protocol: "accessing",
  12742. fn: function (){
  12743. var self=this,$self=this;
  12744. return $self["@size"];
  12745. },
  12746. args: [],
  12747. source: "size\x0a\x09^ size",
  12748. referencedClasses: [],
  12749. messageSends: []
  12750. }),
  12751. $globals.Set);
  12752. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  12753. $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.";
  12754. $core.addMethod(
  12755. $core.method({
  12756. selector: "<<",
  12757. protocol: "writing",
  12758. fn: function (anObject){
  12759. var self=this,$self=this;
  12760. return $core.withContext(function($ctx1) {
  12761. $self._write_(anObject);
  12762. return self;
  12763. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  12764. },
  12765. args: ["anObject"],
  12766. source: "<< anObject\x0a\x09self write: anObject",
  12767. referencedClasses: [],
  12768. messageSends: ["write:"]
  12769. }),
  12770. $globals.ProtoStream);
  12771. $core.addMethod(
  12772. $core.method({
  12773. selector: "atEnd",
  12774. protocol: "testing",
  12775. fn: function (){
  12776. var self=this,$self=this;
  12777. return $core.withContext(function($ctx1) {
  12778. $self._subclassResponsibility();
  12779. return self;
  12780. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  12781. },
  12782. args: [],
  12783. source: "atEnd\x0a\x09self subclassResponsibility",
  12784. referencedClasses: [],
  12785. messageSends: ["subclassResponsibility"]
  12786. }),
  12787. $globals.ProtoStream);
  12788. $core.addMethod(
  12789. $core.method({
  12790. selector: "atStart",
  12791. protocol: "testing",
  12792. fn: function (){
  12793. var self=this,$self=this;
  12794. return $core.withContext(function($ctx1) {
  12795. $self._subclassResponsibility();
  12796. return self;
  12797. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  12798. },
  12799. args: [],
  12800. source: "atStart\x0a\x09self subclassResponsibility",
  12801. referencedClasses: [],
  12802. messageSends: ["subclassResponsibility"]
  12803. }),
  12804. $globals.ProtoStream);
  12805. $core.addMethod(
  12806. $core.method({
  12807. selector: "contents",
  12808. protocol: "accessing",
  12809. fn: function (){
  12810. var self=this,$self=this;
  12811. return $core.withContext(function($ctx1) {
  12812. $self._subclassResponsibility();
  12813. return self;
  12814. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  12815. },
  12816. args: [],
  12817. source: "contents\x0a\x09self subclassResponsibility",
  12818. referencedClasses: [],
  12819. messageSends: ["subclassResponsibility"]
  12820. }),
  12821. $globals.ProtoStream);
  12822. $core.addMethod(
  12823. $core.method({
  12824. selector: "do:",
  12825. protocol: "enumerating",
  12826. fn: function (aBlock){
  12827. var self=this,$self=this;
  12828. return $core.withContext(function($ctx1) {
  12829. $recv((function(){
  12830. return $core.withContext(function($ctx2) {
  12831. return $self._atEnd();
  12832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12833. }))._whileFalse_((function(){
  12834. return $core.withContext(function($ctx2) {
  12835. return $recv(aBlock)._value_($self._next());
  12836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12837. }));
  12838. return self;
  12839. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  12840. },
  12841. args: ["aBlock"],
  12842. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  12843. referencedClasses: [],
  12844. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  12845. }),
  12846. $globals.ProtoStream);
  12847. $core.addMethod(
  12848. $core.method({
  12849. selector: "isEmpty",
  12850. protocol: "testing",
  12851. fn: function (){
  12852. var self=this,$self=this;
  12853. return $core.withContext(function($ctx1) {
  12854. return $recv($self._atStart())._and_((function(){
  12855. return $core.withContext(function($ctx2) {
  12856. return $self._atEnd();
  12857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12858. }));
  12859. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  12860. },
  12861. args: [],
  12862. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  12863. referencedClasses: [],
  12864. messageSends: ["and:", "atStart", "atEnd"]
  12865. }),
  12866. $globals.ProtoStream);
  12867. $core.addMethod(
  12868. $core.method({
  12869. selector: "next",
  12870. protocol: "reading",
  12871. fn: function (){
  12872. var self=this,$self=this;
  12873. return $core.withContext(function($ctx1) {
  12874. var $1;
  12875. $1=$self._atEnd();
  12876. if($core.assert($1)){
  12877. return nil;
  12878. } else {
  12879. return $self._subclassResponsibility();
  12880. }
  12881. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  12882. },
  12883. args: [],
  12884. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  12885. referencedClasses: [],
  12886. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  12887. }),
  12888. $globals.ProtoStream);
  12889. $core.addMethod(
  12890. $core.method({
  12891. selector: "nextPut:",
  12892. protocol: "writing",
  12893. fn: function (anObject){
  12894. var self=this,$self=this;
  12895. return $core.withContext(function($ctx1) {
  12896. $self._subclassResponsibility();
  12897. return self;
  12898. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  12899. },
  12900. args: ["anObject"],
  12901. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  12902. referencedClasses: [],
  12903. messageSends: ["subclassResponsibility"]
  12904. }),
  12905. $globals.ProtoStream);
  12906. $core.addMethod(
  12907. $core.method({
  12908. selector: "nextPutAll:",
  12909. protocol: "writing",
  12910. fn: function (aCollection){
  12911. var self=this,$self=this;
  12912. return $core.withContext(function($ctx1) {
  12913. $recv(aCollection)._do_((function(each){
  12914. return $core.withContext(function($ctx2) {
  12915. return $self._nextPut_(each);
  12916. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12917. }));
  12918. return self;
  12919. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  12920. },
  12921. args: ["aCollection"],
  12922. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  12923. referencedClasses: [],
  12924. messageSends: ["do:", "nextPut:"]
  12925. }),
  12926. $globals.ProtoStream);
  12927. $core.addMethod(
  12928. $core.method({
  12929. selector: "nextPutString:",
  12930. protocol: "writing",
  12931. fn: function (aString){
  12932. var self=this,$self=this;
  12933. return $core.withContext(function($ctx1) {
  12934. $self._nextPut_(aString);
  12935. return self;
  12936. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  12937. },
  12938. args: ["aString"],
  12939. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  12940. referencedClasses: [],
  12941. messageSends: ["nextPut:"]
  12942. }),
  12943. $globals.ProtoStream);
  12944. $core.addMethod(
  12945. $core.method({
  12946. selector: "peek",
  12947. protocol: "reading",
  12948. fn: function (){
  12949. var self=this,$self=this;
  12950. return $core.withContext(function($ctx1) {
  12951. var $1;
  12952. $1=$self._atEnd();
  12953. if($core.assert($1)){
  12954. return nil;
  12955. } else {
  12956. return $self._subclassResponsibility();
  12957. }
  12958. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  12959. },
  12960. args: [],
  12961. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  12962. referencedClasses: [],
  12963. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  12964. }),
  12965. $globals.ProtoStream);
  12966. $core.addMethod(
  12967. $core.method({
  12968. selector: "reset",
  12969. protocol: "actions",
  12970. fn: function (){
  12971. var self=this,$self=this;
  12972. return $core.withContext(function($ctx1) {
  12973. $self._subclassResponsibility();
  12974. return self;
  12975. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  12976. },
  12977. args: [],
  12978. source: "reset\x0a\x09self subclassResponsibility",
  12979. referencedClasses: [],
  12980. messageSends: ["subclassResponsibility"]
  12981. }),
  12982. $globals.ProtoStream);
  12983. $core.addMethod(
  12984. $core.method({
  12985. selector: "resetContents",
  12986. protocol: "actions",
  12987. fn: function (){
  12988. var self=this,$self=this;
  12989. return $core.withContext(function($ctx1) {
  12990. $self._subclassResponsibility();
  12991. return self;
  12992. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  12993. },
  12994. args: [],
  12995. source: "resetContents\x0a\x09self subclassResponsibility",
  12996. referencedClasses: [],
  12997. messageSends: ["subclassResponsibility"]
  12998. }),
  12999. $globals.ProtoStream);
  13000. $core.addMethod(
  13001. $core.method({
  13002. selector: "setToEnd",
  13003. protocol: "positioning",
  13004. fn: function (){
  13005. var self=this,$self=this;
  13006. return $core.withContext(function($ctx1) {
  13007. $self._subclassResponsibility();
  13008. return self;
  13009. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  13010. },
  13011. args: [],
  13012. source: "setToEnd\x0a\x09self subclassResponsibility",
  13013. referencedClasses: [],
  13014. messageSends: ["subclassResponsibility"]
  13015. }),
  13016. $globals.ProtoStream);
  13017. $core.addMethod(
  13018. $core.method({
  13019. selector: "setToStart",
  13020. protocol: "positioning",
  13021. fn: function (){
  13022. var self=this,$self=this;
  13023. return $core.withContext(function($ctx1) {
  13024. $self._reset();
  13025. return self;
  13026. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  13027. },
  13028. args: [],
  13029. source: "setToStart\x0a\x09self reset",
  13030. referencedClasses: [],
  13031. messageSends: ["reset"]
  13032. }),
  13033. $globals.ProtoStream);
  13034. $core.addMethod(
  13035. $core.method({
  13036. selector: "write:",
  13037. protocol: "writing",
  13038. fn: function (anObject){
  13039. var self=this,$self=this;
  13040. return $core.withContext(function($ctx1) {
  13041. $recv(anObject)._putOn_(self);
  13042. return self;
  13043. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  13044. },
  13045. args: ["anObject"],
  13046. source: "write: anObject\x0a\x09anObject putOn: self",
  13047. referencedClasses: [],
  13048. messageSends: ["putOn:"]
  13049. }),
  13050. $globals.ProtoStream);
  13051. $core.addMethod(
  13052. $core.method({
  13053. selector: "on:",
  13054. protocol: "instance creation",
  13055. fn: function (aCollection){
  13056. var self=this,$self=this;
  13057. return $core.withContext(function($ctx1) {
  13058. var $1;
  13059. $1=$self._new();
  13060. $recv($1)._setCollection_(aCollection);
  13061. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13062. return $recv($1)._yourself();
  13063. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  13064. },
  13065. args: ["aCollection"],
  13066. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13067. referencedClasses: [],
  13068. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13069. }),
  13070. $globals.ProtoStream.a$cls);
  13071. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  13072. $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.";
  13073. $core.addMethod(
  13074. $core.method({
  13075. selector: "atEnd",
  13076. protocol: "testing",
  13077. fn: function (){
  13078. var self=this,$self=this;
  13079. return $core.withContext(function($ctx1) {
  13080. return $recv($self._position()).__eq($self._size());
  13081. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  13082. },
  13083. args: [],
  13084. source: "atEnd\x0a\x09^ self position = self size",
  13085. referencedClasses: [],
  13086. messageSends: ["=", "position", "size"]
  13087. }),
  13088. $globals.Stream);
  13089. $core.addMethod(
  13090. $core.method({
  13091. selector: "atStart",
  13092. protocol: "testing",
  13093. fn: function (){
  13094. var self=this,$self=this;
  13095. return $core.withContext(function($ctx1) {
  13096. return $recv($self._position()).__eq((0));
  13097. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  13098. },
  13099. args: [],
  13100. source: "atStart\x0a\x09^ self position = 0",
  13101. referencedClasses: [],
  13102. messageSends: ["=", "position"]
  13103. }),
  13104. $globals.Stream);
  13105. $core.addMethod(
  13106. $core.method({
  13107. selector: "close",
  13108. protocol: "actions",
  13109. fn: function (){
  13110. var self=this,$self=this;
  13111. return self;
  13112. },
  13113. args: [],
  13114. source: "close",
  13115. referencedClasses: [],
  13116. messageSends: []
  13117. }),
  13118. $globals.Stream);
  13119. $core.addMethod(
  13120. $core.method({
  13121. selector: "collection",
  13122. protocol: "accessing",
  13123. fn: function (){
  13124. var self=this,$self=this;
  13125. return $self["@collection"];
  13126. },
  13127. args: [],
  13128. source: "collection\x0a\x09^ collection",
  13129. referencedClasses: [],
  13130. messageSends: []
  13131. }),
  13132. $globals.Stream);
  13133. $core.addMethod(
  13134. $core.method({
  13135. selector: "contents",
  13136. protocol: "accessing",
  13137. fn: function (){
  13138. var self=this,$self=this;
  13139. return $core.withContext(function($ctx1) {
  13140. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  13141. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  13142. },
  13143. args: [],
  13144. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13145. referencedClasses: [],
  13146. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  13147. }),
  13148. $globals.Stream);
  13149. $core.addMethod(
  13150. $core.method({
  13151. selector: "flush",
  13152. protocol: "actions",
  13153. fn: function (){
  13154. var self=this,$self=this;
  13155. return self;
  13156. },
  13157. args: [],
  13158. source: "flush",
  13159. referencedClasses: [],
  13160. messageSends: []
  13161. }),
  13162. $globals.Stream);
  13163. $core.addMethod(
  13164. $core.method({
  13165. selector: "isEmpty",
  13166. protocol: "testing",
  13167. fn: function (){
  13168. var self=this,$self=this;
  13169. return $core.withContext(function($ctx1) {
  13170. return $recv($self._size()).__eq((0));
  13171. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  13172. },
  13173. args: [],
  13174. source: "isEmpty\x0a\x09^ self size = 0",
  13175. referencedClasses: [],
  13176. messageSends: ["=", "size"]
  13177. }),
  13178. $globals.Stream);
  13179. $core.addMethod(
  13180. $core.method({
  13181. selector: "next",
  13182. protocol: "reading",
  13183. fn: function (){
  13184. var self=this,$self=this;
  13185. return $core.withContext(function($ctx1) {
  13186. var $1,$3,$2;
  13187. $1=$self._atEnd();
  13188. if($core.assert($1)){
  13189. return nil;
  13190. } else {
  13191. $3=$self._position();
  13192. $ctx1.sendIdx["position"]=1;
  13193. $2=$recv($3).__plus((1));
  13194. $self._position_($2);
  13195. return $recv($self["@collection"])._at_($self._position());
  13196. }
  13197. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  13198. },
  13199. args: [],
  13200. 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 ]",
  13201. referencedClasses: [],
  13202. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  13203. }),
  13204. $globals.Stream);
  13205. $core.addMethod(
  13206. $core.method({
  13207. selector: "next:",
  13208. protocol: "reading",
  13209. fn: function (anInteger){
  13210. var self=this,$self=this;
  13211. var tempCollection;
  13212. return $core.withContext(function($ctx1) {
  13213. var $1;
  13214. tempCollection=$recv($recv($self._collection())._class())._new();
  13215. $recv(anInteger)._timesRepeat_((function(){
  13216. return $core.withContext(function($ctx2) {
  13217. $1=$self._atEnd();
  13218. if(!$core.assert($1)){
  13219. return $recv(tempCollection)._add_($self._next());
  13220. }
  13221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13222. }));
  13223. return tempCollection;
  13224. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  13225. },
  13226. args: ["anInteger"],
  13227. 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",
  13228. referencedClasses: [],
  13229. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  13230. }),
  13231. $globals.Stream);
  13232. $core.addMethod(
  13233. $core.method({
  13234. selector: "nextPut:",
  13235. protocol: "writing",
  13236. fn: function (anObject){
  13237. var self=this,$self=this;
  13238. return $core.withContext(function($ctx1) {
  13239. var $2,$1,$3,$4;
  13240. $2=$self._position();
  13241. $ctx1.sendIdx["position"]=1;
  13242. $1=$recv($2).__plus((1));
  13243. $self._position_($1);
  13244. $3=$self._collection();
  13245. $4=$self._position();
  13246. $ctx1.sendIdx["position"]=2;
  13247. $recv($3)._at_put_($4,anObject);
  13248. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13249. return self;
  13250. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  13251. },
  13252. args: ["anObject"],
  13253. 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)",
  13254. referencedClasses: [],
  13255. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  13256. }),
  13257. $globals.Stream);
  13258. $core.addMethod(
  13259. $core.method({
  13260. selector: "peek",
  13261. protocol: "reading",
  13262. fn: function (){
  13263. var self=this,$self=this;
  13264. return $core.withContext(function($ctx1) {
  13265. var $1;
  13266. $1=$self._atEnd();
  13267. if(!$core.assert($1)){
  13268. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  13269. }
  13270. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  13271. },
  13272. args: [],
  13273. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  13274. referencedClasses: [],
  13275. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  13276. }),
  13277. $globals.Stream);
  13278. $core.addMethod(
  13279. $core.method({
  13280. selector: "position",
  13281. protocol: "accessing",
  13282. fn: function (){
  13283. var self=this,$self=this;
  13284. return $core.withContext(function($ctx1) {
  13285. var $1,$receiver;
  13286. $1=$self["@position"];
  13287. if(($receiver = $1) == null || $receiver.a$nil){
  13288. $self["@position"]=(0);
  13289. return $self["@position"];
  13290. } else {
  13291. return $1;
  13292. }
  13293. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  13294. },
  13295. args: [],
  13296. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  13297. referencedClasses: [],
  13298. messageSends: ["ifNil:"]
  13299. }),
  13300. $globals.Stream);
  13301. $core.addMethod(
  13302. $core.method({
  13303. selector: "position:",
  13304. protocol: "accessing",
  13305. fn: function (anInteger){
  13306. var self=this,$self=this;
  13307. $self["@position"]=anInteger;
  13308. return self;
  13309. },
  13310. args: ["anInteger"],
  13311. source: "position: anInteger\x0a\x09position := anInteger",
  13312. referencedClasses: [],
  13313. messageSends: []
  13314. }),
  13315. $globals.Stream);
  13316. $core.addMethod(
  13317. $core.method({
  13318. selector: "reset",
  13319. protocol: "actions",
  13320. fn: function (){
  13321. var self=this,$self=this;
  13322. return $core.withContext(function($ctx1) {
  13323. $self._position_((0));
  13324. return self;
  13325. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  13326. },
  13327. args: [],
  13328. source: "reset\x0a\x09self position: 0",
  13329. referencedClasses: [],
  13330. messageSends: ["position:"]
  13331. }),
  13332. $globals.Stream);
  13333. $core.addMethod(
  13334. $core.method({
  13335. selector: "resetContents",
  13336. protocol: "actions",
  13337. fn: function (){
  13338. var self=this,$self=this;
  13339. return $core.withContext(function($ctx1) {
  13340. $self._reset();
  13341. $self._setStreamSize_((0));
  13342. return self;
  13343. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  13344. },
  13345. args: [],
  13346. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13347. referencedClasses: [],
  13348. messageSends: ["reset", "setStreamSize:"]
  13349. }),
  13350. $globals.Stream);
  13351. $core.addMethod(
  13352. $core.method({
  13353. selector: "setCollection:",
  13354. protocol: "accessing",
  13355. fn: function (aCollection){
  13356. var self=this,$self=this;
  13357. $self["@collection"]=aCollection;
  13358. return self;
  13359. },
  13360. args: ["aCollection"],
  13361. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13362. referencedClasses: [],
  13363. messageSends: []
  13364. }),
  13365. $globals.Stream);
  13366. $core.addMethod(
  13367. $core.method({
  13368. selector: "setStreamSize:",
  13369. protocol: "accessing",
  13370. fn: function (anInteger){
  13371. var self=this,$self=this;
  13372. $self["@streamSize"]=anInteger;
  13373. return self;
  13374. },
  13375. args: ["anInteger"],
  13376. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  13377. referencedClasses: [],
  13378. messageSends: []
  13379. }),
  13380. $globals.Stream);
  13381. $core.addMethod(
  13382. $core.method({
  13383. selector: "setToEnd",
  13384. protocol: "positioning",
  13385. fn: function (){
  13386. var self=this,$self=this;
  13387. return $core.withContext(function($ctx1) {
  13388. $self._position_($self._size());
  13389. return self;
  13390. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  13391. },
  13392. args: [],
  13393. source: "setToEnd\x0a\x09self position: self size",
  13394. referencedClasses: [],
  13395. messageSends: ["position:", "size"]
  13396. }),
  13397. $globals.Stream);
  13398. $core.addMethod(
  13399. $core.method({
  13400. selector: "size",
  13401. protocol: "accessing",
  13402. fn: function (){
  13403. var self=this,$self=this;
  13404. return $core.withContext(function($ctx1) {
  13405. return $self._streamSize();
  13406. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  13407. },
  13408. args: [],
  13409. source: "size\x0a\x09^ self streamSize",
  13410. referencedClasses: [],
  13411. messageSends: ["streamSize"]
  13412. }),
  13413. $globals.Stream);
  13414. $core.addMethod(
  13415. $core.method({
  13416. selector: "skip:",
  13417. protocol: "positioning",
  13418. fn: function (anInteger){
  13419. var self=this,$self=this;
  13420. return $core.withContext(function($ctx1) {
  13421. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  13422. return self;
  13423. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  13424. },
  13425. args: ["anInteger"],
  13426. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  13427. referencedClasses: [],
  13428. messageSends: ["position:", "min:max:", "+", "position", "size"]
  13429. }),
  13430. $globals.Stream);
  13431. $core.addMethod(
  13432. $core.method({
  13433. selector: "streamSize",
  13434. protocol: "accessing",
  13435. fn: function (){
  13436. var self=this,$self=this;
  13437. return $self["@streamSize"];
  13438. },
  13439. args: [],
  13440. source: "streamSize\x0a\x09^ streamSize",
  13441. referencedClasses: [],
  13442. messageSends: []
  13443. }),
  13444. $globals.Stream);
  13445. $core.addMethod(
  13446. $core.method({
  13447. selector: "on:",
  13448. protocol: "instance creation",
  13449. fn: function (aCollection){
  13450. var self=this,$self=this;
  13451. return $core.withContext(function($ctx1) {
  13452. var $1;
  13453. $1=$self._new();
  13454. $recv($1)._setCollection_(aCollection);
  13455. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13456. return $recv($1)._yourself();
  13457. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  13458. },
  13459. args: ["aCollection"],
  13460. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13461. referencedClasses: [],
  13462. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13463. }),
  13464. $globals.Stream.a$cls);
  13465. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  13466. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  13467. $core.addMethod(
  13468. $core.method({
  13469. selector: "cr",
  13470. protocol: "writing",
  13471. fn: function (){
  13472. var self=this,$self=this;
  13473. return $core.withContext(function($ctx1) {
  13474. return $self._nextPutAll_($recv($globals.String)._cr());
  13475. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  13476. },
  13477. args: [],
  13478. source: "cr\x0a\x09^ self nextPutAll: String cr",
  13479. referencedClasses: ["String"],
  13480. messageSends: ["nextPutAll:", "cr"]
  13481. }),
  13482. $globals.StringStream);
  13483. $core.addMethod(
  13484. $core.method({
  13485. selector: "crlf",
  13486. protocol: "writing",
  13487. fn: function (){
  13488. var self=this,$self=this;
  13489. return $core.withContext(function($ctx1) {
  13490. return $self._nextPutAll_($recv($globals.String)._crlf());
  13491. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  13492. },
  13493. args: [],
  13494. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  13495. referencedClasses: ["String"],
  13496. messageSends: ["nextPutAll:", "crlf"]
  13497. }),
  13498. $globals.StringStream);
  13499. $core.addMethod(
  13500. $core.method({
  13501. selector: "lf",
  13502. protocol: "writing",
  13503. fn: function (){
  13504. var self=this,$self=this;
  13505. return $core.withContext(function($ctx1) {
  13506. return $self._nextPutAll_($recv($globals.String)._lf());
  13507. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  13508. },
  13509. args: [],
  13510. source: "lf\x0a\x09^ self nextPutAll: String lf",
  13511. referencedClasses: ["String"],
  13512. messageSends: ["nextPutAll:", "lf"]
  13513. }),
  13514. $globals.StringStream);
  13515. $core.addMethod(
  13516. $core.method({
  13517. selector: "next:",
  13518. protocol: "reading",
  13519. fn: function (anInteger){
  13520. var self=this,$self=this;
  13521. var tempCollection;
  13522. return $core.withContext(function($ctx1) {
  13523. var $1;
  13524. tempCollection=$recv($recv($self._collection())._class())._new();
  13525. $recv(anInteger)._timesRepeat_((function(){
  13526. return $core.withContext(function($ctx2) {
  13527. $1=$self._atEnd();
  13528. if(!$core.assert($1)){
  13529. tempCollection=$recv(tempCollection).__comma($self._next());
  13530. return tempCollection;
  13531. }
  13532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13533. }));
  13534. return tempCollection;
  13535. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  13536. },
  13537. args: ["anInteger"],
  13538. 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",
  13539. referencedClasses: [],
  13540. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  13541. }),
  13542. $globals.StringStream);
  13543. $core.addMethod(
  13544. $core.method({
  13545. selector: "nextPut:",
  13546. protocol: "writing",
  13547. fn: function (aString){
  13548. var self=this,$self=this;
  13549. return $core.withContext(function($ctx1) {
  13550. $self._nextPutAll_(aString);
  13551. return self;
  13552. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  13553. },
  13554. args: ["aString"],
  13555. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  13556. referencedClasses: [],
  13557. messageSends: ["nextPutAll:"]
  13558. }),
  13559. $globals.StringStream);
  13560. $core.addMethod(
  13561. $core.method({
  13562. selector: "nextPutAll:",
  13563. protocol: "writing",
  13564. fn: function (aString){
  13565. var self=this,$self=this;
  13566. var pre,post;
  13567. return $core.withContext(function($ctx1) {
  13568. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  13569. $1=$self._atEnd();
  13570. if($core.assert($1)){
  13571. $3=$self._collection();
  13572. $ctx1.sendIdx["collection"]=1;
  13573. $2=$recv($3).__comma(aString);
  13574. $ctx1.sendIdx[","]=1;
  13575. $self._setCollection_($2);
  13576. $ctx1.sendIdx["setCollection:"]=1;
  13577. } else {
  13578. $4=$self._collection();
  13579. $ctx1.sendIdx["collection"]=2;
  13580. $5=$self._position();
  13581. $ctx1.sendIdx["position"]=1;
  13582. pre=$recv($4)._copyFrom_to_((1),$5);
  13583. $ctx1.sendIdx["copyFrom:to:"]=1;
  13584. $6=$self._collection();
  13585. $ctx1.sendIdx["collection"]=3;
  13586. $9=$self._position();
  13587. $ctx1.sendIdx["position"]=2;
  13588. $8=$recv($9).__plus((1));
  13589. $ctx1.sendIdx["+"]=2;
  13590. $10=$recv(aString)._size();
  13591. $ctx1.sendIdx["size"]=1;
  13592. $7=$recv($8).__plus($10);
  13593. $ctx1.sendIdx["+"]=1;
  13594. $11=$recv($self._collection())._size();
  13595. $ctx1.sendIdx["size"]=2;
  13596. post=$recv($6)._copyFrom_to_($7,$11);
  13597. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  13598. $ctx1.sendIdx[","]=2;
  13599. $self._setCollection_($12);
  13600. }
  13601. $14=$self._position();
  13602. $ctx1.sendIdx["position"]=3;
  13603. $13=$recv($14).__plus($recv(aString)._size());
  13604. $self._position_($13);
  13605. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13606. return self;
  13607. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  13608. },
  13609. args: ["aString"],
  13610. 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)",
  13611. referencedClasses: [],
  13612. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  13613. }),
  13614. $globals.StringStream);
  13615. $core.addMethod(
  13616. $core.method({
  13617. selector: "nextPutString:",
  13618. protocol: "writing",
  13619. fn: function (aString){
  13620. var self=this,$self=this;
  13621. return $core.withContext(function($ctx1) {
  13622. $self._nextPutAll_(aString);
  13623. return self;
  13624. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  13625. },
  13626. args: ["aString"],
  13627. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  13628. referencedClasses: [],
  13629. messageSends: ["nextPutAll:"]
  13630. }),
  13631. $globals.StringStream);
  13632. $core.addMethod(
  13633. $core.method({
  13634. selector: "print:",
  13635. protocol: "writing",
  13636. fn: function (anObject){
  13637. var self=this,$self=this;
  13638. return $core.withContext(function($ctx1) {
  13639. $recv(anObject)._printOn_(self);
  13640. return self;
  13641. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  13642. },
  13643. args: ["anObject"],
  13644. source: "print: anObject\x0a\x09anObject printOn: self",
  13645. referencedClasses: [],
  13646. messageSends: ["printOn:"]
  13647. }),
  13648. $globals.StringStream);
  13649. $core.addMethod(
  13650. $core.method({
  13651. selector: "printSymbol:",
  13652. protocol: "writing",
  13653. fn: function (anObject){
  13654. var self=this,$self=this;
  13655. return $core.withContext(function($ctx1) {
  13656. $recv(anObject)._asSymbolPrintOn_(self);
  13657. return self;
  13658. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  13659. },
  13660. args: ["anObject"],
  13661. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  13662. referencedClasses: [],
  13663. messageSends: ["asSymbolPrintOn:"]
  13664. }),
  13665. $globals.StringStream);
  13666. $core.addMethod(
  13667. $core.method({
  13668. selector: "space",
  13669. protocol: "writing",
  13670. fn: function (){
  13671. var self=this,$self=this;
  13672. return $core.withContext(function($ctx1) {
  13673. $self._nextPut_(" ");
  13674. return self;
  13675. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  13676. },
  13677. args: [],
  13678. source: "space\x0a\x09self nextPut: ' '",
  13679. referencedClasses: [],
  13680. messageSends: ["nextPut:"]
  13681. }),
  13682. $globals.StringStream);
  13683. $core.addMethod(
  13684. $core.method({
  13685. selector: "tab",
  13686. protocol: "writing",
  13687. fn: function (){
  13688. var self=this,$self=this;
  13689. return $core.withContext(function($ctx1) {
  13690. return $self._nextPutAll_($recv($globals.String)._tab());
  13691. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  13692. },
  13693. args: [],
  13694. source: "tab\x0a\x09^ self nextPutAll: String tab",
  13695. referencedClasses: ["String"],
  13696. messageSends: ["nextPutAll:", "tab"]
  13697. }),
  13698. $globals.StringStream);
  13699. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  13700. $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.";
  13701. $core.addMethod(
  13702. $core.method({
  13703. selector: "initialize",
  13704. protocol: "initialization",
  13705. fn: function (){
  13706. var self=this,$self=this;
  13707. return $core.withContext(function($ctx1) {
  13708. (
  13709. $ctx1.supercall = true,
  13710. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  13711. $ctx1.supercall = false;
  13712. $self["@read"]=$recv($globals.OrderedCollection)._new();
  13713. $ctx1.sendIdx["new"]=1;
  13714. $self["@write"]=$recv($globals.OrderedCollection)._new();
  13715. $self["@readIndex"]=(1);
  13716. return self;
  13717. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  13718. },
  13719. args: [],
  13720. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  13721. referencedClasses: ["OrderedCollection"],
  13722. messageSends: ["initialize", "new"]
  13723. }),
  13724. $globals.Queue);
  13725. $core.addMethod(
  13726. $core.method({
  13727. selector: "next",
  13728. protocol: "accessing",
  13729. fn: function (){
  13730. var self=this,$self=this;
  13731. return $core.withContext(function($ctx1) {
  13732. return $self._nextIfAbsent_((function(){
  13733. return $core.withContext(function($ctx2) {
  13734. return $self._error_("Cannot read from empty Queue.");
  13735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13736. }));
  13737. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  13738. },
  13739. args: [],
  13740. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  13741. referencedClasses: [],
  13742. messageSends: ["nextIfAbsent:", "error:"]
  13743. }),
  13744. $globals.Queue);
  13745. $core.addMethod(
  13746. $core.method({
  13747. selector: "nextIfAbsent:",
  13748. protocol: "accessing",
  13749. fn: function (aBlock){
  13750. var self=this,$self=this;
  13751. var result;
  13752. return $core.withContext(function($ctx1) {
  13753. var $1;
  13754. var $early={};
  13755. try {
  13756. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  13757. return $core.withContext(function($ctx2) {
  13758. $recv($self["@write"])._ifEmpty_((function(){
  13759. return $core.withContext(function($ctx3) {
  13760. $1=$recv($self["@readIndex"]).__gt((1));
  13761. if($core.assert($1)){
  13762. $self["@read"]=[];
  13763. $self["@readIndex"]=(1);
  13764. $self["@readIndex"];
  13765. }
  13766. throw $early=[$recv(aBlock)._value()];
  13767. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  13768. }));
  13769. $self["@read"]=$self["@write"];
  13770. $self["@readIndex"]=(1);
  13771. $self["@write"]=$recv($globals.OrderedCollection)._new();
  13772. return $recv($self["@read"])._first();
  13773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13774. }));
  13775. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  13776. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  13777. return result;
  13778. }
  13779. catch(e) {if(e===$early)return e[0]; throw e}
  13780. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  13781. },
  13782. args: ["aBlock"],
  13783. 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",
  13784. referencedClasses: ["OrderedCollection"],
  13785. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  13786. }),
  13787. $globals.Queue);
  13788. $core.addMethod(
  13789. $core.method({
  13790. selector: "nextPut:",
  13791. protocol: "accessing",
  13792. fn: function (anObject){
  13793. var self=this,$self=this;
  13794. return $core.withContext(function($ctx1) {
  13795. $recv($self["@write"])._add_(anObject);
  13796. return self;
  13797. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  13798. },
  13799. args: ["anObject"],
  13800. source: "nextPut: anObject\x0a\x09write add: anObject",
  13801. referencedClasses: [],
  13802. messageSends: ["add:"]
  13803. }),
  13804. $globals.Queue);
  13805. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  13806. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  13807. $core.addMethod(
  13808. $core.method({
  13809. selector: "compile:",
  13810. protocol: "evaluating",
  13811. fn: function (aString){
  13812. var self=this,$self=this;
  13813. return $core.withContext(function($ctx1) {
  13814. return self.compile(aString);
  13815. return self;
  13816. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  13817. },
  13818. args: ["aString"],
  13819. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  13820. referencedClasses: [],
  13821. messageSends: []
  13822. }),
  13823. $globals.RegularExpression);
  13824. $core.addMethod(
  13825. $core.method({
  13826. selector: "exec:",
  13827. protocol: "evaluating",
  13828. fn: function (aString){
  13829. var self=this,$self=this;
  13830. return $core.withContext(function($ctx1) {
  13831. return self.exec(aString) || nil;
  13832. return self;
  13833. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  13834. },
  13835. args: ["aString"],
  13836. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  13837. referencedClasses: [],
  13838. messageSends: []
  13839. }),
  13840. $globals.RegularExpression);
  13841. $core.addMethod(
  13842. $core.method({
  13843. selector: "test:",
  13844. protocol: "evaluating",
  13845. fn: function (aString){
  13846. var self=this,$self=this;
  13847. return $core.withContext(function($ctx1) {
  13848. return self.test(aString);
  13849. return self;
  13850. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  13851. },
  13852. args: ["aString"],
  13853. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  13854. referencedClasses: [],
  13855. messageSends: []
  13856. }),
  13857. $globals.RegularExpression);
  13858. $core.addMethod(
  13859. $core.method({
  13860. selector: "fromString:",
  13861. protocol: "instance creation",
  13862. fn: function (aString){
  13863. var self=this,$self=this;
  13864. return $core.withContext(function($ctx1) {
  13865. return $self._fromString_flag_(aString,"");
  13866. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  13867. },
  13868. args: ["aString"],
  13869. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  13870. referencedClasses: [],
  13871. messageSends: ["fromString:flag:"]
  13872. }),
  13873. $globals.RegularExpression.a$cls);
  13874. $core.addMethod(
  13875. $core.method({
  13876. selector: "fromString:flag:",
  13877. protocol: "instance creation",
  13878. fn: function (aString,anotherString){
  13879. var self=this,$self=this;
  13880. return $core.withContext(function($ctx1) {
  13881. return new RegExp(aString, anotherString);
  13882. return self;
  13883. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  13884. },
  13885. args: ["aString", "anotherString"],
  13886. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  13887. referencedClasses: [],
  13888. messageSends: []
  13889. }),
  13890. $globals.RegularExpression.a$cls);
  13891. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  13892. $core.addMethod(
  13893. $core.method({
  13894. selector: "at:",
  13895. protocol: "accessing",
  13896. fn: function (anIndex){
  13897. var self=this,$self=this;
  13898. return $core.withContext(function($ctx1) {
  13899. return $self._at_ifAbsent_(anIndex,(function(){
  13900. return $core.withContext(function($ctx2) {
  13901. return $self._errorNotFound();
  13902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13903. }));
  13904. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.TKeyValueCollection)});
  13905. },
  13906. args: ["anIndex"],
  13907. 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 ]",
  13908. referencedClasses: [],
  13909. messageSends: ["at:ifAbsent:", "errorNotFound"]
  13910. }),
  13911. $globals.TKeyValueCollection);
  13912. $core.addMethod(
  13913. $core.method({
  13914. selector: "at:ifAbsent:",
  13915. protocol: "accessing",
  13916. fn: function (anIndex,aBlock){
  13917. var self=this,$self=this;
  13918. return $core.withContext(function($ctx1) {
  13919. $self._subclassResponsibility();
  13920. return self;
  13921. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  13922. },
  13923. args: ["anIndex", "aBlock"],
  13924. 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",
  13925. referencedClasses: [],
  13926. messageSends: ["subclassResponsibility"]
  13927. }),
  13928. $globals.TKeyValueCollection);
  13929. $core.addMethod(
  13930. $core.method({
  13931. selector: "at:ifAbsentPut:",
  13932. protocol: "accessing",
  13933. fn: function (aKey,aBlock){
  13934. var self=this,$self=this;
  13935. return $core.withContext(function($ctx1) {
  13936. return $self._at_ifAbsent_(aKey,(function(){
  13937. return $core.withContext(function($ctx2) {
  13938. return $self._at_put_(aKey,$recv(aBlock)._value());
  13939. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13940. }));
  13941. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.TKeyValueCollection)});
  13942. },
  13943. args: ["aKey", "aBlock"],
  13944. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  13945. referencedClasses: [],
  13946. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  13947. }),
  13948. $globals.TKeyValueCollection);
  13949. $core.addMethod(
  13950. $core.method({
  13951. selector: "at:ifPresent:",
  13952. protocol: "accessing",
  13953. fn: function (anIndex,aBlock){
  13954. var self=this,$self=this;
  13955. return $core.withContext(function($ctx1) {
  13956. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  13957. return nil;
  13958. }));
  13959. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  13960. },
  13961. args: ["anIndex", "aBlock"],
  13962. 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 ]",
  13963. referencedClasses: [],
  13964. messageSends: ["at:ifPresent:ifAbsent:"]
  13965. }),
  13966. $globals.TKeyValueCollection);
  13967. $core.addMethod(
  13968. $core.method({
  13969. selector: "at:ifPresent:ifAbsent:",
  13970. protocol: "accessing",
  13971. fn: function (anIndex,aBlock,anotherBlock){
  13972. var self=this,$self=this;
  13973. return $core.withContext(function($ctx1) {
  13974. $self._subclassResponsibility();
  13975. return self;
  13976. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TKeyValueCollection)});
  13977. },
  13978. args: ["anIndex", "aBlock", "anotherBlock"],
  13979. 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",
  13980. referencedClasses: [],
  13981. messageSends: ["subclassResponsibility"]
  13982. }),
  13983. $globals.TKeyValueCollection);
  13984. $core.addMethod(
  13985. $core.method({
  13986. selector: "at:put:",
  13987. protocol: "accessing",
  13988. fn: function (anIndex,anObject){
  13989. var self=this,$self=this;
  13990. return $core.withContext(function($ctx1) {
  13991. $self._subclassResponsibility();
  13992. return self;
  13993. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.TKeyValueCollection)});
  13994. },
  13995. args: ["anIndex", "anObject"],
  13996. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  13997. referencedClasses: [],
  13998. messageSends: ["subclassResponsibility"]
  13999. }),
  14000. $globals.TKeyValueCollection);
  14001. $core.addMethod(
  14002. $core.method({
  14003. selector: "indexOf:",
  14004. protocol: "accessing",
  14005. fn: function (anObject){
  14006. var self=this,$self=this;
  14007. return $core.withContext(function($ctx1) {
  14008. return $self._indexOf_ifAbsent_(anObject,(function(){
  14009. return $core.withContext(function($ctx2) {
  14010. return $self._errorNotFound();
  14011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14012. }));
  14013. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.TKeyValueCollection)});
  14014. },
  14015. args: ["anObject"],
  14016. 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 ]",
  14017. referencedClasses: [],
  14018. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  14019. }),
  14020. $globals.TKeyValueCollection);
  14021. $core.addMethod(
  14022. $core.method({
  14023. selector: "indexOf:ifAbsent:",
  14024. protocol: "accessing",
  14025. fn: function (anObject,aBlock){
  14026. var self=this,$self=this;
  14027. return $core.withContext(function($ctx1) {
  14028. $self._subclassResponsibility();
  14029. return self;
  14030. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TKeyValueCollection)});
  14031. },
  14032. args: ["anObject", "aBlock"],
  14033. 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",
  14034. referencedClasses: [],
  14035. messageSends: ["subclassResponsibility"]
  14036. }),
  14037. $globals.TKeyValueCollection);
  14038. $core.addMethod(
  14039. $core.method({
  14040. selector: "with:do:",
  14041. protocol: "enumerating",
  14042. fn: function (anotherCollection,aBlock){
  14043. var self=this,$self=this;
  14044. return $core.withContext(function($ctx1) {
  14045. $self._withIndexDo_((function(each,index){
  14046. return $core.withContext(function($ctx2) {
  14047. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  14048. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  14049. }));
  14050. return self;
  14051. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TKeyValueCollection)});
  14052. },
  14053. args: ["anotherCollection", "aBlock"],
  14054. 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) ]",
  14055. referencedClasses: [],
  14056. messageSends: ["withIndexDo:", "value:value:", "at:"]
  14057. }),
  14058. $globals.TKeyValueCollection);
  14059. $core.addMethod(
  14060. $core.method({
  14061. selector: "withIndexDo:",
  14062. protocol: "enumerating",
  14063. fn: function (aBlock){
  14064. var self=this,$self=this;
  14065. return $core.withContext(function($ctx1) {
  14066. $self._subclassResponsibility();
  14067. return self;
  14068. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TKeyValueCollection)});
  14069. },
  14070. args: ["aBlock"],
  14071. 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",
  14072. referencedClasses: [],
  14073. messageSends: ["subclassResponsibility"]
  14074. }),
  14075. $globals.TKeyValueCollection);
  14076. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  14077. $core.addMethod(
  14078. $core.method({
  14079. selector: "at:ifAbsent:",
  14080. protocol: "accessing",
  14081. fn: function (anIndex,aBlock){
  14082. var self=this,$self=this;
  14083. return $core.withContext(function($ctx1) {
  14084. return anIndex >= 1 && anIndex <= self.length
  14085. ? self[anIndex - 1]
  14086. : aBlock._value()
  14087. ;
  14088. return self;
  14089. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14090. },
  14091. args: ["anIndex", "aBlock"],
  14092. 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'>",
  14093. referencedClasses: [],
  14094. messageSends: []
  14095. }),
  14096. $globals.TNativeZeroBasedCollection);
  14097. $core.addMethod(
  14098. $core.method({
  14099. selector: "at:ifPresent:ifAbsent:",
  14100. protocol: "accessing",
  14101. fn: function (anIndex,aBlock,anotherBlock){
  14102. var self=this,$self=this;
  14103. return $core.withContext(function($ctx1) {
  14104. return anIndex >= 1 && anIndex <= self.length
  14105. ? aBlock._value_(self[anIndex - 1])
  14106. : anotherBlock._value()
  14107. ;
  14108. return self;
  14109. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  14110. },
  14111. args: ["anIndex", "aBlock", "anotherBlock"],
  14112. 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'>",
  14113. referencedClasses: [],
  14114. messageSends: []
  14115. }),
  14116. $globals.TNativeZeroBasedCollection);
  14117. $core.addMethod(
  14118. $core.method({
  14119. selector: "detect:ifNone:",
  14120. protocol: "enumerating",
  14121. fn: function (aBlock,anotherBlock){
  14122. var self=this,$self=this;
  14123. return $core.withContext(function($ctx1) {
  14124. for(var i = 0; i < self.length; i++)
  14125. if(aBlock._value_(self[i]))
  14126. return self[i];
  14127. return anotherBlock._value();
  14128. ;
  14129. return self;
  14130. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  14131. },
  14132. args: ["aBlock", "anotherBlock"],
  14133. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09'>",
  14134. referencedClasses: [],
  14135. messageSends: []
  14136. }),
  14137. $globals.TNativeZeroBasedCollection);
  14138. $core.addMethod(
  14139. $core.method({
  14140. selector: "do:",
  14141. protocol: "enumerating",
  14142. fn: function (aBlock){
  14143. var self=this,$self=this;
  14144. return $core.withContext(function($ctx1) {
  14145. for(var i=0; i < self.length; i++) {
  14146. aBlock._value_(self[i]);
  14147. }
  14148. ;
  14149. return self;
  14150. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14151. },
  14152. args: ["aBlock"],
  14153. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09'>",
  14154. referencedClasses: [],
  14155. messageSends: []
  14156. }),
  14157. $globals.TNativeZeroBasedCollection);
  14158. $core.addMethod(
  14159. $core.method({
  14160. selector: "indexOf:ifAbsent:",
  14161. protocol: "accessing",
  14162. fn: function (anObject,aBlock){
  14163. var self=this,$self=this;
  14164. return $core.withContext(function($ctx1) {
  14165. for(var i=0; i < self.length; i++) {
  14166. if($recv(self[i]).__eq(anObject)) {return i+1}
  14167. };
  14168. return aBlock._value();
  14169. ;
  14170. return self;
  14171. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14172. },
  14173. args: ["anObject", "aBlock"],
  14174. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  14175. referencedClasses: [],
  14176. messageSends: []
  14177. }),
  14178. $globals.TNativeZeroBasedCollection);
  14179. $core.addMethod(
  14180. $core.method({
  14181. selector: "indexOf:startingAt:ifAbsent:",
  14182. protocol: "accessing",
  14183. fn: function (anObject,start,aBlock){
  14184. var self=this,$self=this;
  14185. return $core.withContext(function($ctx1) {
  14186. for(var i=start - 1; i < self.length; i++){
  14187. if($recv(self[i]).__eq(anObject)) {return i+1}
  14188. }
  14189. return aBlock._value();
  14190. ;
  14191. return self;
  14192. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14193. },
  14194. args: ["anObject", "start", "aBlock"],
  14195. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  14196. referencedClasses: [],
  14197. messageSends: []
  14198. }),
  14199. $globals.TNativeZeroBasedCollection);
  14200. $core.addMethod(
  14201. $core.method({
  14202. selector: "single",
  14203. protocol: "accessing",
  14204. fn: function (){
  14205. var self=this,$self=this;
  14206. return $core.withContext(function($ctx1) {
  14207. if (self.length == 0) throw new Error("Collection is empty");
  14208. if (self.length > 1) throw new Error("Collection holds more than one element.");
  14209. return self[0];;
  14210. return self;
  14211. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.TNativeZeroBasedCollection)});
  14212. },
  14213. args: [],
  14214. 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[0];\x0a'>",
  14215. referencedClasses: [],
  14216. messageSends: []
  14217. }),
  14218. $globals.TNativeZeroBasedCollection);
  14219. $core.addMethod(
  14220. $core.method({
  14221. selector: "size",
  14222. protocol: "accessing",
  14223. fn: function (){
  14224. var self=this,$self=this;
  14225. return $core.withContext(function($ctx1) {
  14226. return self.length;
  14227. return self;
  14228. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.TNativeZeroBasedCollection)});
  14229. },
  14230. args: [],
  14231. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  14232. referencedClasses: [],
  14233. messageSends: []
  14234. }),
  14235. $globals.TNativeZeroBasedCollection);
  14236. $core.addMethod(
  14237. $core.method({
  14238. selector: "with:do:",
  14239. protocol: "enumerating",
  14240. fn: function (anotherCollection,aBlock){
  14241. var self=this,$self=this;
  14242. return $core.withContext(function($ctx1) {
  14243. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  14244. for(var i=0; i<self.length; i++) {
  14245. aBlock._value_value_(self[i], anotherCollection[i]);
  14246. }
  14247. ;
  14248. return self;
  14249. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14250. },
  14251. args: ["anotherCollection", "aBlock"],
  14252. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09 $recv(anotherCollection)._first_(0); // #guardSequenceableCollection\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09'>",
  14253. referencedClasses: [],
  14254. messageSends: []
  14255. }),
  14256. $globals.TNativeZeroBasedCollection);
  14257. $core.addMethod(
  14258. $core.method({
  14259. selector: "withIndexDo:",
  14260. protocol: "enumerating",
  14261. fn: function (aBlock){
  14262. var self=this,$self=this;
  14263. return $core.withContext(function($ctx1) {
  14264. for(var i=0; i < self.length; i++) {
  14265. aBlock._value_value_(self[i], i+1);
  14266. }
  14267. ;
  14268. return self;
  14269. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14270. },
  14271. args: ["aBlock"],
  14272. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09'>",
  14273. referencedClasses: [],
  14274. messageSends: []
  14275. }),
  14276. $globals.TNativeZeroBasedCollection);
  14277. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  14278. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  14279. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  14280. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  14281. });
  14282. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Helpers", "amber_core/Kernel-Objects"], function($boot){"use strict";
  14283. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  14284. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  14285. $core.addPackage("Kernel-Classes");
  14286. ($core.packageDescriptors||$core.packages)["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  14287. ($core.packageDescriptors||$core.packages)["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  14288. $core.addClass("Behavior", $globals.Object, ["organization"], "Kernel-Classes");
  14289. $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.";
  14290. $core.addMethod(
  14291. $core.method({
  14292. selector: "allInstanceVariableNames",
  14293. protocol: "accessing",
  14294. fn: function (){
  14295. var self=this,$self=this;
  14296. var result;
  14297. return $core.withContext(function($ctx1) {
  14298. var $1,$receiver;
  14299. result=$recv($self._instanceVariableNames())._copy();
  14300. $1=$self._superclass();
  14301. $ctx1.sendIdx["superclass"]=1;
  14302. if(($receiver = $1) == null || $receiver.a$nil){
  14303. $1;
  14304. } else {
  14305. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  14306. }
  14307. return result;
  14308. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  14309. },
  14310. args: [],
  14311. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14312. referencedClasses: [],
  14313. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14314. }),
  14315. $globals.Behavior);
  14316. $core.addMethod(
  14317. $core.method({
  14318. selector: "allSelectors",
  14319. protocol: "accessing",
  14320. fn: function (){
  14321. var self=this,$self=this;
  14322. return $core.withContext(function($ctx1) {
  14323. var $1,$2;
  14324. $1=$self._allSuperclasses();
  14325. $2=$self._selectors();
  14326. $ctx1.sendIdx["selectors"]=1;
  14327. return $recv($1)._inject_into_($2,(function(acc,each){
  14328. return $core.withContext(function($ctx2) {
  14329. $recv(acc)._addAll_($recv(each)._selectors());
  14330. return $recv(acc)._yourself();
  14331. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  14332. }));
  14333. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  14334. },
  14335. args: [],
  14336. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  14337. referencedClasses: [],
  14338. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  14339. }),
  14340. $globals.Behavior);
  14341. $core.addMethod(
  14342. $core.method({
  14343. selector: "allSubclasses",
  14344. protocol: "accessing",
  14345. fn: function (){
  14346. var self=this,$self=this;
  14347. return $core.withContext(function($ctx1) {
  14348. return $recv($globals.Array)._streamContents_((function(str){
  14349. return $core.withContext(function($ctx2) {
  14350. return $self._allSubclassesDo_((function(each){
  14351. return $core.withContext(function($ctx3) {
  14352. return $recv(str)._nextPut_(each);
  14353. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14354. }));
  14355. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  14356. }));
  14357. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  14358. },
  14359. args: [],
  14360. 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 ] ]",
  14361. referencedClasses: ["Array"],
  14362. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  14363. }),
  14364. $globals.Behavior);
  14365. $core.addMethod(
  14366. $core.method({
  14367. selector: "allSubclassesDo:",
  14368. protocol: "enumerating",
  14369. fn: function (aBlock){
  14370. var self=this,$self=this;
  14371. return $core.withContext(function($ctx1) {
  14372. $core.traverseClassTree(self, function(subclass) {
  14373. if (subclass !== self) aBlock._value_(subclass);
  14374. });
  14375. return self;
  14376. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  14377. },
  14378. args: ["aBlock"],
  14379. 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})'>",
  14380. referencedClasses: [],
  14381. messageSends: []
  14382. }),
  14383. $globals.Behavior);
  14384. $core.addMethod(
  14385. $core.method({
  14386. selector: "allSuperclasses",
  14387. protocol: "accessing",
  14388. fn: function (){
  14389. var self=this,$self=this;
  14390. return $core.withContext(function($ctx1) {
  14391. var $1,$3,$2,$receiver;
  14392. $1=$self._superclass();
  14393. $ctx1.sendIdx["superclass"]=1;
  14394. if(($receiver = $1) == null || $receiver.a$nil){
  14395. return [];
  14396. } else {
  14397. $1;
  14398. }
  14399. $3=$self._superclass();
  14400. $ctx1.sendIdx["superclass"]=2;
  14401. $2=$recv($globals.OrderedCollection)._with_($3);
  14402. $recv($2)._addAll_($recv($self._superclass())._allSuperclasses());
  14403. return $recv($2)._yourself();
  14404. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  14405. },
  14406. args: [],
  14407. 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",
  14408. referencedClasses: ["OrderedCollection"],
  14409. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  14410. }),
  14411. $globals.Behavior);
  14412. $core.addMethod(
  14413. $core.method({
  14414. selector: "basicNew",
  14415. protocol: "instance creation",
  14416. fn: function (){
  14417. var self=this,$self=this;
  14418. return $core.withContext(function($ctx1) {
  14419. return new self.fn();
  14420. return self;
  14421. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  14422. },
  14423. args: [],
  14424. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  14425. referencedClasses: [],
  14426. messageSends: []
  14427. }),
  14428. $globals.Behavior);
  14429. $core.addMethod(
  14430. $core.method({
  14431. selector: "basicOrganization",
  14432. protocol: "accessing",
  14433. fn: function (){
  14434. var self=this,$self=this;
  14435. return $self["@organization"];
  14436. },
  14437. args: [],
  14438. source: "basicOrganization\x0a\x09^ organization",
  14439. referencedClasses: [],
  14440. messageSends: []
  14441. }),
  14442. $globals.Behavior);
  14443. $core.addMethod(
  14444. $core.method({
  14445. selector: "basicOrganization:",
  14446. protocol: "accessing",
  14447. fn: function (aClassOrganizer){
  14448. var self=this,$self=this;
  14449. $self["@organization"]=aClassOrganizer;
  14450. return self;
  14451. },
  14452. args: ["aClassOrganizer"],
  14453. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  14454. referencedClasses: [],
  14455. messageSends: []
  14456. }),
  14457. $globals.Behavior);
  14458. $core.addMethod(
  14459. $core.method({
  14460. selector: "canUnderstand:",
  14461. protocol: "testing",
  14462. fn: function (aSelector){
  14463. var self=this,$self=this;
  14464. return $core.withContext(function($ctx1) {
  14465. var $2,$1;
  14466. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  14467. return $core.withContext(function($ctx2) {
  14468. $2=$self._superclass();
  14469. $ctx2.sendIdx["superclass"]=1;
  14470. $1=$recv($2)._notNil();
  14471. return $recv($1)._and_((function(){
  14472. return $core.withContext(function($ctx3) {
  14473. return $recv($self._superclass())._canUnderstand_(aSelector);
  14474. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14475. }));
  14476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14477. }));
  14478. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  14479. },
  14480. args: ["aSelector"],
  14481. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  14482. referencedClasses: [],
  14483. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  14484. }),
  14485. $globals.Behavior);
  14486. $core.addMethod(
  14487. $core.method({
  14488. selector: "includesBehavior:",
  14489. protocol: "testing",
  14490. fn: function (aClass){
  14491. var self=this,$self=this;
  14492. return $core.withContext(function($ctx1) {
  14493. return $recv($self.__eq_eq(aClass))._or_((function(){
  14494. return $core.withContext(function($ctx2) {
  14495. return $self._inheritsFrom_(aClass);
  14496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14497. }));
  14498. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  14499. },
  14500. args: ["aClass"],
  14501. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  14502. referencedClasses: [],
  14503. messageSends: ["or:", "==", "inheritsFrom:"]
  14504. }),
  14505. $globals.Behavior);
  14506. $core.addMethod(
  14507. $core.method({
  14508. selector: "inheritsFrom:",
  14509. protocol: "testing",
  14510. fn: function (aClass){
  14511. var self=this,$self=this;
  14512. return $core.withContext(function($ctx1) {
  14513. var $1,$3,$2,$receiver;
  14514. $1=$self._superclass();
  14515. $ctx1.sendIdx["superclass"]=1;
  14516. if(($receiver = $1) == null || $receiver.a$nil){
  14517. return false;
  14518. } else {
  14519. $1;
  14520. }
  14521. $3=$self._superclass();
  14522. $ctx1.sendIdx["superclass"]=2;
  14523. $2=$recv(aClass).__eq_eq($3);
  14524. return $recv($2)._or_((function(){
  14525. return $core.withContext(function($ctx2) {
  14526. return $recv($self._superclass())._inheritsFrom_(aClass);
  14527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14528. }));
  14529. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  14530. },
  14531. args: ["aClass"],
  14532. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  14533. referencedClasses: [],
  14534. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  14535. }),
  14536. $globals.Behavior);
  14537. $core.addMethod(
  14538. $core.method({
  14539. selector: "instanceVariableNames",
  14540. protocol: "accessing",
  14541. fn: function (){
  14542. var self=this,$self=this;
  14543. return $core.withContext(function($ctx1) {
  14544. return self.iVarNames;
  14545. return self;
  14546. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  14547. },
  14548. args: [],
  14549. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  14550. referencedClasses: [],
  14551. messageSends: []
  14552. }),
  14553. $globals.Behavior);
  14554. $core.addMethod(
  14555. $core.method({
  14556. selector: "isBehavior",
  14557. protocol: "testing",
  14558. fn: function (){
  14559. var self=this,$self=this;
  14560. return true;
  14561. },
  14562. args: [],
  14563. source: "isBehavior\x0a\x09^ true",
  14564. referencedClasses: [],
  14565. messageSends: []
  14566. }),
  14567. $globals.Behavior);
  14568. $core.addMethod(
  14569. $core.method({
  14570. selector: "javascriptConstructor",
  14571. protocol: "accessing",
  14572. fn: function (){
  14573. var self=this,$self=this;
  14574. return $core.withContext(function($ctx1) {
  14575. return self.fn;
  14576. return self;
  14577. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  14578. },
  14579. args: [],
  14580. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  14581. referencedClasses: [],
  14582. messageSends: []
  14583. }),
  14584. $globals.Behavior);
  14585. $core.addMethod(
  14586. $core.method({
  14587. selector: "javascriptConstructor:",
  14588. protocol: "accessing",
  14589. fn: function (aJavaScriptFunction){
  14590. var self=this,$self=this;
  14591. return $core.withContext(function($ctx1) {
  14592. $core.setClassConstructor(self, aJavaScriptFunction);;
  14593. return self;
  14594. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  14595. },
  14596. args: ["aJavaScriptFunction"],
  14597. 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);'>",
  14598. referencedClasses: [],
  14599. messageSends: []
  14600. }),
  14601. $globals.Behavior);
  14602. $core.addMethod(
  14603. $core.method({
  14604. selector: "lookupSelector:",
  14605. protocol: "accessing",
  14606. fn: function (selector){
  14607. var self=this,$self=this;
  14608. var lookupClass;
  14609. return $core.withContext(function($ctx1) {
  14610. var $1;
  14611. var $early={};
  14612. try {
  14613. lookupClass=self;
  14614. $recv((function(){
  14615. return $core.withContext(function($ctx2) {
  14616. return $recv(lookupClass).__eq(nil);
  14617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14618. }))._whileFalse_((function(){
  14619. return $core.withContext(function($ctx2) {
  14620. $1=$recv(lookupClass)._includesSelector_(selector);
  14621. if($core.assert($1)){
  14622. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  14623. }
  14624. lookupClass=$recv(lookupClass)._superclass();
  14625. return lookupClass;
  14626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14627. }));
  14628. return nil;
  14629. }
  14630. catch(e) {if(e===$early)return e[0]; throw e}
  14631. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  14632. },
  14633. args: ["selector"],
  14634. 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",
  14635. referencedClasses: [],
  14636. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  14637. }),
  14638. $globals.Behavior);
  14639. $core.addMethod(
  14640. $core.method({
  14641. selector: "new",
  14642. protocol: "instance creation",
  14643. fn: function (){
  14644. var self=this,$self=this;
  14645. return $core.withContext(function($ctx1) {
  14646. return $recv($self._basicNew())._initialize();
  14647. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  14648. },
  14649. args: [],
  14650. source: "new\x0a\x09^ self basicNew initialize",
  14651. referencedClasses: [],
  14652. messageSends: ["initialize", "basicNew"]
  14653. }),
  14654. $globals.Behavior);
  14655. $core.addMethod(
  14656. $core.method({
  14657. selector: "prototype",
  14658. protocol: "accessing",
  14659. fn: function (){
  14660. var self=this,$self=this;
  14661. return $core.withContext(function($ctx1) {
  14662. return self.fn.prototype;
  14663. return self;
  14664. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  14665. },
  14666. args: [],
  14667. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  14668. referencedClasses: [],
  14669. messageSends: []
  14670. }),
  14671. $globals.Behavior);
  14672. $core.addMethod(
  14673. $core.method({
  14674. selector: "subclasses",
  14675. protocol: "accessing",
  14676. fn: function (){
  14677. var self=this,$self=this;
  14678. return $core.withContext(function($ctx1) {
  14679. $self._subclassResponsibility();
  14680. return self;
  14681. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  14682. },
  14683. args: [],
  14684. source: "subclasses\x0a\x09self subclassResponsibility",
  14685. referencedClasses: [],
  14686. messageSends: ["subclassResponsibility"]
  14687. }),
  14688. $globals.Behavior);
  14689. $core.addMethod(
  14690. $core.method({
  14691. selector: "superclass",
  14692. protocol: "accessing",
  14693. fn: function (){
  14694. var self=this,$self=this;
  14695. return $core.withContext(function($ctx1) {
  14696. return self.superclass;
  14697. return self;
  14698. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  14699. },
  14700. args: [],
  14701. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  14702. referencedClasses: [],
  14703. messageSends: []
  14704. }),
  14705. $globals.Behavior);
  14706. $core.addMethod(
  14707. $core.method({
  14708. selector: "theMetaClass",
  14709. protocol: "accessing",
  14710. fn: function (){
  14711. var self=this,$self=this;
  14712. return $core.withContext(function($ctx1) {
  14713. $self._subclassResponsibility();
  14714. return self;
  14715. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  14716. },
  14717. args: [],
  14718. source: "theMetaClass\x0a\x09self subclassResponsibility",
  14719. referencedClasses: [],
  14720. messageSends: ["subclassResponsibility"]
  14721. }),
  14722. $globals.Behavior);
  14723. $core.addMethod(
  14724. $core.method({
  14725. selector: "theNonMetaClass",
  14726. protocol: "accessing",
  14727. fn: function (){
  14728. var self=this,$self=this;
  14729. return $core.withContext(function($ctx1) {
  14730. $self._subclassResponsibility();
  14731. return self;
  14732. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  14733. },
  14734. args: [],
  14735. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  14736. referencedClasses: [],
  14737. messageSends: ["subclassResponsibility"]
  14738. }),
  14739. $globals.Behavior);
  14740. $core.addMethod(
  14741. $core.method({
  14742. selector: "withAllSubclasses",
  14743. protocol: "accessing",
  14744. fn: function (){
  14745. var self=this,$self=this;
  14746. return $core.withContext(function($ctx1) {
  14747. var $1;
  14748. $1=$recv($globals.Array)._with_(self);
  14749. $recv($1)._addAll_($self._allSubclasses());
  14750. return $recv($1)._yourself();
  14751. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  14752. },
  14753. args: [],
  14754. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  14755. referencedClasses: ["Array"],
  14756. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  14757. }),
  14758. $globals.Behavior);
  14759. $core.addClass("Class", $globals.Behavior, ["package"], "Kernel-Classes");
  14760. $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.";
  14761. $core.addMethod(
  14762. $core.method({
  14763. selector: "basicPackage:",
  14764. protocol: "accessing",
  14765. fn: function (aPackage){
  14766. var self=this,$self=this;
  14767. $self["@package"]=aPackage;
  14768. return self;
  14769. },
  14770. args: ["aPackage"],
  14771. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  14772. referencedClasses: [],
  14773. messageSends: []
  14774. }),
  14775. $globals.Class);
  14776. $core.addMethod(
  14777. $core.method({
  14778. selector: "classTag",
  14779. protocol: "accessing",
  14780. fn: function (){
  14781. var self=this,$self=this;
  14782. return "class";
  14783. },
  14784. args: [],
  14785. 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'",
  14786. referencedClasses: [],
  14787. messageSends: []
  14788. }),
  14789. $globals.Class);
  14790. $core.addMethod(
  14791. $core.method({
  14792. selector: "definition",
  14793. protocol: "accessing",
  14794. fn: function (){
  14795. var self=this,$self=this;
  14796. return $core.withContext(function($ctx1) {
  14797. var $1,$2;
  14798. return $recv($globals.String)._streamContents_((function(stream){
  14799. return $core.withContext(function($ctx2) {
  14800. $recv(stream)._print_($self._superclass());
  14801. $ctx2.sendIdx["print:"]=1;
  14802. $recv(stream)._write_(" subclass: ");
  14803. $ctx2.sendIdx["write:"]=1;
  14804. $recv(stream)._printSymbol_($self._name());
  14805. $recv(stream)._lf();
  14806. $ctx2.sendIdx["lf"]=1;
  14807. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  14808. return $core.withContext(function($ctx3) {
  14809. $1=$recv($globals.String)._tab();
  14810. $ctx3.sendIdx["tab"]=1;
  14811. $2=$recv($globals.String)._lf();
  14812. $ctx3.sendIdx["lf"]=2;
  14813. return [$1,"uses: ",tcd,$2];
  14814. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  14815. })));
  14816. $ctx2.sendIdx["write:"]=2;
  14817. $recv(stream)._tab();
  14818. $ctx2.sendIdx["tab"]=2;
  14819. $recv(stream)._write_("instanceVariableNames: ");
  14820. $ctx2.sendIdx["write:"]=3;
  14821. $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  14822. $ctx2.sendIdx["print:"]=2;
  14823. $recv(stream)._lf();
  14824. $recv(stream)._tab();
  14825. $recv(stream)._write_("package: ");
  14826. return $recv(stream)._print_($self._category());
  14827. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14828. }));
  14829. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  14830. },
  14831. args: [],
  14832. 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 ]",
  14833. referencedClasses: ["String"],
  14834. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "instanceVariableNames", "category"]
  14835. }),
  14836. $globals.Class);
  14837. $core.addMethod(
  14838. $core.method({
  14839. selector: "isClass",
  14840. protocol: "testing",
  14841. fn: function (){
  14842. var self=this,$self=this;
  14843. return true;
  14844. },
  14845. args: [],
  14846. source: "isClass\x0a\x09^ true",
  14847. referencedClasses: [],
  14848. messageSends: []
  14849. }),
  14850. $globals.Class);
  14851. $core.addMethod(
  14852. $core.method({
  14853. selector: "package",
  14854. protocol: "accessing",
  14855. fn: function (){
  14856. var self=this,$self=this;
  14857. return $self["@package"];
  14858. },
  14859. args: [],
  14860. source: "package\x0a\x09^ package",
  14861. referencedClasses: [],
  14862. messageSends: []
  14863. }),
  14864. $globals.Class);
  14865. $core.addMethod(
  14866. $core.method({
  14867. selector: "provided",
  14868. protocol: "converting",
  14869. fn: function (){
  14870. var self=this,$self=this;
  14871. return $core.withContext(function($ctx1) {
  14872. return $recv($self._javascriptConstructor())._provided();
  14873. }, function($ctx1) {$ctx1.fill(self,"provided",{},$globals.Class)});
  14874. },
  14875. args: [],
  14876. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 Number provided EPSILON\x0a\x09that forwards to (wrapped JS) constructor function.\x22\x0a\x09\x0a\x09^ self javascriptConstructor provided",
  14877. referencedClasses: [],
  14878. messageSends: ["provided", "javascriptConstructor"]
  14879. }),
  14880. $globals.Class);
  14881. $core.addMethod(
  14882. $core.method({
  14883. selector: "rename:",
  14884. protocol: "accessing",
  14885. fn: function (aString){
  14886. var self=this,$self=this;
  14887. return $core.withContext(function($ctx1) {
  14888. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  14889. return self;
  14890. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  14891. },
  14892. args: ["aString"],
  14893. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  14894. referencedClasses: ["ClassBuilder"],
  14895. messageSends: ["renameClass:to:", "new"]
  14896. }),
  14897. $globals.Class);
  14898. $core.addMethod(
  14899. $core.method({
  14900. selector: "subclasses",
  14901. protocol: "accessing",
  14902. fn: function (){
  14903. var self=this,$self=this;
  14904. return $core.withContext(function($ctx1) {
  14905. return self.subclasses._copy();
  14906. return self;
  14907. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  14908. },
  14909. args: [],
  14910. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  14911. referencedClasses: [],
  14912. messageSends: []
  14913. }),
  14914. $globals.Class);
  14915. $core.addMethod(
  14916. $core.method({
  14917. selector: "theMetaClass",
  14918. protocol: "accessing",
  14919. fn: function (){
  14920. var self=this,$self=this;
  14921. return $core.withContext(function($ctx1) {
  14922. return $self._class();
  14923. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  14924. },
  14925. args: [],
  14926. source: "theMetaClass\x0a\x09^ self class",
  14927. referencedClasses: [],
  14928. messageSends: ["class"]
  14929. }),
  14930. $globals.Class);
  14931. $core.addClass("Metaclass", $globals.Behavior, [], "Kernel-Classes");
  14932. $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.";
  14933. $core.addMethod(
  14934. $core.method({
  14935. selector: "asJavaScriptSource",
  14936. protocol: "converting",
  14937. fn: function (){
  14938. var self=this,$self=this;
  14939. return $core.withContext(function($ctx1) {
  14940. var $1;
  14941. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  14942. $ctx1.sendIdx[","]=1;
  14943. return $1;
  14944. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  14945. },
  14946. args: [],
  14947. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  14948. referencedClasses: [],
  14949. messageSends: [",", "name", "instanceClass"]
  14950. }),
  14951. $globals.Metaclass);
  14952. $core.addMethod(
  14953. $core.method({
  14954. selector: "definition",
  14955. protocol: "accessing",
  14956. fn: function (){
  14957. var self=this,$self=this;
  14958. return $core.withContext(function($ctx1) {
  14959. var $1,$2;
  14960. return $recv($globals.String)._streamContents_((function(stream){
  14961. return $core.withContext(function($ctx2) {
  14962. $recv(stream)._print_(self);
  14963. $ctx2.sendIdx["print:"]=1;
  14964. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  14965. return " ";
  14966. }),(function(tcd){
  14967. return $core.withContext(function($ctx3) {
  14968. $1=$recv($globals.String)._lf();
  14969. $ctx3.sendIdx["lf"]=1;
  14970. $2=$recv($globals.String)._tab();
  14971. $ctx3.sendIdx["tab"]=1;
  14972. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  14973. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  14974. })));
  14975. $ctx2.sendIdx["write:"]=1;
  14976. $recv(stream)._write_("instanceVariableNames: ");
  14977. return $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  14978. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14979. }));
  14980. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  14981. },
  14982. args: [],
  14983. 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) ]",
  14984. referencedClasses: ["String"],
  14985. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "instanceVariableNames"]
  14986. }),
  14987. $globals.Metaclass);
  14988. $core.addMethod(
  14989. $core.method({
  14990. selector: "instanceClass",
  14991. protocol: "accessing",
  14992. fn: function (){
  14993. var self=this,$self=this;
  14994. return $core.withContext(function($ctx1) {
  14995. return self.instanceClass;
  14996. return self;
  14997. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  14998. },
  14999. args: [],
  15000. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  15001. referencedClasses: [],
  15002. messageSends: []
  15003. }),
  15004. $globals.Metaclass);
  15005. $core.addMethod(
  15006. $core.method({
  15007. selector: "instanceVariableNames:",
  15008. protocol: "accessing",
  15009. fn: function (aCollection){
  15010. var self=this,$self=this;
  15011. return $core.withContext(function($ctx1) {
  15012. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  15013. return self;
  15014. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  15015. },
  15016. args: ["aCollection"],
  15017. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection.\x0a\x09^ self",
  15018. referencedClasses: ["ClassBuilder"],
  15019. messageSends: ["class:instanceVariableNames:", "new"]
  15020. }),
  15021. $globals.Metaclass);
  15022. $core.addMethod(
  15023. $core.method({
  15024. selector: "isMetaclass",
  15025. protocol: "testing",
  15026. fn: function (){
  15027. var self=this,$self=this;
  15028. return true;
  15029. },
  15030. args: [],
  15031. source: "isMetaclass\x0a\x09^ true",
  15032. referencedClasses: [],
  15033. messageSends: []
  15034. }),
  15035. $globals.Metaclass);
  15036. $core.addMethod(
  15037. $core.method({
  15038. selector: "name",
  15039. protocol: "accessing",
  15040. fn: function (){
  15041. var self=this,$self=this;
  15042. return $core.withContext(function($ctx1) {
  15043. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  15044. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  15045. },
  15046. args: [],
  15047. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15048. referencedClasses: [],
  15049. messageSends: [",", "name", "instanceClass"]
  15050. }),
  15051. $globals.Metaclass);
  15052. $core.addMethod(
  15053. $core.method({
  15054. selector: "package",
  15055. protocol: "accessing",
  15056. fn: function (){
  15057. var self=this,$self=this;
  15058. return $core.withContext(function($ctx1) {
  15059. return $recv($self._instanceClass())._package();
  15060. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  15061. },
  15062. args: [],
  15063. source: "package\x0a\x09^ self instanceClass package",
  15064. referencedClasses: [],
  15065. messageSends: ["package", "instanceClass"]
  15066. }),
  15067. $globals.Metaclass);
  15068. $core.addMethod(
  15069. $core.method({
  15070. selector: "subclasses",
  15071. protocol: "accessing",
  15072. fn: function (){
  15073. var self=this,$self=this;
  15074. return $core.withContext(function($ctx1) {
  15075. return $core.metaSubclasses(self);
  15076. return self;
  15077. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  15078. },
  15079. args: [],
  15080. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  15081. referencedClasses: [],
  15082. messageSends: []
  15083. }),
  15084. $globals.Metaclass);
  15085. $core.addMethod(
  15086. $core.method({
  15087. selector: "theMetaClass",
  15088. protocol: "accessing",
  15089. fn: function (){
  15090. var self=this,$self=this;
  15091. return self;
  15092. },
  15093. args: [],
  15094. source: "theMetaClass\x0a\x09^ self",
  15095. referencedClasses: [],
  15096. messageSends: []
  15097. }),
  15098. $globals.Metaclass);
  15099. $core.addMethod(
  15100. $core.method({
  15101. selector: "theNonMetaClass",
  15102. protocol: "accessing",
  15103. fn: function (){
  15104. var self=this,$self=this;
  15105. return $core.withContext(function($ctx1) {
  15106. return $self._instanceClass();
  15107. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  15108. },
  15109. args: [],
  15110. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15111. referencedClasses: [],
  15112. messageSends: ["instanceClass"]
  15113. }),
  15114. $globals.Metaclass);
  15115. $core.addMethod(
  15116. $core.method({
  15117. selector: "uses:instanceVariableNames:",
  15118. protocol: "accessing",
  15119. fn: function (aTraitCompositionDescription,aCollection){
  15120. var self=this,$self=this;
  15121. var metaclass;
  15122. return $core.withContext(function($ctx1) {
  15123. metaclass=$self._instanceVariableNames_(aCollection);
  15124. $recv(metaclass)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15125. return metaclass;
  15126. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,metaclass:metaclass},$globals.Metaclass)});
  15127. },
  15128. args: ["aTraitCompositionDescription", "aCollection"],
  15129. source: "uses: aTraitCompositionDescription instanceVariableNames: aCollection\x0a\x09| metaclass |\x0a\x09metaclass := self instanceVariableNames: aCollection.\x0a\x09metaclass setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ metaclass",
  15130. referencedClasses: [],
  15131. messageSends: ["instanceVariableNames:", "setTraitComposition:", "asTraitComposition"]
  15132. }),
  15133. $globals.Metaclass);
  15134. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15135. $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:`.";
  15136. $core.addMethod(
  15137. $core.method({
  15138. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15139. protocol: "class definition",
  15140. fn: function (aClass,className,aCollection,packageName){
  15141. var self=this,$self=this;
  15142. var theClass,thePackage;
  15143. return $core.withContext(function($ctx1) {
  15144. var $1,$2,$3,$receiver;
  15145. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15146. thePackage=$recv($globals.Package)._named_(packageName);
  15147. $1=theClass;
  15148. if(($receiver = $1) == null || $receiver.a$nil){
  15149. $1;
  15150. } else {
  15151. $recv(theClass)._package_(thePackage);
  15152. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15153. if(!$core.assert($2)){
  15154. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15155. }
  15156. }
  15157. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15158. $recv($3)._recompile();
  15159. return $recv($3)._yourself();
  15160. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  15161. },
  15162. args: ["aClass", "className", "aCollection", "packageName"],
  15163. 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",
  15164. referencedClasses: ["Smalltalk", "Package"],
  15165. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15166. }),
  15167. $globals.ClassBuilder);
  15168. $core.addMethod(
  15169. $core.method({
  15170. selector: "addTraitNamed:package:",
  15171. protocol: "class definition",
  15172. fn: function (traitName,packageName){
  15173. var self=this,$self=this;
  15174. var theTrait,thePackage;
  15175. return $core.withContext(function($ctx1) {
  15176. var $1,$2,$receiver;
  15177. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15178. thePackage=$recv($globals.Package)._named_(packageName);
  15179. $1=theTrait;
  15180. if(($receiver = $1) == null || $receiver.a$nil){
  15181. $1;
  15182. } else {
  15183. $2=theTrait;
  15184. $recv($2)._package_(thePackage);
  15185. $recv($2)._recompile();
  15186. return $recv($2)._yourself();
  15187. }
  15188. return $self._basicAddTraitNamed_package_(traitName,packageName);
  15189. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  15190. },
  15191. args: ["traitName", "packageName"],
  15192. 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",
  15193. referencedClasses: ["Smalltalk", "Package"],
  15194. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15195. }),
  15196. $globals.ClassBuilder);
  15197. $core.addMethod(
  15198. $core.method({
  15199. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15200. protocol: "private",
  15201. fn: function (aClass,aString,aCollection,packageName){
  15202. var self=this,$self=this;
  15203. return $core.withContext(function($ctx1) {
  15204. return $core.addClass(aString, aClass, aCollection, packageName);
  15205. ;
  15206. return self;
  15207. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  15208. },
  15209. args: ["aClass", "aString", "aCollection", "packageName"],
  15210. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15211. referencedClasses: [],
  15212. messageSends: []
  15213. }),
  15214. $globals.ClassBuilder);
  15215. $core.addMethod(
  15216. $core.method({
  15217. selector: "basicAddTraitNamed:package:",
  15218. protocol: "private",
  15219. fn: function (aString,anotherString){
  15220. var self=this,$self=this;
  15221. return $core.withContext(function($ctx1) {
  15222. return $core.addTrait(aString, anotherString);
  15223. return self;
  15224. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  15225. },
  15226. args: ["aString", "anotherString"],
  15227. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15228. referencedClasses: [],
  15229. messageSends: []
  15230. }),
  15231. $globals.ClassBuilder);
  15232. $core.addMethod(
  15233. $core.method({
  15234. selector: "basicClass:instanceVariables:",
  15235. protocol: "private",
  15236. fn: function (aClass,aCollection){
  15237. var self=this,$self=this;
  15238. return $core.withContext(function($ctx1) {
  15239. var $1;
  15240. $1=$recv(aClass)._isMetaclass();
  15241. if(!$core.assert($1)){
  15242. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  15243. }
  15244. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  15245. return self;
  15246. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15247. },
  15248. args: ["aClass", "aCollection"],
  15249. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  15250. referencedClasses: [],
  15251. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  15252. }),
  15253. $globals.ClassBuilder);
  15254. $core.addMethod(
  15255. $core.method({
  15256. selector: "basicRemoveClass:",
  15257. protocol: "private",
  15258. fn: function (aClass){
  15259. var self=this,$self=this;
  15260. return $core.withContext(function($ctx1) {
  15261. $core.removeClass(aClass);
  15262. return self;
  15263. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  15264. },
  15265. args: ["aClass"],
  15266. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  15267. referencedClasses: [],
  15268. messageSends: []
  15269. }),
  15270. $globals.ClassBuilder);
  15271. $core.addMethod(
  15272. $core.method({
  15273. selector: "basicRenameClass:to:",
  15274. protocol: "private",
  15275. fn: function (aClass,aString){
  15276. var self=this,$self=this;
  15277. return $core.withContext(function($ctx1) {
  15278. $globals[aString] = aClass;
  15279. delete $globals[aClass.name];
  15280. aClass.name = aString;
  15281. ;
  15282. return self;
  15283. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15284. },
  15285. args: ["aClass", "aString"],
  15286. 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'>",
  15287. referencedClasses: [],
  15288. messageSends: []
  15289. }),
  15290. $globals.ClassBuilder);
  15291. $core.addMethod(
  15292. $core.method({
  15293. selector: "basicSwapClassNames:with:",
  15294. protocol: "private",
  15295. fn: function (aClass,anotherClass){
  15296. var self=this,$self=this;
  15297. return $core.withContext(function($ctx1) {
  15298. var tmp = aClass.name;
  15299. aClass.name = anotherClass.name;
  15300. anotherClass.name = tmp;
  15301. ;
  15302. return self;
  15303. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15304. },
  15305. args: ["aClass", "anotherClass"],
  15306. 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'>",
  15307. referencedClasses: [],
  15308. messageSends: []
  15309. }),
  15310. $globals.ClassBuilder);
  15311. $core.addMethod(
  15312. $core.method({
  15313. selector: "class:instanceVariableNames:",
  15314. protocol: "class definition",
  15315. fn: function (aClass,ivarNames){
  15316. var self=this,$self=this;
  15317. return $core.withContext(function($ctx1) {
  15318. $self._class_instanceVariables_(aClass,$self._instanceVariableNamesFor_(ivarNames));
  15319. return self;
  15320. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  15321. },
  15322. args: ["aClass", "ivarNames"],
  15323. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self class: aClass instanceVariables: (self instanceVariableNamesFor: ivarNames)",
  15324. referencedClasses: [],
  15325. messageSends: ["class:instanceVariables:", "instanceVariableNamesFor:"]
  15326. }),
  15327. $globals.ClassBuilder);
  15328. $core.addMethod(
  15329. $core.method({
  15330. selector: "class:instanceVariables:",
  15331. protocol: "class definition",
  15332. fn: function (aClass,aCollection){
  15333. var self=this,$self=this;
  15334. return $core.withContext(function($ctx1) {
  15335. var $1,$3,$2;
  15336. $self._basicClass_instanceVariables_(aClass,aCollection);
  15337. $1=$recv($globals.SystemAnnouncer)._current();
  15338. $3=$recv($globals.ClassDefinitionChanged)._new();
  15339. $recv($3)._theClass_(aClass);
  15340. $2=$recv($3)._yourself();
  15341. $recv($1)._announce_($2);
  15342. return self;
  15343. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15344. },
  15345. args: ["aClass", "aCollection"],
  15346. source: "class: aClass instanceVariables: aCollection\x0a\x09self basicClass: aClass instanceVariables: aCollection.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  15347. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  15348. messageSends: ["basicClass:instanceVariables:", "announce:", "current", "theClass:", "new", "yourself"]
  15349. }),
  15350. $globals.ClassBuilder);
  15351. $core.addMethod(
  15352. $core.method({
  15353. selector: "copyClass:named:",
  15354. protocol: "copying",
  15355. fn: function (aClass,className){
  15356. var self=this,$self=this;
  15357. var newClass;
  15358. return $core.withContext(function($ctx1) {
  15359. var $1,$3,$2;
  15360. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15361. $self._copyClass_to_(aClass,newClass);
  15362. $1=$recv($globals.SystemAnnouncer)._current();
  15363. $3=$recv($globals.ClassAdded)._new();
  15364. $recv($3)._theClass_(newClass);
  15365. $2=$recv($3)._yourself();
  15366. $recv($1)._announce_($2);
  15367. return newClass;
  15368. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  15369. },
  15370. args: ["aClass", "className"],
  15371. 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",
  15372. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15373. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  15374. }),
  15375. $globals.ClassBuilder);
  15376. $core.addMethod(
  15377. $core.method({
  15378. selector: "copyClass:to:",
  15379. protocol: "copying",
  15380. fn: function (aClass,anotherClass){
  15381. var self=this,$self=this;
  15382. return $core.withContext(function($ctx1) {
  15383. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  15384. $recv(anotherClass)._comment_($recv(aClass)._comment());
  15385. $1=$recv(aClass)._methodDictionary();
  15386. $ctx1.sendIdx["methodDictionary"]=1;
  15387. $recv($1)._valuesDo_((function(each){
  15388. return $core.withContext(function($ctx2) {
  15389. $3=$recv(each)._methodClass();
  15390. $ctx2.sendIdx["methodClass"]=1;
  15391. $2=$recv($3).__eq(aClass);
  15392. $ctx2.sendIdx["="]=1;
  15393. if($core.assert($2)){
  15394. $4=$recv($globals.Compiler)._new();
  15395. $ctx2.sendIdx["new"]=1;
  15396. $5=$recv(each)._source();
  15397. $ctx2.sendIdx["source"]=1;
  15398. $6=$recv(each)._protocol();
  15399. $ctx2.sendIdx["protocol"]=1;
  15400. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  15401. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  15402. }
  15403. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15404. }));
  15405. $ctx1.sendIdx["valuesDo:"]=1;
  15406. $7=$recv(aClass)._traitComposition();
  15407. $ctx1.sendIdx["traitComposition"]=1;
  15408. $recv(anotherClass)._setTraitComposition_($7);
  15409. $ctx1.sendIdx["setTraitComposition:"]=1;
  15410. $8=$recv(anotherClass)._class();
  15411. $ctx1.sendIdx["class"]=1;
  15412. $10=$recv(aClass)._class();
  15413. $ctx1.sendIdx["class"]=2;
  15414. $9=$recv($10)._instanceVariableNames();
  15415. $self._basicClass_instanceVariables_($8,$9);
  15416. $12=$recv(aClass)._class();
  15417. $ctx1.sendIdx["class"]=3;
  15418. $11=$recv($12)._methodDictionary();
  15419. $recv($11)._valuesDo_((function(each){
  15420. return $core.withContext(function($ctx2) {
  15421. $14=$recv(each)._methodClass();
  15422. $15=$recv(aClass)._class();
  15423. $ctx2.sendIdx["class"]=4;
  15424. $13=$recv($14).__eq($15);
  15425. if($core.assert($13)){
  15426. $16=$recv($globals.Compiler)._new();
  15427. $17=$recv(each)._source();
  15428. $18=$recv(anotherClass)._class();
  15429. $ctx2.sendIdx["class"]=5;
  15430. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  15431. }
  15432. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15433. }));
  15434. $19=$recv(anotherClass)._class();
  15435. $ctx1.sendIdx["class"]=6;
  15436. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  15437. return self;
  15438. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15439. },
  15440. args: ["aClass", "anotherClass"],
  15441. 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",
  15442. referencedClasses: ["Compiler"],
  15443. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  15444. }),
  15445. $globals.ClassBuilder);
  15446. $core.addMethod(
  15447. $core.method({
  15448. selector: "installMethod:forClass:protocol:",
  15449. protocol: "method definition",
  15450. fn: function (aCompiledMethod,aBehavior,aString){
  15451. var self=this,$self=this;
  15452. return $core.withContext(function($ctx1) {
  15453. $recv(aCompiledMethod)._protocol_(aString);
  15454. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  15455. return aCompiledMethod;
  15456. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  15457. },
  15458. args: ["aCompiledMethod", "aBehavior", "aString"],
  15459. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  15460. referencedClasses: [],
  15461. messageSends: ["protocol:", "addCompiledMethod:"]
  15462. }),
  15463. $globals.ClassBuilder);
  15464. $core.addMethod(
  15465. $core.method({
  15466. selector: "instanceVariableNamesFor:",
  15467. protocol: "accessing",
  15468. fn: function (aString){
  15469. var self=this,$self=this;
  15470. return $core.withContext(function($ctx1) {
  15471. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  15472. return $core.withContext(function($ctx2) {
  15473. return $recv(each)._isEmpty();
  15474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15475. }));
  15476. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  15477. },
  15478. args: ["aString"],
  15479. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  15480. referencedClasses: [],
  15481. messageSends: ["reject:", "tokenize:", "isEmpty"]
  15482. }),
  15483. $globals.ClassBuilder);
  15484. $core.addMethod(
  15485. $core.method({
  15486. selector: "migrateClass:superclass:",
  15487. protocol: "class migration",
  15488. fn: function (aClass,anotherClass){
  15489. var self=this,$self=this;
  15490. return $core.withContext(function($ctx1) {
  15491. var $1;
  15492. $1=$recv(aClass)._name();
  15493. $ctx1.sendIdx["name"]=1;
  15494. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15495. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15496. },
  15497. args: ["aClass", "anotherClass"],
  15498. 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",
  15499. referencedClasses: [],
  15500. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  15501. }),
  15502. $globals.ClassBuilder);
  15503. $core.addMethod(
  15504. $core.method({
  15505. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  15506. protocol: "class migration",
  15507. fn: function (className,aClass,aCollection,packageName){
  15508. var self=this,$self=this;
  15509. var oldClass,newClass,tmp;
  15510. return $core.withContext(function($ctx1) {
  15511. var $1,$2,$4,$3;
  15512. tmp="new*".__comma(className);
  15513. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15514. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  15515. $self._basicSwapClassNames_with_(oldClass,newClass);
  15516. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  15517. $recv((function(){
  15518. return $core.withContext(function($ctx2) {
  15519. return $self._copyClass_to_(oldClass,newClass);
  15520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15521. }))._on_do_($globals.Error,(function(exception){
  15522. return $core.withContext(function($ctx2) {
  15523. $self._basicSwapClassNames_with_(oldClass,newClass);
  15524. $1=$self._basicRemoveClass_(newClass);
  15525. $ctx2.sendIdx["basicRemoveClass:"]=1;
  15526. return $recv(exception)._pass();
  15527. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  15528. }));
  15529. $self._rawRenameClass_to_(oldClass,tmp);
  15530. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  15531. $self._rawRenameClass_to_(newClass,className);
  15532. $recv($recv(oldClass)._subclasses())._do_((function(each){
  15533. return $core.withContext(function($ctx2) {
  15534. return $self._migrateClass_superclass_(each,newClass);
  15535. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15536. }));
  15537. $self._basicRemoveClass_(oldClass);
  15538. $2=$recv($globals.SystemAnnouncer)._current();
  15539. $4=$recv($globals.ClassMigrated)._new();
  15540. $recv($4)._theClass_(newClass);
  15541. $recv($4)._oldClass_(oldClass);
  15542. $3=$recv($4)._yourself();
  15543. $recv($2)._announce_($3);
  15544. return newClass;
  15545. }, 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)});
  15546. },
  15547. args: ["className", "aClass", "aCollection", "packageName"],
  15548. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception pass ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15549. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  15550. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "pass", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  15551. }),
  15552. $globals.ClassBuilder);
  15553. $core.addMethod(
  15554. $core.method({
  15555. selector: "rawRenameClass:to:",
  15556. protocol: "private",
  15557. fn: function (aClass,aString){
  15558. var self=this,$self=this;
  15559. return $core.withContext(function($ctx1) {
  15560. $globals[aString] = aClass;
  15561. ;
  15562. return self;
  15563. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15564. },
  15565. args: ["aClass", "aString"],
  15566. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  15567. referencedClasses: [],
  15568. messageSends: []
  15569. }),
  15570. $globals.ClassBuilder);
  15571. $core.addMethod(
  15572. $core.method({
  15573. selector: "renameClass:to:",
  15574. protocol: "class migration",
  15575. fn: function (aClass,className){
  15576. var self=this,$self=this;
  15577. return $core.withContext(function($ctx1) {
  15578. var $1,$3,$2;
  15579. $self._basicRenameClass_to_(aClass,className);
  15580. $recv(aClass)._recompile();
  15581. $1=$recv($globals.SystemAnnouncer)._current();
  15582. $3=$recv($globals.ClassRenamed)._new();
  15583. $recv($3)._theClass_(aClass);
  15584. $2=$recv($3)._yourself();
  15585. $recv($1)._announce_($2);
  15586. return self;
  15587. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15588. },
  15589. args: ["aClass", "className"],
  15590. 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)",
  15591. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  15592. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  15593. }),
  15594. $globals.ClassBuilder);
  15595. $core.addMethod(
  15596. $core.method({
  15597. selector: "superclass:subclass:",
  15598. protocol: "class definition",
  15599. fn: function (aClass,className){
  15600. var self=this,$self=this;
  15601. return $core.withContext(function($ctx1) {
  15602. return $self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  15603. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15604. },
  15605. args: ["aClass", "className"],
  15606. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  15607. referencedClasses: [],
  15608. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  15609. }),
  15610. $globals.ClassBuilder);
  15611. $core.addMethod(
  15612. $core.method({
  15613. selector: "superclass:subclass:instanceVariableNames:package:",
  15614. protocol: "class definition",
  15615. fn: function (aClass,className,ivarNames,packageName){
  15616. var self=this,$self=this;
  15617. var newClass;
  15618. return $core.withContext(function($ctx1) {
  15619. var $1,$2,$3,$5,$4,$receiver;
  15620. $1=$self._instanceVariableNamesFor_(ivarNames);
  15621. if(($receiver = packageName) == null || $receiver.a$nil){
  15622. $2="unclassified";
  15623. } else {
  15624. $2=packageName;
  15625. }
  15626. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  15627. $3=$recv($globals.SystemAnnouncer)._current();
  15628. $5=$recv($globals.ClassAdded)._new();
  15629. $recv($5)._theClass_(newClass);
  15630. $4=$recv($5)._yourself();
  15631. $recv($3)._announce_($4);
  15632. return newClass;
  15633. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  15634. },
  15635. args: ["aClass", "className", "ivarNames", "packageName"],
  15636. 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",
  15637. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15638. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  15639. }),
  15640. $globals.ClassBuilder);
  15641. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  15642. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  15643. $core.addMethod(
  15644. $core.method({
  15645. selector: "getNodesFrom:",
  15646. protocol: "accessing",
  15647. fn: function (aCollection){
  15648. var self=this,$self=this;
  15649. var children,others;
  15650. return $core.withContext(function($ctx1) {
  15651. var $1;
  15652. children=[];
  15653. others=[];
  15654. $recv(aCollection)._do_((function(each){
  15655. return $core.withContext(function($ctx2) {
  15656. $1=$recv($recv(each)._superclass()).__eq($self._theClass());
  15657. if($core.assert($1)){
  15658. return $recv(children)._add_(each);
  15659. $ctx2.sendIdx["add:"]=1;
  15660. } else {
  15661. return $recv(others)._add_(each);
  15662. }
  15663. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15664. }));
  15665. $self["@nodes"]=$recv(children)._collect_((function(each){
  15666. return $core.withContext(function($ctx2) {
  15667. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv($self._level()).__plus((1)));
  15668. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  15669. }));
  15670. return self;
  15671. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  15672. },
  15673. args: ["aCollection"],
  15674. 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 ]",
  15675. referencedClasses: ["ClassSorterNode"],
  15676. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  15677. }),
  15678. $globals.ClassSorterNode);
  15679. $core.addMethod(
  15680. $core.method({
  15681. selector: "level",
  15682. protocol: "accessing",
  15683. fn: function (){
  15684. var self=this,$self=this;
  15685. return $self["@level"];
  15686. },
  15687. args: [],
  15688. source: "level\x0a\x09^ level",
  15689. referencedClasses: [],
  15690. messageSends: []
  15691. }),
  15692. $globals.ClassSorterNode);
  15693. $core.addMethod(
  15694. $core.method({
  15695. selector: "level:",
  15696. protocol: "accessing",
  15697. fn: function (anInteger){
  15698. var self=this,$self=this;
  15699. $self["@level"]=anInteger;
  15700. return self;
  15701. },
  15702. args: ["anInteger"],
  15703. source: "level: anInteger\x0a\x09level := anInteger",
  15704. referencedClasses: [],
  15705. messageSends: []
  15706. }),
  15707. $globals.ClassSorterNode);
  15708. $core.addMethod(
  15709. $core.method({
  15710. selector: "nodes",
  15711. protocol: "accessing",
  15712. fn: function (){
  15713. var self=this,$self=this;
  15714. return $self["@nodes"];
  15715. },
  15716. args: [],
  15717. source: "nodes\x0a\x09^ nodes",
  15718. referencedClasses: [],
  15719. messageSends: []
  15720. }),
  15721. $globals.ClassSorterNode);
  15722. $core.addMethod(
  15723. $core.method({
  15724. selector: "theClass",
  15725. protocol: "accessing",
  15726. fn: function (){
  15727. var self=this,$self=this;
  15728. return $self["@theClass"];
  15729. },
  15730. args: [],
  15731. source: "theClass\x0a\x09^ theClass",
  15732. referencedClasses: [],
  15733. messageSends: []
  15734. }),
  15735. $globals.ClassSorterNode);
  15736. $core.addMethod(
  15737. $core.method({
  15738. selector: "theClass:",
  15739. protocol: "accessing",
  15740. fn: function (aClass){
  15741. var self=this,$self=this;
  15742. $self["@theClass"]=aClass;
  15743. return self;
  15744. },
  15745. args: ["aClass"],
  15746. source: "theClass: aClass\x0a\x09theClass := aClass",
  15747. referencedClasses: [],
  15748. messageSends: []
  15749. }),
  15750. $globals.ClassSorterNode);
  15751. $core.addMethod(
  15752. $core.method({
  15753. selector: "traverseClassesWith:",
  15754. protocol: "visiting",
  15755. fn: function (aCollection){
  15756. var self=this,$self=this;
  15757. return $core.withContext(function($ctx1) {
  15758. var $1,$3,$2;
  15759. $1=$self._theClass();
  15760. $ctx1.sendIdx["theClass"]=1;
  15761. $recv(aCollection)._add_($1);
  15762. $recv($recv($self._nodes())._sorted_((function(a,b){
  15763. return $core.withContext(function($ctx2) {
  15764. $3=$recv(a)._theClass();
  15765. $ctx2.sendIdx["theClass"]=2;
  15766. $2=$recv($3)._name();
  15767. $ctx2.sendIdx["name"]=1;
  15768. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  15769. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  15770. })))._do_((function(aNode){
  15771. return $core.withContext(function($ctx2) {
  15772. return $recv(aNode)._traverseClassesWith_(aCollection);
  15773. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  15774. }));
  15775. return self;
  15776. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  15777. },
  15778. args: ["aCollection"],
  15779. 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 ].",
  15780. referencedClasses: [],
  15781. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  15782. }),
  15783. $globals.ClassSorterNode);
  15784. $core.addMethod(
  15785. $core.method({
  15786. selector: "on:classes:level:",
  15787. protocol: "instance creation",
  15788. fn: function (aClass,aCollection,anInteger){
  15789. var self=this,$self=this;
  15790. return $core.withContext(function($ctx1) {
  15791. var $1;
  15792. $1=$self._new();
  15793. $recv($1)._theClass_(aClass);
  15794. $recv($1)._level_(anInteger);
  15795. $recv($1)._getNodesFrom_(aCollection);
  15796. return $recv($1)._yourself();
  15797. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.a$cls)});
  15798. },
  15799. args: ["aClass", "aCollection", "anInteger"],
  15800. 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",
  15801. referencedClasses: [],
  15802. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  15803. }),
  15804. $globals.ClassSorterNode.a$cls);
  15805. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  15806. $core.addMethod(
  15807. $core.method({
  15808. selector: "allInstanceVariableNames",
  15809. protocol: "accessing",
  15810. fn: function (){
  15811. var self=this,$self=this;
  15812. return [];
  15813. },
  15814. args: [],
  15815. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  15816. referencedClasses: [],
  15817. messageSends: []
  15818. }),
  15819. $globals.TBehaviorDefaults);
  15820. $core.addMethod(
  15821. $core.method({
  15822. selector: "allSubclassesDo:",
  15823. protocol: "enumerating",
  15824. fn: function (aBlock){
  15825. var self=this,$self=this;
  15826. return self;
  15827. },
  15828. args: ["aBlock"],
  15829. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  15830. referencedClasses: [],
  15831. messageSends: []
  15832. }),
  15833. $globals.TBehaviorDefaults);
  15834. $core.addMethod(
  15835. $core.method({
  15836. selector: "name",
  15837. protocol: "accessing",
  15838. fn: function (){
  15839. var self=this,$self=this;
  15840. return nil;
  15841. },
  15842. args: [],
  15843. source: "name\x0a\x09^ nil",
  15844. referencedClasses: [],
  15845. messageSends: []
  15846. }),
  15847. $globals.TBehaviorDefaults);
  15848. $core.addMethod(
  15849. $core.method({
  15850. selector: "printOn:",
  15851. protocol: "printing",
  15852. fn: function (aStream){
  15853. var self=this,$self=this;
  15854. return $core.withContext(function($ctx1) {
  15855. var $1,$receiver;
  15856. $1=$self._name();
  15857. if(($receiver = $1) == null || $receiver.a$nil){
  15858. (
  15859. $ctx1.supercall = true,
  15860. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  15861. $ctx1.supercall = false;
  15862. } else {
  15863. var name;
  15864. name=$receiver;
  15865. $recv(aStream)._nextPutAll_(name);
  15866. }
  15867. return self;
  15868. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.TBehaviorDefaults)});
  15869. },
  15870. args: ["aStream"],
  15871. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  15872. referencedClasses: [],
  15873. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  15874. }),
  15875. $globals.TBehaviorDefaults);
  15876. $core.addMethod(
  15877. $core.method({
  15878. selector: "superclass",
  15879. protocol: "accessing",
  15880. fn: function (){
  15881. var self=this,$self=this;
  15882. return nil;
  15883. },
  15884. args: [],
  15885. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  15886. referencedClasses: [],
  15887. messageSends: []
  15888. }),
  15889. $globals.TBehaviorDefaults);
  15890. $core.addMethod(
  15891. $core.method({
  15892. selector: "traitUsers",
  15893. protocol: "accessing",
  15894. fn: function (){
  15895. var self=this,$self=this;
  15896. return [];
  15897. },
  15898. args: [],
  15899. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  15900. referencedClasses: [],
  15901. messageSends: []
  15902. }),
  15903. $globals.TBehaviorDefaults);
  15904. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  15905. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  15906. $core.addMethod(
  15907. $core.method({
  15908. selector: ">>",
  15909. protocol: "accessing",
  15910. fn: function (aString){
  15911. var self=this,$self=this;
  15912. return $core.withContext(function($ctx1) {
  15913. return $self._methodAt_(aString);
  15914. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.TBehaviorProvider)});
  15915. },
  15916. args: ["aString"],
  15917. source: ">> aString\x0a\x09^ self methodAt: aString",
  15918. referencedClasses: [],
  15919. messageSends: ["methodAt:"]
  15920. }),
  15921. $globals.TBehaviorProvider);
  15922. $core.addMethod(
  15923. $core.method({
  15924. selector: "addCompiledMethod:",
  15925. protocol: "compiling",
  15926. fn: function (aMethod){
  15927. var self=this,$self=this;
  15928. var oldMethod,announcement;
  15929. return $core.withContext(function($ctx1) {
  15930. var $1,$2,$3,$4,$receiver;
  15931. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  15932. return nil;
  15933. }));
  15934. $self._basicAddCompiledMethod_(aMethod);
  15935. $1=oldMethod;
  15936. if(($receiver = $1) == null || $receiver.a$nil){
  15937. $2=$recv($globals.MethodAdded)._new();
  15938. $ctx1.sendIdx["new"]=1;
  15939. $recv($2)._method_(aMethod);
  15940. $ctx1.sendIdx["method:"]=1;
  15941. $3=$recv($2)._yourself();
  15942. $ctx1.sendIdx["yourself"]=1;
  15943. announcement=$3;
  15944. } else {
  15945. $4=$recv($globals.MethodModified)._new();
  15946. $recv($4)._oldMethod_(oldMethod);
  15947. $recv($4)._method_(aMethod);
  15948. announcement=$recv($4)._yourself();
  15949. }
  15950. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  15951. return self;
  15952. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.TBehaviorProvider)});
  15953. },
  15954. args: ["aMethod"],
  15955. 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",
  15956. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  15957. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  15958. }),
  15959. $globals.TBehaviorProvider);
  15960. $core.addMethod(
  15961. $core.method({
  15962. selector: "basicAddCompiledMethod:",
  15963. protocol: "private",
  15964. fn: function (aMethod){
  15965. var self=this,$self=this;
  15966. return $core.withContext(function($ctx1) {
  15967. $core.addMethod(aMethod, self);
  15968. return self;
  15969. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  15970. },
  15971. args: ["aMethod"],
  15972. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  15973. referencedClasses: [],
  15974. messageSends: []
  15975. }),
  15976. $globals.TBehaviorProvider);
  15977. $core.addMethod(
  15978. $core.method({
  15979. selector: "basicRemoveCompiledMethod:",
  15980. protocol: "private",
  15981. fn: function (aMethod){
  15982. var self=this,$self=this;
  15983. return $core.withContext(function($ctx1) {
  15984. $core.removeMethod(aMethod,self);
  15985. return self;
  15986. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  15987. },
  15988. args: ["aMethod"],
  15989. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  15990. referencedClasses: [],
  15991. messageSends: []
  15992. }),
  15993. $globals.TBehaviorProvider);
  15994. $core.addMethod(
  15995. $core.method({
  15996. selector: "compile:protocol:",
  15997. protocol: "compiling",
  15998. fn: function (aString,anotherString){
  15999. var self=this,$self=this;
  16000. return $core.withContext(function($ctx1) {
  16001. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  16002. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.TBehaviorProvider)});
  16003. },
  16004. args: ["aString", "anotherString"],
  16005. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  16006. referencedClasses: ["Compiler"],
  16007. messageSends: ["install:forClass:protocol:", "new"]
  16008. }),
  16009. $globals.TBehaviorProvider);
  16010. $core.addMethod(
  16011. $core.method({
  16012. selector: "includesSelector:",
  16013. protocol: "testing",
  16014. fn: function (aString){
  16015. var self=this,$self=this;
  16016. return $core.withContext(function($ctx1) {
  16017. return $recv($self._methodDictionary())._includesKey_(aString);
  16018. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.TBehaviorProvider)});
  16019. },
  16020. args: ["aString"],
  16021. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  16022. referencedClasses: [],
  16023. messageSends: ["includesKey:", "methodDictionary"]
  16024. }),
  16025. $globals.TBehaviorProvider);
  16026. $core.addMethod(
  16027. $core.method({
  16028. selector: "methodAt:",
  16029. protocol: "accessing",
  16030. fn: function (aString){
  16031. var self=this,$self=this;
  16032. return $core.withContext(function($ctx1) {
  16033. return $recv($self._methodDictionary())._at_(aString);
  16034. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.TBehaviorProvider)});
  16035. },
  16036. args: ["aString"],
  16037. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  16038. referencedClasses: [],
  16039. messageSends: ["at:", "methodDictionary"]
  16040. }),
  16041. $globals.TBehaviorProvider);
  16042. $core.addMethod(
  16043. $core.method({
  16044. selector: "methodDictionary",
  16045. protocol: "accessing",
  16046. fn: function (){
  16047. var self=this,$self=this;
  16048. return $core.withContext(function($ctx1) {
  16049. var dict = $globals.HashedCollection._new();
  16050. var methods = self.methods;
  16051. Object.keys(methods).forEach(function(i) {
  16052. if(methods[i].selector) {
  16053. dict._at_put_(methods[i].selector, methods[i]);
  16054. }
  16055. });
  16056. return dict;
  16057. return self;
  16058. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.TBehaviorProvider)});
  16059. },
  16060. args: [],
  16061. 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'>",
  16062. referencedClasses: [],
  16063. messageSends: []
  16064. }),
  16065. $globals.TBehaviorProvider);
  16066. $core.addMethod(
  16067. $core.method({
  16068. selector: "methodOrganizationEnter:andLeave:",
  16069. protocol: "accessing",
  16070. fn: function (aMethod,oldMethod){
  16071. var self=this,$self=this;
  16072. return $core.withContext(function($ctx1) {
  16073. var $1,$2,$receiver;
  16074. if(($receiver = aMethod) == null || $receiver.a$nil){
  16075. aMethod;
  16076. } else {
  16077. $1=$self._organization();
  16078. $2=$recv(aMethod)._protocol();
  16079. $ctx1.sendIdx["protocol"]=1;
  16080. $recv($1)._addElement_($2);
  16081. }
  16082. if(($receiver = oldMethod) == null || $receiver.a$nil){
  16083. oldMethod;
  16084. } else {
  16085. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  16086. }
  16087. return self;
  16088. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod},$globals.TBehaviorProvider)});
  16089. },
  16090. args: ["aMethod", "oldMethod"],
  16091. 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 ]",
  16092. referencedClasses: [],
  16093. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  16094. }),
  16095. $globals.TBehaviorProvider);
  16096. $core.addMethod(
  16097. $core.method({
  16098. selector: "methodTemplate",
  16099. protocol: "accessing",
  16100. fn: function (){
  16101. var self=this,$self=this;
  16102. return $core.withContext(function($ctx1) {
  16103. return $recv($globals.String)._streamContents_((function(stream){
  16104. return $core.withContext(function($ctx2) {
  16105. $recv(stream)._write_("messageSelectorAndArgumentNames");
  16106. $ctx2.sendIdx["write:"]=1;
  16107. $recv(stream)._lf();
  16108. $ctx2.sendIdx["lf"]=1;
  16109. $recv(stream)._tab();
  16110. $ctx2.sendIdx["tab"]=1;
  16111. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  16112. $ctx2.sendIdx["write:"]=2;
  16113. $recv(stream)._lf();
  16114. $ctx2.sendIdx["lf"]=2;
  16115. $recv(stream)._lf();
  16116. $ctx2.sendIdx["lf"]=3;
  16117. $recv(stream)._tab();
  16118. $ctx2.sendIdx["tab"]=2;
  16119. $recv(stream)._write_("| temporary variable names |");
  16120. $ctx2.sendIdx["write:"]=3;
  16121. $recv(stream)._lf();
  16122. $recv(stream)._tab();
  16123. return $recv(stream)._write_("statements");
  16124. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16125. }));
  16126. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.TBehaviorProvider)});
  16127. },
  16128. args: [],
  16129. 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' ]",
  16130. referencedClasses: ["String"],
  16131. messageSends: ["streamContents:", "write:", "lf", "tab"]
  16132. }),
  16133. $globals.TBehaviorProvider);
  16134. $core.addMethod(
  16135. $core.method({
  16136. selector: "methods",
  16137. protocol: "accessing",
  16138. fn: function (){
  16139. var self=this,$self=this;
  16140. return $core.withContext(function($ctx1) {
  16141. return $recv($self._methodDictionary())._values();
  16142. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.TBehaviorProvider)});
  16143. },
  16144. args: [],
  16145. source: "methods\x0a\x09^ self methodDictionary values",
  16146. referencedClasses: [],
  16147. messageSends: ["values", "methodDictionary"]
  16148. }),
  16149. $globals.TBehaviorProvider);
  16150. $core.addMethod(
  16151. $core.method({
  16152. selector: "methodsInProtocol:",
  16153. protocol: "accessing",
  16154. fn: function (aString){
  16155. var self=this,$self=this;
  16156. return $core.withContext(function($ctx1) {
  16157. return $recv($self._methods())._select_((function(each){
  16158. return $core.withContext(function($ctx2) {
  16159. return $recv($recv(each)._protocol()).__eq(aString);
  16160. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16161. }));
  16162. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16163. },
  16164. args: ["aString"],
  16165. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  16166. referencedClasses: [],
  16167. messageSends: ["select:", "methods", "=", "protocol"]
  16168. }),
  16169. $globals.TBehaviorProvider);
  16170. $core.addMethod(
  16171. $core.method({
  16172. selector: "organization",
  16173. protocol: "accessing",
  16174. fn: function (){
  16175. var self=this,$self=this;
  16176. return $core.withContext(function($ctx1) {
  16177. var $1,$receiver;
  16178. $1=$self._basicOrganization();
  16179. $ctx1.sendIdx["basicOrganization"]=1;
  16180. if(($receiver = $1) == null || $receiver.a$nil){
  16181. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  16182. return $self._basicOrganization();
  16183. } else {
  16184. return $1;
  16185. }
  16186. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.TBehaviorProvider)});
  16187. },
  16188. args: [],
  16189. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  16190. referencedClasses: ["ClassOrganizer"],
  16191. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  16192. }),
  16193. $globals.TBehaviorProvider);
  16194. $core.addMethod(
  16195. $core.method({
  16196. selector: "ownMethods",
  16197. protocol: "accessing",
  16198. fn: function (){
  16199. var self=this,$self=this;
  16200. return $core.withContext(function($ctx1) {
  16201. var $1;
  16202. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  16203. return $core.withContext(function($ctx2) {
  16204. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  16205. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  16206. })))._sorted_((function(a,b){
  16207. return $core.withContext(function($ctx2) {
  16208. $1=$recv(a)._selector();
  16209. $ctx2.sendIdx["selector"]=1;
  16210. return $recv($1).__lt_eq($recv(b)._selector());
  16211. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16212. }));
  16213. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.TBehaviorProvider)});
  16214. },
  16215. args: [],
  16216. 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 ]",
  16217. referencedClasses: ["OrderedCollection"],
  16218. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  16219. }),
  16220. $globals.TBehaviorProvider);
  16221. $core.addMethod(
  16222. $core.method({
  16223. selector: "ownMethodsInProtocol:",
  16224. protocol: "accessing",
  16225. fn: function (aString){
  16226. var self=this,$self=this;
  16227. return $core.withContext(function($ctx1) {
  16228. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  16229. return $core.withContext(function($ctx2) {
  16230. return $recv($recv(each)._methodClass()).__eq(self);
  16231. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16232. }));
  16233. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16234. },
  16235. args: ["aString"],
  16236. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  16237. referencedClasses: [],
  16238. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  16239. }),
  16240. $globals.TBehaviorProvider);
  16241. $core.addMethod(
  16242. $core.method({
  16243. selector: "ownProtocols",
  16244. protocol: "accessing",
  16245. fn: function (){
  16246. var self=this,$self=this;
  16247. return $core.withContext(function($ctx1) {
  16248. return $recv($self._protocols())._reject_((function(each){
  16249. return $core.withContext(function($ctx2) {
  16250. return $recv(each)._match_("^\x5c*");
  16251. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16252. }));
  16253. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.TBehaviorProvider)});
  16254. },
  16255. args: [],
  16256. 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*' ]",
  16257. referencedClasses: [],
  16258. messageSends: ["reject:", "protocols", "match:"]
  16259. }),
  16260. $globals.TBehaviorProvider);
  16261. $core.addMethod(
  16262. $core.method({
  16263. selector: "packageOfProtocol:",
  16264. protocol: "accessing",
  16265. fn: function (aString){
  16266. var self=this,$self=this;
  16267. return $core.withContext(function($ctx1) {
  16268. var $1;
  16269. $1=$recv(aString)._beginsWith_("*");
  16270. if(!$core.assert($1)){
  16271. return $self._package();
  16272. }
  16273. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  16274. return nil;
  16275. }));
  16276. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16277. },
  16278. args: ["aString"],
  16279. 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 ]",
  16280. referencedClasses: ["Package"],
  16281. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  16282. }),
  16283. $globals.TBehaviorProvider);
  16284. $core.addMethod(
  16285. $core.method({
  16286. selector: "protocols",
  16287. protocol: "accessing",
  16288. fn: function (){
  16289. var self=this,$self=this;
  16290. return $core.withContext(function($ctx1) {
  16291. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  16292. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.TBehaviorProvider)});
  16293. },
  16294. args: [],
  16295. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  16296. referencedClasses: [],
  16297. messageSends: ["sorted", "asArray", "elements", "organization"]
  16298. }),
  16299. $globals.TBehaviorProvider);
  16300. $core.addMethod(
  16301. $core.method({
  16302. selector: "protocolsDo:",
  16303. protocol: "enumerating",
  16304. fn: function (aBlock){
  16305. var self=this,$self=this;
  16306. var methodsByProtocol;
  16307. return $core.withContext(function($ctx1) {
  16308. methodsByProtocol=$recv($globals.HashedCollection)._new();
  16309. $ctx1.sendIdx["new"]=1;
  16310. $recv($self._methodDictionary())._valuesDo_((function(m){
  16311. return $core.withContext(function($ctx2) {
  16312. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  16313. return $core.withContext(function($ctx3) {
  16314. return $recv($globals.Array)._new();
  16315. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16316. })))._add_(m);
  16317. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  16318. }));
  16319. $recv($self._protocols())._do_((function(protocol){
  16320. return $core.withContext(function($ctx2) {
  16321. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  16322. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  16323. }));
  16324. return self;
  16325. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.TBehaviorProvider)});
  16326. },
  16327. args: ["aBlock"],
  16328. 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) ]",
  16329. referencedClasses: ["HashedCollection", "Array"],
  16330. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  16331. }),
  16332. $globals.TBehaviorProvider);
  16333. $core.addMethod(
  16334. $core.method({
  16335. selector: "recompile",
  16336. protocol: "compiling",
  16337. fn: function (){
  16338. var self=this,$self=this;
  16339. return $core.withContext(function($ctx1) {
  16340. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  16341. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.TBehaviorProvider)});
  16342. },
  16343. args: [],
  16344. source: "recompile\x0a\x09^ Compiler new recompile: self",
  16345. referencedClasses: ["Compiler"],
  16346. messageSends: ["recompile:", "new"]
  16347. }),
  16348. $globals.TBehaviorProvider);
  16349. $core.addMethod(
  16350. $core.method({
  16351. selector: "removeCompiledMethod:",
  16352. protocol: "compiling",
  16353. fn: function (aMethod){
  16354. var self=this,$self=this;
  16355. return $core.withContext(function($ctx1) {
  16356. var $1,$3,$2;
  16357. $self._basicRemoveCompiledMethod_(aMethod);
  16358. $1=$recv($globals.SystemAnnouncer)._current();
  16359. $3=$recv($globals.MethodRemoved)._new();
  16360. $recv($3)._method_(aMethod);
  16361. $2=$recv($3)._yourself();
  16362. $recv($1)._announce_($2);
  16363. return self;
  16364. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16365. },
  16366. args: ["aMethod"],
  16367. 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)",
  16368. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  16369. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  16370. }),
  16371. $globals.TBehaviorProvider);
  16372. $core.addMethod(
  16373. $core.method({
  16374. selector: "removeProtocolIfEmpty:",
  16375. protocol: "accessing",
  16376. fn: function (aString){
  16377. var self=this,$self=this;
  16378. return $core.withContext(function($ctx1) {
  16379. $recv($self._methods())._detect_ifNone_((function(each){
  16380. return $core.withContext(function($ctx2) {
  16381. return $recv($recv(each)._protocol()).__eq(aString);
  16382. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16383. }),(function(){
  16384. return $core.withContext(function($ctx2) {
  16385. return $recv($self._organization())._removeElement_(aString);
  16386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16387. }));
  16388. return self;
  16389. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.TBehaviorProvider)});
  16390. },
  16391. args: ["aString"],
  16392. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  16393. referencedClasses: [],
  16394. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  16395. }),
  16396. $globals.TBehaviorProvider);
  16397. $core.addMethod(
  16398. $core.method({
  16399. selector: "selectors",
  16400. protocol: "accessing",
  16401. fn: function (){
  16402. var self=this,$self=this;
  16403. return $core.withContext(function($ctx1) {
  16404. return $recv($self._methodDictionary())._keys();
  16405. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.TBehaviorProvider)});
  16406. },
  16407. args: [],
  16408. source: "selectors\x0a\x09^ self methodDictionary keys",
  16409. referencedClasses: [],
  16410. messageSends: ["keys", "methodDictionary"]
  16411. }),
  16412. $globals.TBehaviorProvider);
  16413. $core.addMethod(
  16414. $core.method({
  16415. selector: "setTraitComposition:",
  16416. protocol: "compiling",
  16417. fn: function (aTraitComposition){
  16418. var self=this,$self=this;
  16419. return $core.withContext(function($ctx1) {
  16420. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  16421. return self;
  16422. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.TBehaviorProvider)});
  16423. },
  16424. args: ["aTraitComposition"],
  16425. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  16426. referencedClasses: [],
  16427. messageSends: []
  16428. }),
  16429. $globals.TBehaviorProvider);
  16430. $core.addMethod(
  16431. $core.method({
  16432. selector: "traitComposition",
  16433. protocol: "accessing",
  16434. fn: function (){
  16435. var self=this,$self=this;
  16436. return $core.withContext(function($ctx1) {
  16437. var $1,$receiver;
  16438. $1=$self._basicAt_("traitComposition");
  16439. if(($receiver = $1) == null || $receiver.a$nil){
  16440. return [];
  16441. } else {
  16442. var aCollection;
  16443. aCollection=$receiver;
  16444. return $recv(aCollection)._collect_((function(each){
  16445. return $core.withContext(function($ctx2) {
  16446. return $recv($globals.TraitTransformation)._fromJSON_(each);
  16447. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16448. }));
  16449. }
  16450. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.TBehaviorProvider)});
  16451. },
  16452. args: [],
  16453. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  16454. referencedClasses: ["TraitTransformation"],
  16455. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  16456. }),
  16457. $globals.TBehaviorProvider);
  16458. $core.addMethod(
  16459. $core.method({
  16460. selector: "traitCompositionDefinition",
  16461. protocol: "accessing",
  16462. fn: function (){
  16463. var self=this,$self=this;
  16464. return $core.withContext(function($ctx1) {
  16465. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  16466. return $core.withContext(function($ctx2) {
  16467. return $recv($globals.String)._streamContents_((function(str){
  16468. return $core.withContext(function($ctx3) {
  16469. $recv(str)._write_("{");
  16470. $ctx3.sendIdx["write:"]=1;
  16471. $recv(traitComposition)._do_separatedBy_((function(each){
  16472. return $core.withContext(function($ctx4) {
  16473. return $recv(str)._write_($recv(each)._definition());
  16474. $ctx4.sendIdx["write:"]=2;
  16475. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16476. }),(function(){
  16477. return $core.withContext(function($ctx4) {
  16478. return $recv(str)._write_(". ");
  16479. $ctx4.sendIdx["write:"]=3;
  16480. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16481. }));
  16482. return $recv(str)._write_("}");
  16483. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  16484. }));
  16485. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  16486. }));
  16487. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.TBehaviorProvider)});
  16488. },
  16489. args: [],
  16490. 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: '}' ] ]",
  16491. referencedClasses: ["String"],
  16492. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  16493. }),
  16494. $globals.TBehaviorProvider);
  16495. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  16496. $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.";
  16497. $core.addMethod(
  16498. $core.method({
  16499. selector: "asJavaScriptSource",
  16500. protocol: "converting",
  16501. fn: function (){
  16502. var self=this,$self=this;
  16503. return $core.withContext(function($ctx1) {
  16504. return "$globals.".__comma($self._name());
  16505. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TMasterBehavior)});
  16506. },
  16507. args: [],
  16508. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  16509. referencedClasses: [],
  16510. messageSends: [",", "name"]
  16511. }),
  16512. $globals.TMasterBehavior);
  16513. $core.addMethod(
  16514. $core.method({
  16515. selector: "browse",
  16516. protocol: "browsing",
  16517. fn: function (){
  16518. var self=this,$self=this;
  16519. return $core.withContext(function($ctx1) {
  16520. $recv($globals.Finder)._findClass_(self);
  16521. return self;
  16522. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.TMasterBehavior)});
  16523. },
  16524. args: [],
  16525. source: "browse\x0a\x09Finder findClass: self",
  16526. referencedClasses: ["Finder"],
  16527. messageSends: ["findClass:"]
  16528. }),
  16529. $globals.TMasterBehavior);
  16530. $core.addMethod(
  16531. $core.method({
  16532. selector: "category",
  16533. protocol: "accessing",
  16534. fn: function (){
  16535. var self=this,$self=this;
  16536. return $core.withContext(function($ctx1) {
  16537. var $1,$receiver;
  16538. $1=$self._package();
  16539. $ctx1.sendIdx["package"]=1;
  16540. if(($receiver = $1) == null || $receiver.a$nil){
  16541. return "Unclassified";
  16542. } else {
  16543. return $recv($self._package())._name();
  16544. }
  16545. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.TMasterBehavior)});
  16546. },
  16547. args: [],
  16548. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  16549. referencedClasses: [],
  16550. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  16551. }),
  16552. $globals.TMasterBehavior);
  16553. $core.addMethod(
  16554. $core.method({
  16555. selector: "classTag",
  16556. protocol: "accessing",
  16557. fn: function (){
  16558. var self=this,$self=this;
  16559. return $core.withContext(function($ctx1) {
  16560. return $self._subclassResponsibility();
  16561. }, function($ctx1) {$ctx1.fill(self,"classTag",{},$globals.TMasterBehavior)});
  16562. },
  16563. args: [],
  16564. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  16565. referencedClasses: [],
  16566. messageSends: ["subclassResponsibility"]
  16567. }),
  16568. $globals.TMasterBehavior);
  16569. $core.addMethod(
  16570. $core.method({
  16571. selector: "comment",
  16572. protocol: "accessing",
  16573. fn: function (){
  16574. var self=this,$self=this;
  16575. return $core.withContext(function($ctx1) {
  16576. var $1,$receiver;
  16577. $1=$self._basicAt_("comment");
  16578. if(($receiver = $1) == null || $receiver.a$nil){
  16579. return "";
  16580. } else {
  16581. return $1;
  16582. }
  16583. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.TMasterBehavior)});
  16584. },
  16585. args: [],
  16586. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  16587. referencedClasses: [],
  16588. messageSends: ["ifNil:", "basicAt:"]
  16589. }),
  16590. $globals.TMasterBehavior);
  16591. $core.addMethod(
  16592. $core.method({
  16593. selector: "comment:",
  16594. protocol: "accessing",
  16595. fn: function (aString){
  16596. var self=this,$self=this;
  16597. return $core.withContext(function($ctx1) {
  16598. var $1,$3,$2;
  16599. $self._basicAt_put_("comment",aString);
  16600. $1=$recv($globals.SystemAnnouncer)._current();
  16601. $3=$recv($globals.ClassCommentChanged)._new();
  16602. $recv($3)._theClass_(self);
  16603. $2=$recv($3)._yourself();
  16604. $recv($1)._announce_($2);
  16605. return self;
  16606. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.TMasterBehavior)});
  16607. },
  16608. args: ["aString"],
  16609. 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)",
  16610. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  16611. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  16612. }),
  16613. $globals.TMasterBehavior);
  16614. $core.addMethod(
  16615. $core.method({
  16616. selector: "definedMethods",
  16617. protocol: "accessing",
  16618. fn: function (){
  16619. var self=this,$self=this;
  16620. var methods;
  16621. return $core.withContext(function($ctx1) {
  16622. var $1,$receiver;
  16623. methods=$self._methods();
  16624. $ctx1.sendIdx["methods"]=1;
  16625. $1=$self._theMetaClass();
  16626. if(($receiver = $1) == null || $receiver.a$nil){
  16627. return methods;
  16628. } else {
  16629. var meta;
  16630. meta=$receiver;
  16631. return $recv(methods).__comma($recv(meta)._methods());
  16632. }
  16633. return self;
  16634. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods},$globals.TMasterBehavior)});
  16635. },
  16636. args: [],
  16637. 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 ]",
  16638. referencedClasses: [],
  16639. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  16640. }),
  16641. $globals.TMasterBehavior);
  16642. $core.addMethod(
  16643. $core.method({
  16644. selector: "enterOrganization",
  16645. protocol: "accessing",
  16646. fn: function (){
  16647. var self=this,$self=this;
  16648. return $core.withContext(function($ctx1) {
  16649. var $1,$receiver;
  16650. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16651. $globals.Smalltalk;
  16652. } else {
  16653. $1=$self._basicAt_("category");
  16654. if(($receiver = $1) == null || $receiver.a$nil){
  16655. $self._basicPackage_(nil);
  16656. $ctx1.sendIdx["basicPackage:"]=1;
  16657. } else {
  16658. var category;
  16659. category=$receiver;
  16660. $self._basicPackage_($recv($globals.Package)._named_(category));
  16661. $recv($recv($self._package())._organization())._addElement_(self);
  16662. }
  16663. }
  16664. return self;
  16665. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{},$globals.TMasterBehavior)});
  16666. },
  16667. args: [],
  16668. 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 ] ]",
  16669. referencedClasses: ["Smalltalk", "Package"],
  16670. messageSends: ["ifNotNil:", "ifNil:ifNotNil:", "basicAt:", "basicPackage:", "named:", "addElement:", "organization", "package"]
  16671. }),
  16672. $globals.TMasterBehavior);
  16673. $core.addMethod(
  16674. $core.method({
  16675. selector: "leaveOrganization",
  16676. protocol: "accessing",
  16677. fn: function (){
  16678. var self=this,$self=this;
  16679. return $core.withContext(function($ctx1) {
  16680. var $receiver;
  16681. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16682. $globals.Smalltalk;
  16683. } else {
  16684. $recv($recv($self._package())._organization())._removeElement_(self);
  16685. }
  16686. return self;
  16687. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{},$globals.TMasterBehavior)});
  16688. },
  16689. args: [],
  16690. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  16691. referencedClasses: ["Smalltalk"],
  16692. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  16693. }),
  16694. $globals.TMasterBehavior);
  16695. $core.addMethod(
  16696. $core.method({
  16697. selector: "name",
  16698. protocol: "accessing",
  16699. fn: function (){
  16700. var self=this,$self=this;
  16701. return $core.withContext(function($ctx1) {
  16702. return self.name;
  16703. return self;
  16704. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.TMasterBehavior)});
  16705. },
  16706. args: [],
  16707. source: "name\x0a\x09<inlineJS: 'return self.name'>",
  16708. referencedClasses: [],
  16709. messageSends: []
  16710. }),
  16711. $globals.TMasterBehavior);
  16712. $core.addMethod(
  16713. $core.method({
  16714. selector: "package:",
  16715. protocol: "accessing",
  16716. fn: function (aPackage){
  16717. var self=this,$self=this;
  16718. var oldPackage;
  16719. return $core.withContext(function($ctx1) {
  16720. var $2,$1,$3,$5,$4;
  16721. $2=$self._package();
  16722. $ctx1.sendIdx["package"]=1;
  16723. $1=$recv($2).__eq(aPackage);
  16724. if($core.assert($1)){
  16725. return self;
  16726. }
  16727. oldPackage=$self._package();
  16728. $self._leaveOrganization();
  16729. $self._basicAt_put_("category",$recv(aPackage)._name());
  16730. $self._enterOrganization();
  16731. $3=$recv($globals.SystemAnnouncer)._current();
  16732. $5=$recv($globals.ClassMoved)._new();
  16733. $recv($5)._theClass_(self);
  16734. $recv($5)._oldPackage_(oldPackage);
  16735. $4=$recv($5)._yourself();
  16736. $recv($3)._announce_($4);
  16737. return self;
  16738. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.TMasterBehavior)});
  16739. },
  16740. args: ["aPackage"],
  16741. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self\x0a\x09\x09leaveOrganization;\x0a\x09\x09basicAt: 'category' put: aPackage name;\x0a\x09\x09enterOrganization.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  16742. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  16743. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "name", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  16744. }),
  16745. $globals.TMasterBehavior);
  16746. $core.addMethod(
  16747. $core.method({
  16748. selector: "theNonMetaClass",
  16749. protocol: "accessing",
  16750. fn: function (){
  16751. var self=this,$self=this;
  16752. return self;
  16753. },
  16754. args: [],
  16755. source: "theNonMetaClass\x0a\x09^ self",
  16756. referencedClasses: [],
  16757. messageSends: []
  16758. }),
  16759. $globals.TMasterBehavior);
  16760. $core.addClass("Trait", $globals.Object, ["organization", "package"], "Kernel-Classes");
  16761. $core.addMethod(
  16762. $core.method({
  16763. selector: "-",
  16764. protocol: "composition",
  16765. fn: function (anArray){
  16766. var self=this,$self=this;
  16767. return $core.withContext(function($ctx1) {
  16768. return $recv($self._asTraitTransformation()).__minus(anArray);
  16769. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  16770. },
  16771. args: ["anArray"],
  16772. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  16773. referencedClasses: [],
  16774. messageSends: ["-", "asTraitTransformation"]
  16775. }),
  16776. $globals.Trait);
  16777. $core.addMethod(
  16778. $core.method({
  16779. selector: "@",
  16780. protocol: "composition",
  16781. fn: function (anArrayOfAssociations){
  16782. var self=this,$self=this;
  16783. return $core.withContext(function($ctx1) {
  16784. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  16785. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  16786. },
  16787. args: ["anArrayOfAssociations"],
  16788. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  16789. referencedClasses: [],
  16790. messageSends: ["@", "asTraitTransformation"]
  16791. }),
  16792. $globals.Trait);
  16793. $core.addMethod(
  16794. $core.method({
  16795. selector: "asTraitComposition",
  16796. protocol: "converting",
  16797. fn: function (){
  16798. var self=this,$self=this;
  16799. return $core.withContext(function($ctx1) {
  16800. return $recv($self._asTraitTransformation())._asTraitComposition();
  16801. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  16802. },
  16803. args: [],
  16804. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  16805. referencedClasses: [],
  16806. messageSends: ["asTraitComposition", "asTraitTransformation"]
  16807. }),
  16808. $globals.Trait);
  16809. $core.addMethod(
  16810. $core.method({
  16811. selector: "asTraitTransformation",
  16812. protocol: "converting",
  16813. fn: function (){
  16814. var self=this,$self=this;
  16815. return $core.withContext(function($ctx1) {
  16816. return $recv($globals.TraitTransformation)._on_(self);
  16817. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  16818. },
  16819. args: [],
  16820. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  16821. referencedClasses: ["TraitTransformation"],
  16822. messageSends: ["on:"]
  16823. }),
  16824. $globals.Trait);
  16825. $core.addMethod(
  16826. $core.method({
  16827. selector: "basicOrganization",
  16828. protocol: "accessing",
  16829. fn: function (){
  16830. var self=this,$self=this;
  16831. return $self["@organization"];
  16832. },
  16833. args: [],
  16834. source: "basicOrganization\x0a\x09^ organization",
  16835. referencedClasses: [],
  16836. messageSends: []
  16837. }),
  16838. $globals.Trait);
  16839. $core.addMethod(
  16840. $core.method({
  16841. selector: "basicOrganization:",
  16842. protocol: "accessing",
  16843. fn: function (aClassOrganizer){
  16844. var self=this,$self=this;
  16845. $self["@organization"]=aClassOrganizer;
  16846. return self;
  16847. },
  16848. args: ["aClassOrganizer"],
  16849. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  16850. referencedClasses: [],
  16851. messageSends: []
  16852. }),
  16853. $globals.Trait);
  16854. $core.addMethod(
  16855. $core.method({
  16856. selector: "basicPackage:",
  16857. protocol: "accessing",
  16858. fn: function (aPackage){
  16859. var self=this,$self=this;
  16860. $self["@package"]=aPackage;
  16861. return self;
  16862. },
  16863. args: ["aPackage"],
  16864. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  16865. referencedClasses: [],
  16866. messageSends: []
  16867. }),
  16868. $globals.Trait);
  16869. $core.addMethod(
  16870. $core.method({
  16871. selector: "classTag",
  16872. protocol: "accessing",
  16873. fn: function (){
  16874. var self=this,$self=this;
  16875. return "trait";
  16876. },
  16877. args: [],
  16878. source: "classTag\x0a\x09^ 'trait'",
  16879. referencedClasses: [],
  16880. messageSends: []
  16881. }),
  16882. $globals.Trait);
  16883. $core.addMethod(
  16884. $core.method({
  16885. selector: "definition",
  16886. protocol: "accessing",
  16887. fn: function (){
  16888. var self=this,$self=this;
  16889. return $core.withContext(function($ctx1) {
  16890. var $1;
  16891. return $recv($globals.String)._streamContents_((function(stream){
  16892. return $core.withContext(function($ctx2) {
  16893. $recv(stream)._write_("Trait named: ");
  16894. $ctx2.sendIdx["write:"]=1;
  16895. $recv(stream)._printSymbol_($self._name());
  16896. $recv(stream)._lf();
  16897. $ctx2.sendIdx["lf"]=1;
  16898. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  16899. return $core.withContext(function($ctx3) {
  16900. $1=$recv($globals.String)._tab();
  16901. $ctx3.sendIdx["tab"]=1;
  16902. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  16903. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  16904. })));
  16905. $ctx2.sendIdx["write:"]=2;
  16906. $recv(stream)._tab();
  16907. $recv(stream)._write_("package: ");
  16908. return $recv(stream)._print_($self._category());
  16909. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16910. }));
  16911. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  16912. },
  16913. args: [],
  16914. 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 ]",
  16915. referencedClasses: ["String"],
  16916. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  16917. }),
  16918. $globals.Trait);
  16919. $core.addMethod(
  16920. $core.method({
  16921. selector: "package",
  16922. protocol: "accessing",
  16923. fn: function (){
  16924. var self=this,$self=this;
  16925. return $self["@package"];
  16926. },
  16927. args: [],
  16928. source: "package\x0a\x09^ package",
  16929. referencedClasses: [],
  16930. messageSends: []
  16931. }),
  16932. $globals.Trait);
  16933. $core.addMethod(
  16934. $core.method({
  16935. selector: "theMetaClass",
  16936. protocol: "accessing",
  16937. fn: function (){
  16938. var self=this,$self=this;
  16939. return nil;
  16940. },
  16941. args: [],
  16942. source: "theMetaClass\x0a\x09^ nil",
  16943. referencedClasses: [],
  16944. messageSends: []
  16945. }),
  16946. $globals.Trait);
  16947. $core.addMethod(
  16948. $core.method({
  16949. selector: "traitUsers",
  16950. protocol: "accessing",
  16951. fn: function (){
  16952. var self=this,$self=this;
  16953. return $core.withContext(function($ctx1) {
  16954. return $recv($self._basicAt_("traitUsers"))._copy();
  16955. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  16956. },
  16957. args: [],
  16958. source: "traitUsers\x0a\x09^ (self basicAt: 'traitUsers') copy",
  16959. referencedClasses: [],
  16960. messageSends: ["copy", "basicAt:"]
  16961. }),
  16962. $globals.Trait);
  16963. $core.addMethod(
  16964. $core.method({
  16965. selector: "named:package:",
  16966. protocol: "instance creation",
  16967. fn: function (aString,anotherString){
  16968. var self=this,$self=this;
  16969. return $core.withContext(function($ctx1) {
  16970. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  16971. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.a$cls)});
  16972. },
  16973. args: ["aString", "anotherString"],
  16974. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  16975. referencedClasses: ["ClassBuilder"],
  16976. messageSends: ["addTraitNamed:package:", "new"]
  16977. }),
  16978. $globals.Trait.a$cls);
  16979. $core.addMethod(
  16980. $core.method({
  16981. selector: "named:uses:package:",
  16982. protocol: "instance creation",
  16983. fn: function (aString,aTraitCompositionDescription,anotherString){
  16984. var self=this,$self=this;
  16985. var trait;
  16986. return $core.withContext(function($ctx1) {
  16987. trait=$self._named_package_(aString,anotherString);
  16988. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  16989. return trait;
  16990. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.a$cls)});
  16991. },
  16992. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  16993. 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",
  16994. referencedClasses: [],
  16995. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  16996. }),
  16997. $globals.Trait.a$cls);
  16998. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  16999. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  17000. $core.addMethod(
  17001. $core.method({
  17002. selector: "-",
  17003. protocol: "composition",
  17004. fn: function (anArray){
  17005. var self=this,$self=this;
  17006. return $core.withContext(function($ctx1) {
  17007. var $1;
  17008. $1=$self._copy();
  17009. $recv($1)._addExclusions_(anArray);
  17010. return $recv($1)._yourself();
  17011. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  17012. },
  17013. args: ["anArray"],
  17014. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  17015. referencedClasses: [],
  17016. messageSends: ["addExclusions:", "copy", "yourself"]
  17017. }),
  17018. $globals.TraitTransformation);
  17019. $core.addMethod(
  17020. $core.method({
  17021. selector: "@",
  17022. protocol: "composition",
  17023. fn: function (anArrayOfAssociations){
  17024. var self=this,$self=this;
  17025. return $core.withContext(function($ctx1) {
  17026. var $1;
  17027. $1=$self._copy();
  17028. $recv($1)._addAliases_(anArrayOfAssociations);
  17029. return $recv($1)._yourself();
  17030. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17031. },
  17032. args: ["anArrayOfAssociations"],
  17033. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  17034. referencedClasses: [],
  17035. messageSends: ["addAliases:", "copy", "yourself"]
  17036. }),
  17037. $globals.TraitTransformation);
  17038. $core.addMethod(
  17039. $core.method({
  17040. selector: "addAliases:",
  17041. protocol: "accessing",
  17042. fn: function (anArrayOfAssociations){
  17043. var self=this,$self=this;
  17044. return $core.withContext(function($ctx1) {
  17045. $recv(anArrayOfAssociations)._do_((function(each){
  17046. var key;
  17047. return $core.withContext(function($ctx2) {
  17048. key=$recv(each)._key();
  17049. return $recv($self["@aliases"])._at_ifPresent_ifAbsent_(key,(function(){
  17050. return $core.withContext(function($ctx3) {
  17051. return $self._error_("Cannot use same alias name twice.");
  17052. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17053. }),(function(){
  17054. return $core.withContext(function($ctx3) {
  17055. return $recv($self["@aliases"])._at_put_(key,$recv(each)._value());
  17056. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  17057. }));
  17058. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  17059. }));
  17060. return anArrayOfAssociations;
  17061. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17062. },
  17063. args: ["anArrayOfAssociations"],
  17064. 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",
  17065. referencedClasses: [],
  17066. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  17067. }),
  17068. $globals.TraitTransformation);
  17069. $core.addMethod(
  17070. $core.method({
  17071. selector: "addExclusions:",
  17072. protocol: "accessing",
  17073. fn: function (anArray){
  17074. var self=this,$self=this;
  17075. return $core.withContext(function($ctx1) {
  17076. $recv($self["@exclusions"])._addAll_(anArray);
  17077. return anArray;
  17078. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  17079. },
  17080. args: ["anArray"],
  17081. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  17082. referencedClasses: [],
  17083. messageSends: ["addAll:"]
  17084. }),
  17085. $globals.TraitTransformation);
  17086. $core.addMethod(
  17087. $core.method({
  17088. selector: "aliases",
  17089. protocol: "accessing",
  17090. fn: function (){
  17091. var self=this,$self=this;
  17092. return $self["@aliases"];
  17093. },
  17094. args: [],
  17095. source: "aliases\x0a\x09^ aliases",
  17096. referencedClasses: [],
  17097. messageSends: []
  17098. }),
  17099. $globals.TraitTransformation);
  17100. $core.addMethod(
  17101. $core.method({
  17102. selector: "asJavaScriptObject",
  17103. protocol: "converting",
  17104. fn: function (){
  17105. var self=this,$self=this;
  17106. return $core.withContext(function($ctx1) {
  17107. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  17108. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  17109. },
  17110. args: [],
  17111. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  17112. referencedClasses: [],
  17113. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  17114. }),
  17115. $globals.TraitTransformation);
  17116. $core.addMethod(
  17117. $core.method({
  17118. selector: "asJavaScriptSource",
  17119. protocol: "converting",
  17120. fn: function (){
  17121. var self=this,$self=this;
  17122. return $core.withContext(function($ctx1) {
  17123. var $2,$3,$1;
  17124. return $recv($globals.String)._streamContents_((function(str){
  17125. return $core.withContext(function($ctx2) {
  17126. $2=$recv($self._trait())._asJavaScriptSource();
  17127. $ctx2.sendIdx["asJavaScriptSource"]=1;
  17128. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  17129. return $core.withContext(function($ctx3) {
  17130. return [", aliases: ",$recv(al)._asJSONString()];
  17131. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17132. }));
  17133. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17134. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  17135. return $core.withContext(function($ctx3) {
  17136. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  17137. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  17138. })),"}"];
  17139. return $recv(str)._write_($1);
  17140. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17141. }));
  17142. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  17143. },
  17144. args: [],
  17145. 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'}' } ]",
  17146. referencedClasses: ["String"],
  17147. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  17148. }),
  17149. $globals.TraitTransformation);
  17150. $core.addMethod(
  17151. $core.method({
  17152. selector: "asTraitComposition",
  17153. protocol: "converting",
  17154. fn: function (){
  17155. var self=this,$self=this;
  17156. return [self];
  17157. },
  17158. args: [],
  17159. source: "asTraitComposition\x0a\x09^ { self }",
  17160. referencedClasses: [],
  17161. messageSends: []
  17162. }),
  17163. $globals.TraitTransformation);
  17164. $core.addMethod(
  17165. $core.method({
  17166. selector: "asTraitTransformation",
  17167. protocol: "converting",
  17168. fn: function (){
  17169. var self=this,$self=this;
  17170. return self;
  17171. },
  17172. args: [],
  17173. source: "asTraitTransformation\x0a\x09^ self",
  17174. referencedClasses: [],
  17175. messageSends: []
  17176. }),
  17177. $globals.TraitTransformation);
  17178. $core.addMethod(
  17179. $core.method({
  17180. selector: "definition",
  17181. protocol: "accessing",
  17182. fn: function (){
  17183. var self=this,$self=this;
  17184. return $core.withContext(function($ctx1) {
  17185. return $recv($globals.String)._streamContents_((function(str){
  17186. return $core.withContext(function($ctx2) {
  17187. $recv(str)._print_($self._trait());
  17188. $recv($self._aliases())._ifNotEmpty_((function(al){
  17189. return $core.withContext(function($ctx3) {
  17190. $recv(str)._write_(" @ {");
  17191. $ctx3.sendIdx["write:"]=1;
  17192. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  17193. return $core.withContext(function($ctx4) {
  17194. $recv(str)._printSymbol_($recv(each)._key());
  17195. $ctx4.sendIdx["printSymbol:"]=1;
  17196. $recv(str)._write_(" -> ");
  17197. $ctx4.sendIdx["write:"]=2;
  17198. return $recv(str)._printSymbol_($recv(each)._value());
  17199. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17200. }),(function(){
  17201. return $core.withContext(function($ctx4) {
  17202. return $recv(str)._write_(". ");
  17203. $ctx4.sendIdx["write:"]=3;
  17204. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17205. }));
  17206. $ctx3.sendIdx["do:separatedBy:"]=1;
  17207. return $recv(str)._write_("}");
  17208. $ctx3.sendIdx["write:"]=4;
  17209. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17210. }));
  17211. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17212. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  17213. return $core.withContext(function($ctx3) {
  17214. $recv(str)._write_(" - #(");
  17215. $ctx3.sendIdx["write:"]=5;
  17216. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  17217. return $core.withContext(function($ctx4) {
  17218. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  17219. $ctx4.sendIdx["write:"]=6;
  17220. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  17221. }),(function(){
  17222. return $core.withContext(function($ctx4) {
  17223. return $recv(str)._space();
  17224. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  17225. }));
  17226. return $recv(str)._write_(")");
  17227. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  17228. }));
  17229. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17230. }));
  17231. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  17232. },
  17233. args: [],
  17234. 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: ')' ] ]",
  17235. referencedClasses: ["String"],
  17236. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  17237. }),
  17238. $globals.TraitTransformation);
  17239. $core.addMethod(
  17240. $core.method({
  17241. selector: "exclusions",
  17242. protocol: "accessing",
  17243. fn: function (){
  17244. var self=this,$self=this;
  17245. return $self["@exclusions"];
  17246. },
  17247. args: [],
  17248. source: "exclusions\x0a\x09^ exclusions",
  17249. referencedClasses: [],
  17250. messageSends: []
  17251. }),
  17252. $globals.TraitTransformation);
  17253. $core.addMethod(
  17254. $core.method({
  17255. selector: "initialize",
  17256. protocol: "initialization",
  17257. fn: function (){
  17258. var self=this,$self=this;
  17259. return $core.withContext(function($ctx1) {
  17260. (
  17261. $ctx1.supercall = true,
  17262. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17263. $ctx1.supercall = false;
  17264. $self["@aliases"]=$globals.HashedCollection._newFromPairs_([]);
  17265. $self["@exclusions"]=$recv($globals.Set)._new();
  17266. $self["@trait"]=nil;
  17267. return self;
  17268. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  17269. },
  17270. args: [],
  17271. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  17272. referencedClasses: ["Set"],
  17273. messageSends: ["initialize", "new"]
  17274. }),
  17275. $globals.TraitTransformation);
  17276. $core.addMethod(
  17277. $core.method({
  17278. selector: "postCopy",
  17279. protocol: "copying",
  17280. fn: function (){
  17281. var self=this,$self=this;
  17282. return $core.withContext(function($ctx1) {
  17283. $self["@aliases"]=$recv($self["@aliases"])._copy();
  17284. $ctx1.sendIdx["copy"]=1;
  17285. $self["@exclusions"]=$recv($self["@exclusions"])._copy();
  17286. return self;
  17287. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  17288. },
  17289. args: [],
  17290. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  17291. referencedClasses: [],
  17292. messageSends: ["copy"]
  17293. }),
  17294. $globals.TraitTransformation);
  17295. $core.addMethod(
  17296. $core.method({
  17297. selector: "trait",
  17298. protocol: "accessing",
  17299. fn: function (){
  17300. var self=this,$self=this;
  17301. return $self["@trait"];
  17302. },
  17303. args: [],
  17304. source: "trait\x0a\x09^ trait",
  17305. referencedClasses: [],
  17306. messageSends: []
  17307. }),
  17308. $globals.TraitTransformation);
  17309. $core.addMethod(
  17310. $core.method({
  17311. selector: "trait:",
  17312. protocol: "accessing",
  17313. fn: function (anObject){
  17314. var self=this,$self=this;
  17315. $self["@trait"]=anObject;
  17316. return self;
  17317. },
  17318. args: ["anObject"],
  17319. source: "trait: anObject\x0a\x09trait := anObject",
  17320. referencedClasses: [],
  17321. messageSends: []
  17322. }),
  17323. $globals.TraitTransformation);
  17324. $core.addMethod(
  17325. $core.method({
  17326. selector: "fromJSON:",
  17327. protocol: "instance creation",
  17328. fn: function (aJSObject){
  17329. var self=this,$self=this;
  17330. return $core.withContext(function($ctx1) {
  17331. var $1,$4,$3,$2;
  17332. $1=(
  17333. $ctx1.supercall = true,
  17334. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17335. $ctx1.supercall = false;
  17336. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  17337. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  17338. return $globals.HashedCollection._newFromPairs_([]);
  17339. }));
  17340. $ctx1.sendIdx["at:ifAbsent:"]=1;
  17341. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  17342. $2=$recv($3)._associations();
  17343. $recv($1)._addAliases_($2);
  17344. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  17345. return [];
  17346. })));
  17347. return $recv($1)._yourself();
  17348. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.a$cls)});
  17349. },
  17350. args: ["aJSObject"],
  17351. 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",
  17352. referencedClasses: ["Smalltalk"],
  17353. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  17354. }),
  17355. $globals.TraitTransformation.a$cls);
  17356. $core.addMethod(
  17357. $core.method({
  17358. selector: "on:",
  17359. protocol: "instance creation",
  17360. fn: function (aTrait){
  17361. var self=this,$self=this;
  17362. return $core.withContext(function($ctx1) {
  17363. var $1;
  17364. $1=(
  17365. $ctx1.supercall = true,
  17366. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17367. $ctx1.supercall = false;
  17368. $recv($1)._trait_(aTrait);
  17369. return $recv($1)._yourself();
  17370. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.a$cls)});
  17371. },
  17372. args: ["aTrait"],
  17373. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  17374. referencedClasses: [],
  17375. messageSends: ["trait:", "new", "yourself"]
  17376. }),
  17377. $globals.TraitTransformation.a$cls);
  17378. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  17379. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  17380. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  17381. $core.addMethod(
  17382. $core.method({
  17383. selector: "asTraitComposition",
  17384. protocol: "*Kernel-Classes",
  17385. fn: function (){
  17386. var self=this,$self=this;
  17387. return $core.withContext(function($ctx1) {
  17388. return $self._collect_((function(each){
  17389. return $core.withContext(function($ctx2) {
  17390. return $recv(each)._asTraitTransformation();
  17391. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17392. }));
  17393. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  17394. },
  17395. args: [],
  17396. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  17397. referencedClasses: [],
  17398. messageSends: ["collect:", "asTraitTransformation"]
  17399. }),
  17400. $globals.Array);
  17401. });
  17402. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17403. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  17404. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17405. $core.addPackage("Kernel-Methods");
  17406. ($core.packageDescriptors||$core.packages)["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  17407. ($core.packageDescriptors||$core.packages)["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17408. $core.addClass("BlockClosure", $globals.Object, [], "Kernel-Methods");
  17409. $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 | ... ] `";
  17410. $core.addMethod(
  17411. $core.method({
  17412. selector: "applyTo:arguments:",
  17413. protocol: "evaluating",
  17414. fn: function (anObject,aCollection){
  17415. var self=this,$self=this;
  17416. return $core.withContext(function($ctx1) {
  17417. return self.apply(anObject, aCollection);
  17418. return self;
  17419. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  17420. },
  17421. args: ["anObject", "aCollection"],
  17422. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  17423. referencedClasses: [],
  17424. messageSends: []
  17425. }),
  17426. $globals.BlockClosure);
  17427. $core.addMethod(
  17428. $core.method({
  17429. selector: "asCompiledMethod:",
  17430. protocol: "converting",
  17431. fn: function (aString){
  17432. var self=this,$self=this;
  17433. return $core.withContext(function($ctx1) {
  17434. return $core.method({selector:aString, fn:self});;
  17435. return self;
  17436. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  17437. },
  17438. args: ["aString"],
  17439. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  17440. referencedClasses: [],
  17441. messageSends: []
  17442. }),
  17443. $globals.BlockClosure);
  17444. $core.addMethod(
  17445. $core.method({
  17446. selector: "compiledSource",
  17447. protocol: "accessing",
  17448. fn: function (){
  17449. var self=this,$self=this;
  17450. return $core.withContext(function($ctx1) {
  17451. return self.toString();
  17452. return self;
  17453. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  17454. },
  17455. args: [],
  17456. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  17457. referencedClasses: [],
  17458. messageSends: []
  17459. }),
  17460. $globals.BlockClosure);
  17461. $core.addMethod(
  17462. $core.method({
  17463. selector: "currySelf",
  17464. protocol: "converting",
  17465. fn: function (){
  17466. var self=this,$self=this;
  17467. return $core.withContext(function($ctx1) {
  17468. return function () {
  17469. var args = [ this ];
  17470. args.push.apply(args, arguments);
  17471. return self.apply(null, args);
  17472. }
  17473. ;
  17474. return self;
  17475. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  17476. },
  17477. args: [],
  17478. 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'>",
  17479. referencedClasses: [],
  17480. messageSends: []
  17481. }),
  17482. $globals.BlockClosure);
  17483. $core.addMethod(
  17484. $core.method({
  17485. selector: "ensure:",
  17486. protocol: "evaluating",
  17487. fn: function (aBlock){
  17488. var self=this,$self=this;
  17489. return $core.withContext(function($ctx1) {
  17490. try{return $self._value()}finally{aBlock._value()};
  17491. return self;
  17492. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  17493. },
  17494. args: ["aBlock"],
  17495. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  17496. referencedClasses: [],
  17497. messageSends: []
  17498. }),
  17499. $globals.BlockClosure);
  17500. $core.addMethod(
  17501. $core.method({
  17502. selector: "fork",
  17503. protocol: "timeout/interval",
  17504. fn: function (){
  17505. var self=this,$self=this;
  17506. return $core.withContext(function($ctx1) {
  17507. $recv($recv($globals.ForkPool)._default())._fork_(self);
  17508. return self;
  17509. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  17510. },
  17511. args: [],
  17512. source: "fork\x0a\x09ForkPool default fork: self",
  17513. referencedClasses: ["ForkPool"],
  17514. messageSends: ["fork:", "default"]
  17515. }),
  17516. $globals.BlockClosure);
  17517. $core.addMethod(
  17518. $core.method({
  17519. selector: "new",
  17520. protocol: "evaluating",
  17521. fn: function (){
  17522. var self=this,$self=this;
  17523. return $core.withContext(function($ctx1) {
  17524. return new self();
  17525. return self;
  17526. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  17527. },
  17528. args: [],
  17529. 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()'>",
  17530. referencedClasses: [],
  17531. messageSends: []
  17532. }),
  17533. $globals.BlockClosure);
  17534. $core.addMethod(
  17535. $core.method({
  17536. selector: "newValue:",
  17537. protocol: "evaluating",
  17538. fn: function (anObject){
  17539. var self=this,$self=this;
  17540. return $core.withContext(function($ctx1) {
  17541. return $self._newWithValues_([anObject]);
  17542. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  17543. },
  17544. args: ["anObject"],
  17545. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  17546. referencedClasses: [],
  17547. messageSends: ["newWithValues:"]
  17548. }),
  17549. $globals.BlockClosure);
  17550. $core.addMethod(
  17551. $core.method({
  17552. selector: "newValue:value:",
  17553. protocol: "evaluating",
  17554. fn: function (anObject,anObject2){
  17555. var self=this,$self=this;
  17556. return $core.withContext(function($ctx1) {
  17557. return $self._newWithValues_([anObject,anObject2]);
  17558. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  17559. },
  17560. args: ["anObject", "anObject2"],
  17561. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  17562. referencedClasses: [],
  17563. messageSends: ["newWithValues:"]
  17564. }),
  17565. $globals.BlockClosure);
  17566. $core.addMethod(
  17567. $core.method({
  17568. selector: "newValue:value:value:",
  17569. protocol: "evaluating",
  17570. fn: function (anObject,anObject2,anObject3){
  17571. var self=this,$self=this;
  17572. return $core.withContext(function($ctx1) {
  17573. return $self._newWithValues_([anObject,anObject2,anObject3]);
  17574. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  17575. },
  17576. args: ["anObject", "anObject2", "anObject3"],
  17577. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  17578. referencedClasses: [],
  17579. messageSends: ["newWithValues:"]
  17580. }),
  17581. $globals.BlockClosure);
  17582. $core.addMethod(
  17583. $core.method({
  17584. selector: "newWithValues:",
  17585. protocol: "evaluating",
  17586. fn: function (aCollection){
  17587. var self=this,$self=this;
  17588. return $core.withContext(function($ctx1) {
  17589. var object = Object.create(self.prototype);
  17590. var result = self.apply(object, aCollection);
  17591. return typeof result === "object" ? result : object;
  17592. ;
  17593. return self;
  17594. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  17595. },
  17596. args: ["aCollection"],
  17597. 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'>",
  17598. referencedClasses: [],
  17599. messageSends: []
  17600. }),
  17601. $globals.BlockClosure);
  17602. $core.addMethod(
  17603. $core.method({
  17604. selector: "numArgs",
  17605. protocol: "accessing",
  17606. fn: function (){
  17607. var self=this,$self=this;
  17608. return $core.withContext(function($ctx1) {
  17609. return self.length;
  17610. return self;
  17611. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  17612. },
  17613. args: [],
  17614. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  17615. referencedClasses: [],
  17616. messageSends: []
  17617. }),
  17618. $globals.BlockClosure);
  17619. $core.addMethod(
  17620. $core.method({
  17621. selector: "on:do:",
  17622. protocol: "error handling",
  17623. fn: function (anErrorClass,aBlock){
  17624. var self=this,$self=this;
  17625. return $core.withContext(function($ctx1) {
  17626. var $1;
  17627. return $self._tryCatch_((function(error){
  17628. var smalltalkError;
  17629. return $core.withContext(function($ctx2) {
  17630. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  17631. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  17632. if($core.assert($1)){
  17633. return $recv(aBlock)._value_(smalltalkError);
  17634. } else {
  17635. return $recv(smalltalkError)._pass();
  17636. }
  17637. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  17638. }));
  17639. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  17640. },
  17641. args: ["anErrorClass", "aBlock"],
  17642. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError pass ] ]",
  17643. referencedClasses: ["Smalltalk"],
  17644. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "pass"]
  17645. }),
  17646. $globals.BlockClosure);
  17647. $core.addMethod(
  17648. $core.method({
  17649. selector: "provided",
  17650. protocol: "converting",
  17651. fn: function (){
  17652. var self=this,$self=this;
  17653. return $core.withContext(function($ctx1) {
  17654. return $recv($globals.JSObjectProxy)._on_(self);
  17655. }, function($ctx1) {$ctx1.fill(self,"provided",{},$globals.BlockClosure)});
  17656. },
  17657. args: [],
  17658. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 require provided resolve: ...\x0a\x09or\x0a\x09 XMLHttpRequest provided DONE\x22\x0a\x09\x0a\x09^ JSObjectProxy on: self",
  17659. referencedClasses: ["JSObjectProxy"],
  17660. messageSends: ["on:"]
  17661. }),
  17662. $globals.BlockClosure);
  17663. $core.addMethod(
  17664. $core.method({
  17665. selector: "receiver",
  17666. protocol: "accessing",
  17667. fn: function (){
  17668. var self=this,$self=this;
  17669. return nil;
  17670. },
  17671. args: [],
  17672. source: "receiver\x0a\x09^ nil",
  17673. referencedClasses: [],
  17674. messageSends: []
  17675. }),
  17676. $globals.BlockClosure);
  17677. $core.addMethod(
  17678. $core.method({
  17679. selector: "timeToRun",
  17680. protocol: "evaluating",
  17681. fn: function (){
  17682. var self=this,$self=this;
  17683. return $core.withContext(function($ctx1) {
  17684. return $recv($globals.Date)._millisecondsToRun_(self);
  17685. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  17686. },
  17687. args: [],
  17688. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  17689. referencedClasses: ["Date"],
  17690. messageSends: ["millisecondsToRun:"]
  17691. }),
  17692. $globals.BlockClosure);
  17693. $core.addMethod(
  17694. $core.method({
  17695. selector: "tryCatch:",
  17696. protocol: "error handling",
  17697. fn: function (aBlock){
  17698. var self=this,$self=this;
  17699. return $core.withContext(function($ctx1) {
  17700. try {
  17701. return $self._value();
  17702. } catch(error) {
  17703. // pass non-local returns undetected
  17704. if (Array.isArray(error) && error.length === 1) throw error;
  17705. return aBlock._value_(error);
  17706. }
  17707. ;
  17708. return self;
  17709. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  17710. },
  17711. args: ["aBlock"],
  17712. 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'>",
  17713. referencedClasses: [],
  17714. messageSends: []
  17715. }),
  17716. $globals.BlockClosure);
  17717. $core.addMethod(
  17718. $core.method({
  17719. selector: "value",
  17720. protocol: "evaluating",
  17721. fn: function (){
  17722. var self=this,$self=this;
  17723. return $core.withContext(function($ctx1) {
  17724. return self();;
  17725. return self;
  17726. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  17727. },
  17728. args: [],
  17729. source: "value\x0a\x09<inlineJS: 'return self();'>",
  17730. referencedClasses: [],
  17731. messageSends: []
  17732. }),
  17733. $globals.BlockClosure);
  17734. $core.addMethod(
  17735. $core.method({
  17736. selector: "value:",
  17737. protocol: "evaluating",
  17738. fn: function (anArg){
  17739. var self=this,$self=this;
  17740. return $core.withContext(function($ctx1) {
  17741. return self(anArg);;
  17742. return self;
  17743. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  17744. },
  17745. args: ["anArg"],
  17746. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  17747. referencedClasses: [],
  17748. messageSends: []
  17749. }),
  17750. $globals.BlockClosure);
  17751. $core.addMethod(
  17752. $core.method({
  17753. selector: "value:value:",
  17754. protocol: "evaluating",
  17755. fn: function (firstArg,secondArg){
  17756. var self=this,$self=this;
  17757. return $core.withContext(function($ctx1) {
  17758. return self(firstArg, secondArg);;
  17759. return self;
  17760. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  17761. },
  17762. args: ["firstArg", "secondArg"],
  17763. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  17764. referencedClasses: [],
  17765. messageSends: []
  17766. }),
  17767. $globals.BlockClosure);
  17768. $core.addMethod(
  17769. $core.method({
  17770. selector: "value:value:value:",
  17771. protocol: "evaluating",
  17772. fn: function (firstArg,secondArg,thirdArg){
  17773. var self=this,$self=this;
  17774. return $core.withContext(function($ctx1) {
  17775. return self(firstArg, secondArg, thirdArg);;
  17776. return self;
  17777. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  17778. },
  17779. args: ["firstArg", "secondArg", "thirdArg"],
  17780. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  17781. referencedClasses: [],
  17782. messageSends: []
  17783. }),
  17784. $globals.BlockClosure);
  17785. $core.addMethod(
  17786. $core.method({
  17787. selector: "valueWithInterval:",
  17788. protocol: "timeout/interval",
  17789. fn: function (aNumber){
  17790. var self=this,$self=this;
  17791. return $core.withContext(function($ctx1) {
  17792. var interval = setInterval(self, aNumber);
  17793. return $globals.Timeout._on_(interval);
  17794. ;
  17795. return self;
  17796. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  17797. },
  17798. args: ["aNumber"],
  17799. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  17800. referencedClasses: [],
  17801. messageSends: []
  17802. }),
  17803. $globals.BlockClosure);
  17804. $core.addMethod(
  17805. $core.method({
  17806. selector: "valueWithPossibleArguments:",
  17807. protocol: "evaluating",
  17808. fn: function (aCollection){
  17809. var self=this,$self=this;
  17810. return $core.withContext(function($ctx1) {
  17811. return self.apply(null, aCollection);;
  17812. return self;
  17813. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  17814. },
  17815. args: ["aCollection"],
  17816. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  17817. referencedClasses: [],
  17818. messageSends: []
  17819. }),
  17820. $globals.BlockClosure);
  17821. $core.addMethod(
  17822. $core.method({
  17823. selector: "valueWithTimeout:",
  17824. protocol: "timeout/interval",
  17825. fn: function (aNumber){
  17826. var self=this,$self=this;
  17827. return $core.withContext(function($ctx1) {
  17828. var timeout = setTimeout(self, aNumber);
  17829. return $globals.Timeout._on_(timeout);
  17830. ;
  17831. return self;
  17832. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  17833. },
  17834. args: ["aNumber"],
  17835. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  17836. referencedClasses: [],
  17837. messageSends: []
  17838. }),
  17839. $globals.BlockClosure);
  17840. $core.addMethod(
  17841. $core.method({
  17842. selector: "whileFalse",
  17843. protocol: "controlling",
  17844. fn: function (){
  17845. var self=this,$self=this;
  17846. return $core.withContext(function($ctx1) {
  17847. $self._whileFalse_((function(){
  17848. }));
  17849. return self;
  17850. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  17851. },
  17852. args: [],
  17853. source: "whileFalse\x0a\x09self whileFalse: []",
  17854. referencedClasses: [],
  17855. messageSends: ["whileFalse:"]
  17856. }),
  17857. $globals.BlockClosure);
  17858. $core.addMethod(
  17859. $core.method({
  17860. selector: "whileFalse:",
  17861. protocol: "controlling",
  17862. fn: function (aBlock){
  17863. var self=this,$self=this;
  17864. return $core.withContext(function($ctx1) {
  17865. while(!$core.assert($self._value())) {aBlock._value()};
  17866. return self;
  17867. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  17868. },
  17869. args: ["aBlock"],
  17870. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  17871. referencedClasses: [],
  17872. messageSends: []
  17873. }),
  17874. $globals.BlockClosure);
  17875. $core.addMethod(
  17876. $core.method({
  17877. selector: "whileTrue",
  17878. protocol: "controlling",
  17879. fn: function (){
  17880. var self=this,$self=this;
  17881. return $core.withContext(function($ctx1) {
  17882. $self._whileTrue_((function(){
  17883. }));
  17884. return self;
  17885. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  17886. },
  17887. args: [],
  17888. source: "whileTrue\x0a\x09self whileTrue: []",
  17889. referencedClasses: [],
  17890. messageSends: ["whileTrue:"]
  17891. }),
  17892. $globals.BlockClosure);
  17893. $core.addMethod(
  17894. $core.method({
  17895. selector: "whileTrue:",
  17896. protocol: "controlling",
  17897. fn: function (aBlock){
  17898. var self=this,$self=this;
  17899. return $core.withContext(function($ctx1) {
  17900. while($core.assert($self._value())) {aBlock._value()};
  17901. return self;
  17902. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  17903. },
  17904. args: ["aBlock"],
  17905. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  17906. referencedClasses: [],
  17907. messageSends: []
  17908. }),
  17909. $globals.BlockClosure);
  17910. $core.addClass("CompiledMethod", $globals.Object, [], "Kernel-Methods");
  17911. $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";
  17912. $core.addMethod(
  17913. $core.method({
  17914. selector: "arguments",
  17915. protocol: "accessing",
  17916. fn: function (){
  17917. var self=this,$self=this;
  17918. return $core.withContext(function($ctx1) {
  17919. return self.args || [];
  17920. return self;
  17921. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  17922. },
  17923. args: [],
  17924. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  17925. referencedClasses: [],
  17926. messageSends: []
  17927. }),
  17928. $globals.CompiledMethod);
  17929. $core.addMethod(
  17930. $core.method({
  17931. selector: "browse",
  17932. protocol: "browsing",
  17933. fn: function (){
  17934. var self=this,$self=this;
  17935. return $core.withContext(function($ctx1) {
  17936. $recv($globals.Finder)._findMethod_(self);
  17937. return self;
  17938. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  17939. },
  17940. args: [],
  17941. source: "browse\x0a\x09Finder findMethod: self",
  17942. referencedClasses: ["Finder"],
  17943. messageSends: ["findMethod:"]
  17944. }),
  17945. $globals.CompiledMethod);
  17946. $core.addMethod(
  17947. $core.method({
  17948. selector: "category",
  17949. protocol: "accessing",
  17950. fn: function (){
  17951. var self=this,$self=this;
  17952. return $core.withContext(function($ctx1) {
  17953. return $self._protocol();
  17954. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  17955. },
  17956. args: [],
  17957. source: "category\x0a\x09^ self protocol",
  17958. referencedClasses: [],
  17959. messageSends: ["protocol"]
  17960. }),
  17961. $globals.CompiledMethod);
  17962. $core.addMethod(
  17963. $core.method({
  17964. selector: "defaultProtocol",
  17965. protocol: "defaults",
  17966. fn: function (){
  17967. var self=this,$self=this;
  17968. return "as yet unclassified";
  17969. },
  17970. args: [],
  17971. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  17972. referencedClasses: [],
  17973. messageSends: []
  17974. }),
  17975. $globals.CompiledMethod);
  17976. $core.addMethod(
  17977. $core.method({
  17978. selector: "fn",
  17979. protocol: "accessing",
  17980. fn: function (){
  17981. var self=this,$self=this;
  17982. return $core.withContext(function($ctx1) {
  17983. return $self._basicAt_("fn");
  17984. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  17985. },
  17986. args: [],
  17987. source: "fn\x0a\x09^ self basicAt: 'fn'",
  17988. referencedClasses: [],
  17989. messageSends: ["basicAt:"]
  17990. }),
  17991. $globals.CompiledMethod);
  17992. $core.addMethod(
  17993. $core.method({
  17994. selector: "fn:",
  17995. protocol: "accessing",
  17996. fn: function (aBlock){
  17997. var self=this,$self=this;
  17998. return $core.withContext(function($ctx1) {
  17999. $self._basicAt_put_("fn",aBlock);
  18000. return self;
  18001. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  18002. },
  18003. args: ["aBlock"],
  18004. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  18005. referencedClasses: [],
  18006. messageSends: ["basicAt:put:"]
  18007. }),
  18008. $globals.CompiledMethod);
  18009. $core.addMethod(
  18010. $core.method({
  18011. selector: "isCompiledMethod",
  18012. protocol: "testing",
  18013. fn: function (){
  18014. var self=this,$self=this;
  18015. return true;
  18016. },
  18017. args: [],
  18018. source: "isCompiledMethod\x0a\x09^ true",
  18019. referencedClasses: [],
  18020. messageSends: []
  18021. }),
  18022. $globals.CompiledMethod);
  18023. $core.addMethod(
  18024. $core.method({
  18025. selector: "isOverridden",
  18026. protocol: "testing",
  18027. fn: function (){
  18028. var self=this,$self=this;
  18029. var selector;
  18030. return $core.withContext(function($ctx1) {
  18031. var $1;
  18032. var $early={};
  18033. try {
  18034. selector=$self._selector();
  18035. $recv($self._methodClass())._allSubclassesDo_((function(each){
  18036. return $core.withContext(function($ctx2) {
  18037. $1=$recv(each)._includesSelector_(selector);
  18038. if($core.assert($1)){
  18039. throw $early=[true];
  18040. }
  18041. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18042. }));
  18043. return false;
  18044. }
  18045. catch(e) {if(e===$early)return e[0]; throw e}
  18046. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  18047. },
  18048. args: [],
  18049. 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",
  18050. referencedClasses: [],
  18051. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  18052. }),
  18053. $globals.CompiledMethod);
  18054. $core.addMethod(
  18055. $core.method({
  18056. selector: "isOverride",
  18057. protocol: "testing",
  18058. fn: function (){
  18059. var self=this,$self=this;
  18060. var superclass;
  18061. return $core.withContext(function($ctx1) {
  18062. var $1,$2,$receiver;
  18063. $1=$self._methodClass();
  18064. $ctx1.sendIdx["methodClass"]=1;
  18065. superclass=$recv($1)._superclass();
  18066. $ctx1.sendIdx["superclass"]=1;
  18067. $2=superclass;
  18068. if(($receiver = $2) == null || $receiver.a$nil){
  18069. return false;
  18070. } else {
  18071. $2;
  18072. }
  18073. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  18074. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  18075. },
  18076. args: [],
  18077. 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",
  18078. referencedClasses: [],
  18079. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  18080. }),
  18081. $globals.CompiledMethod);
  18082. $core.addMethod(
  18083. $core.method({
  18084. selector: "messageSends",
  18085. protocol: "accessing",
  18086. fn: function (){
  18087. var self=this,$self=this;
  18088. return $core.withContext(function($ctx1) {
  18089. return $self._basicAt_("messageSends");
  18090. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  18091. },
  18092. args: [],
  18093. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  18094. referencedClasses: [],
  18095. messageSends: ["basicAt:"]
  18096. }),
  18097. $globals.CompiledMethod);
  18098. $core.addMethod(
  18099. $core.method({
  18100. selector: "methodClass",
  18101. protocol: "accessing",
  18102. fn: function (){
  18103. var self=this,$self=this;
  18104. return $core.withContext(function($ctx1) {
  18105. return $self._basicAt_("owner");
  18106. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  18107. },
  18108. args: [],
  18109. source: "methodClass\x0a\x09^ self basicAt: 'owner'",
  18110. referencedClasses: [],
  18111. messageSends: ["basicAt:"]
  18112. }),
  18113. $globals.CompiledMethod);
  18114. $core.addMethod(
  18115. $core.method({
  18116. selector: "package",
  18117. protocol: "accessing",
  18118. fn: function (){
  18119. var self=this,$self=this;
  18120. return $core.withContext(function($ctx1) {
  18121. var $1,$receiver;
  18122. $1=$self._methodClass();
  18123. if(($receiver = $1) == null || $receiver.a$nil){
  18124. return $1;
  18125. } else {
  18126. var class_;
  18127. class_=$receiver;
  18128. return $recv(class_)._packageOfProtocol_($self._protocol());
  18129. }
  18130. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  18131. },
  18132. args: [],
  18133. 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 ]",
  18134. referencedClasses: [],
  18135. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  18136. }),
  18137. $globals.CompiledMethod);
  18138. $core.addMethod(
  18139. $core.method({
  18140. selector: "protocol",
  18141. protocol: "accessing",
  18142. fn: function (){
  18143. var self=this,$self=this;
  18144. return $core.withContext(function($ctx1) {
  18145. var $1,$receiver;
  18146. $1=$self._basicAt_("protocol");
  18147. if(($receiver = $1) == null || $receiver.a$nil){
  18148. return $self._defaultProtocol();
  18149. } else {
  18150. return $1;
  18151. }
  18152. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  18153. },
  18154. args: [],
  18155. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  18156. referencedClasses: [],
  18157. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  18158. }),
  18159. $globals.CompiledMethod);
  18160. $core.addMethod(
  18161. $core.method({
  18162. selector: "protocol:",
  18163. protocol: "accessing",
  18164. fn: function (aString){
  18165. var self=this,$self=this;
  18166. var oldProtocol;
  18167. return $core.withContext(function($ctx1) {
  18168. var $1,$3,$2,$4,$receiver;
  18169. oldProtocol=$self._protocol();
  18170. $self._basicAt_put_("protocol",aString);
  18171. $1=$recv($globals.SystemAnnouncer)._current();
  18172. $3=$recv($globals.MethodMoved)._new();
  18173. $recv($3)._method_(self);
  18174. $recv($3)._oldProtocol_(oldProtocol);
  18175. $2=$recv($3)._yourself();
  18176. $recv($1)._announce_($2);
  18177. $4=$self._methodClass();
  18178. if(($receiver = $4) == null || $receiver.a$nil){
  18179. $4;
  18180. } else {
  18181. var methodClass;
  18182. methodClass=$receiver;
  18183. $recv($recv(methodClass)._organization())._addElement_(aString);
  18184. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  18185. }
  18186. return self;
  18187. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  18188. },
  18189. args: ["aString"],
  18190. 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 ]",
  18191. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  18192. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  18193. }),
  18194. $globals.CompiledMethod);
  18195. $core.addMethod(
  18196. $core.method({
  18197. selector: "referencedClasses",
  18198. protocol: "accessing",
  18199. fn: function (){
  18200. var self=this,$self=this;
  18201. return $core.withContext(function($ctx1) {
  18202. return $self._basicAt_("referencedClasses");
  18203. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  18204. },
  18205. args: [],
  18206. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  18207. referencedClasses: [],
  18208. messageSends: ["basicAt:"]
  18209. }),
  18210. $globals.CompiledMethod);
  18211. $core.addMethod(
  18212. $core.method({
  18213. selector: "selector",
  18214. protocol: "accessing",
  18215. fn: function (){
  18216. var self=this,$self=this;
  18217. return $core.withContext(function($ctx1) {
  18218. return $self._basicAt_("selector");
  18219. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  18220. },
  18221. args: [],
  18222. source: "selector\x0a\x09^ self basicAt: 'selector'",
  18223. referencedClasses: [],
  18224. messageSends: ["basicAt:"]
  18225. }),
  18226. $globals.CompiledMethod);
  18227. $core.addMethod(
  18228. $core.method({
  18229. selector: "selector:",
  18230. protocol: "accessing",
  18231. fn: function (aString){
  18232. var self=this,$self=this;
  18233. return $core.withContext(function($ctx1) {
  18234. $self._basicAt_put_("selector",aString);
  18235. return self;
  18236. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  18237. },
  18238. args: ["aString"],
  18239. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  18240. referencedClasses: [],
  18241. messageSends: ["basicAt:put:"]
  18242. }),
  18243. $globals.CompiledMethod);
  18244. $core.addMethod(
  18245. $core.method({
  18246. selector: "sendTo:arguments:",
  18247. protocol: "evaluating",
  18248. fn: function (anObject,aCollection){
  18249. var self=this,$self=this;
  18250. return $core.withContext(function($ctx1) {
  18251. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  18252. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  18253. },
  18254. args: ["anObject", "aCollection"],
  18255. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  18256. referencedClasses: [],
  18257. messageSends: ["applyTo:arguments:", "fn"]
  18258. }),
  18259. $globals.CompiledMethod);
  18260. $core.addMethod(
  18261. $core.method({
  18262. selector: "source",
  18263. protocol: "accessing",
  18264. fn: function (){
  18265. var self=this,$self=this;
  18266. return $core.withContext(function($ctx1) {
  18267. var $1,$receiver;
  18268. $1=$self._basicAt_("source");
  18269. if(($receiver = $1) == null || $receiver.a$nil){
  18270. return "";
  18271. } else {
  18272. return $1;
  18273. }
  18274. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  18275. },
  18276. args: [],
  18277. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  18278. referencedClasses: [],
  18279. messageSends: ["ifNil:", "basicAt:"]
  18280. }),
  18281. $globals.CompiledMethod);
  18282. $core.addMethod(
  18283. $core.method({
  18284. selector: "source:",
  18285. protocol: "accessing",
  18286. fn: function (aString){
  18287. var self=this,$self=this;
  18288. return $core.withContext(function($ctx1) {
  18289. $self._basicAt_put_("source",aString);
  18290. return self;
  18291. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  18292. },
  18293. args: ["aString"],
  18294. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  18295. referencedClasses: [],
  18296. messageSends: ["basicAt:put:"]
  18297. }),
  18298. $globals.CompiledMethod);
  18299. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  18300. $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`";
  18301. $core.addMethod(
  18302. $core.method({
  18303. selector: "addWorker",
  18304. protocol: "private",
  18305. fn: function (){
  18306. var self=this,$self=this;
  18307. return $core.withContext(function($ctx1) {
  18308. $recv($self["@worker"])._valueWithTimeout_((0));
  18309. $self["@poolSize"]=$recv($self["@poolSize"]).__plus((1));
  18310. return self;
  18311. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  18312. },
  18313. args: [],
  18314. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  18315. referencedClasses: [],
  18316. messageSends: ["valueWithTimeout:", "+"]
  18317. }),
  18318. $globals.ForkPool);
  18319. $core.addMethod(
  18320. $core.method({
  18321. selector: "defaultMaxPoolSize",
  18322. protocol: "defaults",
  18323. fn: function (){
  18324. var self=this,$self=this;
  18325. return $core.withContext(function($ctx1) {
  18326. return $recv($self._class())._defaultMaxPoolSize();
  18327. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  18328. },
  18329. args: [],
  18330. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  18331. referencedClasses: [],
  18332. messageSends: ["defaultMaxPoolSize", "class"]
  18333. }),
  18334. $globals.ForkPool);
  18335. $core.addMethod(
  18336. $core.method({
  18337. selector: "fork:",
  18338. protocol: "actions",
  18339. fn: function (aBlock){
  18340. var self=this,$self=this;
  18341. return $core.withContext(function($ctx1) {
  18342. var $1;
  18343. $1=$recv($self["@poolSize"]).__lt($self._maxPoolSize());
  18344. if($core.assert($1)){
  18345. $self._addWorker();
  18346. }
  18347. $recv($self["@queue"])._nextPut_(aBlock);
  18348. return self;
  18349. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  18350. },
  18351. args: ["aBlock"],
  18352. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  18353. referencedClasses: [],
  18354. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  18355. }),
  18356. $globals.ForkPool);
  18357. $core.addMethod(
  18358. $core.method({
  18359. selector: "initialize",
  18360. protocol: "initialization",
  18361. fn: function (){
  18362. var self=this,$self=this;
  18363. return $core.withContext(function($ctx1) {
  18364. (
  18365. $ctx1.supercall = true,
  18366. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18367. $ctx1.supercall = false;
  18368. $self["@poolSize"]=(0);
  18369. $self["@queue"]=$recv($globals.Queue)._new();
  18370. $self["@worker"]=$self._makeWorker();
  18371. return self;
  18372. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  18373. },
  18374. args: [],
  18375. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  18376. referencedClasses: ["Queue"],
  18377. messageSends: ["initialize", "new", "makeWorker"]
  18378. }),
  18379. $globals.ForkPool);
  18380. $core.addMethod(
  18381. $core.method({
  18382. selector: "makeWorker",
  18383. protocol: "initialization",
  18384. fn: function (){
  18385. var self=this,$self=this;
  18386. var sentinel;
  18387. return $core.withContext(function($ctx1) {
  18388. var $1;
  18389. sentinel=$recv($globals.Object)._new();
  18390. return (function(){
  18391. var block;
  18392. return $core.withContext(function($ctx2) {
  18393. $self["@poolSize"]=$recv($self["@poolSize"]).__minus((1));
  18394. block=$recv($self["@queue"])._nextIfAbsent_((function(){
  18395. return sentinel;
  18396. }));
  18397. $1=$recv(block).__eq_eq(sentinel);
  18398. if(!$core.assert($1)){
  18399. return $recv((function(){
  18400. return $core.withContext(function($ctx3) {
  18401. return $recv(block)._value();
  18402. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  18403. }))._ensure_((function(){
  18404. return $core.withContext(function($ctx3) {
  18405. return $self._addWorker();
  18406. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  18407. }));
  18408. }
  18409. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  18410. });
  18411. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  18412. },
  18413. args: [],
  18414. 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 ] ]]",
  18415. referencedClasses: ["Object"],
  18416. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  18417. }),
  18418. $globals.ForkPool);
  18419. $core.addMethod(
  18420. $core.method({
  18421. selector: "maxPoolSize",
  18422. protocol: "accessing",
  18423. fn: function (){
  18424. var self=this,$self=this;
  18425. return $core.withContext(function($ctx1) {
  18426. var $1,$receiver;
  18427. $1=$self["@maxPoolSize"];
  18428. if(($receiver = $1) == null || $receiver.a$nil){
  18429. return $self._defaultMaxPoolSize();
  18430. } else {
  18431. return $1;
  18432. }
  18433. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  18434. },
  18435. args: [],
  18436. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  18437. referencedClasses: [],
  18438. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  18439. }),
  18440. $globals.ForkPool);
  18441. $core.addMethod(
  18442. $core.method({
  18443. selector: "maxPoolSize:",
  18444. protocol: "accessing",
  18445. fn: function (anInteger){
  18446. var self=this,$self=this;
  18447. $self["@maxPoolSize"]=anInteger;
  18448. return self;
  18449. },
  18450. args: ["anInteger"],
  18451. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  18452. referencedClasses: [],
  18453. messageSends: []
  18454. }),
  18455. $globals.ForkPool);
  18456. $globals.ForkPool.a$cls.iVarNames = ["default"];
  18457. $core.addMethod(
  18458. $core.method({
  18459. selector: "default",
  18460. protocol: "accessing",
  18461. fn: function (){
  18462. var self=this,$self=this;
  18463. return $core.withContext(function($ctx1) {
  18464. var $1,$receiver;
  18465. $1=$self["@default"];
  18466. if(($receiver = $1) == null || $receiver.a$nil){
  18467. $self["@default"]=$self._new();
  18468. return $self["@default"];
  18469. } else {
  18470. return $1;
  18471. }
  18472. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.a$cls)});
  18473. },
  18474. args: [],
  18475. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  18476. referencedClasses: [],
  18477. messageSends: ["ifNil:", "new"]
  18478. }),
  18479. $globals.ForkPool.a$cls);
  18480. $core.addMethod(
  18481. $core.method({
  18482. selector: "defaultMaxPoolSize",
  18483. protocol: "accessing",
  18484. fn: function (){
  18485. var self=this,$self=this;
  18486. return (100);
  18487. },
  18488. args: [],
  18489. source: "defaultMaxPoolSize\x0a\x09^ 100",
  18490. referencedClasses: [],
  18491. messageSends: []
  18492. }),
  18493. $globals.ForkPool.a$cls);
  18494. $core.addMethod(
  18495. $core.method({
  18496. selector: "resetDefault",
  18497. protocol: "accessing",
  18498. fn: function (){
  18499. var self=this,$self=this;
  18500. $self["@default"]=nil;
  18501. return self;
  18502. },
  18503. args: [],
  18504. source: "resetDefault\x0a\x09default := nil",
  18505. referencedClasses: [],
  18506. messageSends: []
  18507. }),
  18508. $globals.ForkPool.a$cls);
  18509. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  18510. $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.";
  18511. $core.addMethod(
  18512. $core.method({
  18513. selector: "arguments",
  18514. protocol: "accessing",
  18515. fn: function (){
  18516. var self=this,$self=this;
  18517. return $self["@arguments"];
  18518. },
  18519. args: [],
  18520. source: "arguments\x0a\x09^ arguments",
  18521. referencedClasses: [],
  18522. messageSends: []
  18523. }),
  18524. $globals.Message);
  18525. $core.addMethod(
  18526. $core.method({
  18527. selector: "arguments:",
  18528. protocol: "accessing",
  18529. fn: function (anArray){
  18530. var self=this,$self=this;
  18531. $self["@arguments"]=anArray;
  18532. return self;
  18533. },
  18534. args: ["anArray"],
  18535. source: "arguments: anArray\x0a\x09arguments := anArray",
  18536. referencedClasses: [],
  18537. messageSends: []
  18538. }),
  18539. $globals.Message);
  18540. $core.addMethod(
  18541. $core.method({
  18542. selector: "printOn:",
  18543. protocol: "printing",
  18544. fn: function (aStream){
  18545. var self=this,$self=this;
  18546. return $core.withContext(function($ctx1) {
  18547. (
  18548. $ctx1.supercall = true,
  18549. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18550. $ctx1.supercall = false;
  18551. $recv(aStream)._nextPutAll_("(");
  18552. $ctx1.sendIdx["nextPutAll:"]=1;
  18553. $recv(aStream)._nextPutAll_($self._selector());
  18554. $ctx1.sendIdx["nextPutAll:"]=2;
  18555. $recv(aStream)._nextPutAll_(")");
  18556. return self;
  18557. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  18558. },
  18559. args: ["aStream"],
  18560. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18561. referencedClasses: [],
  18562. messageSends: ["printOn:", "nextPutAll:", "selector"]
  18563. }),
  18564. $globals.Message);
  18565. $core.addMethod(
  18566. $core.method({
  18567. selector: "selector",
  18568. protocol: "accessing",
  18569. fn: function (){
  18570. var self=this,$self=this;
  18571. return $self["@selector"];
  18572. },
  18573. args: [],
  18574. source: "selector\x0a\x09^ selector",
  18575. referencedClasses: [],
  18576. messageSends: []
  18577. }),
  18578. $globals.Message);
  18579. $core.addMethod(
  18580. $core.method({
  18581. selector: "selector:",
  18582. protocol: "accessing",
  18583. fn: function (aString){
  18584. var self=this,$self=this;
  18585. $self["@selector"]=aString;
  18586. return self;
  18587. },
  18588. args: ["aString"],
  18589. source: "selector: aString\x0a\x09selector := aString",
  18590. referencedClasses: [],
  18591. messageSends: []
  18592. }),
  18593. $globals.Message);
  18594. $core.addMethod(
  18595. $core.method({
  18596. selector: "sendTo:",
  18597. protocol: "actions",
  18598. fn: function (anObject){
  18599. var self=this,$self=this;
  18600. return $core.withContext(function($ctx1) {
  18601. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  18602. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  18603. },
  18604. args: ["anObject"],
  18605. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  18606. referencedClasses: [],
  18607. messageSends: ["perform:withArguments:", "selector", "arguments"]
  18608. }),
  18609. $globals.Message);
  18610. $core.addMethod(
  18611. $core.method({
  18612. selector: "selector:arguments:",
  18613. protocol: "instance creation",
  18614. fn: function (aString,anArray){
  18615. var self=this,$self=this;
  18616. return $core.withContext(function($ctx1) {
  18617. var $1;
  18618. $1=$self._new();
  18619. $recv($1)._selector_(aString);
  18620. $recv($1)._arguments_(anArray);
  18621. return $recv($1)._yourself();
  18622. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.a$cls)});
  18623. },
  18624. args: ["aString", "anArray"],
  18625. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  18626. referencedClasses: [],
  18627. messageSends: ["selector:", "new", "arguments:", "yourself"]
  18628. }),
  18629. $globals.Message.a$cls);
  18630. $core.addMethod(
  18631. $core.method({
  18632. selector: "selector:arguments:notUnderstoodBy:",
  18633. protocol: "dnu handling",
  18634. fn: function (aString,anArray,anObject){
  18635. var self=this,$self=this;
  18636. return $core.withContext(function($ctx1) {
  18637. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  18638. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject},$globals.Message.a$cls)});
  18639. },
  18640. args: ["aString", "anArray", "anObject"],
  18641. 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)",
  18642. referencedClasses: [],
  18643. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  18644. }),
  18645. $globals.Message.a$cls);
  18646. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  18647. $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.";
  18648. $core.addMethod(
  18649. $core.method({
  18650. selector: "arguments",
  18651. protocol: "accessing",
  18652. fn: function (){
  18653. var self=this,$self=this;
  18654. return $core.withContext(function($ctx1) {
  18655. return $recv($self["@message"])._arguments();
  18656. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  18657. },
  18658. args: [],
  18659. source: "arguments\x0a\x09^ message arguments",
  18660. referencedClasses: [],
  18661. messageSends: ["arguments"]
  18662. }),
  18663. $globals.MessageSend);
  18664. $core.addMethod(
  18665. $core.method({
  18666. selector: "arguments:",
  18667. protocol: "accessing",
  18668. fn: function (aCollection){
  18669. var self=this,$self=this;
  18670. return $core.withContext(function($ctx1) {
  18671. $recv($self["@message"])._arguments_(aCollection);
  18672. return self;
  18673. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  18674. },
  18675. args: ["aCollection"],
  18676. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  18677. referencedClasses: [],
  18678. messageSends: ["arguments:"]
  18679. }),
  18680. $globals.MessageSend);
  18681. $core.addMethod(
  18682. $core.method({
  18683. selector: "initialize",
  18684. protocol: "initialization",
  18685. fn: function (){
  18686. var self=this,$self=this;
  18687. return $core.withContext(function($ctx1) {
  18688. (
  18689. $ctx1.supercall = true,
  18690. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18691. $ctx1.supercall = false;
  18692. $self["@message"]=$recv($globals.Message)._new();
  18693. return self;
  18694. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  18695. },
  18696. args: [],
  18697. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  18698. referencedClasses: ["Message"],
  18699. messageSends: ["initialize", "new"]
  18700. }),
  18701. $globals.MessageSend);
  18702. $core.addMethod(
  18703. $core.method({
  18704. selector: "printOn:",
  18705. protocol: "printing",
  18706. fn: function (aStream){
  18707. var self=this,$self=this;
  18708. return $core.withContext(function($ctx1) {
  18709. (
  18710. $ctx1.supercall = true,
  18711. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18712. $ctx1.supercall = false;
  18713. $recv(aStream)._nextPutAll_("(");
  18714. $ctx1.sendIdx["nextPutAll:"]=1;
  18715. $recv(aStream)._nextPutAll_($self._receiver());
  18716. $ctx1.sendIdx["nextPutAll:"]=2;
  18717. $recv(aStream)._nextPutAll_(" >> ");
  18718. $ctx1.sendIdx["nextPutAll:"]=3;
  18719. $recv(aStream)._nextPutAll_($self._selector());
  18720. $ctx1.sendIdx["nextPutAll:"]=4;
  18721. $recv(aStream)._nextPutAll_(")");
  18722. return self;
  18723. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  18724. },
  18725. args: ["aStream"],
  18726. 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: ')'",
  18727. referencedClasses: [],
  18728. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  18729. }),
  18730. $globals.MessageSend);
  18731. $core.addMethod(
  18732. $core.method({
  18733. selector: "receiver",
  18734. protocol: "accessing",
  18735. fn: function (){
  18736. var self=this,$self=this;
  18737. return $self["@receiver"];
  18738. },
  18739. args: [],
  18740. source: "receiver\x0a\x09^ receiver",
  18741. referencedClasses: [],
  18742. messageSends: []
  18743. }),
  18744. $globals.MessageSend);
  18745. $core.addMethod(
  18746. $core.method({
  18747. selector: "receiver:",
  18748. protocol: "accessing",
  18749. fn: function (anObject){
  18750. var self=this,$self=this;
  18751. $self["@receiver"]=anObject;
  18752. return self;
  18753. },
  18754. args: ["anObject"],
  18755. source: "receiver: anObject\x0a\x09receiver := anObject",
  18756. referencedClasses: [],
  18757. messageSends: []
  18758. }),
  18759. $globals.MessageSend);
  18760. $core.addMethod(
  18761. $core.method({
  18762. selector: "selector",
  18763. protocol: "accessing",
  18764. fn: function (){
  18765. var self=this,$self=this;
  18766. return $core.withContext(function($ctx1) {
  18767. return $recv($self["@message"])._selector();
  18768. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  18769. },
  18770. args: [],
  18771. source: "selector\x0a\x09^ message selector",
  18772. referencedClasses: [],
  18773. messageSends: ["selector"]
  18774. }),
  18775. $globals.MessageSend);
  18776. $core.addMethod(
  18777. $core.method({
  18778. selector: "selector:",
  18779. protocol: "accessing",
  18780. fn: function (aString){
  18781. var self=this,$self=this;
  18782. return $core.withContext(function($ctx1) {
  18783. $recv($self["@message"])._selector_(aString);
  18784. return self;
  18785. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  18786. },
  18787. args: ["aString"],
  18788. source: "selector: aString\x0a\x09message selector: aString",
  18789. referencedClasses: [],
  18790. messageSends: ["selector:"]
  18791. }),
  18792. $globals.MessageSend);
  18793. $core.addMethod(
  18794. $core.method({
  18795. selector: "value",
  18796. protocol: "evaluating",
  18797. fn: function (){
  18798. var self=this,$self=this;
  18799. return $core.withContext(function($ctx1) {
  18800. return $recv($self["@message"])._sendTo_($self._receiver());
  18801. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  18802. },
  18803. args: [],
  18804. source: "value\x0a\x09^ message sendTo: self receiver",
  18805. referencedClasses: [],
  18806. messageSends: ["sendTo:", "receiver"]
  18807. }),
  18808. $globals.MessageSend);
  18809. $core.addMethod(
  18810. $core.method({
  18811. selector: "value:",
  18812. protocol: "evaluating",
  18813. fn: function (anObject){
  18814. var self=this,$self=this;
  18815. return $core.withContext(function($ctx1) {
  18816. var $1;
  18817. $1=$self["@message"];
  18818. $recv($1)._arguments_([anObject]);
  18819. return $recv($1)._sendTo_($self._receiver());
  18820. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  18821. },
  18822. args: ["anObject"],
  18823. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  18824. referencedClasses: [],
  18825. messageSends: ["arguments:", "sendTo:", "receiver"]
  18826. }),
  18827. $globals.MessageSend);
  18828. $core.addMethod(
  18829. $core.method({
  18830. selector: "value:value:",
  18831. protocol: "evaluating",
  18832. fn: function (firstArgument,secondArgument){
  18833. var self=this,$self=this;
  18834. return $core.withContext(function($ctx1) {
  18835. var $1;
  18836. $1=$self["@message"];
  18837. $recv($1)._arguments_([firstArgument,secondArgument]);
  18838. return $recv($1)._sendTo_($self._receiver());
  18839. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  18840. },
  18841. args: ["firstArgument", "secondArgument"],
  18842. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  18843. referencedClasses: [],
  18844. messageSends: ["arguments:", "sendTo:", "receiver"]
  18845. }),
  18846. $globals.MessageSend);
  18847. $core.addMethod(
  18848. $core.method({
  18849. selector: "value:value:value:",
  18850. protocol: "evaluating",
  18851. fn: function (firstArgument,secondArgument,thirdArgument){
  18852. var self=this,$self=this;
  18853. return $core.withContext(function($ctx1) {
  18854. var $1;
  18855. $1=$self["@message"];
  18856. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  18857. return $recv($1)._sendTo_($self._receiver());
  18858. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  18859. },
  18860. args: ["firstArgument", "secondArgument", "thirdArgument"],
  18861. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  18862. referencedClasses: [],
  18863. messageSends: ["arguments:", "sendTo:", "receiver"]
  18864. }),
  18865. $globals.MessageSend);
  18866. $core.addMethod(
  18867. $core.method({
  18868. selector: "valueWithPossibleArguments:",
  18869. protocol: "evaluating",
  18870. fn: function (aCollection){
  18871. var self=this,$self=this;
  18872. return $core.withContext(function($ctx1) {
  18873. $self._arguments_(aCollection);
  18874. return $self._value();
  18875. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  18876. },
  18877. args: ["aCollection"],
  18878. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  18879. referencedClasses: [],
  18880. messageSends: ["arguments:", "value"]
  18881. }),
  18882. $globals.MessageSend);
  18883. $core.addClass("MethodContext", $globals.Object, [], "Kernel-Methods");
  18884. $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`.";
  18885. $core.addMethod(
  18886. $core.method({
  18887. selector: "asString",
  18888. protocol: "converting",
  18889. fn: function (){
  18890. var self=this,$self=this;
  18891. return $core.withContext(function($ctx1) {
  18892. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  18893. $2=$self._isBlockContext();
  18894. if($core.assert($2)){
  18895. $3="a block (in ".__comma($recv($self._methodContext())._asString());
  18896. $ctx1.sendIdx[","]=2;
  18897. $1=$recv($3).__comma(")");
  18898. $ctx1.sendIdx[","]=1;
  18899. } else {
  18900. var methodClass;
  18901. methodClass=$recv($self._method())._methodClass();
  18902. $5=methodClass;
  18903. $7=$self._receiver();
  18904. $ctx1.sendIdx["receiver"]=1;
  18905. $6=$recv($7)._class();
  18906. $ctx1.sendIdx["class"]=1;
  18907. $4=$recv($5).__eq($6);
  18908. if($core.assert($4)){
  18909. $11=$self._receiver();
  18910. $ctx1.sendIdx["receiver"]=2;
  18911. $10=$recv($11)._class();
  18912. $ctx1.sendIdx["class"]=2;
  18913. $9=$recv($10)._name();
  18914. $ctx1.sendIdx["name"]=1;
  18915. $8=$recv($9).__comma(" >> ");
  18916. $ctx1.sendIdx[","]=4;
  18917. $12=$self._selector();
  18918. $ctx1.sendIdx["selector"]=1;
  18919. $1=$recv($8).__comma($12);
  18920. $ctx1.sendIdx[","]=3;
  18921. } else {
  18922. $16=$recv($recv($self._receiver())._class())._name();
  18923. $ctx1.sendIdx["name"]=2;
  18924. $15=$recv($16).__comma("(");
  18925. $14=$recv($15).__comma($recv(methodClass)._name());
  18926. $ctx1.sendIdx[","]=7;
  18927. $13=$recv($14).__comma(") >> ");
  18928. $ctx1.sendIdx[","]=6;
  18929. $1=$recv($13).__comma($self._selector());
  18930. $ctx1.sendIdx[","]=5;
  18931. }
  18932. }
  18933. return $1;
  18934. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  18935. },
  18936. args: [],
  18937. 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 ] ]",
  18938. referencedClasses: [],
  18939. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  18940. }),
  18941. $globals.MethodContext);
  18942. $core.addMethod(
  18943. $core.method({
  18944. selector: "basicReceiver",
  18945. protocol: "accessing",
  18946. fn: function (){
  18947. var self=this,$self=this;
  18948. return $core.withContext(function($ctx1) {
  18949. return self.receiver;
  18950. return self;
  18951. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  18952. },
  18953. args: [],
  18954. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  18955. referencedClasses: [],
  18956. messageSends: []
  18957. }),
  18958. $globals.MethodContext);
  18959. $core.addMethod(
  18960. $core.method({
  18961. selector: "evaluatedSelector",
  18962. protocol: "accessing",
  18963. fn: function (){
  18964. var self=this,$self=this;
  18965. return $core.withContext(function($ctx1) {
  18966. return self.evaluatedSelector;
  18967. return self;
  18968. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  18969. },
  18970. args: [],
  18971. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  18972. referencedClasses: [],
  18973. messageSends: []
  18974. }),
  18975. $globals.MethodContext);
  18976. $core.addMethod(
  18977. $core.method({
  18978. selector: "findContextSuchThat:",
  18979. protocol: "accessing",
  18980. fn: function (testBlock){
  18981. var self=this,$self=this;
  18982. var context;
  18983. return $core.withContext(function($ctx1) {
  18984. var $1;
  18985. var $early={};
  18986. try {
  18987. context=self;
  18988. $recv((function(){
  18989. return $core.withContext(function($ctx2) {
  18990. return $recv(context)._isNil();
  18991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  18992. }))._whileFalse_((function(){
  18993. return $core.withContext(function($ctx2) {
  18994. $1=$recv(testBlock)._value_(context);
  18995. if($core.assert($1)){
  18996. throw $early=[context];
  18997. }
  18998. context=$recv(context)._outerContext();
  18999. return context;
  19000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  19001. }));
  19002. return nil;
  19003. }
  19004. catch(e) {if(e===$early)return e[0]; throw e}
  19005. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  19006. },
  19007. args: ["testBlock"],
  19008. 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",
  19009. referencedClasses: [],
  19010. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  19011. }),
  19012. $globals.MethodContext);
  19013. $core.addMethod(
  19014. $core.method({
  19015. selector: "home",
  19016. protocol: "accessing",
  19017. fn: function (){
  19018. var self=this,$self=this;
  19019. return $core.withContext(function($ctx1) {
  19020. return self.homeContext;
  19021. return self;
  19022. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  19023. },
  19024. args: [],
  19025. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  19026. referencedClasses: [],
  19027. messageSends: []
  19028. }),
  19029. $globals.MethodContext);
  19030. $core.addMethod(
  19031. $core.method({
  19032. selector: "index",
  19033. protocol: "accessing",
  19034. fn: function (){
  19035. var self=this,$self=this;
  19036. return $core.withContext(function($ctx1) {
  19037. return self.index || 0;
  19038. return self;
  19039. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  19040. },
  19041. args: [],
  19042. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  19043. referencedClasses: [],
  19044. messageSends: []
  19045. }),
  19046. $globals.MethodContext);
  19047. $core.addMethod(
  19048. $core.method({
  19049. selector: "isBlockContext",
  19050. protocol: "testing",
  19051. fn: function (){
  19052. var self=this,$self=this;
  19053. return $core.withContext(function($ctx1) {
  19054. return $recv($self._selector())._isNil();
  19055. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  19056. },
  19057. args: [],
  19058. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  19059. referencedClasses: [],
  19060. messageSends: ["isNil", "selector"]
  19061. }),
  19062. $globals.MethodContext);
  19063. $core.addMethod(
  19064. $core.method({
  19065. selector: "locals",
  19066. protocol: "accessing",
  19067. fn: function (){
  19068. var self=this,$self=this;
  19069. return $core.withContext(function($ctx1) {
  19070. return self.locals || {};
  19071. return self;
  19072. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  19073. },
  19074. args: [],
  19075. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  19076. referencedClasses: [],
  19077. messageSends: []
  19078. }),
  19079. $globals.MethodContext);
  19080. $core.addMethod(
  19081. $core.method({
  19082. selector: "method",
  19083. protocol: "accessing",
  19084. fn: function (){
  19085. var self=this,$self=this;
  19086. var method,lookupClass,receiverClass,supercall;
  19087. return $core.withContext(function($ctx1) {
  19088. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  19089. $1=$self._methodContext();
  19090. $ctx1.sendIdx["methodContext"]=1;
  19091. if(($receiver = $1) == null || $receiver.a$nil){
  19092. return nil;
  19093. } else {
  19094. $1;
  19095. }
  19096. $3=$self._methodContext();
  19097. $ctx1.sendIdx["methodContext"]=2;
  19098. $2=$recv($3)._receiver();
  19099. receiverClass=$recv($2)._class();
  19100. $4=receiverClass;
  19101. $6=$self._methodContext();
  19102. $ctx1.sendIdx["methodContext"]=3;
  19103. $5=$recv($6)._selector();
  19104. $ctx1.sendIdx["selector"]=1;
  19105. method=$recv($4)._lookupSelector_($5);
  19106. $ctx1.sendIdx["lookupSelector:"]=1;
  19107. $7=$self._outerContext();
  19108. if(($receiver = $7) == null || $receiver.a$nil){
  19109. supercall=false;
  19110. } else {
  19111. var outer;
  19112. outer=$receiver;
  19113. supercall=$recv(outer)._supercall();
  19114. }
  19115. $8=supercall;
  19116. if($core.assert($8)){
  19117. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  19118. } else {
  19119. return method;
  19120. }
  19121. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  19122. },
  19123. args: [],
  19124. 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 ]",
  19125. referencedClasses: [],
  19126. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  19127. }),
  19128. $globals.MethodContext);
  19129. $core.addMethod(
  19130. $core.method({
  19131. selector: "methodContext",
  19132. protocol: "accessing",
  19133. fn: function (){
  19134. var self=this,$self=this;
  19135. return $core.withContext(function($ctx1) {
  19136. var $1,$2,$receiver;
  19137. $1=$self._isBlockContext();
  19138. if(!$core.assert($1)){
  19139. return self;
  19140. }
  19141. $2=$self._outerContext();
  19142. if(($receiver = $2) == null || $receiver.a$nil){
  19143. return $2;
  19144. } else {
  19145. var outer;
  19146. outer=$receiver;
  19147. return $recv(outer)._methodContext();
  19148. }
  19149. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  19150. },
  19151. args: [],
  19152. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  19153. referencedClasses: [],
  19154. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  19155. }),
  19156. $globals.MethodContext);
  19157. $core.addMethod(
  19158. $core.method({
  19159. selector: "outerContext",
  19160. protocol: "accessing",
  19161. fn: function (){
  19162. var self=this,$self=this;
  19163. return $core.withContext(function($ctx1) {
  19164. return self.outerContext || self.homeContext;
  19165. return self;
  19166. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  19167. },
  19168. args: [],
  19169. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  19170. referencedClasses: [],
  19171. messageSends: []
  19172. }),
  19173. $globals.MethodContext);
  19174. $core.addMethod(
  19175. $core.method({
  19176. selector: "printOn:",
  19177. protocol: "printing",
  19178. fn: function (aStream){
  19179. var self=this,$self=this;
  19180. return $core.withContext(function($ctx1) {
  19181. (
  19182. $ctx1.supercall = true,
  19183. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19184. $ctx1.supercall = false;
  19185. $recv(aStream)._nextPutAll_("(");
  19186. $ctx1.sendIdx["nextPutAll:"]=1;
  19187. $recv(aStream)._nextPutAll_($self._asString());
  19188. $ctx1.sendIdx["nextPutAll:"]=2;
  19189. $recv(aStream)._nextPutAll_(")");
  19190. return self;
  19191. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  19192. },
  19193. args: ["aStream"],
  19194. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  19195. referencedClasses: [],
  19196. messageSends: ["printOn:", "nextPutAll:", "asString"]
  19197. }),
  19198. $globals.MethodContext);
  19199. $core.addMethod(
  19200. $core.method({
  19201. selector: "receiver",
  19202. protocol: "accessing",
  19203. fn: function (){
  19204. var self=this,$self=this;
  19205. return $core.withContext(function($ctx1) {
  19206. var $2,$1;
  19207. $1=$recv($self._isBlockContext())._and_((function(){
  19208. return $core.withContext(function($ctx2) {
  19209. $2=$self._outerContext();
  19210. $ctx2.sendIdx["outerContext"]=1;
  19211. return $recv($2)._notNil();
  19212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19213. }));
  19214. if($core.assert($1)){
  19215. return $recv($self._outerContext())._receiver();
  19216. } else {
  19217. return $self._basicReceiver();
  19218. }
  19219. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  19220. },
  19221. args: [],
  19222. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  19223. referencedClasses: [],
  19224. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  19225. }),
  19226. $globals.MethodContext);
  19227. $core.addMethod(
  19228. $core.method({
  19229. selector: "selector",
  19230. protocol: "accessing",
  19231. fn: function (){
  19232. var self=this,$self=this;
  19233. return $core.withContext(function($ctx1) {
  19234. if(self.selector) {
  19235. return $core.js2st(self.selector);
  19236. } else {
  19237. return nil;
  19238. }
  19239. ;
  19240. return self;
  19241. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  19242. },
  19243. args: [],
  19244. 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'>",
  19245. referencedClasses: [],
  19246. messageSends: []
  19247. }),
  19248. $globals.MethodContext);
  19249. $core.addMethod(
  19250. $core.method({
  19251. selector: "sendIndexAt:",
  19252. protocol: "accessing",
  19253. fn: function (aSelector){
  19254. var self=this,$self=this;
  19255. return $core.withContext(function($ctx1) {
  19256. return self.sendIdx[aSelector] || 0;
  19257. return self;
  19258. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  19259. },
  19260. args: ["aSelector"],
  19261. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  19262. referencedClasses: [],
  19263. messageSends: []
  19264. }),
  19265. $globals.MethodContext);
  19266. $core.addMethod(
  19267. $core.method({
  19268. selector: "sendIndexes",
  19269. protocol: "accessing",
  19270. fn: function (){
  19271. var self=this,$self=this;
  19272. return $core.withContext(function($ctx1) {
  19273. return self.sendIdx;
  19274. return self;
  19275. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  19276. },
  19277. args: [],
  19278. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  19279. referencedClasses: [],
  19280. messageSends: []
  19281. }),
  19282. $globals.MethodContext);
  19283. $core.addMethod(
  19284. $core.method({
  19285. selector: "stubHere",
  19286. protocol: "accessing",
  19287. fn: function (){
  19288. var self=this,$self=this;
  19289. return $core.withContext(function($ctx1) {
  19290. self.homeContext = undefined;
  19291. return self;
  19292. }, function($ctx1) {$ctx1.fill(self,"stubHere",{},$globals.MethodContext)});
  19293. },
  19294. args: [],
  19295. source: "stubHere\x0a\x09<inlineJS: 'self.homeContext = undefined'>",
  19296. referencedClasses: [],
  19297. messageSends: []
  19298. }),
  19299. $globals.MethodContext);
  19300. $core.addMethod(
  19301. $core.method({
  19302. selector: "stubToAtMost:",
  19303. protocol: "error handling",
  19304. fn: function (anInteger){
  19305. var self=this,$self=this;
  19306. var context;
  19307. return $core.withContext(function($ctx1) {
  19308. var $1,$2,$receiver;
  19309. context=self;
  19310. $recv(anInteger)._timesRepeat_((function(){
  19311. return $core.withContext(function($ctx2) {
  19312. $1=context;
  19313. if(($receiver = $1) == null || $receiver.a$nil){
  19314. context=$1;
  19315. } else {
  19316. context=$recv(context)._home();
  19317. }
  19318. return context;
  19319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19320. }));
  19321. $2=context;
  19322. if(($receiver = $2) == null || $receiver.a$nil){
  19323. $2;
  19324. } else {
  19325. $recv(context)._stubHere();
  19326. }
  19327. return self;
  19328. }, function($ctx1) {$ctx1.fill(self,"stubToAtMost:",{anInteger:anInteger,context:context},$globals.MethodContext)});
  19329. },
  19330. args: ["anInteger"],
  19331. source: "stubToAtMost: anInteger\x0a\x09| context |\x0a\x09context := self.\x0a\x09anInteger timesRepeat: [ context := context ifNotNil: [ context home ] ].\x0a\x09context ifNotNil: [ context stubHere ]",
  19332. referencedClasses: [],
  19333. messageSends: ["timesRepeat:", "ifNotNil:", "home", "stubHere"]
  19334. }),
  19335. $globals.MethodContext);
  19336. $core.addMethod(
  19337. $core.method({
  19338. selector: "supercall",
  19339. protocol: "accessing",
  19340. fn: function (){
  19341. var self=this,$self=this;
  19342. return $core.withContext(function($ctx1) {
  19343. return self.supercall == true;
  19344. return self;
  19345. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  19346. },
  19347. args: [],
  19348. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  19349. referencedClasses: [],
  19350. messageSends: []
  19351. }),
  19352. $globals.MethodContext);
  19353. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  19354. $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' ]";
  19355. $core.addMethod(
  19356. $core.method({
  19357. selector: "constructorNamed:",
  19358. protocol: "instance creation",
  19359. fn: function (aString){
  19360. var self=this,$self=this;
  19361. return $core.withContext(function($ctx1) {
  19362. var nativeFunc=$globals.Platform._globals()[aString];
  19363. return new nativeFunc();
  19364. ;
  19365. return self;
  19366. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19367. },
  19368. args: ["aString"],
  19369. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19370. referencedClasses: [],
  19371. messageSends: []
  19372. }),
  19373. $globals.NativeFunction.a$cls);
  19374. $core.addMethod(
  19375. $core.method({
  19376. selector: "constructorNamed:value:",
  19377. protocol: "instance creation",
  19378. fn: function (aString,anObject){
  19379. var self=this,$self=this;
  19380. return $core.withContext(function($ctx1) {
  19381. var nativeFunc=$globals.Platform._globals()[aString];
  19382. return new nativeFunc(anObject);
  19383. ;
  19384. return self;
  19385. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19386. },
  19387. args: ["aString", "anObject"],
  19388. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19389. referencedClasses: [],
  19390. messageSends: []
  19391. }),
  19392. $globals.NativeFunction.a$cls);
  19393. $core.addMethod(
  19394. $core.method({
  19395. selector: "constructorNamed:value:value:",
  19396. protocol: "instance creation",
  19397. fn: function (aString,anObject,anObject2){
  19398. var self=this,$self=this;
  19399. return $core.withContext(function($ctx1) {
  19400. var nativeFunc=$globals.Platform._globals[aString];
  19401. return new nativeFunc(anObject,anObject2);
  19402. ;
  19403. return self;
  19404. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19405. },
  19406. args: ["aString", "anObject", "anObject2"],
  19407. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19408. referencedClasses: [],
  19409. messageSends: []
  19410. }),
  19411. $globals.NativeFunction.a$cls);
  19412. $core.addMethod(
  19413. $core.method({
  19414. selector: "constructorNamed:value:value:value:",
  19415. protocol: "instance creation",
  19416. fn: function (aString,anObject,anObject2,anObject3){
  19417. var self=this,$self=this;
  19418. return $core.withContext(function($ctx1) {
  19419. var nativeFunc=$globals.Platform._globals[aString];
  19420. return new nativeFunc(anObject,anObject2, anObject3);
  19421. ;
  19422. return self;
  19423. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19424. },
  19425. args: ["aString", "anObject", "anObject2", "anObject3"],
  19426. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19427. referencedClasses: [],
  19428. messageSends: []
  19429. }),
  19430. $globals.NativeFunction.a$cls);
  19431. $core.addMethod(
  19432. $core.method({
  19433. selector: "constructorOf:",
  19434. protocol: "instance creation",
  19435. fn: function (nativeFunc){
  19436. var self=this,$self=this;
  19437. return $core.withContext(function($ctx1) {
  19438. return new nativeFunc();
  19439. ;
  19440. return self;
  19441. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19442. },
  19443. args: ["nativeFunc"],
  19444. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19445. referencedClasses: [],
  19446. messageSends: []
  19447. }),
  19448. $globals.NativeFunction.a$cls);
  19449. $core.addMethod(
  19450. $core.method({
  19451. selector: "constructorOf:value:",
  19452. protocol: "instance creation",
  19453. fn: function (nativeFunc,anObject){
  19454. var self=this,$self=this;
  19455. return $core.withContext(function($ctx1) {
  19456. return new nativeFunc(anObject);
  19457. ;
  19458. return self;
  19459. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19460. },
  19461. args: ["nativeFunc", "anObject"],
  19462. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19463. referencedClasses: [],
  19464. messageSends: []
  19465. }),
  19466. $globals.NativeFunction.a$cls);
  19467. $core.addMethod(
  19468. $core.method({
  19469. selector: "constructorOf:value:value:",
  19470. protocol: "instance creation",
  19471. fn: function (nativeFunc,anObject,anObject2){
  19472. var self=this,$self=this;
  19473. return $core.withContext(function($ctx1) {
  19474. return new nativeFunc(anObject,anObject2);
  19475. ;
  19476. return self;
  19477. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19478. },
  19479. args: ["nativeFunc", "anObject", "anObject2"],
  19480. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19481. referencedClasses: [],
  19482. messageSends: []
  19483. }),
  19484. $globals.NativeFunction.a$cls);
  19485. $core.addMethod(
  19486. $core.method({
  19487. selector: "constructorOf:value:value:value:",
  19488. protocol: "instance creation",
  19489. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19490. var self=this,$self=this;
  19491. return $core.withContext(function($ctx1) {
  19492. return new nativeFunc(anObject,anObject2, anObject3);
  19493. ;
  19494. return self;
  19495. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19496. },
  19497. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19498. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19499. referencedClasses: [],
  19500. messageSends: []
  19501. }),
  19502. $globals.NativeFunction.a$cls);
  19503. $core.addMethod(
  19504. $core.method({
  19505. selector: "exists:",
  19506. protocol: "testing",
  19507. fn: function (aString){
  19508. var self=this,$self=this;
  19509. return $core.withContext(function($ctx1) {
  19510. return $recv($globals.Platform)._includesGlobal_(aString);
  19511. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.a$cls)});
  19512. },
  19513. args: ["aString"],
  19514. source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
  19515. referencedClasses: ["Platform"],
  19516. messageSends: ["includesGlobal:"]
  19517. }),
  19518. $globals.NativeFunction.a$cls);
  19519. $core.addMethod(
  19520. $core.method({
  19521. selector: "functionNamed:",
  19522. protocol: "function calling",
  19523. fn: function (aString){
  19524. var self=this,$self=this;
  19525. return $core.withContext(function($ctx1) {
  19526. var nativeFunc=$globals.Platform._globals[aString];
  19527. return nativeFunc();
  19528. ;
  19529. return self;
  19530. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19531. },
  19532. args: ["aString"],
  19533. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19534. referencedClasses: [],
  19535. messageSends: []
  19536. }),
  19537. $globals.NativeFunction.a$cls);
  19538. $core.addMethod(
  19539. $core.method({
  19540. selector: "functionNamed:value:",
  19541. protocol: "function calling",
  19542. fn: function (aString,anObject){
  19543. var self=this,$self=this;
  19544. return $core.withContext(function($ctx1) {
  19545. var nativeFunc=$globals.Platform._globals()[aString];
  19546. return nativeFunc(anObject);
  19547. ;
  19548. return self;
  19549. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19550. },
  19551. args: ["aString", "anObject"],
  19552. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19553. referencedClasses: [],
  19554. messageSends: []
  19555. }),
  19556. $globals.NativeFunction.a$cls);
  19557. $core.addMethod(
  19558. $core.method({
  19559. selector: "functionNamed:value:value:",
  19560. protocol: "function calling",
  19561. fn: function (aString,anObject,anObject2){
  19562. var self=this,$self=this;
  19563. return $core.withContext(function($ctx1) {
  19564. var nativeFunc=$globals.Platform._globals()[aString];
  19565. return nativeFunc(anObject,anObject2);
  19566. ;
  19567. return self;
  19568. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19569. },
  19570. args: ["aString", "anObject", "anObject2"],
  19571. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19572. referencedClasses: [],
  19573. messageSends: []
  19574. }),
  19575. $globals.NativeFunction.a$cls);
  19576. $core.addMethod(
  19577. $core.method({
  19578. selector: "functionNamed:value:value:value:",
  19579. protocol: "function calling",
  19580. fn: function (aString,anObject,anObject2,anObject3){
  19581. var self=this,$self=this;
  19582. return $core.withContext(function($ctx1) {
  19583. var nativeFunc=$globals.Platform._globals()[aString];
  19584. return nativeFunc(anObject,anObject2, anObject3);
  19585. ;
  19586. return self;
  19587. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19588. },
  19589. args: ["aString", "anObject", "anObject2", "anObject3"],
  19590. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19591. referencedClasses: [],
  19592. messageSends: []
  19593. }),
  19594. $globals.NativeFunction.a$cls);
  19595. $core.addMethod(
  19596. $core.method({
  19597. selector: "functionNamed:valueWithArgs:",
  19598. protocol: "function calling",
  19599. fn: function (aString,args){
  19600. var self=this,$self=this;
  19601. return $core.withContext(function($ctx1) {
  19602. var nativeFunc=$globals.Platform._globals()[aString];
  19603. return Function.prototype.apply.call(nativeFunc, null, args);
  19604. ;
  19605. return self;
  19606. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.a$cls)});
  19607. },
  19608. args: ["aString", "args"],
  19609. source: "functionNamed: aString valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19610. referencedClasses: [],
  19611. messageSends: []
  19612. }),
  19613. $globals.NativeFunction.a$cls);
  19614. $core.addMethod(
  19615. $core.method({
  19616. selector: "functionOf:",
  19617. protocol: "function calling",
  19618. fn: function (nativeFunc){
  19619. var self=this,$self=this;
  19620. return $core.withContext(function($ctx1) {
  19621. return nativeFunc();
  19622. ;
  19623. return self;
  19624. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19625. },
  19626. args: ["nativeFunc"],
  19627. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19628. referencedClasses: [],
  19629. messageSends: []
  19630. }),
  19631. $globals.NativeFunction.a$cls);
  19632. $core.addMethod(
  19633. $core.method({
  19634. selector: "functionOf:value:",
  19635. protocol: "function calling",
  19636. fn: function (nativeFunc,anObject){
  19637. var self=this,$self=this;
  19638. return $core.withContext(function($ctx1) {
  19639. return nativeFunc(anObject);
  19640. ;
  19641. return self;
  19642. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19643. },
  19644. args: ["nativeFunc", "anObject"],
  19645. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19646. referencedClasses: [],
  19647. messageSends: []
  19648. }),
  19649. $globals.NativeFunction.a$cls);
  19650. $core.addMethod(
  19651. $core.method({
  19652. selector: "functionOf:value:value:",
  19653. protocol: "function calling",
  19654. fn: function (nativeFunc,anObject,anObject2){
  19655. var self=this,$self=this;
  19656. return $core.withContext(function($ctx1) {
  19657. return nativeFunc(anObject,anObject2);
  19658. ;
  19659. return self;
  19660. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19661. },
  19662. args: ["nativeFunc", "anObject", "anObject2"],
  19663. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19664. referencedClasses: [],
  19665. messageSends: []
  19666. }),
  19667. $globals.NativeFunction.a$cls);
  19668. $core.addMethod(
  19669. $core.method({
  19670. selector: "functionOf:value:value:value:",
  19671. protocol: "function calling",
  19672. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19673. var self=this,$self=this;
  19674. return $core.withContext(function($ctx1) {
  19675. return nativeFunc(anObject,anObject2, anObject3);
  19676. ;
  19677. return self;
  19678. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19679. },
  19680. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19681. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19682. referencedClasses: [],
  19683. messageSends: []
  19684. }),
  19685. $globals.NativeFunction.a$cls);
  19686. $core.addMethod(
  19687. $core.method({
  19688. selector: "functionOf:valueWithArgs:",
  19689. protocol: "function calling",
  19690. fn: function (nativeFunc,args){
  19691. var self=this,$self=this;
  19692. return $core.withContext(function($ctx1) {
  19693. return Function.prototype.apply.call(nativeFunc, null, args);
  19694. ;
  19695. return self;
  19696. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.a$cls)});
  19697. },
  19698. args: ["nativeFunc", "args"],
  19699. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19700. referencedClasses: [],
  19701. messageSends: []
  19702. }),
  19703. $globals.NativeFunction.a$cls);
  19704. $core.addMethod(
  19705. $core.method({
  19706. selector: "isNativeFunction:",
  19707. protocol: "testing",
  19708. fn: function (anObject){
  19709. var self=this,$self=this;
  19710. return $core.withContext(function($ctx1) {
  19711. return typeof anObject === "function";
  19712. return self;
  19713. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject},$globals.NativeFunction.a$cls)});
  19714. },
  19715. args: ["anObject"],
  19716. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  19717. referencedClasses: [],
  19718. messageSends: []
  19719. }),
  19720. $globals.NativeFunction.a$cls);
  19721. $core.addMethod(
  19722. $core.method({
  19723. selector: "methodOf:this:",
  19724. protocol: "method calling",
  19725. fn: function (nativeFunc,thisObject){
  19726. var self=this,$self=this;
  19727. return $core.withContext(function($ctx1) {
  19728. return Function.prototype.call.call(nativeFunc, thisObject);
  19729. ;
  19730. return self;
  19731. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.a$cls)});
  19732. },
  19733. args: ["nativeFunc", "thisObject"],
  19734. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  19735. referencedClasses: [],
  19736. messageSends: []
  19737. }),
  19738. $globals.NativeFunction.a$cls);
  19739. $core.addMethod(
  19740. $core.method({
  19741. selector: "methodOf:this:value:",
  19742. protocol: "method calling",
  19743. fn: function (nativeFunc,thisObject,anObject){
  19744. var self=this,$self=this;
  19745. return $core.withContext(function($ctx1) {
  19746. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  19747. ;
  19748. return self;
  19749. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.a$cls)});
  19750. },
  19751. args: ["nativeFunc", "thisObject", "anObject"],
  19752. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  19753. referencedClasses: [],
  19754. messageSends: []
  19755. }),
  19756. $globals.NativeFunction.a$cls);
  19757. $core.addMethod(
  19758. $core.method({
  19759. selector: "methodOf:this:value:value:",
  19760. protocol: "method calling",
  19761. fn: function (nativeFunc,thisObject,anObject,anObject2){
  19762. var self=this,$self=this;
  19763. return $core.withContext(function($ctx1) {
  19764. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  19765. ;
  19766. return self;
  19767. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19768. },
  19769. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  19770. 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'>",
  19771. referencedClasses: [],
  19772. messageSends: []
  19773. }),
  19774. $globals.NativeFunction.a$cls);
  19775. $core.addMethod(
  19776. $core.method({
  19777. selector: "methodOf:this:value:value:value:",
  19778. protocol: "method calling",
  19779. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  19780. var self=this,$self=this;
  19781. return $core.withContext(function($ctx1) {
  19782. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  19783. ;
  19784. return self;
  19785. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19786. },
  19787. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  19788. 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'>",
  19789. referencedClasses: [],
  19790. messageSends: []
  19791. }),
  19792. $globals.NativeFunction.a$cls);
  19793. $core.addMethod(
  19794. $core.method({
  19795. selector: "methodOf:this:valueWithArgs:",
  19796. protocol: "method calling",
  19797. fn: function (nativeFunc,thisObject,args){
  19798. var self=this,$self=this;
  19799. return $core.withContext(function($ctx1) {
  19800. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  19801. ;
  19802. return self;
  19803. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.a$cls)});
  19804. },
  19805. args: ["nativeFunc", "thisObject", "args"],
  19806. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  19807. referencedClasses: [],
  19808. messageSends: []
  19809. }),
  19810. $globals.NativeFunction.a$cls);
  19811. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  19812. $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.";
  19813. $core.addMethod(
  19814. $core.method({
  19815. selector: "clearInterval",
  19816. protocol: "timeout/interval",
  19817. fn: function (){
  19818. var self=this,$self=this;
  19819. return $core.withContext(function($ctx1) {
  19820. var interval = $self["@rawTimeout"];
  19821. clearInterval(interval);
  19822. ;
  19823. return self;
  19824. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  19825. },
  19826. args: [],
  19827. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  19828. referencedClasses: [],
  19829. messageSends: []
  19830. }),
  19831. $globals.Timeout);
  19832. $core.addMethod(
  19833. $core.method({
  19834. selector: "clearTimeout",
  19835. protocol: "timeout/interval",
  19836. fn: function (){
  19837. var self=this,$self=this;
  19838. return $core.withContext(function($ctx1) {
  19839. var timeout = $self["@rawTimeout"];
  19840. clearTimeout(timeout);
  19841. ;
  19842. return self;
  19843. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  19844. },
  19845. args: [],
  19846. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  19847. referencedClasses: [],
  19848. messageSends: []
  19849. }),
  19850. $globals.Timeout);
  19851. $core.addMethod(
  19852. $core.method({
  19853. selector: "rawTimeout:",
  19854. protocol: "accessing",
  19855. fn: function (anObject){
  19856. var self=this,$self=this;
  19857. $self["@rawTimeout"]=anObject;
  19858. return self;
  19859. },
  19860. args: ["anObject"],
  19861. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  19862. referencedClasses: [],
  19863. messageSends: []
  19864. }),
  19865. $globals.Timeout);
  19866. $core.addMethod(
  19867. $core.method({
  19868. selector: "on:",
  19869. protocol: "instance creation",
  19870. fn: function (anObject){
  19871. var self=this,$self=this;
  19872. return $core.withContext(function($ctx1) {
  19873. var $1;
  19874. $1=$self._new();
  19875. $recv($1)._rawTimeout_(anObject);
  19876. return $recv($1)._yourself();
  19877. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.a$cls)});
  19878. },
  19879. args: ["anObject"],
  19880. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  19881. referencedClasses: [],
  19882. messageSends: ["rawTimeout:", "new", "yourself"]
  19883. }),
  19884. $globals.Timeout.a$cls);
  19885. });
  19886. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  19887. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  19888. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  19889. $core.addPackage("Kernel-Dag");
  19890. ($core.packageDescriptors||$core.packages)["Kernel-Dag"].innerEval = function (expr) { return eval(expr); };
  19891. ($core.packageDescriptors||$core.packages)["Kernel-Dag"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19892. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  19893. $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:`.";
  19894. $core.addMethod(
  19895. $core.method({
  19896. selector: "value:",
  19897. protocol: "evaluating",
  19898. fn: function (anObject){
  19899. var self=this,$self=this;
  19900. return $core.withContext(function($ctx1) {
  19901. return $self._visit_(anObject);
  19902. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  19903. },
  19904. args: ["anObject"],
  19905. source: "value: anObject\x0a\x09^ self visit: anObject",
  19906. referencedClasses: [],
  19907. messageSends: ["visit:"]
  19908. }),
  19909. $globals.AbstractDagVisitor);
  19910. $core.addMethod(
  19911. $core.method({
  19912. selector: "visit:",
  19913. protocol: "visiting",
  19914. fn: function (aNode){
  19915. var self=this,$self=this;
  19916. return $core.withContext(function($ctx1) {
  19917. return $recv(aNode)._acceptDagVisitor_(self);
  19918. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  19919. },
  19920. args: ["aNode"],
  19921. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  19922. referencedClasses: [],
  19923. messageSends: ["acceptDagVisitor:"]
  19924. }),
  19925. $globals.AbstractDagVisitor);
  19926. $core.addMethod(
  19927. $core.method({
  19928. selector: "visitAll:",
  19929. protocol: "visiting",
  19930. fn: function (aCollection){
  19931. var self=this,$self=this;
  19932. return $core.withContext(function($ctx1) {
  19933. return $recv(aCollection)._collect_((function(each){
  19934. return $core.withContext(function($ctx2) {
  19935. return $self._visit_(each);
  19936. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19937. }));
  19938. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  19939. },
  19940. args: ["aCollection"],
  19941. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  19942. referencedClasses: [],
  19943. messageSends: ["collect:", "visit:"]
  19944. }),
  19945. $globals.AbstractDagVisitor);
  19946. $core.addMethod(
  19947. $core.method({
  19948. selector: "visitAllChildren:",
  19949. protocol: "visiting",
  19950. fn: function (aDagNode){
  19951. var self=this,$self=this;
  19952. return $core.withContext(function($ctx1) {
  19953. return $self._visitAll_($recv(aDagNode)._dagChildren());
  19954. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  19955. },
  19956. args: ["aDagNode"],
  19957. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  19958. referencedClasses: [],
  19959. messageSends: ["visitAll:", "dagChildren"]
  19960. }),
  19961. $globals.AbstractDagVisitor);
  19962. $core.addMethod(
  19963. $core.method({
  19964. selector: "visitDagNode:",
  19965. protocol: "visiting",
  19966. fn: function (aNode){
  19967. var self=this,$self=this;
  19968. return $core.withContext(function($ctx1) {
  19969. $self._subclassResponsibility();
  19970. return self;
  19971. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  19972. },
  19973. args: ["aNode"],
  19974. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  19975. referencedClasses: [],
  19976. messageSends: ["subclassResponsibility"]
  19977. }),
  19978. $globals.AbstractDagVisitor);
  19979. $core.addMethod(
  19980. $core.method({
  19981. selector: "visitDagNodeVariantRedux:",
  19982. protocol: "visiting",
  19983. fn: function (aNode){
  19984. var self=this,$self=this;
  19985. var newChildren,oldChildren;
  19986. return $core.withContext(function($ctx1) {
  19987. var $2,$3,$1,$4,$5;
  19988. var $early={};
  19989. try {
  19990. oldChildren=$recv(aNode)._dagChildren();
  19991. newChildren=$self._visitAllChildren_(aNode);
  19992. $2=$recv(oldChildren)._size();
  19993. $ctx1.sendIdx["size"]=1;
  19994. $3=$recv(newChildren)._size();
  19995. $ctx1.sendIdx["size"]=2;
  19996. $1=$recv($2).__eq($3);
  19997. if($core.assert($1)){
  19998. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  19999. return $core.withContext(function($ctx2) {
  20000. $4=$recv(oldChildren)._at_(i);
  20001. $ctx2.sendIdx["at:"]=1;
  20002. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  20003. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  20004. }),(function(){
  20005. throw $early=[aNode];
  20006. }));
  20007. }
  20008. $5=$recv(aNode)._copy();
  20009. $recv($5)._dagChildren_(newChildren);
  20010. return $recv($5)._yourself();
  20011. }
  20012. catch(e) {if(e===$early)return e[0]; throw e}
  20013. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  20014. },
  20015. args: ["aNode"],
  20016. 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",
  20017. referencedClasses: [],
  20018. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  20019. }),
  20020. $globals.AbstractDagVisitor);
  20021. $core.addMethod(
  20022. $core.method({
  20023. selector: "visitDagNodeVariantSimple:",
  20024. protocol: "visiting",
  20025. fn: function (aNode){
  20026. var self=this,$self=this;
  20027. return $core.withContext(function($ctx1) {
  20028. $self._visitAllChildren_(aNode);
  20029. return aNode;
  20030. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20031. },
  20032. args: ["aNode"],
  20033. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  20034. referencedClasses: [],
  20035. messageSends: ["visitAllChildren:"]
  20036. }),
  20037. $globals.AbstractDagVisitor);
  20038. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  20039. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  20040. $core.addMethod(
  20041. $core.method({
  20042. selector: "initialize",
  20043. protocol: "initialization",
  20044. fn: function (){
  20045. var self=this,$self=this;
  20046. return $core.withContext(function($ctx1) {
  20047. (
  20048. $ctx1.supercall = true,
  20049. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  20050. $ctx1.supercall = false;
  20051. $self["@path"]=[];
  20052. return self;
  20053. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  20054. },
  20055. args: [],
  20056. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  20057. referencedClasses: [],
  20058. messageSends: ["initialize"]
  20059. }),
  20060. $globals.PathDagVisitor);
  20061. $core.addMethod(
  20062. $core.method({
  20063. selector: "path",
  20064. protocol: "accessing",
  20065. fn: function (){
  20066. var self=this,$self=this;
  20067. return $self["@path"];
  20068. },
  20069. args: [],
  20070. source: "path\x0a\x09^ path",
  20071. referencedClasses: [],
  20072. messageSends: []
  20073. }),
  20074. $globals.PathDagVisitor);
  20075. $core.addMethod(
  20076. $core.method({
  20077. selector: "visit:",
  20078. protocol: "visiting",
  20079. fn: function (aNode){
  20080. var self=this,$self=this;
  20081. var oldPath,result;
  20082. return $core.withContext(function($ctx1) {
  20083. result=aNode;
  20084. oldPath=$self["@path"];
  20085. $recv((function(){
  20086. return $core.withContext(function($ctx2) {
  20087. $self["@path"]=$recv($self["@path"]).__comma([aNode]);
  20088. result=(
  20089. $ctx2.supercall = true,
  20090. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  20091. $ctx2.supercall = false;
  20092. return result;
  20093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20094. }))._ensure_((function(){
  20095. $self["@path"]=oldPath;
  20096. return $self["@path"];
  20097. }));
  20098. return result;
  20099. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  20100. },
  20101. args: ["aNode"],
  20102. 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",
  20103. referencedClasses: [],
  20104. messageSends: ["ensure:", ",", "visit:"]
  20105. }),
  20106. $globals.PathDagVisitor);
  20107. $core.addMethod(
  20108. $core.method({
  20109. selector: "visitDagNodeVariantRedux:",
  20110. protocol: "visiting",
  20111. fn: function (aNode){
  20112. var self=this,$self=this;
  20113. var newNode;
  20114. return $core.withContext(function($ctx1) {
  20115. var $1;
  20116. newNode=(
  20117. $ctx1.supercall = true,
  20118. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($self, [aNode]));
  20119. $ctx1.supercall = false;
  20120. $1=$recv(aNode).__eq_eq(newNode);
  20121. if(!$core.assert($1)){
  20122. $recv($self["@path"])._at_put_($recv($self["@path"])._size(),newNode);
  20123. }
  20124. return newNode;
  20125. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  20126. },
  20127. args: ["aNode"],
  20128. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  20129. referencedClasses: [],
  20130. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  20131. }),
  20132. $globals.PathDagVisitor);
  20133. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  20134. $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).";
  20135. $core.addMethod(
  20136. $core.method({
  20137. selector: "acceptDagVisitor:",
  20138. protocol: "visiting",
  20139. fn: function (aVisitor){
  20140. var self=this,$self=this;
  20141. return $core.withContext(function($ctx1) {
  20142. return $recv(aVisitor)._visitDagNode_(self);
  20143. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  20144. },
  20145. args: ["aVisitor"],
  20146. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  20147. referencedClasses: [],
  20148. messageSends: ["visitDagNode:"]
  20149. }),
  20150. $globals.DagNode);
  20151. $core.addMethod(
  20152. $core.method({
  20153. selector: "allDagChildren",
  20154. protocol: "accessing",
  20155. fn: function (){
  20156. var self=this,$self=this;
  20157. var allNodes;
  20158. return $core.withContext(function($ctx1) {
  20159. var $1;
  20160. $1=$self._dagChildren();
  20161. $ctx1.sendIdx["dagChildren"]=1;
  20162. allNodes=$recv($1)._asSet();
  20163. $recv($self._dagChildren())._do_((function(each){
  20164. return $core.withContext(function($ctx2) {
  20165. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  20166. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20167. }));
  20168. return allNodes;
  20169. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  20170. },
  20171. args: [],
  20172. 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",
  20173. referencedClasses: [],
  20174. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  20175. }),
  20176. $globals.DagNode);
  20177. $core.addMethod(
  20178. $core.method({
  20179. selector: "dagChildren",
  20180. protocol: "accessing",
  20181. fn: function (){
  20182. var self=this,$self=this;
  20183. return $core.withContext(function($ctx1) {
  20184. $self._subclassResponsibility();
  20185. return self;
  20186. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  20187. },
  20188. args: [],
  20189. source: "dagChildren\x0a\x09self subclassResponsibility",
  20190. referencedClasses: [],
  20191. messageSends: ["subclassResponsibility"]
  20192. }),
  20193. $globals.DagNode);
  20194. $core.addMethod(
  20195. $core.method({
  20196. selector: "dagChildren:",
  20197. protocol: "accessing",
  20198. fn: function (aCollection){
  20199. var self=this,$self=this;
  20200. return $core.withContext(function($ctx1) {
  20201. $self._subclassResponsibility();
  20202. return self;
  20203. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  20204. },
  20205. args: ["aCollection"],
  20206. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  20207. referencedClasses: [],
  20208. messageSends: ["subclassResponsibility"]
  20209. }),
  20210. $globals.DagNode);
  20211. $core.addMethod(
  20212. $core.method({
  20213. selector: "isDagNode",
  20214. protocol: "testing",
  20215. fn: function (){
  20216. var self=this,$self=this;
  20217. return true;
  20218. },
  20219. args: [],
  20220. source: "isDagNode\x0a\x09^ true",
  20221. referencedClasses: [],
  20222. messageSends: []
  20223. }),
  20224. $globals.DagNode);
  20225. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20226. $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.";
  20227. $core.addMethod(
  20228. $core.method({
  20229. selector: "addDagChild:",
  20230. protocol: "accessing",
  20231. fn: function (aDagNode){
  20232. var self=this,$self=this;
  20233. return $core.withContext(function($ctx1) {
  20234. $recv($self._dagChildren())._add_(aDagNode);
  20235. return self;
  20236. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  20237. },
  20238. args: ["aDagNode"],
  20239. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  20240. referencedClasses: [],
  20241. messageSends: ["add:", "dagChildren"]
  20242. }),
  20243. $globals.DagParentNode);
  20244. $core.addMethod(
  20245. $core.method({
  20246. selector: "dagChildren",
  20247. protocol: "accessing",
  20248. fn: function (){
  20249. var self=this,$self=this;
  20250. return $core.withContext(function($ctx1) {
  20251. var $1,$receiver;
  20252. $1=$self["@nodes"];
  20253. if(($receiver = $1) == null || $receiver.a$nil){
  20254. $self["@nodes"]=$recv($globals.Array)._new();
  20255. return $self["@nodes"];
  20256. } else {
  20257. return $1;
  20258. }
  20259. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  20260. },
  20261. args: [],
  20262. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  20263. referencedClasses: ["Array"],
  20264. messageSends: ["ifNil:", "new"]
  20265. }),
  20266. $globals.DagParentNode);
  20267. $core.addMethod(
  20268. $core.method({
  20269. selector: "dagChildren:",
  20270. protocol: "accessing",
  20271. fn: function (aCollection){
  20272. var self=this,$self=this;
  20273. $self["@nodes"]=aCollection;
  20274. return self;
  20275. },
  20276. args: ["aCollection"],
  20277. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  20278. referencedClasses: [],
  20279. messageSends: []
  20280. }),
  20281. $globals.DagParentNode);
  20282. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20283. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  20284. $core.addMethod(
  20285. $core.method({
  20286. selector: "dagChildren",
  20287. protocol: "accessing",
  20288. fn: function (){
  20289. var self=this,$self=this;
  20290. return [];
  20291. },
  20292. args: [],
  20293. source: "dagChildren\x0a\x09^ #()",
  20294. referencedClasses: [],
  20295. messageSends: []
  20296. }),
  20297. $globals.DagSink);
  20298. $core.addMethod(
  20299. $core.method({
  20300. selector: "dagChildren:",
  20301. protocol: "accessing",
  20302. fn: function (aCollection){
  20303. var self=this,$self=this;
  20304. return $core.withContext(function($ctx1) {
  20305. $recv(aCollection)._ifNotEmpty_((function(){
  20306. return $core.withContext(function($ctx2) {
  20307. return $self._error_("A DagSink cannot have children.");
  20308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20309. }));
  20310. return self;
  20311. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  20312. },
  20313. args: ["aCollection"],
  20314. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  20315. referencedClasses: [],
  20316. messageSends: ["ifNotEmpty:", "error:"]
  20317. }),
  20318. $globals.DagSink);
  20319. $core.addMethod(
  20320. $core.method({
  20321. selector: "isDagNode",
  20322. protocol: "*Kernel-Dag",
  20323. fn: function (){
  20324. var self=this,$self=this;
  20325. return false;
  20326. },
  20327. args: [],
  20328. source: "isDagNode\x0a\x09^ false",
  20329. referencedClasses: [],
  20330. messageSends: []
  20331. }),
  20332. $globals.Object);
  20333. });
  20334. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20335. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20336. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20337. $core.addPackage("Kernel-Exceptions");
  20338. ($core.packageDescriptors||$core.packages)["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  20339. ($core.packageDescriptors||$core.packages)["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20340. $core.addClass("Error", $globals.Object, ["messageText"], "Kernel-Exceptions");
  20341. $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.";
  20342. $core.addMethod(
  20343. $core.method({
  20344. selector: "beHandled",
  20345. protocol: "accessing",
  20346. fn: function (){
  20347. var self=this,$self=this;
  20348. return $core.withContext(function($ctx1) {
  20349. self.amberHandled = true;
  20350. return self;
  20351. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  20352. },
  20353. args: [],
  20354. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  20355. referencedClasses: [],
  20356. messageSends: []
  20357. }),
  20358. $globals.Error);
  20359. $core.addMethod(
  20360. $core.method({
  20361. selector: "beUnhandled",
  20362. protocol: "accessing",
  20363. fn: function (){
  20364. var self=this,$self=this;
  20365. return $core.withContext(function($ctx1) {
  20366. self.amberHandled = false;
  20367. return self;
  20368. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  20369. },
  20370. args: [],
  20371. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  20372. referencedClasses: [],
  20373. messageSends: []
  20374. }),
  20375. $globals.Error);
  20376. $core.addMethod(
  20377. $core.method({
  20378. selector: "context",
  20379. protocol: "accessing",
  20380. fn: function (){
  20381. var self=this,$self=this;
  20382. return $core.withContext(function($ctx1) {
  20383. return self.context;
  20384. return self;
  20385. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  20386. },
  20387. args: [],
  20388. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  20389. referencedClasses: [],
  20390. messageSends: []
  20391. }),
  20392. $globals.Error);
  20393. $core.addMethod(
  20394. $core.method({
  20395. selector: "initialize",
  20396. protocol: "initialization",
  20397. fn: function (){
  20398. var self=this,$self=this;
  20399. return $core.withContext(function($ctx1) {
  20400. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  20401. return self;
  20402. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20403. },
  20404. args: [],
  20405. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20406. referencedClasses: [],
  20407. messageSends: ["messageText:", ",", "name", "class"]
  20408. }),
  20409. $globals.Error);
  20410. $core.addMethod(
  20411. $core.method({
  20412. selector: "isSmalltalkError",
  20413. protocol: "testing",
  20414. fn: function (){
  20415. var self=this,$self=this;
  20416. return $core.withContext(function($ctx1) {
  20417. return self.smalltalkError === true;
  20418. return self;
  20419. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20420. },
  20421. args: [],
  20422. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  20423. referencedClasses: [],
  20424. messageSends: []
  20425. }),
  20426. $globals.Error);
  20427. $core.addMethod(
  20428. $core.method({
  20429. selector: "jsStack",
  20430. protocol: "accessing",
  20431. fn: function (){
  20432. var self=this,$self=this;
  20433. return $core.withContext(function($ctx1) {
  20434. return self.stack;
  20435. return self;
  20436. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  20437. },
  20438. args: [],
  20439. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  20440. referencedClasses: [],
  20441. messageSends: []
  20442. }),
  20443. $globals.Error);
  20444. $core.addMethod(
  20445. $core.method({
  20446. selector: "messageText",
  20447. protocol: "accessing",
  20448. fn: function (){
  20449. var self=this,$self=this;
  20450. return $self["@messageText"];
  20451. },
  20452. args: [],
  20453. source: "messageText\x0a\x09^ messageText",
  20454. referencedClasses: [],
  20455. messageSends: []
  20456. }),
  20457. $globals.Error);
  20458. $core.addMethod(
  20459. $core.method({
  20460. selector: "messageText:",
  20461. protocol: "accessing",
  20462. fn: function (aString){
  20463. var self=this,$self=this;
  20464. $self["@messageText"]=aString;
  20465. return self;
  20466. },
  20467. args: ["aString"],
  20468. source: "messageText: aString\x0a\x09messageText := aString",
  20469. referencedClasses: [],
  20470. messageSends: []
  20471. }),
  20472. $globals.Error);
  20473. $core.addMethod(
  20474. $core.method({
  20475. selector: "outer",
  20476. protocol: "signaling",
  20477. fn: function (){
  20478. var self=this,$self=this;
  20479. return $core.withContext(function($ctx1) {
  20480. return $self._pass();
  20481. }, function($ctx1) {$ctx1.fill(self,"outer",{},$globals.Error)});
  20482. },
  20483. args: [],
  20484. source: "outer\x0a\x09\x22Pharo compatibility. Just sends #pass.\x22\x0a\x09\x0a\x09^ self pass",
  20485. referencedClasses: [],
  20486. messageSends: ["pass"]
  20487. }),
  20488. $globals.Error);
  20489. $core.addMethod(
  20490. $core.method({
  20491. selector: "pass",
  20492. protocol: "signaling",
  20493. fn: function (){
  20494. var self=this,$self=this;
  20495. return $core.withContext(function($ctx1) {
  20496. self.amberHandled = false;
  20497. throw self;
  20498. ;
  20499. return self;
  20500. }, function($ctx1) {$ctx1.fill(self,"pass",{},$globals.Error)});
  20501. },
  20502. args: [],
  20503. source: "pass\x0a\x09\x22Let outer handler take care of this.\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw self;\x0a\x09'>",
  20504. referencedClasses: [],
  20505. messageSends: []
  20506. }),
  20507. $globals.Error);
  20508. $core.addMethod(
  20509. $core.method({
  20510. selector: "resignal",
  20511. protocol: "signaling",
  20512. fn: function (){
  20513. var self=this,$self=this;
  20514. return $core.withContext(function($ctx1) {
  20515. $self._deprecatedAPI_("Use #pass.");
  20516. return $self._pass();
  20517. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20518. },
  20519. args: [],
  20520. source: "resignal\x0a\x09self deprecatedAPI: 'Use #pass.'.\x0a\x09^ self pass",
  20521. referencedClasses: [],
  20522. messageSends: ["deprecatedAPI:", "pass"]
  20523. }),
  20524. $globals.Error);
  20525. $core.addMethod(
  20526. $core.method({
  20527. selector: "signal",
  20528. protocol: "signaling",
  20529. fn: function (){
  20530. var self=this,$self=this;
  20531. return $core.withContext(function($ctx1) {
  20532. self.amberHandled = false;
  20533. self.context = $core.getThisContext();
  20534. self.smalltalkError = true;
  20535. throw self;
  20536. ;
  20537. return self;
  20538. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20539. },
  20540. args: [],
  20541. 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'>",
  20542. referencedClasses: [],
  20543. messageSends: []
  20544. }),
  20545. $globals.Error);
  20546. $core.addMethod(
  20547. $core.method({
  20548. selector: "signal:",
  20549. protocol: "signaling",
  20550. fn: function (aString){
  20551. var self=this,$self=this;
  20552. return $core.withContext(function($ctx1) {
  20553. $self._messageText_(aString);
  20554. $self._signal();
  20555. return self;
  20556. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20557. },
  20558. args: ["aString"],
  20559. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  20560. referencedClasses: [],
  20561. messageSends: ["messageText:", "signal"]
  20562. }),
  20563. $globals.Error);
  20564. $core.addMethod(
  20565. $core.method({
  20566. selector: "signalerContext",
  20567. protocol: "accessing",
  20568. fn: function (){
  20569. var self=this,$self=this;
  20570. return $core.withContext(function($ctx1) {
  20571. return $self._signalerContextFrom_($self._context());
  20572. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20573. },
  20574. args: [],
  20575. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20576. referencedClasses: [],
  20577. messageSends: ["signalerContextFrom:", "context"]
  20578. }),
  20579. $globals.Error);
  20580. $core.addMethod(
  20581. $core.method({
  20582. selector: "signalerContextFrom:",
  20583. protocol: "accessing",
  20584. fn: function (aContext){
  20585. var self=this,$self=this;
  20586. return $core.withContext(function($ctx1) {
  20587. var $3,$2,$1;
  20588. return $recv(aContext)._findContextSuchThat_((function(context){
  20589. return $core.withContext(function($ctx2) {
  20590. $3=$recv(context)._receiver();
  20591. $ctx2.sendIdx["receiver"]=1;
  20592. $2=$recv($3).__eq_eq(self);
  20593. $ctx2.sendIdx["=="]=1;
  20594. $1=$recv($2)._or_((function(){
  20595. return $core.withContext(function($ctx3) {
  20596. return $recv($recv(context)._receiver()).__eq_eq($self._class());
  20597. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20598. }));
  20599. return $recv($1)._not();
  20600. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20601. }));
  20602. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20603. },
  20604. args: ["aContext"],
  20605. 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 ]",
  20606. referencedClasses: [],
  20607. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20608. }),
  20609. $globals.Error);
  20610. $core.addMethod(
  20611. $core.method({
  20612. selector: "wasHandled",
  20613. protocol: "testing",
  20614. fn: function (){
  20615. var self=this,$self=this;
  20616. return $core.withContext(function($ctx1) {
  20617. return self.amberHandled || false;
  20618. return self;
  20619. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20620. },
  20621. args: [],
  20622. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  20623. referencedClasses: [],
  20624. messageSends: []
  20625. }),
  20626. $globals.Error);
  20627. $core.addMethod(
  20628. $core.method({
  20629. selector: "classTag",
  20630. protocol: "accessing",
  20631. fn: function (){
  20632. var self=this,$self=this;
  20633. return "exception";
  20634. },
  20635. args: [],
  20636. 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'",
  20637. referencedClasses: [],
  20638. messageSends: []
  20639. }),
  20640. $globals.Error.a$cls);
  20641. $core.addMethod(
  20642. $core.method({
  20643. selector: "signal",
  20644. protocol: "instance creation",
  20645. fn: function (){
  20646. var self=this,$self=this;
  20647. return $core.withContext(function($ctx1) {
  20648. return $recv($self._new())._signal();
  20649. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.a$cls)});
  20650. },
  20651. args: [],
  20652. source: "signal\x0a\x09^ self new signal",
  20653. referencedClasses: [],
  20654. messageSends: ["signal", "new"]
  20655. }),
  20656. $globals.Error.a$cls);
  20657. $core.addMethod(
  20658. $core.method({
  20659. selector: "signal:",
  20660. protocol: "instance creation",
  20661. fn: function (aString){
  20662. var self=this,$self=this;
  20663. return $core.withContext(function($ctx1) {
  20664. return $recv($self._new())._signal_(aString);
  20665. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.a$cls)});
  20666. },
  20667. args: ["aString"],
  20668. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20669. referencedClasses: [],
  20670. messageSends: ["signal:", "new"]
  20671. }),
  20672. $globals.Error.a$cls);
  20673. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  20674. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20675. $core.addMethod(
  20676. $core.method({
  20677. selector: "messageText",
  20678. protocol: "accessing",
  20679. fn: function (){
  20680. var self=this,$self=this;
  20681. return "Halt encountered";
  20682. },
  20683. args: [],
  20684. source: "messageText\x0a\x09^ 'Halt encountered'",
  20685. referencedClasses: [],
  20686. messageSends: []
  20687. }),
  20688. $globals.Halt);
  20689. $core.addMethod(
  20690. $core.method({
  20691. selector: "signalerContextFrom:",
  20692. protocol: "accessing",
  20693. fn: function (aContext){
  20694. var self=this,$self=this;
  20695. return $core.withContext(function($ctx1) {
  20696. var $3,$2,$1;
  20697. return $recv(aContext)._findContextSuchThat_((function(context){
  20698. return $core.withContext(function($ctx2) {
  20699. $3=$recv(context)._receiver();
  20700. $ctx2.sendIdx["receiver"]=1;
  20701. $2=$recv($3).__eq_eq(self);
  20702. $ctx2.sendIdx["=="]=1;
  20703. $1=$recv($2)._or_((function(){
  20704. return $core.withContext(function($ctx3) {
  20705. return $recv($recv($recv(context)._receiver()).__eq_eq($self._class()))._or_((function(){
  20706. return $core.withContext(function($ctx4) {
  20707. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  20708. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20709. }));
  20710. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20711. }));
  20712. $ctx2.sendIdx["or:"]=1;
  20713. return $recv($1)._not();
  20714. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20715. }));
  20716. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20717. },
  20718. args: ["aContext"],
  20719. 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 ]",
  20720. referencedClasses: [],
  20721. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20722. }),
  20723. $globals.Halt);
  20724. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  20725. $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:`";
  20726. $core.addMethod(
  20727. $core.method({
  20728. selector: "context:",
  20729. protocol: "accessing",
  20730. fn: function (aMethodContext){
  20731. var self=this,$self=this;
  20732. return $core.withContext(function($ctx1) {
  20733. self.context = aMethodContext;
  20734. return self;
  20735. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  20736. },
  20737. args: ["aMethodContext"],
  20738. 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'>",
  20739. referencedClasses: [],
  20740. messageSends: []
  20741. }),
  20742. $globals.JavaScriptException);
  20743. $core.addMethod(
  20744. $core.method({
  20745. selector: "exception",
  20746. protocol: "accessing",
  20747. fn: function (){
  20748. var self=this,$self=this;
  20749. return $self["@exception"];
  20750. },
  20751. args: [],
  20752. source: "exception\x0a\x09^ exception",
  20753. referencedClasses: [],
  20754. messageSends: []
  20755. }),
  20756. $globals.JavaScriptException);
  20757. $core.addMethod(
  20758. $core.method({
  20759. selector: "exception:",
  20760. protocol: "accessing",
  20761. fn: function (anException){
  20762. var self=this,$self=this;
  20763. $self["@exception"]=anException;
  20764. return self;
  20765. },
  20766. args: ["anException"],
  20767. source: "exception: anException\x0a\x09exception := anException",
  20768. referencedClasses: [],
  20769. messageSends: []
  20770. }),
  20771. $globals.JavaScriptException);
  20772. $core.addMethod(
  20773. $core.method({
  20774. selector: "messageText",
  20775. protocol: "accessing",
  20776. fn: function (){
  20777. var self=this,$self=this;
  20778. return $core.withContext(function($ctx1) {
  20779. return "JavaScript exception: " + $self["@exception"].toString();
  20780. return self;
  20781. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20782. },
  20783. args: [],
  20784. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self[\x22@exception\x22].toString()'>",
  20785. referencedClasses: [],
  20786. messageSends: []
  20787. }),
  20788. $globals.JavaScriptException);
  20789. $core.addMethod(
  20790. $core.method({
  20791. selector: "shouldBeStubbed",
  20792. protocol: "testing",
  20793. fn: function (){
  20794. var self=this,$self=this;
  20795. return $core.withContext(function($ctx1) {
  20796. return $self["@exception"] instanceof RangeError;
  20797. return self;
  20798. }, function($ctx1) {$ctx1.fill(self,"shouldBeStubbed",{},$globals.JavaScriptException)});
  20799. },
  20800. args: [],
  20801. source: "shouldBeStubbed\x0a\x09<inlineJS: 'return $self[\x22@exception\x22] instanceof RangeError'>",
  20802. referencedClasses: [],
  20803. messageSends: []
  20804. }),
  20805. $globals.JavaScriptException);
  20806. $core.addMethod(
  20807. $core.method({
  20808. selector: "wrap",
  20809. protocol: "error handling",
  20810. fn: function (){
  20811. var self=this,$self=this;
  20812. return $core.withContext(function($ctx1) {
  20813. var $1;
  20814. $recv((function(){
  20815. return $core.withContext(function($ctx2) {
  20816. return $self._signal();
  20817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20818. }))._tryCatch_((function(){
  20819. return $core.withContext(function($ctx2) {
  20820. $1=$self._shouldBeStubbed();
  20821. if($core.assert($1)){
  20822. return $recv($self._context())._stubToAtMost_((100));
  20823. }
  20824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  20825. }));
  20826. return self;
  20827. }, function($ctx1) {$ctx1.fill(self,"wrap",{},$globals.JavaScriptException)});
  20828. },
  20829. args: [],
  20830. source: "wrap\x0a\x09[ self signal ] tryCatch:\x0a\x09\x09[ self shouldBeStubbed ifTrue: [ self context stubToAtMost: 100 ] ]",
  20831. referencedClasses: [],
  20832. messageSends: ["tryCatch:", "signal", "ifTrue:", "shouldBeStubbed", "stubToAtMost:", "context"]
  20833. }),
  20834. $globals.JavaScriptException);
  20835. $core.addMethod(
  20836. $core.method({
  20837. selector: "on:",
  20838. protocol: "instance creation",
  20839. fn: function (anException){
  20840. var self=this,$self=this;
  20841. return $core.withContext(function($ctx1) {
  20842. var $1;
  20843. $1=$self._new();
  20844. $recv($1)._exception_(anException);
  20845. return $recv($1)._yourself();
  20846. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.a$cls)});
  20847. },
  20848. args: ["anException"],
  20849. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  20850. referencedClasses: [],
  20851. messageSends: ["exception:", "new", "yourself"]
  20852. }),
  20853. $globals.JavaScriptException.a$cls);
  20854. $core.addMethod(
  20855. $core.method({
  20856. selector: "on:context:",
  20857. protocol: "instance creation",
  20858. fn: function (anException,aMethodContext){
  20859. var self=this,$self=this;
  20860. return $core.withContext(function($ctx1) {
  20861. var $1;
  20862. $1=$self._new();
  20863. $recv($1)._exception_(anException);
  20864. $recv($1)._context_(aMethodContext);
  20865. return $recv($1)._yourself();
  20866. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.a$cls)});
  20867. },
  20868. args: ["anException", "aMethodContext"],
  20869. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  20870. referencedClasses: [],
  20871. messageSends: ["exception:", "new", "context:", "yourself"]
  20872. }),
  20873. $globals.JavaScriptException.a$cls);
  20874. $core.addClass("MessageNotUnderstood", $globals.Error, ["message", "receiver"], "Kernel-Exceptions");
  20875. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  20876. $core.addMethod(
  20877. $core.method({
  20878. selector: "message",
  20879. protocol: "accessing",
  20880. fn: function (){
  20881. var self=this,$self=this;
  20882. return $self["@message"];
  20883. },
  20884. args: [],
  20885. source: "message\x0a\x09^ message",
  20886. referencedClasses: [],
  20887. messageSends: []
  20888. }),
  20889. $globals.MessageNotUnderstood);
  20890. $core.addMethod(
  20891. $core.method({
  20892. selector: "message:",
  20893. protocol: "accessing",
  20894. fn: function (aMessage){
  20895. var self=this,$self=this;
  20896. $self["@message"]=aMessage;
  20897. return self;
  20898. },
  20899. args: ["aMessage"],
  20900. source: "message: aMessage\x0a\x09message := aMessage",
  20901. referencedClasses: [],
  20902. messageSends: []
  20903. }),
  20904. $globals.MessageNotUnderstood);
  20905. $core.addMethod(
  20906. $core.method({
  20907. selector: "messageText",
  20908. protocol: "accessing",
  20909. fn: function (){
  20910. var self=this,$self=this;
  20911. return $core.withContext(function($ctx1) {
  20912. var $1;
  20913. $1=$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector());
  20914. $ctx1.sendIdx[","]=1;
  20915. return $1;
  20916. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  20917. },
  20918. args: [],
  20919. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  20920. referencedClasses: [],
  20921. messageSends: [",", "asString", "receiver", "selector", "message"]
  20922. }),
  20923. $globals.MessageNotUnderstood);
  20924. $core.addMethod(
  20925. $core.method({
  20926. selector: "receiver",
  20927. protocol: "accessing",
  20928. fn: function (){
  20929. var self=this,$self=this;
  20930. return $self["@receiver"];
  20931. },
  20932. args: [],
  20933. source: "receiver\x0a\x09^ receiver",
  20934. referencedClasses: [],
  20935. messageSends: []
  20936. }),
  20937. $globals.MessageNotUnderstood);
  20938. $core.addMethod(
  20939. $core.method({
  20940. selector: "receiver:",
  20941. protocol: "accessing",
  20942. fn: function (anObject){
  20943. var self=this,$self=this;
  20944. $self["@receiver"]=anObject;
  20945. return self;
  20946. },
  20947. args: ["anObject"],
  20948. source: "receiver: anObject\x0a\x09receiver := anObject",
  20949. referencedClasses: [],
  20950. messageSends: []
  20951. }),
  20952. $globals.MessageNotUnderstood);
  20953. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  20954. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  20955. $core.addMethod(
  20956. $core.method({
  20957. selector: "object",
  20958. protocol: "accessing",
  20959. fn: function (){
  20960. var self=this,$self=this;
  20961. return $self["@object"];
  20962. },
  20963. args: [],
  20964. source: "object\x0a\x09^ object",
  20965. referencedClasses: [],
  20966. messageSends: []
  20967. }),
  20968. $globals.NonBooleanReceiver);
  20969. $core.addMethod(
  20970. $core.method({
  20971. selector: "object:",
  20972. protocol: "accessing",
  20973. fn: function (anObject){
  20974. var self=this,$self=this;
  20975. $self["@object"]=anObject;
  20976. return self;
  20977. },
  20978. args: ["anObject"],
  20979. source: "object: anObject\x0a\x09object := anObject",
  20980. referencedClasses: [],
  20981. messageSends: []
  20982. }),
  20983. $globals.NonBooleanReceiver);
  20984. $core.addMethod(
  20985. $core.method({
  20986. selector: "signalOn:",
  20987. protocol: "instance creation",
  20988. fn: function (anObject){
  20989. var self=this,$self=this;
  20990. return $core.withContext(function($ctx1) {
  20991. var $1;
  20992. $1=$self._new();
  20993. $recv($1)._object_(anObject);
  20994. return $recv($1)._signal();
  20995. }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject},$globals.NonBooleanReceiver.a$cls)});
  20996. },
  20997. args: ["anObject"],
  20998. source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
  20999. referencedClasses: [],
  21000. messageSends: ["object:", "new", "signal"]
  21001. }),
  21002. $globals.NonBooleanReceiver.a$cls);
  21003. });
  21004. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  21005. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21006. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21007. $core.addPackage("Kernel-Promises");
  21008. ($core.packageDescriptors||$core.packages)["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  21009. ($core.packageDescriptors||$core.packages)["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21010. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  21011. $core.addMethod(
  21012. $core.method({
  21013. selector: "all:",
  21014. protocol: "composites",
  21015. fn: function (aCollection){
  21016. var self=this,$self=this;
  21017. return $core.withContext(function($ctx1) {
  21018. return Promise.all($recv(aCollection)._asArray());
  21019. return self;
  21020. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21021. },
  21022. args: ["aCollection"],
  21023. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  21024. referencedClasses: [],
  21025. messageSends: []
  21026. }),
  21027. $globals.Promise.a$cls);
  21028. $core.addMethod(
  21029. $core.method({
  21030. selector: "any:",
  21031. protocol: "composites",
  21032. fn: function (aCollection){
  21033. var self=this,$self=this;
  21034. return $core.withContext(function($ctx1) {
  21035. return Promise.race($recv(aCollection)._asArray());
  21036. return self;
  21037. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21038. },
  21039. args: ["aCollection"],
  21040. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  21041. referencedClasses: [],
  21042. messageSends: []
  21043. }),
  21044. $globals.Promise.a$cls);
  21045. $core.addMethod(
  21046. $core.method({
  21047. selector: "forBlock:",
  21048. protocol: "instance creation",
  21049. fn: function (aBlock){
  21050. var self=this,$self=this;
  21051. return $core.withContext(function($ctx1) {
  21052. return $recv($self._new())._then_(aBlock);
  21053. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21054. },
  21055. args: ["aBlock"],
  21056. 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",
  21057. referencedClasses: [],
  21058. messageSends: ["then:", "new"]
  21059. }),
  21060. $globals.Promise.a$cls);
  21061. $core.addMethod(
  21062. $core.method({
  21063. selector: "new",
  21064. protocol: "instance creation",
  21065. fn: function (){
  21066. var self=this,$self=this;
  21067. return $core.withContext(function($ctx1) {
  21068. return Promise.resolve();
  21069. return self;
  21070. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.a$cls)});
  21071. },
  21072. args: [],
  21073. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  21074. referencedClasses: [],
  21075. messageSends: []
  21076. }),
  21077. $globals.Promise.a$cls);
  21078. $core.addMethod(
  21079. $core.method({
  21080. selector: "new:",
  21081. protocol: "instance creation",
  21082. fn: function (aBlock){
  21083. var self=this,$self=this;
  21084. return $core.withContext(function($ctx1) {
  21085. return new Promise(function (resolve, reject) {
  21086. var model = {value: resolve, signal: reject};
  21087. aBlock._value_(model);
  21088. });
  21089. return self;
  21090. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21091. },
  21092. args: ["aBlock"],
  21093. 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})'>",
  21094. referencedClasses: [],
  21095. messageSends: []
  21096. }),
  21097. $globals.Promise.a$cls);
  21098. $core.addMethod(
  21099. $core.method({
  21100. selector: "signal:",
  21101. protocol: "instance creation",
  21102. fn: function (anObject){
  21103. var self=this,$self=this;
  21104. return $core.withContext(function($ctx1) {
  21105. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  21106. return self;
  21107. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.a$cls)});
  21108. },
  21109. args: ["anObject"],
  21110. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  21111. referencedClasses: [],
  21112. messageSends: []
  21113. }),
  21114. $globals.Promise.a$cls);
  21115. $core.addMethod(
  21116. $core.method({
  21117. selector: "value:",
  21118. protocol: "instance creation",
  21119. fn: function (anObject){
  21120. var self=this,$self=this;
  21121. return $core.withContext(function($ctx1) {
  21122. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  21123. return self;
  21124. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.a$cls)});
  21125. },
  21126. args: ["anObject"],
  21127. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  21128. referencedClasses: [],
  21129. messageSends: []
  21130. }),
  21131. $globals.Promise.a$cls);
  21132. $core.addTrait("TThenable", "Kernel-Promises");
  21133. $core.addMethod(
  21134. $core.method({
  21135. selector: "catch:",
  21136. protocol: "promises",
  21137. fn: function (aBlock){
  21138. var self=this,$self=this;
  21139. return $core.withContext(function($ctx1) {
  21140. return self.then(null, function (err) {return $core.seamless(function () {
  21141. return aBlock._value_(err);
  21142. })});
  21143. return self;
  21144. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.TThenable)});
  21145. },
  21146. args: ["aBlock"],
  21147. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  21148. referencedClasses: [],
  21149. messageSends: []
  21150. }),
  21151. $globals.TThenable);
  21152. $core.addMethod(
  21153. $core.method({
  21154. selector: "on:do:",
  21155. protocol: "promises",
  21156. fn: function (aClass,aBlock){
  21157. var self=this,$self=this;
  21158. return $core.withContext(function($ctx1) {
  21159. return self.then(null, function (err) {return $core.seamless(function () {
  21160. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  21161. else throw err;
  21162. })});
  21163. return self;
  21164. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21165. },
  21166. args: ["aClass", "aBlock"],
  21167. 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})})'>",
  21168. referencedClasses: [],
  21169. messageSends: []
  21170. }),
  21171. $globals.TThenable);
  21172. $core.addMethod(
  21173. $core.method({
  21174. selector: "on:do:catch:",
  21175. protocol: "promises",
  21176. fn: function (aClass,aBlock,anotherBlock){
  21177. var self=this,$self=this;
  21178. return $core.withContext(function($ctx1) {
  21179. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21180. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21181. },
  21182. args: ["aClass", "aBlock", "anotherBlock"],
  21183. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  21184. referencedClasses: [],
  21185. messageSends: ["catch:", "on:do:"]
  21186. }),
  21187. $globals.TThenable);
  21188. $core.addMethod(
  21189. $core.method({
  21190. selector: "then:",
  21191. protocol: "promises",
  21192. fn: function (aBlockOrArray){
  21193. var self=this,$self=this;
  21194. return $core.withContext(function($ctx1) {
  21195. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  21196. return array.reduce(function (soFar, aBlock) {
  21197. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  21198. function (result) {return $core.seamless(function () {
  21199. if (Array.isArray(result)) {
  21200. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  21201. } else {
  21202. return aBlock._value_(result);
  21203. }
  21204. })} :
  21205. function (result) {return $core.seamless(function () {
  21206. return aBlock._value_(result);
  21207. })}
  21208. );
  21209. }, self);
  21210. return self;
  21211. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.TThenable)});
  21212. },
  21213. args: ["aBlockOrArray"],
  21214. 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)'>",
  21215. referencedClasses: [],
  21216. messageSends: []
  21217. }),
  21218. $globals.TThenable);
  21219. $core.addMethod(
  21220. $core.method({
  21221. selector: "then:catch:",
  21222. protocol: "promises",
  21223. fn: function (aBlockOrArray,anotherBlock){
  21224. var self=this,$self=this;
  21225. return $core.withContext(function($ctx1) {
  21226. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  21227. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.TThenable)});
  21228. },
  21229. args: ["aBlockOrArray", "anotherBlock"],
  21230. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  21231. referencedClasses: [],
  21232. messageSends: ["catch:", "then:"]
  21233. }),
  21234. $globals.TThenable);
  21235. $core.addMethod(
  21236. $core.method({
  21237. selector: "then:on:do:",
  21238. protocol: "promises",
  21239. fn: function (aBlockOrArray,aClass,aBlock){
  21240. var self=this,$self=this;
  21241. return $core.withContext(function($ctx1) {
  21242. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  21243. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21244. },
  21245. args: ["aBlockOrArray", "aClass", "aBlock"],
  21246. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  21247. referencedClasses: [],
  21248. messageSends: ["on:do:", "then:"]
  21249. }),
  21250. $globals.TThenable);
  21251. $core.addMethod(
  21252. $core.method({
  21253. selector: "then:on:do:catch:",
  21254. protocol: "promises",
  21255. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21256. var self=this,$self=this;
  21257. return $core.withContext(function($ctx1) {
  21258. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21259. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21260. },
  21261. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21262. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  21263. referencedClasses: [],
  21264. messageSends: ["catch:", "on:do:", "then:"]
  21265. }),
  21266. $globals.TThenable);
  21267. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  21268. });
  21269. 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";
  21270. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21271. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21272. $core.addPackage("Kernel-Infrastructure");
  21273. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  21274. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21275. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  21276. $core.addMethod(
  21277. $core.method({
  21278. selector: "organizeClasses",
  21279. protocol: "organization",
  21280. fn: function (){
  21281. var self=this,$self=this;
  21282. return $core.withContext(function($ctx1) {
  21283. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21284. return $core.withContext(function($ctx2) {
  21285. return $recv(each)._enterOrganization();
  21286. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21287. }));
  21288. return self;
  21289. }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21290. },
  21291. args: [],
  21292. source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]",
  21293. referencedClasses: ["Smalltalk"],
  21294. messageSends: ["do:", "classes", "enterOrganization"]
  21295. }),
  21296. $globals.AmberBootstrapInitialization.a$cls);
  21297. $core.addMethod(
  21298. $core.method({
  21299. selector: "organizeMethods",
  21300. protocol: "organization",
  21301. fn: function (){
  21302. var self=this,$self=this;
  21303. return $core.withContext(function($ctx1) {
  21304. $recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){
  21305. return $core.withContext(function($ctx2) {
  21306. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  21307. return $core.withContext(function($ctx3) {
  21308. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  21309. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  21310. }));
  21311. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  21312. }));
  21313. $ctx1.sendIdx["do:"]=1;
  21314. return self;
  21315. }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{},$globals.AmberBootstrapInitialization.a$cls)});
  21316. },
  21317. args: [],
  21318. source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  21319. referencedClasses: ["Smalltalk"],
  21320. messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  21321. }),
  21322. $globals.AmberBootstrapInitialization.a$cls);
  21323. $core.addMethod(
  21324. $core.method({
  21325. selector: "run",
  21326. protocol: "public api",
  21327. fn: function (){
  21328. var self=this,$self=this;
  21329. return $core.withContext(function($ctx1) {
  21330. $recv($globals.SmalltalkImage)._initialize();
  21331. $self._organizeClasses();
  21332. $self._organizeMethods();
  21333. return $recv($globals.Smalltalk)._postLoad();
  21334. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.AmberBootstrapInitialization.a$cls)});
  21335. },
  21336. args: [],
  21337. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods.\x0a\x09^ Smalltalk postLoad",
  21338. referencedClasses: ["SmalltalkImage", "Smalltalk"],
  21339. messageSends: ["initialize", "organizeClasses", "organizeMethods", "postLoad"]
  21340. }),
  21341. $globals.AmberBootstrapInitialization.a$cls);
  21342. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  21343. $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`.";
  21344. $core.addMethod(
  21345. $core.method({
  21346. selector: "=",
  21347. protocol: "comparing",
  21348. fn: function (anObject){
  21349. var self=this,$self=this;
  21350. return $core.withContext(function($ctx1) {
  21351. var $2,$1;
  21352. $2=$recv(anObject)._class();
  21353. $ctx1.sendIdx["class"]=1;
  21354. $1=$recv($2).__eq_eq($self._class());
  21355. if(!$core.assert($1)){
  21356. return false;
  21357. }
  21358. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  21359. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  21360. },
  21361. args: ["anObject"],
  21362. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  21363. referencedClasses: ["JSObjectProxy"],
  21364. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  21365. }),
  21366. $globals.JSObjectProxy);
  21367. $core.addMethod(
  21368. $core.method({
  21369. selector: "asJavaScriptObject",
  21370. protocol: "converting",
  21371. fn: function (){
  21372. var self=this,$self=this;
  21373. return $self["@jsObject"];
  21374. },
  21375. args: [],
  21376. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  21377. referencedClasses: [],
  21378. messageSends: []
  21379. }),
  21380. $globals.JSObjectProxy);
  21381. $core.addMethod(
  21382. $core.method({
  21383. selector: "at:",
  21384. protocol: "accessing",
  21385. fn: function (aString){
  21386. var self=this,$self=this;
  21387. return $core.withContext(function($ctx1) {
  21388. return $self['@jsObject'][aString];
  21389. return self;
  21390. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  21391. },
  21392. args: ["aString"],
  21393. source: "at: aString\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString]'>",
  21394. referencedClasses: [],
  21395. messageSends: []
  21396. }),
  21397. $globals.JSObjectProxy);
  21398. $core.addMethod(
  21399. $core.method({
  21400. selector: "at:ifAbsent:",
  21401. protocol: "accessing",
  21402. fn: function (aString,aBlock){
  21403. var self=this,$self=this;
  21404. return $core.withContext(function($ctx1) {
  21405. var obj = $self['@jsObject'];
  21406. return aString in obj ? obj[aString] : aBlock._value();
  21407. ;
  21408. return self;
  21409. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21410. },
  21411. args: ["aString", "aBlock"],
  21412. 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'>",
  21413. referencedClasses: [],
  21414. messageSends: []
  21415. }),
  21416. $globals.JSObjectProxy);
  21417. $core.addMethod(
  21418. $core.method({
  21419. selector: "at:ifPresent:",
  21420. protocol: "accessing",
  21421. fn: function (aString,aBlock){
  21422. var self=this,$self=this;
  21423. return $core.withContext(function($ctx1) {
  21424. var obj = $self['@jsObject'];
  21425. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  21426. ;
  21427. return self;
  21428. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21429. },
  21430. args: ["aString", "aBlock"],
  21431. 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'>",
  21432. referencedClasses: [],
  21433. messageSends: []
  21434. }),
  21435. $globals.JSObjectProxy);
  21436. $core.addMethod(
  21437. $core.method({
  21438. selector: "at:ifPresent:ifAbsent:",
  21439. protocol: "accessing",
  21440. fn: function (aString,aBlock,anotherBlock){
  21441. var self=this,$self=this;
  21442. return $core.withContext(function($ctx1) {
  21443. var obj = $self['@jsObject'];
  21444. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  21445. ;
  21446. return self;
  21447. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21448. },
  21449. args: ["aString", "aBlock", "anotherBlock"],
  21450. 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'>",
  21451. referencedClasses: [],
  21452. messageSends: []
  21453. }),
  21454. $globals.JSObjectProxy);
  21455. $core.addMethod(
  21456. $core.method({
  21457. selector: "at:put:",
  21458. protocol: "accessing",
  21459. fn: function (aString,anObject){
  21460. var self=this,$self=this;
  21461. return $core.withContext(function($ctx1) {
  21462. return $self['@jsObject'][aString] = anObject;
  21463. return self;
  21464. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  21465. },
  21466. args: ["aString", "anObject"],
  21467. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString] = anObject'>",
  21468. referencedClasses: [],
  21469. messageSends: []
  21470. }),
  21471. $globals.JSObjectProxy);
  21472. $core.addMethod(
  21473. $core.method({
  21474. selector: "catch:",
  21475. protocol: "promises",
  21476. fn: function (aBlock){
  21477. var self=this,$self=this;
  21478. return $core.withContext(function($ctx1) {
  21479. var $1,$2;
  21480. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21481. if($core.assert($1)){
  21482. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self["@jsObject"],[aBlock]);
  21483. } else {
  21484. $2=(
  21485. $ctx1.supercall = true,
  21486. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  21487. $ctx1.supercall = false;
  21488. return $2;
  21489. }
  21490. return self;
  21491. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21492. },
  21493. args: ["aBlock"],
  21494. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  21495. referencedClasses: ["NativeFunction", "TThenable"],
  21496. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  21497. }),
  21498. $globals.JSObjectProxy);
  21499. $core.addMethod(
  21500. $core.method({
  21501. selector: "doesNotUnderstand:",
  21502. protocol: "proxy",
  21503. fn: function (aMessage){
  21504. var self=this,$self=this;
  21505. return $core.withContext(function($ctx1) {
  21506. var $1,$receiver;
  21507. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  21508. if(($receiver = $1) == null || $receiver.a$nil){
  21509. return (
  21510. $ctx1.supercall = true,
  21511. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  21512. $ctx1.supercall = false;
  21513. } else {
  21514. var jsSelector;
  21515. jsSelector=$receiver;
  21516. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  21517. }
  21518. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  21519. },
  21520. args: ["aMessage"],
  21521. 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 ]",
  21522. referencedClasses: ["JSObjectProxy"],
  21523. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  21524. }),
  21525. $globals.JSObjectProxy);
  21526. $core.addMethod(
  21527. $core.method({
  21528. selector: "in:",
  21529. protocol: "accessing",
  21530. fn: function (aValuable){
  21531. var self=this,$self=this;
  21532. return $core.withContext(function($ctx1) {
  21533. return $recv(aValuable)._value_($self["@jsObject"]);
  21534. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  21535. },
  21536. args: ["aValuable"],
  21537. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  21538. referencedClasses: [],
  21539. messageSends: ["value:"]
  21540. }),
  21541. $globals.JSObjectProxy);
  21542. $core.addMethod(
  21543. $core.method({
  21544. selector: "jsObject",
  21545. protocol: "accessing",
  21546. fn: function (){
  21547. var self=this,$self=this;
  21548. return $self["@jsObject"];
  21549. },
  21550. args: [],
  21551. source: "jsObject\x0a\x09^ jsObject",
  21552. referencedClasses: [],
  21553. messageSends: []
  21554. }),
  21555. $globals.JSObjectProxy);
  21556. $core.addMethod(
  21557. $core.method({
  21558. selector: "keysAndValuesDo:",
  21559. protocol: "enumerating",
  21560. fn: function (aBlock){
  21561. var self=this,$self=this;
  21562. return $core.withContext(function($ctx1) {
  21563. var o = $self['@jsObject'];
  21564. for(var i in o) {
  21565. aBlock._value_value_(i, o[i]);
  21566. }
  21567. ;
  21568. return self;
  21569. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21570. },
  21571. args: ["aBlock"],
  21572. 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'>",
  21573. referencedClasses: [],
  21574. messageSends: []
  21575. }),
  21576. $globals.JSObjectProxy);
  21577. $core.addMethod(
  21578. $core.method({
  21579. selector: "on:do:",
  21580. protocol: "promises",
  21581. fn: function (aClass,aBlock){
  21582. var self=this,$self=this;
  21583. return $core.withContext(function($ctx1) {
  21584. var $1,$2;
  21585. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21586. if($core.assert($1)){
  21587. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self["@jsObject"],[aClass,aBlock]);
  21588. } else {
  21589. $2=(
  21590. $ctx1.supercall = true,
  21591. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  21592. $ctx1.supercall = false;
  21593. return $2;
  21594. }
  21595. return self;
  21596. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21597. },
  21598. args: ["aClass", "aBlock"],
  21599. 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 ]",
  21600. referencedClasses: ["NativeFunction", "TThenable"],
  21601. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  21602. }),
  21603. $globals.JSObjectProxy);
  21604. $core.addMethod(
  21605. $core.method({
  21606. selector: "printOn:",
  21607. protocol: "printing",
  21608. fn: function (aStream){
  21609. var self=this,$self=this;
  21610. return $core.withContext(function($ctx1) {
  21611. $recv(aStream)._nextPutAll_($self._printString());
  21612. return self;
  21613. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21614. },
  21615. args: ["aStream"],
  21616. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  21617. referencedClasses: [],
  21618. messageSends: ["nextPutAll:", "printString"]
  21619. }),
  21620. $globals.JSObjectProxy);
  21621. $core.addMethod(
  21622. $core.method({
  21623. selector: "printString",
  21624. protocol: "printing",
  21625. fn: function (){
  21626. var self=this,$self=this;
  21627. return $core.withContext(function($ctx1) {
  21628. var js = $self['@jsObject'];
  21629. return js.toString
  21630. ? js.toString()
  21631. : Object.prototype.toString.call(js)
  21632. ;
  21633. return self;
  21634. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  21635. },
  21636. args: [],
  21637. 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'>",
  21638. referencedClasses: [],
  21639. messageSends: []
  21640. }),
  21641. $globals.JSObjectProxy);
  21642. $core.addMethod(
  21643. $core.method({
  21644. selector: "putOn:",
  21645. protocol: "streaming",
  21646. fn: function (aStream){
  21647. var self=this,$self=this;
  21648. return $core.withContext(function($ctx1) {
  21649. $recv(aStream)._nextPutJSObject_($self["@jsObject"]);
  21650. return self;
  21651. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21652. },
  21653. args: ["aStream"],
  21654. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  21655. referencedClasses: [],
  21656. messageSends: ["nextPutJSObject:"]
  21657. }),
  21658. $globals.JSObjectProxy);
  21659. $core.addMethod(
  21660. $core.method({
  21661. selector: "removeKey:",
  21662. protocol: "accessing",
  21663. fn: function (aString){
  21664. var self=this,$self=this;
  21665. return $core.withContext(function($ctx1) {
  21666. delete $self['@jsObject'][aString]; return aString;
  21667. return self;
  21668. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aString:aString},$globals.JSObjectProxy)});
  21669. },
  21670. args: ["aString"],
  21671. source: "removeKey: aString\x0a\x09<inlineJS: 'delete $self[''@jsObject''][aString]; return aString'>",
  21672. referencedClasses: [],
  21673. messageSends: []
  21674. }),
  21675. $globals.JSObjectProxy);
  21676. $core.addMethod(
  21677. $core.method({
  21678. selector: "then:",
  21679. protocol: "promises",
  21680. fn: function (aBlockOrArray){
  21681. var self=this,$self=this;
  21682. return $core.withContext(function($ctx1) {
  21683. var $1,$2;
  21684. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21685. if($core.assert($1)){
  21686. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self["@jsObject"],[aBlockOrArray]);
  21687. } else {
  21688. $2=(
  21689. $ctx1.supercall = true,
  21690. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  21691. $ctx1.supercall = false;
  21692. return $2;
  21693. }
  21694. return self;
  21695. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  21696. },
  21697. args: ["aBlockOrArray"],
  21698. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  21699. referencedClasses: ["NativeFunction", "TThenable"],
  21700. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  21701. }),
  21702. $globals.JSObjectProxy);
  21703. $core.addMethod(
  21704. $core.method({
  21705. selector: "addObjectVariablesTo:ofProxy:",
  21706. protocol: "proxy",
  21707. fn: function (aDictionary,aProxy){
  21708. var self=this,$self=this;
  21709. return $core.withContext(function($ctx1) {
  21710. var jsObject = aProxy['@jsObject'];
  21711. for(var i in jsObject) {
  21712. aDictionary._at_put_(i, jsObject[i]);
  21713. }
  21714. ;
  21715. return self;
  21716. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21717. },
  21718. args: ["aDictionary", "aProxy"],
  21719. 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'>",
  21720. referencedClasses: [],
  21721. messageSends: []
  21722. }),
  21723. $globals.JSObjectProxy.a$cls);
  21724. $core.addMethod(
  21725. $core.method({
  21726. selector: "compareJSObjectOfProxy:withProxy:",
  21727. protocol: "proxy",
  21728. fn: function (aProxy,anotherProxy){
  21729. var self=this,$self=this;
  21730. return $core.withContext(function($ctx1) {
  21731. var anotherJSObject = anotherProxy.a$cls ? anotherProxy["@jsObject"] : anotherProxy;
  21732. return aProxy["@jsObject"] === anotherJSObject;
  21733. return self;
  21734. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.a$cls)});
  21735. },
  21736. args: ["aProxy", "anotherProxy"],
  21737. 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'>",
  21738. referencedClasses: [],
  21739. messageSends: []
  21740. }),
  21741. $globals.JSObjectProxy.a$cls);
  21742. $core.addMethod(
  21743. $core.method({
  21744. selector: "forwardMessage:withArguments:ofProxy:",
  21745. protocol: "proxy",
  21746. fn: function (aString,anArray,aProxy){
  21747. var self=this,$self=this;
  21748. return $core.withContext(function($ctx1) {
  21749. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  21750. ;
  21751. return self;
  21752. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21753. },
  21754. args: ["aString", "anArray", "aProxy"],
  21755. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  21756. referencedClasses: [],
  21757. messageSends: []
  21758. }),
  21759. $globals.JSObjectProxy.a$cls);
  21760. $core.addMethod(
  21761. $core.method({
  21762. selector: "jsObject:ofProxy:",
  21763. protocol: "proxy",
  21764. fn: function (aJSObject,aProxy){
  21765. var self=this,$self=this;
  21766. return $core.withContext(function($ctx1) {
  21767. aProxy['@jsObject'] = aJSObject;
  21768. return self;
  21769. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21770. },
  21771. args: ["aJSObject", "aProxy"],
  21772. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  21773. referencedClasses: [],
  21774. messageSends: []
  21775. }),
  21776. $globals.JSObjectProxy.a$cls);
  21777. $core.addMethod(
  21778. $core.method({
  21779. selector: "lookupProperty:ofProxy:",
  21780. protocol: "proxy",
  21781. fn: function (aString,aProxy){
  21782. var self=this,$self=this;
  21783. return $core.withContext(function($ctx1) {
  21784. return aString in aProxy._jsObject() ? aString : nil;
  21785. return self;
  21786. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21787. },
  21788. args: ["aString", "aProxy"],
  21789. 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'>",
  21790. referencedClasses: [],
  21791. messageSends: []
  21792. }),
  21793. $globals.JSObjectProxy.a$cls);
  21794. $core.addMethod(
  21795. $core.method({
  21796. selector: "null",
  21797. protocol: "accessing",
  21798. fn: function (){
  21799. var self=this,$self=this;
  21800. return $core.withContext(function($ctx1) {
  21801. return null;
  21802. return self;
  21803. }, function($ctx1) {$ctx1.fill(self,"null",{},$globals.JSObjectProxy.a$cls)});
  21804. },
  21805. args: [],
  21806. source: "null\x0a\x09<inlineJS: 'return null'>",
  21807. referencedClasses: [],
  21808. messageSends: []
  21809. }),
  21810. $globals.JSObjectProxy.a$cls);
  21811. $core.addMethod(
  21812. $core.method({
  21813. selector: "on:",
  21814. protocol: "instance creation",
  21815. fn: function (aJSObject){
  21816. var self=this,$self=this;
  21817. var instance;
  21818. return $core.withContext(function($ctx1) {
  21819. instance=$self._new();
  21820. $self._jsObject_ofProxy_(aJSObject,instance);
  21821. return instance;
  21822. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.a$cls)});
  21823. },
  21824. args: ["aJSObject"],
  21825. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  21826. referencedClasses: [],
  21827. messageSends: ["new", "jsObject:ofProxy:"]
  21828. }),
  21829. $globals.JSObjectProxy.a$cls);
  21830. $core.addMethod(
  21831. $core.method({
  21832. selector: "undefined",
  21833. protocol: "accessing",
  21834. fn: function (){
  21835. var self=this,$self=this;
  21836. return $core.withContext(function($ctx1) {
  21837. return undefined;
  21838. return self;
  21839. }, function($ctx1) {$ctx1.fill(self,"undefined",{},$globals.JSObjectProxy.a$cls)});
  21840. },
  21841. args: [],
  21842. source: "undefined\x0a\x09<inlineJS: 'return undefined'>",
  21843. referencedClasses: [],
  21844. messageSends: []
  21845. }),
  21846. $globals.JSObjectProxy.a$cls);
  21847. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  21848. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  21849. $core.addMethod(
  21850. $core.method({
  21851. selector: "addElement:",
  21852. protocol: "accessing",
  21853. fn: function (anObject){
  21854. var self=this,$self=this;
  21855. return $core.withContext(function($ctx1) {
  21856. $recv($self._elements())._add_(anObject);
  21857. return self;
  21858. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  21859. },
  21860. args: ["anObject"],
  21861. source: "addElement: anObject\x0a\x09self elements add: anObject",
  21862. referencedClasses: [],
  21863. messageSends: ["add:", "elements"]
  21864. }),
  21865. $globals.Organizer);
  21866. $core.addMethod(
  21867. $core.method({
  21868. selector: "elements",
  21869. protocol: "accessing",
  21870. fn: function (){
  21871. var self=this,$self=this;
  21872. return $self["@elements"];
  21873. },
  21874. args: [],
  21875. source: "elements\x0a\x09^ elements",
  21876. referencedClasses: [],
  21877. messageSends: []
  21878. }),
  21879. $globals.Organizer);
  21880. $core.addMethod(
  21881. $core.method({
  21882. selector: "initialize",
  21883. protocol: "initialization",
  21884. fn: function (){
  21885. var self=this,$self=this;
  21886. return $core.withContext(function($ctx1) {
  21887. (
  21888. $ctx1.supercall = true,
  21889. ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  21890. $ctx1.supercall = false;
  21891. $self["@elements"]=$recv($globals.Set)._new();
  21892. return self;
  21893. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Organizer)});
  21894. },
  21895. args: [],
  21896. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  21897. referencedClasses: ["Set"],
  21898. messageSends: ["initialize", "new"]
  21899. }),
  21900. $globals.Organizer);
  21901. $core.addMethod(
  21902. $core.method({
  21903. selector: "removeElement:",
  21904. protocol: "accessing",
  21905. fn: function (anObject){
  21906. var self=this,$self=this;
  21907. return $core.withContext(function($ctx1) {
  21908. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  21909. }));
  21910. return self;
  21911. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  21912. },
  21913. args: ["anObject"],
  21914. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  21915. referencedClasses: [],
  21916. messageSends: ["remove:ifAbsent:", "elements"]
  21917. }),
  21918. $globals.Organizer);
  21919. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  21920. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  21921. $core.addMethod(
  21922. $core.method({
  21923. selector: "addElement:",
  21924. protocol: "accessing",
  21925. fn: function (aString){
  21926. var self=this,$self=this;
  21927. return $core.withContext(function($ctx1) {
  21928. var $1,$3,$2;
  21929. (
  21930. $ctx1.supercall = true,
  21931. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  21932. $ctx1.supercall = false;
  21933. $1=$recv($globals.SystemAnnouncer)._current();
  21934. $3=$recv($globals.ProtocolAdded)._new();
  21935. $recv($3)._protocol_(aString);
  21936. $recv($3)._theClass_($self._theClass());
  21937. $2=$recv($3)._yourself();
  21938. $recv($1)._announce_($2);
  21939. return self;
  21940. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  21941. },
  21942. args: ["aString"],
  21943. 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)",
  21944. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  21945. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  21946. }),
  21947. $globals.ClassOrganizer);
  21948. $core.addMethod(
  21949. $core.method({
  21950. selector: "removeElement:",
  21951. protocol: "accessing",
  21952. fn: function (aString){
  21953. var self=this,$self=this;
  21954. return $core.withContext(function($ctx1) {
  21955. var $1,$3,$2;
  21956. (
  21957. $ctx1.supercall = true,
  21958. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  21959. $ctx1.supercall = false;
  21960. $1=$recv($globals.SystemAnnouncer)._current();
  21961. $3=$recv($globals.ProtocolRemoved)._new();
  21962. $recv($3)._protocol_(aString);
  21963. $recv($3)._theClass_($self._theClass());
  21964. $2=$recv($3)._yourself();
  21965. $recv($1)._announce_($2);
  21966. return self;
  21967. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  21968. },
  21969. args: ["aString"],
  21970. 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)",
  21971. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  21972. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  21973. }),
  21974. $globals.ClassOrganizer);
  21975. $core.addMethod(
  21976. $core.method({
  21977. selector: "theClass",
  21978. protocol: "accessing",
  21979. fn: function (){
  21980. var self=this,$self=this;
  21981. return $self["@traitOrBehavior"];
  21982. },
  21983. args: [],
  21984. source: "theClass\x0a\x09^ traitOrBehavior",
  21985. referencedClasses: [],
  21986. messageSends: []
  21987. }),
  21988. $globals.ClassOrganizer);
  21989. $core.addMethod(
  21990. $core.method({
  21991. selector: "theClass:",
  21992. protocol: "accessing",
  21993. fn: function (aClass){
  21994. var self=this,$self=this;
  21995. $self["@traitOrBehavior"]=aClass;
  21996. return self;
  21997. },
  21998. args: ["aClass"],
  21999. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  22000. referencedClasses: [],
  22001. messageSends: []
  22002. }),
  22003. $globals.ClassOrganizer);
  22004. $core.addMethod(
  22005. $core.method({
  22006. selector: "on:",
  22007. protocol: "instance creation",
  22008. fn: function (aClass){
  22009. var self=this,$self=this;
  22010. return $core.withContext(function($ctx1) {
  22011. var $1;
  22012. $1=$self._new();
  22013. $recv($1)._theClass_(aClass);
  22014. return $recv($1)._yourself();
  22015. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.ClassOrganizer.a$cls)});
  22016. },
  22017. args: ["aClass"],
  22018. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  22019. referencedClasses: [],
  22020. messageSends: ["theClass:", "new", "yourself"]
  22021. }),
  22022. $globals.ClassOrganizer.a$cls);
  22023. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  22024. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  22025. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization"], "Kernel-Infrastructure");
  22026. $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'";
  22027. $core.addMethod(
  22028. $core.method({
  22029. selector: "basicTransport",
  22030. protocol: "private",
  22031. fn: function (){
  22032. var self=this,$self=this;
  22033. return $self["@basicTransport"];
  22034. },
  22035. args: [],
  22036. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  22037. referencedClasses: [],
  22038. messageSends: []
  22039. }),
  22040. $globals.Package);
  22041. $core.addMethod(
  22042. $core.method({
  22043. selector: "beClean",
  22044. protocol: "accessing",
  22045. fn: function (){
  22046. var self=this,$self=this;
  22047. return $core.withContext(function($ctx1) {
  22048. var $1,$3,$2;
  22049. $self["@dirty"]=false;
  22050. $1=$recv($globals.SystemAnnouncer)._current();
  22051. $3=$recv($globals.PackageClean)._new();
  22052. $recv($3)._package_(self);
  22053. $2=$recv($3)._yourself();
  22054. $recv($1)._announce_($2);
  22055. return self;
  22056. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  22057. },
  22058. args: [],
  22059. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22060. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  22061. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22062. }),
  22063. $globals.Package);
  22064. $core.addMethod(
  22065. $core.method({
  22066. selector: "beDirty",
  22067. protocol: "accessing",
  22068. fn: function (){
  22069. var self=this,$self=this;
  22070. return $core.withContext(function($ctx1) {
  22071. var $1,$3,$2;
  22072. $self["@dirty"]=true;
  22073. $1=$recv($globals.SystemAnnouncer)._current();
  22074. $3=$recv($globals.PackageDirty)._new();
  22075. $recv($3)._package_(self);
  22076. $2=$recv($3)._yourself();
  22077. $recv($1)._announce_($2);
  22078. return self;
  22079. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  22080. },
  22081. args: [],
  22082. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22083. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  22084. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22085. }),
  22086. $globals.Package);
  22087. $core.addMethod(
  22088. $core.method({
  22089. selector: "classTemplate",
  22090. protocol: "accessing",
  22091. fn: function (){
  22092. var self=this,$self=this;
  22093. return $core.withContext(function($ctx1) {
  22094. return $recv($globals.String)._streamContents_((function(stream){
  22095. return $core.withContext(function($ctx2) {
  22096. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  22097. $ctx2.sendIdx["write:"]=1;
  22098. $recv(stream)._lf();
  22099. $ctx2.sendIdx["lf"]=1;
  22100. $recv(stream)._tab();
  22101. $ctx2.sendIdx["tab"]=1;
  22102. $recv(stream)._write_("instanceVariableNames: ''");
  22103. $ctx2.sendIdx["write:"]=2;
  22104. $recv(stream)._lf();
  22105. $recv(stream)._tab();
  22106. $recv(stream)._write_("package: ");
  22107. return $recv(stream)._print_($self._name());
  22108. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22109. }));
  22110. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  22111. },
  22112. args: [],
  22113. 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 ]",
  22114. referencedClasses: ["String"],
  22115. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  22116. }),
  22117. $globals.Package);
  22118. $core.addMethod(
  22119. $core.method({
  22120. selector: "classes",
  22121. protocol: "classes",
  22122. fn: function (){
  22123. var self=this,$self=this;
  22124. return $core.withContext(function($ctx1) {
  22125. return $recv($recv($self._organization())._elements())._copy();
  22126. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  22127. },
  22128. args: [],
  22129. source: "classes\x0a\x09^ self organization elements copy",
  22130. referencedClasses: [],
  22131. messageSends: ["copy", "elements", "organization"]
  22132. }),
  22133. $globals.Package);
  22134. $core.addMethod(
  22135. $core.method({
  22136. selector: "definition",
  22137. protocol: "accessing",
  22138. fn: function (){
  22139. var self=this,$self=this;
  22140. return $core.withContext(function($ctx1) {
  22141. var $1;
  22142. return $recv($globals.String)._streamContents_((function(stream){
  22143. return $core.withContext(function($ctx2) {
  22144. $1=$recv($self._class())._name();
  22145. $ctx2.sendIdx["name"]=1;
  22146. $recv(stream)._write_($1);
  22147. $ctx2.sendIdx["write:"]=1;
  22148. $recv(stream)._lf();
  22149. $ctx2.sendIdx["lf"]=1;
  22150. $recv(stream)._tab();
  22151. $ctx2.sendIdx["tab"]=1;
  22152. $recv(stream)._write_("named: ");
  22153. $ctx2.sendIdx["write:"]=2;
  22154. $recv(stream)._print_($self._name());
  22155. $recv(stream)._lf();
  22156. $ctx2.sendIdx["lf"]=2;
  22157. $recv(stream)._tab();
  22158. $ctx2.sendIdx["tab"]=2;
  22159. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  22160. $ctx2.sendIdx["write:"]=3;
  22161. $recv(stream)._lf();
  22162. $recv(stream)._tab();
  22163. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  22164. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22165. }));
  22166. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  22167. },
  22168. args: [],
  22169. 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. ')' } ]",
  22170. referencedClasses: ["String"],
  22171. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  22172. }),
  22173. $globals.Package);
  22174. $core.addMethod(
  22175. $core.method({
  22176. selector: "eval:",
  22177. protocol: "evaluating",
  22178. fn: function (aString){
  22179. var self=this,$self=this;
  22180. return $core.withContext(function($ctx1) {
  22181. var $1,$receiver;
  22182. $1=$self["@evalBlock"];
  22183. if(($receiver = $1) == null || $receiver.a$nil){
  22184. return $recv($globals.Compiler)._eval_(aString);
  22185. } else {
  22186. return $recv($self["@evalBlock"])._value_(aString);
  22187. }
  22188. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Package)});
  22189. },
  22190. args: ["aString"],
  22191. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  22192. referencedClasses: ["Compiler"],
  22193. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  22194. }),
  22195. $globals.Package);
  22196. $core.addMethod(
  22197. $core.method({
  22198. selector: "evalBlock",
  22199. protocol: "accessing",
  22200. fn: function (){
  22201. var self=this,$self=this;
  22202. return $self["@evalBlock"];
  22203. },
  22204. args: [],
  22205. source: "evalBlock\x0a\x09^ evalBlock",
  22206. referencedClasses: [],
  22207. messageSends: []
  22208. }),
  22209. $globals.Package);
  22210. $core.addMethod(
  22211. $core.method({
  22212. selector: "evalBlock:",
  22213. protocol: "accessing",
  22214. fn: function (aBlock){
  22215. var self=this,$self=this;
  22216. $self["@evalBlock"]=aBlock;
  22217. return self;
  22218. },
  22219. args: ["aBlock"],
  22220. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  22221. referencedClasses: [],
  22222. messageSends: []
  22223. }),
  22224. $globals.Package);
  22225. $core.addMethod(
  22226. $core.method({
  22227. selector: "imports",
  22228. protocol: "accessing",
  22229. fn: function (){
  22230. var self=this,$self=this;
  22231. return $core.withContext(function($ctx1) {
  22232. var $1,$receiver;
  22233. $1=$self["@imports"];
  22234. if(($receiver = $1) == null || $receiver.a$nil){
  22235. $self._imports_([]);
  22236. return $self["@imports"];
  22237. } else {
  22238. return $1;
  22239. }
  22240. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  22241. },
  22242. args: [],
  22243. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  22244. referencedClasses: [],
  22245. messageSends: ["ifNil:", "imports:"]
  22246. }),
  22247. $globals.Package);
  22248. $core.addMethod(
  22249. $core.method({
  22250. selector: "imports:",
  22251. protocol: "accessing",
  22252. fn: function (anArray){
  22253. var self=this,$self=this;
  22254. return $core.withContext(function($ctx1) {
  22255. $self._validateImports_(anArray);
  22256. $self["@imports"]=$recv(anArray)._asSet();
  22257. return self;
  22258. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  22259. },
  22260. args: ["anArray"],
  22261. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  22262. referencedClasses: [],
  22263. messageSends: ["validateImports:", "asSet"]
  22264. }),
  22265. $globals.Package);
  22266. $core.addMethod(
  22267. $core.method({
  22268. selector: "importsAsJson",
  22269. protocol: "converting",
  22270. fn: function (){
  22271. var self=this,$self=this;
  22272. return $core.withContext(function($ctx1) {
  22273. var $1;
  22274. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  22275. return $core.withContext(function($ctx2) {
  22276. $1=$recv(each)._isString();
  22277. if($core.assert($1)){
  22278. return each;
  22279. } else {
  22280. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  22281. $ctx2.sendIdx[","]=1;
  22282. }
  22283. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22284. }));
  22285. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  22286. },
  22287. args: [],
  22288. 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 ]]",
  22289. referencedClasses: [],
  22290. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  22291. }),
  22292. $globals.Package);
  22293. $core.addMethod(
  22294. $core.method({
  22295. selector: "importsDefinition",
  22296. protocol: "accessing",
  22297. fn: function (){
  22298. var self=this,$self=this;
  22299. return $core.withContext(function($ctx1) {
  22300. return $recv($globals.String)._streamContents_((function(stream){
  22301. return $core.withContext(function($ctx2) {
  22302. $recv(stream)._write_("{");
  22303. $ctx2.sendIdx["write:"]=1;
  22304. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  22305. return $core.withContext(function($ctx3) {
  22306. return $recv(stream)._print_(each);
  22307. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  22308. }),(function(){
  22309. return $core.withContext(function($ctx3) {
  22310. return $recv(stream)._write_(". ");
  22311. $ctx3.sendIdx["write:"]=2;
  22312. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  22313. }));
  22314. return $recv(stream)._write_("}");
  22315. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22316. }));
  22317. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  22318. },
  22319. args: [],
  22320. 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: '}' ]",
  22321. referencedClasses: ["String"],
  22322. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  22323. }),
  22324. $globals.Package);
  22325. $core.addMethod(
  22326. $core.method({
  22327. selector: "importsFromJson:",
  22328. protocol: "converting",
  22329. fn: function (anArray){
  22330. var self=this,$self=this;
  22331. return $core.withContext(function($ctx1) {
  22332. var $1;
  22333. return $recv(anArray)._collect_((function(each){
  22334. var split;
  22335. return $core.withContext(function($ctx2) {
  22336. split=$recv(each)._tokenize_("=");
  22337. $1=$recv($recv(split)._size()).__eq((1));
  22338. if($core.assert($1)){
  22339. return $recv(split)._first();
  22340. $ctx2.sendIdx["first"]=1;
  22341. } else {
  22342. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  22343. }
  22344. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  22345. }));
  22346. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  22347. },
  22348. args: ["anArray"],
  22349. 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 ]]",
  22350. referencedClasses: [],
  22351. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  22352. }),
  22353. $globals.Package);
  22354. $core.addMethod(
  22355. $core.method({
  22356. selector: "initialize",
  22357. protocol: "initialization",
  22358. fn: function (){
  22359. var self=this,$self=this;
  22360. return $core.withContext(function($ctx1) {
  22361. (
  22362. $ctx1.supercall = true,
  22363. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22364. $ctx1.supercall = false;
  22365. $self["@organization"]=$recv($globals.PackageOrganizer)._new();
  22366. $self["@evalBlock"]=nil;
  22367. $self["@dirty"]=nil;
  22368. $self["@imports"]=nil;
  22369. $self["@transport"]=nil;
  22370. return self;
  22371. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Package)});
  22372. },
  22373. args: [],
  22374. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09organization := PackageOrganizer new.\x0a\x09evalBlock := nil.\x0a\x09dirty := nil.\x0a\x09imports := nil.\x0a\x09transport := nil",
  22375. referencedClasses: ["PackageOrganizer"],
  22376. messageSends: ["initialize", "new"]
  22377. }),
  22378. $globals.Package);
  22379. $core.addMethod(
  22380. $core.method({
  22381. selector: "isDirty",
  22382. protocol: "testing",
  22383. fn: function (){
  22384. var self=this,$self=this;
  22385. return $core.withContext(function($ctx1) {
  22386. var $1,$receiver;
  22387. $1=$self["@dirty"];
  22388. if(($receiver = $1) == null || $receiver.a$nil){
  22389. return false;
  22390. } else {
  22391. return $1;
  22392. }
  22393. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  22394. },
  22395. args: [],
  22396. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  22397. referencedClasses: [],
  22398. messageSends: ["ifNil:"]
  22399. }),
  22400. $globals.Package);
  22401. $core.addMethod(
  22402. $core.method({
  22403. selector: "isPackage",
  22404. protocol: "testing",
  22405. fn: function (){
  22406. var self=this,$self=this;
  22407. return true;
  22408. },
  22409. args: [],
  22410. source: "isPackage\x0a\x09^ true",
  22411. referencedClasses: [],
  22412. messageSends: []
  22413. }),
  22414. $globals.Package);
  22415. $core.addMethod(
  22416. $core.method({
  22417. selector: "javaScriptDescriptor:",
  22418. protocol: "accessing",
  22419. fn: function (anObject){
  22420. var self=this,$self=this;
  22421. var basicEval,basicImports;
  22422. return $core.withContext(function($ctx1) {
  22423. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  22424. return $core.withContext(function($ctx2) {
  22425. return nil._asJavaScriptObject();
  22426. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22427. }));
  22428. $ctx1.sendIdx["at:ifAbsent:"]=1;
  22429. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  22430. return [];
  22431. }));
  22432. $ctx1.sendIdx["at:ifAbsent:"]=2;
  22433. $self["@basicTransport"]=$recv(anObject)._at_ifAbsent_("transport",(function(){
  22434. }));
  22435. $self._evalBlock_(basicEval);
  22436. $self._imports_($self._importsFromJson_(basicImports));
  22437. return self;
  22438. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports},$globals.Package)});
  22439. },
  22440. args: ["anObject"],
  22441. 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)",
  22442. referencedClasses: [],
  22443. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "evalBlock:", "imports:", "importsFromJson:"]
  22444. }),
  22445. $globals.Package);
  22446. $core.addMethod(
  22447. $core.method({
  22448. selector: "loadDependencies",
  22449. protocol: "dependencies",
  22450. fn: function (){
  22451. var self=this,$self=this;
  22452. var classes,packages;
  22453. return $core.withContext(function($ctx1) {
  22454. var $1;
  22455. classes=$self._loadDependencyClasses();
  22456. $1=$recv($recv(classes)._collect_((function(each){
  22457. return $core.withContext(function($ctx2) {
  22458. return $recv(each)._package();
  22459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22460. })))._asSet();
  22461. $recv($1)._remove_ifAbsent_(self,(function(){
  22462. }));
  22463. return $recv($1)._yourself();
  22464. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  22465. },
  22466. args: [],
  22467. 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",
  22468. referencedClasses: [],
  22469. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  22470. }),
  22471. $globals.Package);
  22472. $core.addMethod(
  22473. $core.method({
  22474. selector: "loadDependencyClasses",
  22475. protocol: "dependencies",
  22476. fn: function (){
  22477. var self=this,$self=this;
  22478. var starCategoryName;
  22479. return $core.withContext(function($ctx1) {
  22480. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  22481. starCategoryName="*".__comma($self._name());
  22482. $ctx1.sendIdx[","]=1;
  22483. $3=$self._classes();
  22484. $ctx1.sendIdx["classes"]=1;
  22485. $2=$recv($3)._collect_((function(each){
  22486. return $core.withContext(function($ctx2) {
  22487. return $recv(each)._superclass();
  22488. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22489. }));
  22490. $ctx1.sendIdx["collect:"]=1;
  22491. $1=$recv($2)._asSet();
  22492. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  22493. return $core.withContext(function($ctx2) {
  22494. $5=$recv(each)._protocols();
  22495. $ctx2.sendIdx["protocols"]=1;
  22496. $7=$recv(each)._theMetaClass();
  22497. if(($receiver = $7) == null || $receiver.a$nil){
  22498. $6=[];
  22499. } else {
  22500. var meta;
  22501. meta=$receiver;
  22502. $6=$recv(meta)._protocols();
  22503. }
  22504. $4=$recv($5).__comma($6);
  22505. return $recv($4)._includes_(starCategoryName);
  22506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22507. })));
  22508. $ctx1.sendIdx["addAll:"]=1;
  22509. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  22510. return $core.withContext(function($ctx2) {
  22511. return $recv($self._traitCompositions())._valuesDo_((function(each){
  22512. return $core.withContext(function($ctx3) {
  22513. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  22514. return $core.withContext(function($ctx4) {
  22515. return $recv(eachTT)._trait();
  22516. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  22517. })));
  22518. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  22519. }));
  22520. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  22521. })));
  22522. $recv($1)._remove_ifAbsent_(nil,(function(){
  22523. }));
  22524. return $recv($1)._yourself();
  22525. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  22526. },
  22527. args: [],
  22528. 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",
  22529. referencedClasses: ["Smalltalk", "Array"],
  22530. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  22531. }),
  22532. $globals.Package);
  22533. $core.addMethod(
  22534. $core.method({
  22535. selector: "name",
  22536. protocol: "accessing",
  22537. fn: function (){
  22538. var self=this,$self=this;
  22539. return $self["@name"];
  22540. },
  22541. args: [],
  22542. source: "name\x0a\x09^ name",
  22543. referencedClasses: [],
  22544. messageSends: []
  22545. }),
  22546. $globals.Package);
  22547. $core.addMethod(
  22548. $core.method({
  22549. selector: "name:",
  22550. protocol: "accessing",
  22551. fn: function (aString){
  22552. var self=this,$self=this;
  22553. $self["@name"]=aString;
  22554. return self;
  22555. },
  22556. args: ["aString"],
  22557. source: "name: aString\x0a\x09name := aString",
  22558. referencedClasses: [],
  22559. messageSends: []
  22560. }),
  22561. $globals.Package);
  22562. $core.addMethod(
  22563. $core.method({
  22564. selector: "organization",
  22565. protocol: "accessing",
  22566. fn: function (){
  22567. var self=this,$self=this;
  22568. return $self["@organization"];
  22569. },
  22570. args: [],
  22571. source: "organization\x0a\x09^ organization",
  22572. referencedClasses: [],
  22573. messageSends: []
  22574. }),
  22575. $globals.Package);
  22576. $core.addMethod(
  22577. $core.method({
  22578. selector: "printOn:",
  22579. protocol: "printing",
  22580. fn: function (aStream){
  22581. var self=this,$self=this;
  22582. return $core.withContext(function($ctx1) {
  22583. (
  22584. $ctx1.supercall = true,
  22585. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  22586. $ctx1.supercall = false;
  22587. $recv(aStream)._nextPutAll_(" (");
  22588. $ctx1.sendIdx["nextPutAll:"]=1;
  22589. $recv(aStream)._nextPutAll_($self._name());
  22590. $ctx1.sendIdx["nextPutAll:"]=2;
  22591. $recv(aStream)._nextPutAll_(")");
  22592. return self;
  22593. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  22594. },
  22595. args: ["aStream"],
  22596. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  22597. referencedClasses: [],
  22598. messageSends: ["printOn:", "nextPutAll:", "name"]
  22599. }),
  22600. $globals.Package);
  22601. $core.addMethod(
  22602. $core.method({
  22603. selector: "setupClasses",
  22604. protocol: "classes",
  22605. fn: function (){
  22606. var self=this,$self=this;
  22607. return $core.withContext(function($ctx1) {
  22608. $recv($self._classes())._do_((function(each){
  22609. return $core.withContext(function($ctx2) {
  22610. return $recv(each)._initialize();
  22611. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22612. }));
  22613. return self;
  22614. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  22615. },
  22616. args: [],
  22617. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  22618. referencedClasses: [],
  22619. messageSends: ["do:", "classes", "initialize"]
  22620. }),
  22621. $globals.Package);
  22622. $core.addMethod(
  22623. $core.method({
  22624. selector: "sortedClasses",
  22625. protocol: "classes",
  22626. fn: function (){
  22627. var self=this,$self=this;
  22628. return $core.withContext(function($ctx1) {
  22629. return $recv($self._class())._sortedClasses_($self._classes());
  22630. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  22631. },
  22632. args: [],
  22633. 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",
  22634. referencedClasses: [],
  22635. messageSends: ["sortedClasses:", "class", "classes"]
  22636. }),
  22637. $globals.Package);
  22638. $core.addMethod(
  22639. $core.method({
  22640. selector: "sortedImportsAsArray",
  22641. protocol: "private",
  22642. fn: function (){
  22643. var self=this,$self=this;
  22644. return $core.withContext(function($ctx1) {
  22645. var $3,$2,$4,$1,$6,$5,$7;
  22646. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  22647. return $core.withContext(function($ctx2) {
  22648. $3=$recv(a)._isString();
  22649. $ctx2.sendIdx["isString"]=1;
  22650. $2=$recv($3)._not();
  22651. $4=$recv(b)._isString();
  22652. $ctx2.sendIdx["isString"]=2;
  22653. $1=$recv($2).__and($4);
  22654. return $recv($1)._or_((function(){
  22655. return $core.withContext(function($ctx3) {
  22656. $6=$recv(a)._isString();
  22657. $ctx3.sendIdx["isString"]=3;
  22658. $5=$recv($6).__eq($recv(b)._isString());
  22659. return $recv($5)._and_((function(){
  22660. return $core.withContext(function($ctx4) {
  22661. $7=$recv(a)._value();
  22662. $ctx4.sendIdx["value"]=1;
  22663. return $recv($7).__lt_eq($recv(b)._value());
  22664. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  22665. }));
  22666. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  22667. }));
  22668. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  22669. }));
  22670. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  22671. },
  22672. args: [],
  22673. 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 ]]]",
  22674. referencedClasses: [],
  22675. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  22676. }),
  22677. $globals.Package);
  22678. $core.addMethod(
  22679. $core.method({
  22680. selector: "traitCompositions",
  22681. protocol: "dependencies",
  22682. fn: function (){
  22683. var self=this,$self=this;
  22684. var traitCompositions;
  22685. return $core.withContext(function($ctx1) {
  22686. var $1,$2,$3,$receiver;
  22687. traitCompositions=$recv($globals.Dictionary)._new();
  22688. $recv($self._classes())._do_((function(each){
  22689. return $core.withContext(function($ctx2) {
  22690. $1=traitCompositions;
  22691. $2=$recv(each)._traitComposition();
  22692. $ctx2.sendIdx["traitComposition"]=1;
  22693. $recv($1)._at_put_(each,$2);
  22694. $ctx2.sendIdx["at:put:"]=1;
  22695. $3=$recv(each)._theMetaClass();
  22696. if(($receiver = $3) == null || $receiver.a$nil){
  22697. return $3;
  22698. } else {
  22699. var meta;
  22700. meta=$receiver;
  22701. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  22702. }
  22703. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22704. }));
  22705. return $recv(traitCompositions)._reject_((function(each){
  22706. return $core.withContext(function($ctx2) {
  22707. return $recv(each)._isEmpty();
  22708. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  22709. }));
  22710. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  22711. },
  22712. args: [],
  22713. 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 ]",
  22714. referencedClasses: ["Dictionary"],
  22715. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  22716. }),
  22717. $globals.Package);
  22718. $core.addMethod(
  22719. $core.method({
  22720. selector: "transport",
  22721. protocol: "accessing",
  22722. fn: function (){
  22723. var self=this,$self=this;
  22724. return $core.withContext(function($ctx1) {
  22725. var $1,$receiver;
  22726. $1=$self["@transport"];
  22727. if(($receiver = $1) == null || $receiver.a$nil){
  22728. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  22729. return $self["@transport"];
  22730. } else {
  22731. return $1;
  22732. }
  22733. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  22734. },
  22735. args: [],
  22736. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  22737. referencedClasses: ["PackageTransport"],
  22738. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  22739. }),
  22740. $globals.Package);
  22741. $core.addMethod(
  22742. $core.method({
  22743. selector: "transport:",
  22744. protocol: "accessing",
  22745. fn: function (aPackageTransport){
  22746. var self=this,$self=this;
  22747. return $core.withContext(function($ctx1) {
  22748. $self["@transport"]=aPackageTransport;
  22749. $recv(aPackageTransport)._package_(self);
  22750. return self;
  22751. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  22752. },
  22753. args: ["aPackageTransport"],
  22754. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  22755. referencedClasses: [],
  22756. messageSends: ["package:"]
  22757. }),
  22758. $globals.Package);
  22759. $core.addMethod(
  22760. $core.method({
  22761. selector: "validateImports:",
  22762. protocol: "validation",
  22763. fn: function (aCollection){
  22764. var self=this,$self=this;
  22765. return $core.withContext(function($ctx1) {
  22766. var $1,$2,$5,$4,$3,$6;
  22767. $recv(aCollection)._do_((function(import_){
  22768. return $core.withContext(function($ctx2) {
  22769. $1=$recv(import_)._isString();
  22770. $ctx2.sendIdx["isString"]=1;
  22771. if(!$core.assert($1)){
  22772. $2=$recv(import_)._respondsTo_("key");
  22773. if(!$core.assert($2)){
  22774. $self._error_("Imports must be Strings or Associations");
  22775. $ctx2.sendIdx["error:"]=1;
  22776. }
  22777. $5=$recv(import_)._key();
  22778. $ctx2.sendIdx["key"]=1;
  22779. $4=$recv($5)._isString();
  22780. $ctx2.sendIdx["isString"]=2;
  22781. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  22782. if(!$core.assert($3)){
  22783. $self._error_("Key and value must be Strings");
  22784. $ctx2.sendIdx["error:"]=2;
  22785. }
  22786. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  22787. if(!$core.assert($6)){
  22788. return $self._error_("Keys must be identifiers");
  22789. }
  22790. }
  22791. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  22792. }));
  22793. return self;
  22794. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  22795. },
  22796. args: ["aCollection"],
  22797. 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' ]]]",
  22798. referencedClasses: [],
  22799. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  22800. }),
  22801. $globals.Package);
  22802. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  22803. $core.addMethod(
  22804. $core.method({
  22805. selector: "named:",
  22806. protocol: "accessing",
  22807. fn: function (aPackageName){
  22808. var self=this,$self=this;
  22809. return $core.withContext(function($ctx1) {
  22810. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  22811. return $core.withContext(function($ctx2) {
  22812. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  22813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22814. }));
  22815. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  22816. },
  22817. args: ["aPackageName"],
  22818. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  22819. referencedClasses: ["Smalltalk"],
  22820. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  22821. }),
  22822. $globals.Package.a$cls);
  22823. $core.addMethod(
  22824. $core.method({
  22825. selector: "named:ifAbsent:",
  22826. protocol: "accessing",
  22827. fn: function (aPackageName,aBlock){
  22828. var self=this,$self=this;
  22829. return $core.withContext(function($ctx1) {
  22830. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  22831. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  22832. },
  22833. args: ["aPackageName", "aBlock"],
  22834. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  22835. referencedClasses: ["Smalltalk"],
  22836. messageSends: ["packageAt:ifAbsent:"]
  22837. }),
  22838. $globals.Package.a$cls);
  22839. $core.addMethod(
  22840. $core.method({
  22841. selector: "named:imports:transport:",
  22842. protocol: "accessing",
  22843. fn: function (aPackageName,anArray,aTransport){
  22844. var self=this,$self=this;
  22845. var pkg;
  22846. return $core.withContext(function($ctx1) {
  22847. pkg=$self._named_(aPackageName);
  22848. $recv(pkg)._imports_(anArray);
  22849. $recv(pkg)._transport_(aTransport);
  22850. return pkg;
  22851. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  22852. },
  22853. args: ["aPackageName", "anArray", "aTransport"],
  22854. 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",
  22855. referencedClasses: [],
  22856. messageSends: ["named:", "imports:", "transport:"]
  22857. }),
  22858. $globals.Package.a$cls);
  22859. $core.addMethod(
  22860. $core.method({
  22861. selector: "named:javaScriptDescriptor:",
  22862. protocol: "instance creation",
  22863. fn: function (aString,anObject){
  22864. var self=this,$self=this;
  22865. var pkg;
  22866. return $core.withContext(function($ctx1) {
  22867. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  22868. $recv(pkg)._javaScriptDescriptor_(anObject);
  22869. return pkg;
  22870. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg},$globals.Package.a$cls)});
  22871. },
  22872. args: ["aString", "anObject"],
  22873. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  22874. referencedClasses: ["Smalltalk"],
  22875. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  22876. }),
  22877. $globals.Package.a$cls);
  22878. $core.addMethod(
  22879. $core.method({
  22880. selector: "named:transport:",
  22881. protocol: "accessing",
  22882. fn: function (aPackageName,aTransport){
  22883. var self=this,$self=this;
  22884. var pkg;
  22885. return $core.withContext(function($ctx1) {
  22886. pkg=$self._named_(aPackageName);
  22887. $recv(pkg)._transport_(aTransport);
  22888. return pkg;
  22889. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  22890. },
  22891. args: ["aPackageName", "aTransport"],
  22892. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  22893. referencedClasses: [],
  22894. messageSends: ["named:", "transport:"]
  22895. }),
  22896. $globals.Package.a$cls);
  22897. $core.addMethod(
  22898. $core.method({
  22899. selector: "new:",
  22900. protocol: "instance creation",
  22901. fn: function (aString){
  22902. var self=this,$self=this;
  22903. return $core.withContext(function($ctx1) {
  22904. var $1;
  22905. $1=$recv($globals.Package)._new();
  22906. $recv($1)._name_(aString);
  22907. return $recv($1)._yourself();
  22908. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.Package.a$cls)});
  22909. },
  22910. args: ["aString"],
  22911. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  22912. referencedClasses: ["Package"],
  22913. messageSends: ["name:", "new", "yourself"]
  22914. }),
  22915. $globals.Package.a$cls);
  22916. $core.addMethod(
  22917. $core.method({
  22918. selector: "sortedClasses:",
  22919. protocol: "sorting",
  22920. fn: function (classes){
  22921. var self=this,$self=this;
  22922. var children,others,nodes,expandedClasses;
  22923. return $core.withContext(function($ctx1) {
  22924. var $1,$3,$2;
  22925. children=[];
  22926. others=[];
  22927. $recv(classes)._do_((function(each){
  22928. return $core.withContext(function($ctx2) {
  22929. $1=$recv(classes)._includes_($recv(each)._superclass());
  22930. if($core.assert($1)){
  22931. return $recv(others)._add_(each);
  22932. } else {
  22933. return $recv(children)._add_(each);
  22934. $ctx2.sendIdx["add:"]=1;
  22935. }
  22936. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22937. }));
  22938. $ctx1.sendIdx["do:"]=1;
  22939. nodes=$recv(children)._collect_((function(each){
  22940. return $core.withContext(function($ctx2) {
  22941. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  22942. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  22943. }));
  22944. nodes=$recv(nodes)._sorted_((function(a,b){
  22945. return $core.withContext(function($ctx2) {
  22946. $3=$recv(a)._theClass();
  22947. $ctx2.sendIdx["theClass"]=1;
  22948. $2=$recv($3)._name();
  22949. $ctx2.sendIdx["name"]=1;
  22950. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  22951. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  22952. }));
  22953. expandedClasses=$recv($globals.Array)._new();
  22954. $recv(nodes)._do_((function(aNode){
  22955. return $core.withContext(function($ctx2) {
  22956. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  22957. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  22958. }));
  22959. return expandedClasses;
  22960. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  22961. },
  22962. args: ["classes"],
  22963. 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",
  22964. referencedClasses: ["ClassSorterNode", "Array"],
  22965. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  22966. }),
  22967. $globals.Package.a$cls);
  22968. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  22969. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  22970. $core.addMethod(
  22971. $core.method({
  22972. selector: "announcer",
  22973. protocol: "accessing",
  22974. fn: function (){
  22975. var self=this,$self=this;
  22976. return $core.withContext(function($ctx1) {
  22977. return $recv($globals.SystemAnnouncer)._current();
  22978. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  22979. },
  22980. args: [],
  22981. source: "announcer\x0a\x09^ SystemAnnouncer current",
  22982. referencedClasses: ["SystemAnnouncer"],
  22983. messageSends: ["current"]
  22984. }),
  22985. $globals.PackageStateObserver);
  22986. $core.addMethod(
  22987. $core.method({
  22988. selector: "observeSystem",
  22989. protocol: "actions",
  22990. fn: function (){
  22991. var self=this,$self=this;
  22992. return $core.withContext(function($ctx1) {
  22993. var $1;
  22994. $1=$self._announcer();
  22995. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  22996. $ctx1.sendIdx["on:send:to:"]=1;
  22997. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  22998. $ctx1.sendIdx["on:send:to:"]=2;
  22999. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  23000. $ctx1.sendIdx["on:send:to:"]=3;
  23001. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  23002. return self;
  23003. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  23004. },
  23005. args: [],
  23006. 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",
  23007. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  23008. messageSends: ["on:send:to:", "announcer"]
  23009. }),
  23010. $globals.PackageStateObserver);
  23011. $core.addMethod(
  23012. $core.method({
  23013. selector: "onClassModification:",
  23014. protocol: "reactions",
  23015. fn: function (anAnnouncement){
  23016. var self=this,$self=this;
  23017. return $core.withContext(function($ctx1) {
  23018. var $1,$receiver;
  23019. $1=$recv(anAnnouncement)._theClass();
  23020. if(($receiver = $1) == null || $receiver.a$nil){
  23021. $1;
  23022. } else {
  23023. var theClass;
  23024. theClass=$receiver;
  23025. $recv($recv(theClass)._package())._beDirty();
  23026. }
  23027. return self;
  23028. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23029. },
  23030. args: ["anAnnouncement"],
  23031. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  23032. referencedClasses: [],
  23033. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  23034. }),
  23035. $globals.PackageStateObserver);
  23036. $core.addMethod(
  23037. $core.method({
  23038. selector: "onMethodModification:",
  23039. protocol: "reactions",
  23040. fn: function (anAnnouncement){
  23041. var self=this,$self=this;
  23042. return $core.withContext(function($ctx1) {
  23043. var $1,$receiver;
  23044. $1=$recv($recv(anAnnouncement)._method())._package();
  23045. if(($receiver = $1) == null || $receiver.a$nil){
  23046. $1;
  23047. } else {
  23048. var package_;
  23049. package_=$receiver;
  23050. $recv(package_)._beDirty();
  23051. }
  23052. return self;
  23053. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23054. },
  23055. args: ["anAnnouncement"],
  23056. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  23057. referencedClasses: [],
  23058. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  23059. }),
  23060. $globals.PackageStateObserver);
  23061. $core.addMethod(
  23062. $core.method({
  23063. selector: "onPackageAdded:",
  23064. protocol: "reactions",
  23065. fn: function (anAnnouncement){
  23066. var self=this,$self=this;
  23067. return $core.withContext(function($ctx1) {
  23068. $recv($recv(anAnnouncement)._package())._beDirty();
  23069. return self;
  23070. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23071. },
  23072. args: ["anAnnouncement"],
  23073. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  23074. referencedClasses: [],
  23075. messageSends: ["beDirty", "package"]
  23076. }),
  23077. $globals.PackageStateObserver);
  23078. $core.addMethod(
  23079. $core.method({
  23080. selector: "onProtocolModification:",
  23081. protocol: "reactions",
  23082. fn: function (anAnnouncement){
  23083. var self=this,$self=this;
  23084. return $core.withContext(function($ctx1) {
  23085. var $1,$receiver;
  23086. $1=$recv(anAnnouncement)._package();
  23087. if(($receiver = $1) == null || $receiver.a$nil){
  23088. $1;
  23089. } else {
  23090. var package_;
  23091. package_=$receiver;
  23092. $recv(package_)._beDirty();
  23093. }
  23094. return self;
  23095. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23096. },
  23097. args: ["anAnnouncement"],
  23098. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  23099. referencedClasses: [],
  23100. messageSends: ["ifNotNil:", "package", "beDirty"]
  23101. }),
  23102. $globals.PackageStateObserver);
  23103. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  23104. $core.addMethod(
  23105. $core.method({
  23106. selector: "current",
  23107. protocol: "accessing",
  23108. fn: function (){
  23109. var self=this,$self=this;
  23110. return $core.withContext(function($ctx1) {
  23111. var $1,$receiver;
  23112. $1=$self["@current"];
  23113. if(($receiver = $1) == null || $receiver.a$nil){
  23114. $self["@current"]=$self._new();
  23115. return $self["@current"];
  23116. } else {
  23117. return $1;
  23118. }
  23119. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  23120. },
  23121. args: [],
  23122. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  23123. referencedClasses: [],
  23124. messageSends: ["ifNil:", "new"]
  23125. }),
  23126. $globals.PackageStateObserver.a$cls);
  23127. $core.addMethod(
  23128. $core.method({
  23129. selector: "initialize",
  23130. protocol: "initialization",
  23131. fn: function (){
  23132. var self=this,$self=this;
  23133. return $core.withContext(function($ctx1) {
  23134. $recv($self._current())._observeSystem();
  23135. return self;
  23136. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  23137. },
  23138. args: [],
  23139. source: "initialize\x0a\x09self current observeSystem",
  23140. referencedClasses: [],
  23141. messageSends: ["observeSystem", "current"]
  23142. }),
  23143. $globals.PackageStateObserver.a$cls);
  23144. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  23145. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  23146. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  23147. $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`";
  23148. $core.addMethod(
  23149. $core.method({
  23150. selector: "defaultValue",
  23151. protocol: "accessing",
  23152. fn: function (){
  23153. var self=this,$self=this;
  23154. return $self["@defaultValue"];
  23155. },
  23156. args: [],
  23157. source: "defaultValue\x0a\x09^ defaultValue",
  23158. referencedClasses: [],
  23159. messageSends: []
  23160. }),
  23161. $globals.Setting);
  23162. $core.addMethod(
  23163. $core.method({
  23164. selector: "defaultValue:",
  23165. protocol: "accessing",
  23166. fn: function (aStringifiableObject){
  23167. var self=this,$self=this;
  23168. $self["@defaultValue"]=aStringifiableObject;
  23169. return self;
  23170. },
  23171. args: ["aStringifiableObject"],
  23172. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  23173. referencedClasses: [],
  23174. messageSends: []
  23175. }),
  23176. $globals.Setting);
  23177. $core.addMethod(
  23178. $core.method({
  23179. selector: "key",
  23180. protocol: "accessing",
  23181. fn: function (){
  23182. var self=this,$self=this;
  23183. return $self["@key"];
  23184. },
  23185. args: [],
  23186. source: "key\x0a\x09^ key",
  23187. referencedClasses: [],
  23188. messageSends: []
  23189. }),
  23190. $globals.Setting);
  23191. $core.addMethod(
  23192. $core.method({
  23193. selector: "key:",
  23194. protocol: "accessing",
  23195. fn: function (aString){
  23196. var self=this,$self=this;
  23197. $self["@key"]=aString;
  23198. return self;
  23199. },
  23200. args: ["aString"],
  23201. source: "key: aString\x0a\x09key := aString",
  23202. referencedClasses: [],
  23203. messageSends: []
  23204. }),
  23205. $globals.Setting);
  23206. $core.addMethod(
  23207. $core.method({
  23208. selector: "value",
  23209. protocol: "accessing",
  23210. fn: function (){
  23211. var self=this,$self=this;
  23212. return $core.withContext(function($ctx1) {
  23213. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  23214. return $core.withContext(function($ctx2) {
  23215. return $self._defaultValue();
  23216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23217. }));
  23218. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  23219. },
  23220. args: [],
  23221. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  23222. referencedClasses: ["Smalltalk"],
  23223. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  23224. }),
  23225. $globals.Setting);
  23226. $core.addMethod(
  23227. $core.method({
  23228. selector: "value:",
  23229. protocol: "accessing",
  23230. fn: function (aStringifiableObject){
  23231. var self=this,$self=this;
  23232. return $core.withContext(function($ctx1) {
  23233. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  23234. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  23235. },
  23236. args: ["aStringifiableObject"],
  23237. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  23238. referencedClasses: ["Smalltalk"],
  23239. messageSends: ["at:put:", "settings", "key"]
  23240. }),
  23241. $globals.Setting);
  23242. $core.addMethod(
  23243. $core.method({
  23244. selector: "at:ifAbsent:",
  23245. protocol: "instance creation",
  23246. fn: function (aString,aDefaultValue){
  23247. var self=this,$self=this;
  23248. return $core.withContext(function($ctx1) {
  23249. var $1;
  23250. $1=(
  23251. $ctx1.supercall = true,
  23252. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  23253. $ctx1.supercall = false;
  23254. $recv($1)._key_(aString);
  23255. $recv($1)._defaultValue_(aDefaultValue);
  23256. return $recv($1)._yourself();
  23257. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  23258. },
  23259. args: ["aString", "aDefaultValue"],
  23260. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  23261. referencedClasses: [],
  23262. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  23263. }),
  23264. $globals.Setting.a$cls);
  23265. $core.addMethod(
  23266. $core.method({
  23267. selector: "new",
  23268. protocol: "instance creation",
  23269. fn: function (){
  23270. var self=this,$self=this;
  23271. return $core.withContext(function($ctx1) {
  23272. $self._shouldNotImplement();
  23273. return self;
  23274. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  23275. },
  23276. args: [],
  23277. source: "new\x0a\x09self shouldNotImplement",
  23278. referencedClasses: [],
  23279. messageSends: ["shouldNotImplement"]
  23280. }),
  23281. $globals.Setting.a$cls);
  23282. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  23283. $globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `$core` declared in `base/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 `base/parser.js` parser file in order to work.";
  23284. $core.addMethod(
  23285. $core.method({
  23286. selector: "addGlobalJsVariable:",
  23287. protocol: "globals",
  23288. fn: function (aString){
  23289. var self=this,$self=this;
  23290. return $core.withContext(function($ctx1) {
  23291. $recv($self._globalJsVariables())._add_(aString);
  23292. return self;
  23293. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23294. },
  23295. args: ["aString"],
  23296. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  23297. referencedClasses: [],
  23298. messageSends: ["add:", "globalJsVariables"]
  23299. }),
  23300. $globals.SmalltalkImage);
  23301. $core.addMethod(
  23302. $core.method({
  23303. selector: "adoptPackageDescriptors",
  23304. protocol: "private",
  23305. fn: function (){
  23306. var self=this,$self=this;
  23307. var pkgs;
  23308. return $core.withContext(function($ctx1) {
  23309. pkgs=$recv($globals.Set)._new();
  23310. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  23311. return $core.withContext(function($ctx2) {
  23312. return $recv(pkgs)._add_($recv($globals.Package)._named_javaScriptDescriptor_(key,value));
  23313. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23314. }));
  23315. return pkgs;
  23316. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDescriptors",{pkgs:pkgs},$globals.SmalltalkImage)});
  23317. },
  23318. args: [],
  23319. source: "adoptPackageDescriptors\x0a\x09| pkgs |\x0a\x09pkgs := Set new.\x0a\x09self core packageDescriptors keysAndValuesDo: [ :key :value |\x0a\x09\x09pkgs add: (Package named: key javaScriptDescriptor: value) ].\x0a\x09^ pkgs",
  23320. referencedClasses: ["Set", "Package"],
  23321. messageSends: ["new", "keysAndValuesDo:", "packageDescriptors", "core", "add:", "named:javaScriptDescriptor:"]
  23322. }),
  23323. $globals.SmalltalkImage);
  23324. $core.addMethod(
  23325. $core.method({
  23326. selector: "amdRequire",
  23327. protocol: "accessing amd",
  23328. fn: function (){
  23329. var self=this,$self=this;
  23330. return $core.withContext(function($ctx1) {
  23331. return $recv($self._core())._at_("amdRequire");
  23332. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  23333. },
  23334. args: [],
  23335. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  23336. referencedClasses: [],
  23337. messageSends: ["at:", "core"]
  23338. }),
  23339. $globals.SmalltalkImage);
  23340. $core.addMethod(
  23341. $core.method({
  23342. selector: "asSmalltalkException:",
  23343. protocol: "error handling",
  23344. fn: function (anObject){
  23345. var self=this,$self=this;
  23346. return $core.withContext(function($ctx1) {
  23347. var $1;
  23348. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  23349. return $core.withContext(function($ctx2) {
  23350. return $recv(anObject)._isKindOf_($globals.Error);
  23351. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23352. }));
  23353. if($core.assert($1)){
  23354. return anObject;
  23355. } else {
  23356. return $recv($globals.JavaScriptException)._on_(anObject);
  23357. }
  23358. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  23359. },
  23360. args: ["anObject"],
  23361. 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 ]",
  23362. referencedClasses: ["Error", "JavaScriptException"],
  23363. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  23364. }),
  23365. $globals.SmalltalkImage);
  23366. $core.addMethod(
  23367. $core.method({
  23368. selector: "basicCreatePackage:",
  23369. protocol: "private",
  23370. fn: function (packageName){
  23371. var self=this,$self=this;
  23372. return $core.withContext(function($ctx1) {
  23373. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  23374. return $core.withContext(function($ctx2) {
  23375. return $recv($globals.Package)._new_(packageName);
  23376. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23377. }));
  23378. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  23379. },
  23380. args: ["packageName"],
  23381. 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 ]",
  23382. referencedClasses: ["Package"],
  23383. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  23384. }),
  23385. $globals.SmalltalkImage);
  23386. $core.addMethod(
  23387. $core.method({
  23388. selector: "basicParse:",
  23389. protocol: "private",
  23390. fn: function (aString){
  23391. var self=this,$self=this;
  23392. return $core.withContext(function($ctx1) {
  23393. return $recv($globals.SmalltalkParser)._parse_(aString);
  23394. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  23395. },
  23396. args: ["aString"],
  23397. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  23398. referencedClasses: ["SmalltalkParser"],
  23399. messageSends: ["parse:"]
  23400. }),
  23401. $globals.SmalltalkImage);
  23402. $core.addMethod(
  23403. $core.method({
  23404. selector: "cancelOptOut:",
  23405. protocol: "accessing",
  23406. fn: function (anObject){
  23407. var self=this,$self=this;
  23408. return $core.withContext(function($ctx1) {
  23409. delete anObject.klass; delete anObject.a$cls;;
  23410. return self;
  23411. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23412. },
  23413. args: ["anObject"],
  23414. 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;'>",
  23415. referencedClasses: [],
  23416. messageSends: []
  23417. }),
  23418. $globals.SmalltalkImage);
  23419. $core.addMethod(
  23420. $core.method({
  23421. selector: "classes",
  23422. protocol: "classes",
  23423. fn: function (){
  23424. var self=this,$self=this;
  23425. return $core.withContext(function($ctx1) {
  23426. return $recv($recv($self._core())._traitsOrClasses())._copy();
  23427. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  23428. },
  23429. args: [],
  23430. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  23431. referencedClasses: [],
  23432. messageSends: ["copy", "traitsOrClasses", "core"]
  23433. }),
  23434. $globals.SmalltalkImage);
  23435. $core.addMethod(
  23436. $core.method({
  23437. selector: "core",
  23438. protocol: "accessing",
  23439. fn: function (){
  23440. var self=this,$self=this;
  23441. return $core.withContext(function($ctx1) {
  23442. return $core;
  23443. return self;
  23444. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  23445. },
  23446. args: [],
  23447. source: "core\x0a\x09<inlineJS: 'return $core'>",
  23448. referencedClasses: [],
  23449. messageSends: []
  23450. }),
  23451. $globals.SmalltalkImage);
  23452. $core.addMethod(
  23453. $core.method({
  23454. selector: "createPackage:",
  23455. protocol: "packages",
  23456. fn: function (packageName){
  23457. var self=this,$self=this;
  23458. var package_,announcement;
  23459. return $core.withContext(function($ctx1) {
  23460. var $1;
  23461. package_=$self._basicCreatePackage_(packageName);
  23462. $1=$recv($globals.PackageAdded)._new();
  23463. $recv($1)._package_(package_);
  23464. announcement=$recv($1)._yourself();
  23465. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  23466. return package_;
  23467. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  23468. },
  23469. args: ["packageName"],
  23470. 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",
  23471. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  23472. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  23473. }),
  23474. $globals.SmalltalkImage);
  23475. $core.addMethod(
  23476. $core.method({
  23477. selector: "defaultAmdNamespace",
  23478. protocol: "accessing amd",
  23479. fn: function (){
  23480. var self=this,$self=this;
  23481. return $core.withContext(function($ctx1) {
  23482. return "transport.defaultAmdNamespace"._settingValue();
  23483. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  23484. },
  23485. args: [],
  23486. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  23487. referencedClasses: [],
  23488. messageSends: ["settingValue"]
  23489. }),
  23490. $globals.SmalltalkImage);
  23491. $core.addMethod(
  23492. $core.method({
  23493. selector: "defaultAmdNamespace:",
  23494. protocol: "accessing amd",
  23495. fn: function (aString){
  23496. var self=this,$self=this;
  23497. return $core.withContext(function($ctx1) {
  23498. "transport.defaultAmdNamespace"._settingValue_(aString);
  23499. return self;
  23500. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  23501. },
  23502. args: ["aString"],
  23503. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  23504. referencedClasses: [],
  23505. messageSends: ["settingValue:"]
  23506. }),
  23507. $globals.SmalltalkImage);
  23508. $core.addMethod(
  23509. $core.method({
  23510. selector: "deleteClass:",
  23511. protocol: "private",
  23512. fn: function (aClass){
  23513. var self=this,$self=this;
  23514. return $core.withContext(function($ctx1) {
  23515. $core.removeClass(aClass);
  23516. return self;
  23517. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23518. },
  23519. args: ["aClass"],
  23520. 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)'>",
  23521. referencedClasses: [],
  23522. messageSends: []
  23523. }),
  23524. $globals.SmalltalkImage);
  23525. $core.addMethod(
  23526. $core.method({
  23527. selector: "deleteGlobalJsVariable:",
  23528. protocol: "globals",
  23529. fn: function (aString){
  23530. var self=this,$self=this;
  23531. return $core.withContext(function($ctx1) {
  23532. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  23533. }));
  23534. return self;
  23535. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23536. },
  23537. args: ["aString"],
  23538. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  23539. referencedClasses: [],
  23540. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  23541. }),
  23542. $globals.SmalltalkImage);
  23543. $core.addMethod(
  23544. $core.method({
  23545. selector: "existsJsGlobal:",
  23546. protocol: "testing",
  23547. fn: function (aString){
  23548. var self=this,$self=this;
  23549. return $core.withContext(function($ctx1) {
  23550. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  23551. return $recv($globals.Platform)._includesGlobal_(aString);
  23552. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  23553. },
  23554. args: ["aString"],
  23555. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  23556. referencedClasses: ["Platform"],
  23557. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  23558. }),
  23559. $globals.SmalltalkImage);
  23560. $core.addMethod(
  23561. $core.method({
  23562. selector: "globalJsVariables",
  23563. protocol: "globals",
  23564. fn: function (){
  23565. var self=this,$self=this;
  23566. return $core.withContext(function($ctx1) {
  23567. var $1,$receiver;
  23568. $1=$self["@globalJsVariables"];
  23569. if(($receiver = $1) == null || $receiver.a$nil){
  23570. $self["@globalJsVariables"]=["window", "document", "process", "global"];
  23571. return $self["@globalJsVariables"];
  23572. } else {
  23573. return $1;
  23574. }
  23575. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  23576. },
  23577. args: [],
  23578. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  23579. referencedClasses: [],
  23580. messageSends: ["ifNil:"]
  23581. }),
  23582. $globals.SmalltalkImage);
  23583. $core.addMethod(
  23584. $core.method({
  23585. selector: "globals",
  23586. protocol: "accessing",
  23587. fn: function (){
  23588. var self=this,$self=this;
  23589. return $core.withContext(function($ctx1) {
  23590. return $globals;
  23591. return self;
  23592. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  23593. },
  23594. args: [],
  23595. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  23596. referencedClasses: [],
  23597. messageSends: []
  23598. }),
  23599. $globals.SmalltalkImage);
  23600. $core.addMethod(
  23601. $core.method({
  23602. selector: "includesKey:",
  23603. protocol: "accessing",
  23604. fn: function (aKey){
  23605. var self=this,$self=this;
  23606. return $core.withContext(function($ctx1) {
  23607. return $core.hasOwnProperty(aKey);
  23608. return self;
  23609. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  23610. },
  23611. args: ["aKey"],
  23612. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  23613. referencedClasses: [],
  23614. messageSends: []
  23615. }),
  23616. $globals.SmalltalkImage);
  23617. $core.addMethod(
  23618. $core.method({
  23619. selector: "isSmalltalkObject:",
  23620. protocol: "testing",
  23621. fn: function (anObject){
  23622. var self=this,$self=this;
  23623. return $core.withContext(function($ctx1) {
  23624. return anObject.a$cls != null;
  23625. return self;
  23626. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23627. },
  23628. args: ["anObject"],
  23629. 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'>",
  23630. referencedClasses: [],
  23631. messageSends: []
  23632. }),
  23633. $globals.SmalltalkImage);
  23634. $core.addMethod(
  23635. $core.method({
  23636. selector: "optOut:",
  23637. protocol: "accessing",
  23638. fn: function (anObject){
  23639. var self=this,$self=this;
  23640. return $core.withContext(function($ctx1) {
  23641. anObject.klass = null; anObject.a$cls = null;
  23642. return self;
  23643. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23644. },
  23645. args: ["anObject"],
  23646. 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'>",
  23647. referencedClasses: [],
  23648. messageSends: []
  23649. }),
  23650. $globals.SmalltalkImage);
  23651. $core.addMethod(
  23652. $core.method({
  23653. selector: "packageAt:ifAbsent:",
  23654. protocol: "packages",
  23655. fn: function (packageName,aBlock){
  23656. var self=this,$self=this;
  23657. return $core.withContext(function($ctx1) {
  23658. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  23659. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23660. },
  23661. args: ["packageName", "aBlock"],
  23662. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  23663. referencedClasses: [],
  23664. messageSends: ["at:ifAbsent:", "packageDictionary"]
  23665. }),
  23666. $globals.SmalltalkImage);
  23667. $core.addMethod(
  23668. $core.method({
  23669. selector: "packageAt:ifPresent:",
  23670. protocol: "packages",
  23671. fn: function (packageName,aBlock){
  23672. var self=this,$self=this;
  23673. return $core.withContext(function($ctx1) {
  23674. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  23675. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23676. },
  23677. args: ["packageName", "aBlock"],
  23678. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  23679. referencedClasses: [],
  23680. messageSends: ["at:ifPresent:", "packageDictionary"]
  23681. }),
  23682. $globals.SmalltalkImage);
  23683. $core.addMethod(
  23684. $core.method({
  23685. selector: "packageDictionary",
  23686. protocol: "packages",
  23687. fn: function (){
  23688. var self=this,$self=this;
  23689. return $core.withContext(function($ctx1) {
  23690. var $1,$receiver;
  23691. $1=$self["@packageDictionary"];
  23692. if(($receiver = $1) == null || $receiver.a$nil){
  23693. $self["@packageDictionary"]=$recv($globals.Dictionary)._new();
  23694. return $self["@packageDictionary"];
  23695. } else {
  23696. return $1;
  23697. }
  23698. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  23699. },
  23700. args: [],
  23701. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  23702. referencedClasses: ["Dictionary"],
  23703. messageSends: ["ifNil:", "new"]
  23704. }),
  23705. $globals.SmalltalkImage);
  23706. $core.addMethod(
  23707. $core.method({
  23708. selector: "packages",
  23709. protocol: "packages",
  23710. fn: function (){
  23711. var self=this,$self=this;
  23712. return $core.withContext(function($ctx1) {
  23713. return $recv($recv($self._packageDictionary())._values())._copy();
  23714. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  23715. },
  23716. args: [],
  23717. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  23718. referencedClasses: [],
  23719. messageSends: ["copy", "values", "packageDictionary"]
  23720. }),
  23721. $globals.SmalltalkImage);
  23722. $core.addMethod(
  23723. $core.method({
  23724. selector: "parse:",
  23725. protocol: "accessing",
  23726. fn: function (aString){
  23727. var self=this,$self=this;
  23728. var result;
  23729. return $core.withContext(function($ctx1) {
  23730. var $1;
  23731. $recv((function(){
  23732. return $core.withContext(function($ctx2) {
  23733. result=$self._basicParse_(aString);
  23734. return result;
  23735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23736. }))._tryCatch_((function(ex){
  23737. return $core.withContext(function($ctx2) {
  23738. return $recv($self._parseError_parsing_(ex,aString))._signal();
  23739. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  23740. }));
  23741. $1=result;
  23742. $recv($1)._source_(aString);
  23743. return $recv($1)._yourself();
  23744. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  23745. },
  23746. args: ["aString"],
  23747. 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",
  23748. referencedClasses: [],
  23749. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  23750. }),
  23751. $globals.SmalltalkImage);
  23752. $core.addMethod(
  23753. $core.method({
  23754. selector: "parseError:parsing:",
  23755. protocol: "error handling",
  23756. fn: function (anException,aString){
  23757. var self=this,$self=this;
  23758. return $core.withContext(function($ctx1) {
  23759. var $1,$2,$9,$8,$7,$6,$5,$4,$3,$receiver;
  23760. $1=$recv(anException)._basicAt_("location");
  23761. $ctx1.sendIdx["basicAt:"]=1;
  23762. if(($receiver = $1) == null || $receiver.a$nil){
  23763. return $recv(anException)._pass();
  23764. } else {
  23765. var loc;
  23766. loc=$receiver;
  23767. $2=$recv($globals.ParseError)._new();
  23768. $9=$recv(loc)._start();
  23769. $ctx1.sendIdx["start"]=1;
  23770. $8=$recv($9)._line();
  23771. $7="Parse error on line ".__comma($8);
  23772. $6=$recv($7).__comma(" column ");
  23773. $ctx1.sendIdx[","]=4;
  23774. $5=$recv($6).__comma($recv($recv(loc)._start())._column());
  23775. $ctx1.sendIdx[","]=3;
  23776. $4=$recv($5).__comma(" : Unexpected character ");
  23777. $ctx1.sendIdx[","]=2;
  23778. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  23779. $ctx1.sendIdx[","]=1;
  23780. $recv($2)._messageText_($3);
  23781. return $recv($2)._yourself();
  23782. }
  23783. return self;
  23784. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  23785. },
  23786. args: ["anException", "aString"],
  23787. source: "parseError: anException parsing: aString\x0a\x09(anException basicAt: 'location')\x0a\x09\x09ifNil: [ ^ anException pass ]\x0a\x09\x09ifNotNil: [ :loc |\x0a\x09\x09\x09^ ParseError new \x0a\x09\x09\x09\x09messageText: \x0a\x09\x09\x09\x09\x09'Parse error on line ', loc start line ,\x0a\x09\x09\x09\x09\x09' column ' , loc start column ,\x0a\x09\x09\x09\x09\x09' : Unexpected character ', (anException basicAt: 'found');\x0a\x09\x09\x09\x09yourself ]",
  23788. referencedClasses: ["ParseError"],
  23789. messageSends: ["ifNil:ifNotNil:", "basicAt:", "pass", "messageText:", "new", ",", "line", "start", "column", "yourself"]
  23790. }),
  23791. $globals.SmalltalkImage);
  23792. $core.addMethod(
  23793. $core.method({
  23794. selector: "postLoad",
  23795. protocol: "image",
  23796. fn: function (){
  23797. var self=this,$self=this;
  23798. var pkgs,classes;
  23799. return $core.withContext(function($ctx1) {
  23800. var $1;
  23801. pkgs=$self._adoptPackageDescriptors();
  23802. $recv(pkgs)._do_("beClean");
  23803. $ctx1.sendIdx["do:"]=1;
  23804. classes=$recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  23805. return $core.withContext(function($ctx2) {
  23806. return $recv(pkgs)._includes_($recv(each)._package());
  23807. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23808. }));
  23809. $recv(classes)._do_((function(each){
  23810. return $core.withContext(function($ctx2) {
  23811. $1=$recv(each).__eq($self._class());
  23812. if(!$core.assert($1)){
  23813. return $recv(each)._initialize();
  23814. }
  23815. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  23816. }));
  23817. $self._sweepPackageDescriptors_(pkgs);
  23818. return self;
  23819. }, function($ctx1) {$ctx1.fill(self,"postLoad",{pkgs:pkgs,classes:classes},$globals.SmalltalkImage)});
  23820. },
  23821. args: [],
  23822. source: "postLoad\x0a\x09| pkgs classes |\x0a\x09pkgs := self adoptPackageDescriptors.\x0a\x09pkgs do: #beClean.\x0a\x09classes := Smalltalk classes select:\x0a\x09\x09[ :each | pkgs includes: each package ].\x0a\x09classes do: [ :each |\x0a\x09\x09each = self class ifFalse: [ each initialize ] ].\x0a\x09self sweepPackageDescriptors: pkgs",
  23823. referencedClasses: ["Smalltalk"],
  23824. messageSends: ["adoptPackageDescriptors", "do:", "select:", "classes", "includes:", "package", "ifFalse:", "=", "class", "initialize", "sweepPackageDescriptors:"]
  23825. }),
  23826. $globals.SmalltalkImage);
  23827. $core.addMethod(
  23828. $core.method({
  23829. selector: "pseudoVariableNames",
  23830. protocol: "accessing",
  23831. fn: function (){
  23832. var self=this,$self=this;
  23833. return ["self", "super", "nil", "true", "false", "thisContext"];
  23834. },
  23835. args: [],
  23836. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  23837. referencedClasses: [],
  23838. messageSends: []
  23839. }),
  23840. $globals.SmalltalkImage);
  23841. $core.addMethod(
  23842. $core.method({
  23843. selector: "readJSObject:",
  23844. protocol: "accessing",
  23845. fn: function (anObject){
  23846. var self=this,$self=this;
  23847. return $core.withContext(function($ctx1) {
  23848. return $core.readJSObject(anObject);
  23849. return self;
  23850. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23851. },
  23852. args: ["anObject"],
  23853. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  23854. referencedClasses: [],
  23855. messageSends: []
  23856. }),
  23857. $globals.SmalltalkImage);
  23858. $core.addMethod(
  23859. $core.method({
  23860. selector: "removeClass:",
  23861. protocol: "classes",
  23862. fn: function (aClass){
  23863. var self=this,$self=this;
  23864. return $core.withContext(function($ctx1) {
  23865. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  23866. $1=$recv(aClass)._isMetaclass();
  23867. if($core.assert($1)){
  23868. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  23869. $ctx1.sendIdx[","]=1;
  23870. $self._error_($2);
  23871. $ctx1.sendIdx["error:"]=1;
  23872. }
  23873. $recv(aClass)._allSubclassesDo_((function(subclass){
  23874. return $core.withContext(function($ctx2) {
  23875. $5=$recv(aClass)._name();
  23876. $ctx2.sendIdx["name"]=1;
  23877. $4=$recv($5).__comma(" has a subclass: ");
  23878. $ctx2.sendIdx[","]=3;
  23879. $6=$recv(subclass)._name();
  23880. $ctx2.sendIdx["name"]=2;
  23881. $3=$recv($4).__comma($6);
  23882. $ctx2.sendIdx[","]=2;
  23883. return $self._error_($3);
  23884. $ctx2.sendIdx["error:"]=2;
  23885. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  23886. }));
  23887. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  23888. return $core.withContext(function($ctx2) {
  23889. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  23890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  23891. }));
  23892. $self._deleteClass_(aClass);
  23893. $recv(aClass)._setTraitComposition_([]);
  23894. $ctx1.sendIdx["setTraitComposition:"]=1;
  23895. $7=$recv(aClass)._theMetaClass();
  23896. if(($receiver = $7) == null || $receiver.a$nil){
  23897. $7;
  23898. } else {
  23899. var meta;
  23900. meta=$receiver;
  23901. $recv(meta)._setTraitComposition_([]);
  23902. }
  23903. $8=$recv($globals.SystemAnnouncer)._current();
  23904. $10=$recv($globals.ClassRemoved)._new();
  23905. $recv($10)._theClass_(aClass);
  23906. $9=$recv($10)._yourself();
  23907. $recv($8)._announce_($9);
  23908. return self;
  23909. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23910. },
  23911. args: ["aClass"],
  23912. 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)",
  23913. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  23914. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  23915. }),
  23916. $globals.SmalltalkImage);
  23917. $core.addMethod(
  23918. $core.method({
  23919. selector: "removePackage:",
  23920. protocol: "packages",
  23921. fn: function (packageName){
  23922. var self=this,$self=this;
  23923. var pkg;
  23924. return $core.withContext(function($ctx1) {
  23925. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  23926. return $core.withContext(function($ctx2) {
  23927. return $self._error_("Missing package: ".__comma(packageName));
  23928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23929. }));
  23930. $recv($recv(pkg)._classes())._do_((function(each){
  23931. return $core.withContext(function($ctx2) {
  23932. return $self._removeClass_(each);
  23933. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  23934. }));
  23935. $recv($self._packageDictionary())._removeKey_(packageName);
  23936. return self;
  23937. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  23938. },
  23939. args: ["packageName"],
  23940. 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",
  23941. referencedClasses: [],
  23942. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  23943. }),
  23944. $globals.SmalltalkImage);
  23945. $core.addMethod(
  23946. $core.method({
  23947. selector: "renamePackage:to:",
  23948. protocol: "packages",
  23949. fn: function (packageName,newName){
  23950. var self=this,$self=this;
  23951. var pkg;
  23952. return $core.withContext(function($ctx1) {
  23953. var $1,$2,$3;
  23954. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  23955. return $core.withContext(function($ctx2) {
  23956. $1="Missing package: ".__comma(packageName);
  23957. $ctx2.sendIdx[","]=1;
  23958. return $self._error_($1);
  23959. $ctx2.sendIdx["error:"]=1;
  23960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23961. }));
  23962. $self._packageAt_ifPresent_(newName,(function(){
  23963. return $core.withContext(function($ctx2) {
  23964. return $self._error_("Already exists a package called: ".__comma(newName));
  23965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  23966. }));
  23967. $2=pkg;
  23968. $recv($2)._name_(newName);
  23969. $recv($2)._beDirty();
  23970. $3=$self._packageDictionary();
  23971. $recv($3)._at_put_(newName,pkg);
  23972. $recv($3)._removeKey_(packageName);
  23973. return self;
  23974. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  23975. },
  23976. args: ["packageName", "newName"],
  23977. 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",
  23978. referencedClasses: [],
  23979. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  23980. }),
  23981. $globals.SmalltalkImage);
  23982. $core.addMethod(
  23983. $core.method({
  23984. selector: "reservedWords",
  23985. protocol: "accessing",
  23986. fn: function (){
  23987. var self=this,$self=this;
  23988. 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"];
  23989. },
  23990. args: [],
  23991. 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)",
  23992. referencedClasses: [],
  23993. messageSends: []
  23994. }),
  23995. $globals.SmalltalkImage);
  23996. $core.addMethod(
  23997. $core.method({
  23998. selector: "settings",
  23999. protocol: "accessing",
  24000. fn: function (){
  24001. var self=this,$self=this;
  24002. return $globals.SmalltalkSettings;
  24003. },
  24004. args: [],
  24005. source: "settings\x0a\x09^ SmalltalkSettings",
  24006. referencedClasses: ["SmalltalkSettings"],
  24007. messageSends: []
  24008. }),
  24009. $globals.SmalltalkImage);
  24010. $core.addMethod(
  24011. $core.method({
  24012. selector: "sweepPackageDescriptors:",
  24013. protocol: "private",
  24014. fn: function (pkgs){
  24015. var self=this,$self=this;
  24016. var pd;
  24017. return $core.withContext(function($ctx1) {
  24018. pd=$recv($self._core())._packageDescriptors();
  24019. $recv(pkgs)._do_((function(each){
  24020. return $core.withContext(function($ctx2) {
  24021. return $recv(pd)._removeKey_($recv(each)._name());
  24022. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24023. }));
  24024. return self;
  24025. }, function($ctx1) {$ctx1.fill(self,"sweepPackageDescriptors:",{pkgs:pkgs,pd:pd},$globals.SmalltalkImage)});
  24026. },
  24027. args: ["pkgs"],
  24028. source: "sweepPackageDescriptors: pkgs\x0a\x09| pd |\x09\x0a\x09pd := self core packageDescriptors.\x0a\x09pkgs do: [ :each | pd removeKey: each name ]",
  24029. referencedClasses: [],
  24030. messageSends: ["packageDescriptors", "core", "do:", "removeKey:", "name"]
  24031. }),
  24032. $globals.SmalltalkImage);
  24033. $core.addMethod(
  24034. $core.method({
  24035. selector: "version",
  24036. protocol: "accessing",
  24037. fn: function (){
  24038. var self=this,$self=this;
  24039. return "0.22.4";
  24040. },
  24041. args: [],
  24042. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.22.4'",
  24043. referencedClasses: [],
  24044. messageSends: []
  24045. }),
  24046. $globals.SmalltalkImage);
  24047. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  24048. $core.addMethod(
  24049. $core.method({
  24050. selector: "current",
  24051. protocol: "instance creation",
  24052. fn: function (){
  24053. var self=this,$self=this;
  24054. return $core.withContext(function($ctx1) {
  24055. var $1,$receiver;
  24056. $1=$self["@current"];
  24057. if(($receiver = $1) == null || $receiver.a$nil){
  24058. $self["@current"]=(
  24059. $ctx1.supercall = true,
  24060. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24061. $ctx1.supercall = false;
  24062. return $self["@current"];
  24063. } else {
  24064. $self._deprecatedAPI();
  24065. return $self["@current"];
  24066. }
  24067. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  24068. },
  24069. args: [],
  24070. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  24071. referencedClasses: [],
  24072. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  24073. }),
  24074. $globals.SmalltalkImage.a$cls);
  24075. $core.addMethod(
  24076. $core.method({
  24077. selector: "initialize",
  24078. protocol: "initialization",
  24079. fn: function (){
  24080. var self=this,$self=this;
  24081. var st;
  24082. return $core.withContext(function($ctx1) {
  24083. st=$self._current();
  24084. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  24085. return self;
  24086. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  24087. },
  24088. args: [],
  24089. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  24090. referencedClasses: [],
  24091. messageSends: ["current", "at:put:", "globals"]
  24092. }),
  24093. $globals.SmalltalkImage.a$cls);
  24094. $core.addMethod(
  24095. $core.method({
  24096. selector: "new",
  24097. protocol: "instance creation",
  24098. fn: function (){
  24099. var self=this,$self=this;
  24100. return $core.withContext(function($ctx1) {
  24101. $self._shouldNotImplement();
  24102. return self;
  24103. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  24104. },
  24105. args: [],
  24106. source: "new\x0a\x09self shouldNotImplement",
  24107. referencedClasses: [],
  24108. messageSends: ["shouldNotImplement"]
  24109. }),
  24110. $globals.SmalltalkImage.a$cls);
  24111. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  24112. $core.addMethod(
  24113. $core.method({
  24114. selector: "nextPutJSObject:",
  24115. protocol: "*Kernel-Infrastructure",
  24116. fn: function (aJSObject){
  24117. var self=this,$self=this;
  24118. return $core.withContext(function($ctx1) {
  24119. $self._nextPut_(aJSObject);
  24120. return self;
  24121. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  24122. },
  24123. args: ["aJSObject"],
  24124. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  24125. referencedClasses: [],
  24126. messageSends: ["nextPut:"]
  24127. }),
  24128. $globals.ProtoStream);
  24129. $core.addMethod(
  24130. $core.method({
  24131. selector: "asJavaScriptPropertyName",
  24132. protocol: "*Kernel-Infrastructure",
  24133. fn: function (){
  24134. var self=this,$self=this;
  24135. return $core.withContext(function($ctx1) {
  24136. return $core.st2prop(self);
  24137. return self;
  24138. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  24139. },
  24140. args: [],
  24141. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  24142. referencedClasses: [],
  24143. messageSends: []
  24144. }),
  24145. $globals.String);
  24146. $core.addMethod(
  24147. $core.method({
  24148. selector: "asSetting",
  24149. protocol: "*Kernel-Infrastructure",
  24150. fn: function (){
  24151. var self=this,$self=this;
  24152. return $core.withContext(function($ctx1) {
  24153. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  24154. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  24155. },
  24156. args: [],
  24157. 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",
  24158. referencedClasses: ["Setting"],
  24159. messageSends: ["at:ifAbsent:"]
  24160. }),
  24161. $globals.String);
  24162. $core.addMethod(
  24163. $core.method({
  24164. selector: "asSettingIfAbsent:",
  24165. protocol: "*Kernel-Infrastructure",
  24166. fn: function (aDefaultValue){
  24167. var self=this,$self=this;
  24168. return $core.withContext(function($ctx1) {
  24169. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  24170. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24171. },
  24172. args: ["aDefaultValue"],
  24173. 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",
  24174. referencedClasses: ["Setting"],
  24175. messageSends: ["at:ifAbsent:"]
  24176. }),
  24177. $globals.String);
  24178. $core.addMethod(
  24179. $core.method({
  24180. selector: "settingValue",
  24181. protocol: "*Kernel-Infrastructure",
  24182. fn: function (){
  24183. var self=this,$self=this;
  24184. return $core.withContext(function($ctx1) {
  24185. return $recv($self._asSetting())._value();
  24186. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  24187. },
  24188. args: [],
  24189. source: "settingValue\x0a\x09^ self asSetting value",
  24190. referencedClasses: [],
  24191. messageSends: ["value", "asSetting"]
  24192. }),
  24193. $globals.String);
  24194. $core.addMethod(
  24195. $core.method({
  24196. selector: "settingValue:",
  24197. protocol: "*Kernel-Infrastructure",
  24198. fn: function (aValue){
  24199. var self=this,$self=this;
  24200. return $core.withContext(function($ctx1) {
  24201. return $recv($self._asSetting())._value_(aValue);
  24202. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  24203. },
  24204. args: ["aValue"],
  24205. 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",
  24206. referencedClasses: [],
  24207. messageSends: ["value:", "asSetting"]
  24208. }),
  24209. $globals.String);
  24210. $core.addMethod(
  24211. $core.method({
  24212. selector: "settingValueIfAbsent:",
  24213. protocol: "*Kernel-Infrastructure",
  24214. fn: function (aDefaultValue){
  24215. var self=this,$self=this;
  24216. return $core.withContext(function($ctx1) {
  24217. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  24218. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24219. },
  24220. args: ["aDefaultValue"],
  24221. 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",
  24222. referencedClasses: [],
  24223. messageSends: ["value", "asSettingIfAbsent:"]
  24224. }),
  24225. $globals.String);
  24226. });
  24227. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  24228. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  24229. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24230. $core.addPackage("Kernel-Announcements");
  24231. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  24232. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  24233. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  24234. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  24235. $core.addMethod(
  24236. $core.method({
  24237. selector: "announcementClass",
  24238. protocol: "accessing",
  24239. fn: function (){
  24240. var self=this,$self=this;
  24241. return $self["@announcementClass"];
  24242. },
  24243. args: [],
  24244. source: "announcementClass\x0a\x09^ announcementClass",
  24245. referencedClasses: [],
  24246. messageSends: []
  24247. }),
  24248. $globals.AnnouncementSubscription);
  24249. $core.addMethod(
  24250. $core.method({
  24251. selector: "announcementClass:",
  24252. protocol: "accessing",
  24253. fn: function (aClass){
  24254. var self=this,$self=this;
  24255. return $core.withContext(function($ctx1) {
  24256. $self["@announcementClass"]=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aClass)._name());
  24257. return self;
  24258. }, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass},$globals.AnnouncementSubscription)});
  24259. },
  24260. args: ["aClass"],
  24261. source: "announcementClass: aClass\x0a\x09announcementClass := Smalltalk globals at: aClass name",
  24262. referencedClasses: ["Smalltalk"],
  24263. messageSends: ["at:", "globals", "name"]
  24264. }),
  24265. $globals.AnnouncementSubscription);
  24266. $core.addMethod(
  24267. $core.method({
  24268. selector: "deliver:",
  24269. protocol: "announcing",
  24270. fn: function (anAnnouncement){
  24271. var self=this,$self=this;
  24272. return $core.withContext(function($ctx1) {
  24273. var $1;
  24274. $1=$self._handlesAnnouncement_(anAnnouncement);
  24275. if($core.assert($1)){
  24276. $recv($self._valuable())._value_(anAnnouncement);
  24277. }
  24278. return self;
  24279. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24280. },
  24281. args: ["anAnnouncement"],
  24282. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  24283. referencedClasses: [],
  24284. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  24285. }),
  24286. $globals.AnnouncementSubscription);
  24287. $core.addMethod(
  24288. $core.method({
  24289. selector: "handlesAnnouncement:",
  24290. protocol: "announcing",
  24291. fn: function (anAnnouncement){
  24292. var self=this,$self=this;
  24293. return $core.withContext(function($ctx1) {
  24294. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(anAnnouncement)._class())._name()))._includesBehavior_($self._announcementClass());
  24295. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24296. },
  24297. args: ["anAnnouncement"],
  24298. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: anAnnouncement class name) includesBehavior: self announcementClass",
  24299. referencedClasses: ["Smalltalk"],
  24300. messageSends: ["includesBehavior:", "at:", "globals", "name", "class", "announcementClass"]
  24301. }),
  24302. $globals.AnnouncementSubscription);
  24303. $core.addMethod(
  24304. $core.method({
  24305. selector: "receiver",
  24306. protocol: "accessing",
  24307. fn: function (){
  24308. var self=this,$self=this;
  24309. return $core.withContext(function($ctx1) {
  24310. return $recv($self._valuable())._receiver();
  24311. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  24312. },
  24313. args: [],
  24314. source: "receiver\x0a\x09^ self valuable receiver",
  24315. referencedClasses: [],
  24316. messageSends: ["receiver", "valuable"]
  24317. }),
  24318. $globals.AnnouncementSubscription);
  24319. $core.addMethod(
  24320. $core.method({
  24321. selector: "valuable",
  24322. protocol: "accessing",
  24323. fn: function (){
  24324. var self=this,$self=this;
  24325. return $self["@valuable"];
  24326. },
  24327. args: [],
  24328. source: "valuable\x0a\x09^ valuable",
  24329. referencedClasses: [],
  24330. messageSends: []
  24331. }),
  24332. $globals.AnnouncementSubscription);
  24333. $core.addMethod(
  24334. $core.method({
  24335. selector: "valuable:",
  24336. protocol: "accessing",
  24337. fn: function (aValuable){
  24338. var self=this,$self=this;
  24339. $self["@valuable"]=aValuable;
  24340. return self;
  24341. },
  24342. args: ["aValuable"],
  24343. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  24344. referencedClasses: [],
  24345. messageSends: []
  24346. }),
  24347. $globals.AnnouncementSubscription);
  24348. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  24349. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  24350. $core.addMethod(
  24351. $core.method({
  24352. selector: "receiver",
  24353. protocol: "accessing",
  24354. fn: function (){
  24355. var self=this,$self=this;
  24356. return $self["@receiver"];
  24357. },
  24358. args: [],
  24359. source: "receiver\x0a\x09^ receiver",
  24360. referencedClasses: [],
  24361. messageSends: []
  24362. }),
  24363. $globals.AnnouncementValuable);
  24364. $core.addMethod(
  24365. $core.method({
  24366. selector: "receiver:",
  24367. protocol: "accessing",
  24368. fn: function (anObject){
  24369. var self=this,$self=this;
  24370. $self["@receiver"]=anObject;
  24371. return self;
  24372. },
  24373. args: ["anObject"],
  24374. source: "receiver: anObject\x0a\x09receiver := anObject",
  24375. referencedClasses: [],
  24376. messageSends: []
  24377. }),
  24378. $globals.AnnouncementValuable);
  24379. $core.addMethod(
  24380. $core.method({
  24381. selector: "valuable",
  24382. protocol: "accessing",
  24383. fn: function (){
  24384. var self=this,$self=this;
  24385. return $self["@valuable"];
  24386. },
  24387. args: [],
  24388. source: "valuable\x0a\x09^ valuable",
  24389. referencedClasses: [],
  24390. messageSends: []
  24391. }),
  24392. $globals.AnnouncementValuable);
  24393. $core.addMethod(
  24394. $core.method({
  24395. selector: "valuable:",
  24396. protocol: "accessing",
  24397. fn: function (anObject){
  24398. var self=this,$self=this;
  24399. $self["@valuable"]=anObject;
  24400. return self;
  24401. },
  24402. args: ["anObject"],
  24403. source: "valuable: anObject\x0a\x09valuable := anObject",
  24404. referencedClasses: [],
  24405. messageSends: []
  24406. }),
  24407. $globals.AnnouncementValuable);
  24408. $core.addMethod(
  24409. $core.method({
  24410. selector: "value",
  24411. protocol: "evaluating",
  24412. fn: function (){
  24413. var self=this,$self=this;
  24414. return $core.withContext(function($ctx1) {
  24415. return $recv($self._valuable())._value();
  24416. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  24417. },
  24418. args: [],
  24419. source: "value\x0a\x09^ self valuable value",
  24420. referencedClasses: [],
  24421. messageSends: ["value", "valuable"]
  24422. }),
  24423. $globals.AnnouncementValuable);
  24424. $core.addMethod(
  24425. $core.method({
  24426. selector: "value:",
  24427. protocol: "evaluating",
  24428. fn: function (anObject){
  24429. var self=this,$self=this;
  24430. return $core.withContext(function($ctx1) {
  24431. return $recv($self._valuable())._value_(anObject);
  24432. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  24433. },
  24434. args: ["anObject"],
  24435. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  24436. referencedClasses: [],
  24437. messageSends: ["value:", "valuable"]
  24438. }),
  24439. $globals.AnnouncementValuable);
  24440. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  24441. $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' ].";
  24442. $core.addMethod(
  24443. $core.method({
  24444. selector: "announce:",
  24445. protocol: "announcing",
  24446. fn: function (anAnnouncement){
  24447. var self=this,$self=this;
  24448. return $core.withContext(function($ctx1) {
  24449. $recv($self["@subscriptions"])._do_((function(each){
  24450. return $core.withContext(function($ctx2) {
  24451. return $recv(each)._deliver_(anAnnouncement);
  24452. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24453. }));
  24454. return self;
  24455. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  24456. },
  24457. args: ["anAnnouncement"],
  24458. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  24459. referencedClasses: [],
  24460. messageSends: ["do:", "deliver:"]
  24461. }),
  24462. $globals.Announcer);
  24463. $core.addMethod(
  24464. $core.method({
  24465. selector: "initialize",
  24466. protocol: "initialization",
  24467. fn: function (){
  24468. var self=this,$self=this;
  24469. return $core.withContext(function($ctx1) {
  24470. (
  24471. $ctx1.supercall = true,
  24472. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  24473. $ctx1.supercall = false;
  24474. $self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  24475. return self;
  24476. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  24477. },
  24478. args: [],
  24479. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  24480. referencedClasses: ["OrderedCollection"],
  24481. messageSends: ["initialize", "new"]
  24482. }),
  24483. $globals.Announcer);
  24484. $core.addMethod(
  24485. $core.method({
  24486. selector: "on:do:",
  24487. protocol: "subscribing",
  24488. fn: function (aClass,aBlock){
  24489. var self=this,$self=this;
  24490. return $core.withContext(function($ctx1) {
  24491. $self._on_do_for_(aClass,aBlock,nil);
  24492. return self;
  24493. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  24494. },
  24495. args: ["aClass", "aBlock"],
  24496. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  24497. referencedClasses: [],
  24498. messageSends: ["on:do:for:"]
  24499. }),
  24500. $globals.Announcer);
  24501. $core.addMethod(
  24502. $core.method({
  24503. selector: "on:do:for:",
  24504. protocol: "subscribing",
  24505. fn: function (aClass,aBlock,aReceiver){
  24506. var self=this,$self=this;
  24507. return $core.withContext(function($ctx1) {
  24508. var $1,$3,$5,$6,$4,$2;
  24509. $1=$self["@subscriptions"];
  24510. $3=$recv($globals.AnnouncementSubscription)._new();
  24511. $ctx1.sendIdx["new"]=1;
  24512. $5=$recv($globals.AnnouncementValuable)._new();
  24513. $recv($5)._valuable_(aBlock);
  24514. $recv($5)._receiver_(aReceiver);
  24515. $6=$recv($5)._yourself();
  24516. $ctx1.sendIdx["yourself"]=1;
  24517. $4=$6;
  24518. $recv($3)._valuable_($4);
  24519. $ctx1.sendIdx["valuable:"]=1;
  24520. $recv($3)._announcementClass_(aClass);
  24521. $2=$recv($3)._yourself();
  24522. $recv($1)._add_($2);
  24523. return self;
  24524. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  24525. },
  24526. args: ["aClass", "aBlock", "aReceiver"],
  24527. 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)",
  24528. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  24529. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  24530. }),
  24531. $globals.Announcer);
  24532. $core.addMethod(
  24533. $core.method({
  24534. selector: "on:doOnce:",
  24535. protocol: "subscribing",
  24536. fn: function (aClass,aBlock){
  24537. var self=this,$self=this;
  24538. var subscription;
  24539. return $core.withContext(function($ctx1) {
  24540. var $1;
  24541. $1=$recv($globals.AnnouncementSubscription)._new();
  24542. $recv($1)._announcementClass_(aClass);
  24543. subscription=$recv($1)._yourself();
  24544. $recv(subscription)._valuable_((function(ann){
  24545. return $core.withContext(function($ctx2) {
  24546. $recv($self["@subscriptions"])._remove_(subscription);
  24547. return $recv(aBlock)._value_(ann);
  24548. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  24549. }));
  24550. $recv($self["@subscriptions"])._add_(subscription);
  24551. return self;
  24552. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  24553. },
  24554. args: ["aClass", "aBlock"],
  24555. 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",
  24556. referencedClasses: ["AnnouncementSubscription"],
  24557. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  24558. }),
  24559. $globals.Announcer);
  24560. $core.addMethod(
  24561. $core.method({
  24562. selector: "on:send:to:",
  24563. protocol: "subscribing",
  24564. fn: function (aClass,aSelector,anObject){
  24565. var self=this,$self=this;
  24566. return $core.withContext(function($ctx1) {
  24567. var $1,$3,$5,$6,$4,$2;
  24568. $1=$self["@subscriptions"];
  24569. $3=$recv($globals.AnnouncementSubscription)._new();
  24570. $ctx1.sendIdx["new"]=1;
  24571. $5=$recv($globals.MessageSend)._new();
  24572. $recv($5)._receiver_(anObject);
  24573. $recv($5)._selector_(aSelector);
  24574. $6=$recv($5)._yourself();
  24575. $ctx1.sendIdx["yourself"]=1;
  24576. $4=$6;
  24577. $recv($3)._valuable_($4);
  24578. $recv($3)._announcementClass_(aClass);
  24579. $2=$recv($3)._yourself();
  24580. $recv($1)._add_($2);
  24581. return self;
  24582. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  24583. },
  24584. args: ["aClass", "aSelector", "anObject"],
  24585. 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)",
  24586. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  24587. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  24588. }),
  24589. $globals.Announcer);
  24590. $core.addMethod(
  24591. $core.method({
  24592. selector: "unsubscribe:",
  24593. protocol: "subscribing",
  24594. fn: function (anObject){
  24595. var self=this,$self=this;
  24596. return $core.withContext(function($ctx1) {
  24597. $self["@subscriptions"]=$recv($self["@subscriptions"])._reject_((function(each){
  24598. return $core.withContext(function($ctx2) {
  24599. return $recv($recv(each)._receiver()).__eq(anObject);
  24600. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24601. }));
  24602. return self;
  24603. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  24604. },
  24605. args: ["anObject"],
  24606. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  24607. referencedClasses: [],
  24608. messageSends: ["reject:", "=", "receiver"]
  24609. }),
  24610. $globals.Announcer);
  24611. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  24612. $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`";
  24613. $globals.SystemAnnouncer.a$cls.iVarNames = ["current"];
  24614. $core.addMethod(
  24615. $core.method({
  24616. selector: "current",
  24617. protocol: "accessing",
  24618. fn: function (){
  24619. var self=this,$self=this;
  24620. return $core.withContext(function($ctx1) {
  24621. var $1,$receiver;
  24622. $1=$self["@current"];
  24623. if(($receiver = $1) == null || $receiver.a$nil){
  24624. $self["@current"]=(
  24625. $ctx1.supercall = true,
  24626. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24627. $ctx1.supercall = false;
  24628. return $self["@current"];
  24629. } else {
  24630. return $1;
  24631. }
  24632. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.a$cls)});
  24633. },
  24634. args: [],
  24635. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  24636. referencedClasses: [],
  24637. messageSends: ["ifNil:", "new"]
  24638. }),
  24639. $globals.SystemAnnouncer.a$cls);
  24640. $core.addMethod(
  24641. $core.method({
  24642. selector: "new",
  24643. protocol: "instance creation",
  24644. fn: function (){
  24645. var self=this,$self=this;
  24646. return $core.withContext(function($ctx1) {
  24647. $self._shouldNotImplement();
  24648. return self;
  24649. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.a$cls)});
  24650. },
  24651. args: [],
  24652. source: "new\x0a\x09self shouldNotImplement",
  24653. referencedClasses: [],
  24654. messageSends: ["shouldNotImplement"]
  24655. }),
  24656. $globals.SystemAnnouncer.a$cls);
  24657. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  24658. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  24659. $core.addMethod(
  24660. $core.method({
  24661. selector: "classTag",
  24662. protocol: "accessing",
  24663. fn: function (){
  24664. var self=this,$self=this;
  24665. return "announcement";
  24666. },
  24667. args: [],
  24668. 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'",
  24669. referencedClasses: [],
  24670. messageSends: []
  24671. }),
  24672. $globals.SystemAnnouncement.a$cls);
  24673. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  24674. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  24675. $core.addMethod(
  24676. $core.method({
  24677. selector: "theClass",
  24678. protocol: "accessing",
  24679. fn: function (){
  24680. var self=this,$self=this;
  24681. return $self["@theClass"];
  24682. },
  24683. args: [],
  24684. source: "theClass\x0a\x09^ theClass",
  24685. referencedClasses: [],
  24686. messageSends: []
  24687. }),
  24688. $globals.ClassAnnouncement);
  24689. $core.addMethod(
  24690. $core.method({
  24691. selector: "theClass:",
  24692. protocol: "accessing",
  24693. fn: function (aClass){
  24694. var self=this,$self=this;
  24695. $self["@theClass"]=aClass;
  24696. return self;
  24697. },
  24698. args: ["aClass"],
  24699. source: "theClass: aClass\x0a\x09theClass := aClass",
  24700. referencedClasses: [],
  24701. messageSends: []
  24702. }),
  24703. $globals.ClassAnnouncement);
  24704. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24705. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  24706. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24707. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  24708. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24709. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  24710. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  24711. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  24712. $core.addMethod(
  24713. $core.method({
  24714. selector: "oldClass",
  24715. protocol: "accessing",
  24716. fn: function (){
  24717. var self=this,$self=this;
  24718. return $self["@oldClass"];
  24719. },
  24720. args: [],
  24721. source: "oldClass\x0a\x09^ oldClass",
  24722. referencedClasses: [],
  24723. messageSends: []
  24724. }),
  24725. $globals.ClassMigrated);
  24726. $core.addMethod(
  24727. $core.method({
  24728. selector: "oldClass:",
  24729. protocol: "accessing",
  24730. fn: function (aClass){
  24731. var self=this,$self=this;
  24732. $self["@oldClass"]=aClass;
  24733. return self;
  24734. },
  24735. args: ["aClass"],
  24736. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  24737. referencedClasses: [],
  24738. messageSends: []
  24739. }),
  24740. $globals.ClassMigrated);
  24741. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  24742. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  24743. $core.addMethod(
  24744. $core.method({
  24745. selector: "oldPackage",
  24746. protocol: "accessing",
  24747. fn: function (){
  24748. var self=this,$self=this;
  24749. return $self["@oldPackage"];
  24750. },
  24751. args: [],
  24752. source: "oldPackage\x0a\x09^ oldPackage",
  24753. referencedClasses: [],
  24754. messageSends: []
  24755. }),
  24756. $globals.ClassMoved);
  24757. $core.addMethod(
  24758. $core.method({
  24759. selector: "oldPackage:",
  24760. protocol: "accessing",
  24761. fn: function (aPackage){
  24762. var self=this,$self=this;
  24763. $self["@oldPackage"]=aPackage;
  24764. return self;
  24765. },
  24766. args: ["aPackage"],
  24767. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  24768. referencedClasses: [],
  24769. messageSends: []
  24770. }),
  24771. $globals.ClassMoved);
  24772. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24773. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  24774. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24775. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  24776. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  24777. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  24778. $core.addMethod(
  24779. $core.method({
  24780. selector: "method",
  24781. protocol: "accessing",
  24782. fn: function (){
  24783. var self=this,$self=this;
  24784. return $self["@method"];
  24785. },
  24786. args: [],
  24787. source: "method\x0a\x09^ method",
  24788. referencedClasses: [],
  24789. messageSends: []
  24790. }),
  24791. $globals.MethodAnnouncement);
  24792. $core.addMethod(
  24793. $core.method({
  24794. selector: "method:",
  24795. protocol: "accessing",
  24796. fn: function (aCompiledMethod){
  24797. var self=this,$self=this;
  24798. $self["@method"]=aCompiledMethod;
  24799. return self;
  24800. },
  24801. args: ["aCompiledMethod"],
  24802. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  24803. referencedClasses: [],
  24804. messageSends: []
  24805. }),
  24806. $globals.MethodAnnouncement);
  24807. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24808. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  24809. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  24810. $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.";
  24811. $core.addMethod(
  24812. $core.method({
  24813. selector: "oldMethod",
  24814. protocol: "accessing",
  24815. fn: function (){
  24816. var self=this,$self=this;
  24817. return $self["@oldMethod"];
  24818. },
  24819. args: [],
  24820. source: "oldMethod\x0a\x09^ oldMethod",
  24821. referencedClasses: [],
  24822. messageSends: []
  24823. }),
  24824. $globals.MethodModified);
  24825. $core.addMethod(
  24826. $core.method({
  24827. selector: "oldMethod:",
  24828. protocol: "accessing",
  24829. fn: function (aMethod){
  24830. var self=this,$self=this;
  24831. $self["@oldMethod"]=aMethod;
  24832. return self;
  24833. },
  24834. args: ["aMethod"],
  24835. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  24836. referencedClasses: [],
  24837. messageSends: []
  24838. }),
  24839. $globals.MethodModified);
  24840. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  24841. $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.";
  24842. $core.addMethod(
  24843. $core.method({
  24844. selector: "oldProtocol",
  24845. protocol: "accessing",
  24846. fn: function (){
  24847. var self=this,$self=this;
  24848. return $self["@oldProtocol"];
  24849. },
  24850. args: [],
  24851. source: "oldProtocol\x0a\x09^ oldProtocol",
  24852. referencedClasses: [],
  24853. messageSends: []
  24854. }),
  24855. $globals.MethodMoved);
  24856. $core.addMethod(
  24857. $core.method({
  24858. selector: "oldProtocol:",
  24859. protocol: "accessing",
  24860. fn: function (aString){
  24861. var self=this,$self=this;
  24862. $self["@oldProtocol"]=aString;
  24863. return self;
  24864. },
  24865. args: ["aString"],
  24866. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  24867. referencedClasses: [],
  24868. messageSends: []
  24869. }),
  24870. $globals.MethodMoved);
  24871. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24872. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  24873. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  24874. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  24875. $core.addMethod(
  24876. $core.method({
  24877. selector: "package",
  24878. protocol: "accessing",
  24879. fn: function (){
  24880. var self=this,$self=this;
  24881. return $self["@package"];
  24882. },
  24883. args: [],
  24884. source: "package\x0a\x09^ package",
  24885. referencedClasses: [],
  24886. messageSends: []
  24887. }),
  24888. $globals.PackageAnnouncement);
  24889. $core.addMethod(
  24890. $core.method({
  24891. selector: "package:",
  24892. protocol: "accessing",
  24893. fn: function (aPackage){
  24894. var self=this,$self=this;
  24895. $self["@package"]=aPackage;
  24896. return self;
  24897. },
  24898. args: ["aPackage"],
  24899. source: "package: aPackage\x0a\x09package := aPackage",
  24900. referencedClasses: [],
  24901. messageSends: []
  24902. }),
  24903. $globals.PackageAnnouncement);
  24904. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24905. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  24906. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24907. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  24908. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24909. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  24910. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24911. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  24912. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  24913. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  24914. $core.addMethod(
  24915. $core.method({
  24916. selector: "package",
  24917. protocol: "accessing",
  24918. fn: function (){
  24919. var self=this,$self=this;
  24920. return $core.withContext(function($ctx1) {
  24921. var $1,$receiver;
  24922. $1=$self._theClass();
  24923. if(($receiver = $1) == null || $receiver.a$nil){
  24924. return $1;
  24925. } else {
  24926. var class_;
  24927. class_=$receiver;
  24928. return $recv(class_)._packageOfProtocol_($self._protocol());
  24929. }
  24930. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  24931. },
  24932. args: [],
  24933. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  24934. referencedClasses: [],
  24935. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  24936. }),
  24937. $globals.ProtocolAnnouncement);
  24938. $core.addMethod(
  24939. $core.method({
  24940. selector: "protocol",
  24941. protocol: "accessing",
  24942. fn: function (){
  24943. var self=this,$self=this;
  24944. return $self["@protocol"];
  24945. },
  24946. args: [],
  24947. source: "protocol\x0a\x09^ protocol",
  24948. referencedClasses: [],
  24949. messageSends: []
  24950. }),
  24951. $globals.ProtocolAnnouncement);
  24952. $core.addMethod(
  24953. $core.method({
  24954. selector: "protocol:",
  24955. protocol: "accessing",
  24956. fn: function (aString){
  24957. var self=this,$self=this;
  24958. $self["@protocol"]=aString;
  24959. return self;
  24960. },
  24961. args: ["aString"],
  24962. source: "protocol: aString\x0a\x09protocol := aString",
  24963. referencedClasses: [],
  24964. messageSends: []
  24965. }),
  24966. $globals.ProtocolAnnouncement);
  24967. $core.addMethod(
  24968. $core.method({
  24969. selector: "theClass",
  24970. protocol: "accessing",
  24971. fn: function (){
  24972. var self=this,$self=this;
  24973. return $self["@theClass"];
  24974. },
  24975. args: [],
  24976. source: "theClass\x0a\x09^ theClass",
  24977. referencedClasses: [],
  24978. messageSends: []
  24979. }),
  24980. $globals.ProtocolAnnouncement);
  24981. $core.addMethod(
  24982. $core.method({
  24983. selector: "theClass:",
  24984. protocol: "accessing",
  24985. fn: function (aClass){
  24986. var self=this,$self=this;
  24987. $self["@theClass"]=aClass;
  24988. return self;
  24989. },
  24990. args: ["aClass"],
  24991. source: "theClass: aClass\x0a\x09theClass := aClass",
  24992. referencedClasses: [],
  24993. messageSends: []
  24994. }),
  24995. $globals.ProtocolAnnouncement);
  24996. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  24997. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  24998. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  24999. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  25000. });
  25001. 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";
  25002. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  25003. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  25004. $core.addPackage("Platform-Services");
  25005. ($core.packageDescriptors||$core.packages)["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  25006. ($core.packageDescriptors||$core.packages)["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  25007. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  25008. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  25009. $core.addMethod(
  25010. $core.method({
  25011. selector: "handleError:",
  25012. protocol: "error handling",
  25013. fn: function (anError){
  25014. var self=this,$self=this;
  25015. return $core.withContext(function($ctx1) {
  25016. var $1,$receiver;
  25017. $1=$recv(anError)._context();
  25018. $ctx1.sendIdx["context"]=1;
  25019. if(($receiver = $1) == null || $receiver.a$nil){
  25020. $1;
  25021. } else {
  25022. $self._logErrorContext_($recv(anError)._context());
  25023. }
  25024. $self._logError_(anError);
  25025. return self;
  25026. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25027. },
  25028. args: ["anError"],
  25029. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  25030. referencedClasses: [],
  25031. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  25032. }),
  25033. $globals.ConsoleErrorHandler);
  25034. $core.addMethod(
  25035. $core.method({
  25036. selector: "log:",
  25037. protocol: "private",
  25038. fn: function (aString){
  25039. var self=this,$self=this;
  25040. return $core.withContext(function($ctx1) {
  25041. $recv(console)._log_(aString);
  25042. return self;
  25043. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  25044. },
  25045. args: ["aString"],
  25046. source: "log: aString\x0a\x09console log: aString",
  25047. referencedClasses: [],
  25048. messageSends: ["log:"]
  25049. }),
  25050. $globals.ConsoleErrorHandler);
  25051. $core.addMethod(
  25052. $core.method({
  25053. selector: "logContext:",
  25054. protocol: "private",
  25055. fn: function (aContext){
  25056. var self=this,$self=this;
  25057. return $core.withContext(function($ctx1) {
  25058. var $1,$receiver;
  25059. $1=$recv(aContext)._home();
  25060. $ctx1.sendIdx["home"]=1;
  25061. if(($receiver = $1) == null || $receiver.a$nil){
  25062. $1;
  25063. } else {
  25064. $self._logContext_($recv(aContext)._home());
  25065. }
  25066. $self._log_($recv(aContext)._asString());
  25067. return self;
  25068. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25069. },
  25070. args: ["aContext"],
  25071. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  25072. referencedClasses: [],
  25073. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  25074. }),
  25075. $globals.ConsoleErrorHandler);
  25076. $core.addMethod(
  25077. $core.method({
  25078. selector: "logError:",
  25079. protocol: "private",
  25080. fn: function (anError){
  25081. var self=this,$self=this;
  25082. return $core.withContext(function($ctx1) {
  25083. $self._log_($recv(anError)._messageText());
  25084. return self;
  25085. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25086. },
  25087. args: ["anError"],
  25088. source: "logError: anError\x0a\x09self log: anError messageText",
  25089. referencedClasses: [],
  25090. messageSends: ["log:", "messageText"]
  25091. }),
  25092. $globals.ConsoleErrorHandler);
  25093. $core.addMethod(
  25094. $core.method({
  25095. selector: "logErrorContext:",
  25096. protocol: "private",
  25097. fn: function (aContext){
  25098. var self=this,$self=this;
  25099. return $core.withContext(function($ctx1) {
  25100. var $1,$receiver;
  25101. if(($receiver = aContext) == null || $receiver.a$nil){
  25102. aContext;
  25103. } else {
  25104. $1=$recv(aContext)._home();
  25105. $ctx1.sendIdx["home"]=1;
  25106. if(($receiver = $1) == null || $receiver.a$nil){
  25107. $1;
  25108. } else {
  25109. $self._logContext_($recv(aContext)._home());
  25110. }
  25111. }
  25112. return self;
  25113. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25114. },
  25115. args: ["aContext"],
  25116. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  25117. referencedClasses: [],
  25118. messageSends: ["ifNotNil:", "home", "logContext:"]
  25119. }),
  25120. $globals.ConsoleErrorHandler);
  25121. $globals.ConsoleErrorHandler.a$cls.iVarNames = ["current"];
  25122. $core.addMethod(
  25123. $core.method({
  25124. selector: "initialize",
  25125. protocol: "initialization",
  25126. fn: function (){
  25127. var self=this,$self=this;
  25128. return $core.withContext(function($ctx1) {
  25129. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  25130. return self;
  25131. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.a$cls)});
  25132. },
  25133. args: [],
  25134. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  25135. referencedClasses: ["ErrorHandler"],
  25136. messageSends: ["registerIfNone:", "new"]
  25137. }),
  25138. $globals.ConsoleErrorHandler.a$cls);
  25139. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  25140. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  25141. $core.addMethod(
  25142. $core.method({
  25143. selector: "clear",
  25144. protocol: "printing",
  25145. fn: function (){
  25146. var self=this,$self=this;
  25147. return self;
  25148. },
  25149. args: [],
  25150. source: "clear\x0a\x09\x22no op\x22",
  25151. referencedClasses: [],
  25152. messageSends: []
  25153. }),
  25154. $globals.ConsoleTranscript);
  25155. $core.addMethod(
  25156. $core.method({
  25157. selector: "cr",
  25158. protocol: "printing",
  25159. fn: function (){
  25160. var self=this,$self=this;
  25161. return self;
  25162. },
  25163. args: [],
  25164. source: "cr\x0a\x09\x22no op\x22",
  25165. referencedClasses: [],
  25166. messageSends: []
  25167. }),
  25168. $globals.ConsoleTranscript);
  25169. $core.addMethod(
  25170. $core.method({
  25171. selector: "open",
  25172. protocol: "actions",
  25173. fn: function (){
  25174. var self=this,$self=this;
  25175. return self;
  25176. },
  25177. args: [],
  25178. source: "open",
  25179. referencedClasses: [],
  25180. messageSends: []
  25181. }),
  25182. $globals.ConsoleTranscript);
  25183. $core.addMethod(
  25184. $core.method({
  25185. selector: "show:",
  25186. protocol: "printing",
  25187. fn: function (anObject){
  25188. var self=this,$self=this;
  25189. return $core.withContext(function($ctx1) {
  25190. console.log(String($recv(anObject)._asString()));
  25191. return self;
  25192. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  25193. },
  25194. args: ["anObject"],
  25195. 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()))'>",
  25196. referencedClasses: [],
  25197. messageSends: []
  25198. }),
  25199. $globals.ConsoleTranscript);
  25200. $core.addMethod(
  25201. $core.method({
  25202. selector: "initialize",
  25203. protocol: "initialization",
  25204. fn: function (){
  25205. var self=this,$self=this;
  25206. return $core.withContext(function($ctx1) {
  25207. $recv($globals.Transcript)._registerIfNone_($self._new());
  25208. return self;
  25209. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.a$cls)});
  25210. },
  25211. args: [],
  25212. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  25213. referencedClasses: ["Transcript"],
  25214. messageSends: ["registerIfNone:", "new"]
  25215. }),
  25216. $globals.ConsoleTranscript.a$cls);
  25217. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  25218. $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.";
  25219. $core.addMethod(
  25220. $core.method({
  25221. selector: "addInstVarNamed:to:",
  25222. protocol: "compiling",
  25223. fn: function (aString,aClass){
  25224. var self=this,$self=this;
  25225. var newInstVars;
  25226. return $core.withContext(function($ctx1) {
  25227. var $1,$2,$3,$4,$5;
  25228. newInstVars=$recv($recv(aClass)._instanceVariableNames())._copyWith_(aString);
  25229. $1=$recv(aClass)._isMetaclass();
  25230. if($core.assert($1)){
  25231. $2=$self._classBuilder();
  25232. $ctx1.sendIdx["classBuilder"]=1;
  25233. $recv($2)._class_instanceVariables_(aClass,newInstVars);
  25234. } else {
  25235. $3=$self._classBuilder();
  25236. $4=$recv(aClass)._superclass();
  25237. $5=$recv(aClass)._name();
  25238. $ctx1.sendIdx["name"]=1;
  25239. $recv($3)._addSubclassOf_named_instanceVariableNames_package_($4,$5,newInstVars,$recv($recv(aClass)._package())._name());
  25240. }
  25241. return self;
  25242. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass,newInstVars:newInstVars},$globals.Environment)});
  25243. },
  25244. args: ["aString", "aClass"],
  25245. source: "addInstVarNamed: aString to: aClass\x0a\x09| newInstVars |\x0a\x09newInstVars := aClass instanceVariableNames copyWith: aString.\x0a\x0a\x09aClass isMetaclass\x0a\x09\x09ifTrue: [ self classBuilder\x0a\x09\x09\x09class: aClass instanceVariables: newInstVars ]\x0a\x09\x09ifFalse: [ self classBuilder\x0a\x09\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09\x09named: aClass name \x0a\x09\x09\x09instanceVariableNames: newInstVars\x0a\x09\x09\x09package: aClass package name ]",
  25246. referencedClasses: [],
  25247. messageSends: ["copyWith:", "instanceVariableNames", "ifTrue:ifFalse:", "isMetaclass", "class:instanceVariables:", "classBuilder", "addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "package"]
  25248. }),
  25249. $globals.Environment);
  25250. $core.addMethod(
  25251. $core.method({
  25252. selector: "allSelectors",
  25253. protocol: "accessing",
  25254. fn: function (){
  25255. var self=this,$self=this;
  25256. return $core.withContext(function($ctx1) {
  25257. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  25258. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  25259. },
  25260. args: [],
  25261. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  25262. referencedClasses: ["Smalltalk"],
  25263. messageSends: ["allSelectors", "core"]
  25264. }),
  25265. $globals.Environment);
  25266. $core.addMethod(
  25267. $core.method({
  25268. selector: "availableClassNames",
  25269. protocol: "accessing",
  25270. fn: function (){
  25271. var self=this,$self=this;
  25272. return $core.withContext(function($ctx1) {
  25273. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  25274. return $core.withContext(function($ctx2) {
  25275. return $recv(each)._name();
  25276. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25277. }));
  25278. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  25279. },
  25280. args: [],
  25281. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  25282. referencedClasses: ["Smalltalk"],
  25283. messageSends: ["collect:", "classes", "name"]
  25284. }),
  25285. $globals.Environment);
  25286. $core.addMethod(
  25287. $core.method({
  25288. selector: "availablePackageNames",
  25289. protocol: "accessing",
  25290. fn: function (){
  25291. var self=this,$self=this;
  25292. return $core.withContext(function($ctx1) {
  25293. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  25294. return $core.withContext(function($ctx2) {
  25295. return $recv(each)._name();
  25296. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25297. }));
  25298. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  25299. },
  25300. args: [],
  25301. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  25302. referencedClasses: ["Smalltalk"],
  25303. messageSends: ["collect:", "packages", "name"]
  25304. }),
  25305. $globals.Environment);
  25306. $core.addMethod(
  25307. $core.method({
  25308. selector: "availableProtocolsFor:",
  25309. protocol: "accessing",
  25310. fn: function (aClass){
  25311. var self=this,$self=this;
  25312. var protocols;
  25313. return $core.withContext(function($ctx1) {
  25314. var $1,$receiver;
  25315. protocols=$recv(aClass)._protocols();
  25316. $1=$recv(aClass)._superclass();
  25317. $ctx1.sendIdx["superclass"]=1;
  25318. if(($receiver = $1) == null || $receiver.a$nil){
  25319. $1;
  25320. } else {
  25321. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  25322. }
  25323. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  25324. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  25325. },
  25326. args: ["aClass"],
  25327. 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",
  25328. referencedClasses: [],
  25329. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  25330. }),
  25331. $globals.Environment);
  25332. $core.addMethod(
  25333. $core.method({
  25334. selector: "classBuilder",
  25335. protocol: "accessing",
  25336. fn: function (){
  25337. var self=this,$self=this;
  25338. return $core.withContext(function($ctx1) {
  25339. return $recv($globals.ClassBuilder)._new();
  25340. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  25341. },
  25342. args: [],
  25343. source: "classBuilder\x0a\x09^ ClassBuilder new",
  25344. referencedClasses: ["ClassBuilder"],
  25345. messageSends: ["new"]
  25346. }),
  25347. $globals.Environment);
  25348. $core.addMethod(
  25349. $core.method({
  25350. selector: "classNamed:",
  25351. protocol: "accessing",
  25352. fn: function (aString){
  25353. var self=this,$self=this;
  25354. return $core.withContext(function($ctx1) {
  25355. var $1,$receiver;
  25356. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  25357. if(($receiver = $1) == null || $receiver.a$nil){
  25358. return $self._error_("Invalid class name");
  25359. } else {
  25360. return $1;
  25361. }
  25362. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  25363. },
  25364. args: ["aString"],
  25365. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  25366. referencedClasses: ["Smalltalk"],
  25367. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  25368. }),
  25369. $globals.Environment);
  25370. $core.addMethod(
  25371. $core.method({
  25372. selector: "classes",
  25373. protocol: "accessing",
  25374. fn: function (){
  25375. var self=this,$self=this;
  25376. return $core.withContext(function($ctx1) {
  25377. return $recv($globals.Smalltalk)._classes();
  25378. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  25379. },
  25380. args: [],
  25381. source: "classes\x0a\x09^ Smalltalk classes",
  25382. referencedClasses: ["Smalltalk"],
  25383. messageSends: ["classes"]
  25384. }),
  25385. $globals.Environment);
  25386. $core.addMethod(
  25387. $core.method({
  25388. selector: "commitPackage:onSuccess:onError:",
  25389. protocol: "actions",
  25390. fn: function (aPackage,aBlock,anotherBlock){
  25391. var self=this,$self=this;
  25392. return $core.withContext(function($ctx1) {
  25393. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  25394. return self;
  25395. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  25396. },
  25397. args: ["aPackage", "aBlock", "anotherBlock"],
  25398. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  25399. referencedClasses: [],
  25400. messageSends: ["commitOnSuccess:onError:", "transport"]
  25401. }),
  25402. $globals.Environment);
  25403. $core.addMethod(
  25404. $core.method({
  25405. selector: "compileClassComment:for:",
  25406. protocol: "compiling",
  25407. fn: function (aString,aClass){
  25408. var self=this,$self=this;
  25409. return $core.withContext(function($ctx1) {
  25410. $recv(aClass)._comment_(aString);
  25411. return self;
  25412. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  25413. },
  25414. args: ["aString", "aClass"],
  25415. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  25416. referencedClasses: [],
  25417. messageSends: ["comment:"]
  25418. }),
  25419. $globals.Environment);
  25420. $core.addMethod(
  25421. $core.method({
  25422. selector: "compileClassDefinition:",
  25423. protocol: "compiling",
  25424. fn: function (aString){
  25425. var self=this,$self=this;
  25426. return $core.withContext(function($ctx1) {
  25427. $recv((function(){
  25428. return $core.withContext(function($ctx2) {
  25429. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  25430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25431. }))._on_do_($globals.Error,(function(error){
  25432. return $core.withContext(function($ctx2) {
  25433. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  25434. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  25435. }));
  25436. return self;
  25437. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  25438. },
  25439. args: ["aString"],
  25440. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  25441. referencedClasses: ["DoIt", "Error", "Terminal"],
  25442. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  25443. }),
  25444. $globals.Environment);
  25445. $core.addMethod(
  25446. $core.method({
  25447. selector: "compileMethod:for:protocol:",
  25448. protocol: "compiling",
  25449. fn: function (sourceCode,class_,protocol){
  25450. var self=this,$self=this;
  25451. return $core.withContext(function($ctx1) {
  25452. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  25453. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  25454. },
  25455. args: ["sourceCode", "class", "protocol"],
  25456. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  25457. referencedClasses: [],
  25458. messageSends: ["compile:protocol:"]
  25459. }),
  25460. $globals.Environment);
  25461. $core.addMethod(
  25462. $core.method({
  25463. selector: "copyClass:to:",
  25464. protocol: "actions",
  25465. fn: function (aClass,aClassName){
  25466. var self=this,$self=this;
  25467. return $core.withContext(function($ctx1) {
  25468. var $1,$2,$receiver;
  25469. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25470. if(($receiver = $1) == null || $receiver.a$nil){
  25471. $1;
  25472. } else {
  25473. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25474. $ctx1.sendIdx[","]=1;
  25475. $self._error_($2);
  25476. }
  25477. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  25478. return self;
  25479. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25480. },
  25481. args: ["aClass", "aClassName"],
  25482. 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",
  25483. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25484. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  25485. }),
  25486. $globals.Environment);
  25487. $core.addMethod(
  25488. $core.method({
  25489. selector: "doItReceiver",
  25490. protocol: "accessing",
  25491. fn: function (){
  25492. var self=this,$self=this;
  25493. return $core.withContext(function($ctx1) {
  25494. return $recv($globals.DoIt)._new();
  25495. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  25496. },
  25497. args: [],
  25498. source: "doItReceiver\x0a\x09^ DoIt new",
  25499. referencedClasses: ["DoIt"],
  25500. messageSends: ["new"]
  25501. }),
  25502. $globals.Environment);
  25503. $core.addMethod(
  25504. $core.method({
  25505. selector: "evaluate:for:",
  25506. protocol: "evaluating",
  25507. fn: function (aString,anObject){
  25508. var self=this,$self=this;
  25509. return $core.withContext(function($ctx1) {
  25510. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  25511. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  25512. },
  25513. args: ["aString", "anObject"],
  25514. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  25515. referencedClasses: ["Evaluator"],
  25516. messageSends: ["evaluate:for:"]
  25517. }),
  25518. $globals.Environment);
  25519. $core.addMethod(
  25520. $core.method({
  25521. selector: "evaluate:on:do:",
  25522. protocol: "error handling",
  25523. fn: function (aBlock,anErrorClass,exceptionBlock){
  25524. var self=this,$self=this;
  25525. return $core.withContext(function($ctx1) {
  25526. var $1;
  25527. $recv(aBlock)._tryCatch_((function(exception){
  25528. return $core.withContext(function($ctx2) {
  25529. $1=$recv(exception)._isKindOf_($self._classNamed_($recv(anErrorClass)._name()));
  25530. if($core.assert($1)){
  25531. return $recv(exceptionBlock)._value_(exception);
  25532. } else {
  25533. return $recv(exception)._pass();
  25534. }
  25535. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  25536. }));
  25537. return self;
  25538. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  25539. },
  25540. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  25541. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception pass ] ]",
  25542. referencedClasses: [],
  25543. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "pass"]
  25544. }),
  25545. $globals.Environment);
  25546. $core.addMethod(
  25547. $core.method({
  25548. selector: "inspect:",
  25549. protocol: "actions",
  25550. fn: function (anObject){
  25551. var self=this,$self=this;
  25552. return $core.withContext(function($ctx1) {
  25553. $recv($globals.Inspector)._inspect_(anObject);
  25554. return self;
  25555. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  25556. },
  25557. args: ["anObject"],
  25558. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  25559. referencedClasses: ["Inspector"],
  25560. messageSends: ["inspect:"]
  25561. }),
  25562. $globals.Environment);
  25563. $core.addMethod(
  25564. $core.method({
  25565. selector: "moveClass:toPackage:",
  25566. protocol: "actions",
  25567. fn: function (aClass,aPackageName){
  25568. var self=this,$self=this;
  25569. var package_;
  25570. return $core.withContext(function($ctx1) {
  25571. var $1,$2,$receiver;
  25572. package_=$recv($globals.Package)._named_(aPackageName);
  25573. $1=package_;
  25574. if(($receiver = $1) == null || $receiver.a$nil){
  25575. $self._error_("Invalid package name");
  25576. } else {
  25577. $1;
  25578. }
  25579. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  25580. if($core.assert($2)){
  25581. return self;
  25582. }
  25583. $recv(aClass)._package_(package_);
  25584. $recv(aClass)._recompile();
  25585. return self;
  25586. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  25587. },
  25588. args: ["aClass", "aPackageName"],
  25589. 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",
  25590. referencedClasses: ["Package"],
  25591. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  25592. }),
  25593. $globals.Environment);
  25594. $core.addMethod(
  25595. $core.method({
  25596. selector: "moveMethod:toClass:",
  25597. protocol: "actions",
  25598. fn: function (aMethod,aClassName){
  25599. var self=this,$self=this;
  25600. var destinationClass;
  25601. return $core.withContext(function($ctx1) {
  25602. var $2,$3,$1,$5,$4;
  25603. destinationClass=$self._classNamed_(aClassName);
  25604. $2=destinationClass;
  25605. $3=$recv(aMethod)._methodClass();
  25606. $ctx1.sendIdx["methodClass"]=1;
  25607. $1=$recv($2).__eq_eq($3);
  25608. if($core.assert($1)){
  25609. return self;
  25610. }
  25611. $5=$recv(aMethod)._methodClass();
  25612. $ctx1.sendIdx["methodClass"]=2;
  25613. $4=$recv($5)._isMetaclass();
  25614. if($core.assert($4)){
  25615. destinationClass=$recv(destinationClass)._theMetaClass();
  25616. destinationClass;
  25617. }
  25618. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25619. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25620. return self;
  25621. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  25622. },
  25623. args: ["aMethod", "aClassName"],
  25624. 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",
  25625. referencedClasses: [],
  25626. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  25627. }),
  25628. $globals.Environment);
  25629. $core.addMethod(
  25630. $core.method({
  25631. selector: "moveMethod:toProtocol:",
  25632. protocol: "actions",
  25633. fn: function (aMethod,aProtocol){
  25634. var self=this,$self=this;
  25635. return $core.withContext(function($ctx1) {
  25636. $recv(aMethod)._protocol_(aProtocol);
  25637. $recv($recv(aMethod)._methodClass())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25638. return self;
  25639. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  25640. },
  25641. args: ["aMethod", "aProtocol"],
  25642. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod methodClass\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  25643. referencedClasses: [],
  25644. messageSends: ["protocol:", "compile:protocol:", "methodClass", "source", "protocol"]
  25645. }),
  25646. $globals.Environment);
  25647. $core.addMethod(
  25648. $core.method({
  25649. selector: "packages",
  25650. protocol: "accessing",
  25651. fn: function (){
  25652. var self=this,$self=this;
  25653. return $core.withContext(function($ctx1) {
  25654. return $recv($globals.Smalltalk)._packages();
  25655. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  25656. },
  25657. args: [],
  25658. source: "packages\x0a\x09^ Smalltalk packages",
  25659. referencedClasses: ["Smalltalk"],
  25660. messageSends: ["packages"]
  25661. }),
  25662. $globals.Environment);
  25663. $core.addMethod(
  25664. $core.method({
  25665. selector: "registerErrorHandler:",
  25666. protocol: "services",
  25667. fn: function (anErrorHandler){
  25668. var self=this,$self=this;
  25669. return $core.withContext(function($ctx1) {
  25670. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  25671. return self;
  25672. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  25673. },
  25674. args: ["anErrorHandler"],
  25675. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  25676. referencedClasses: ["ErrorHandler"],
  25677. messageSends: ["register:"]
  25678. }),
  25679. $globals.Environment);
  25680. $core.addMethod(
  25681. $core.method({
  25682. selector: "registerFinder:",
  25683. protocol: "services",
  25684. fn: function (aFinder){
  25685. var self=this,$self=this;
  25686. return $core.withContext(function($ctx1) {
  25687. $recv($globals.Finder)._register_(aFinder);
  25688. return self;
  25689. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  25690. },
  25691. args: ["aFinder"],
  25692. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  25693. referencedClasses: ["Finder"],
  25694. messageSends: ["register:"]
  25695. }),
  25696. $globals.Environment);
  25697. $core.addMethod(
  25698. $core.method({
  25699. selector: "registerInspector:",
  25700. protocol: "services",
  25701. fn: function (anInspector){
  25702. var self=this,$self=this;
  25703. return $core.withContext(function($ctx1) {
  25704. $recv($globals.Inspector)._register_(anInspector);
  25705. return self;
  25706. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  25707. },
  25708. args: ["anInspector"],
  25709. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  25710. referencedClasses: ["Inspector"],
  25711. messageSends: ["register:"]
  25712. }),
  25713. $globals.Environment);
  25714. $core.addMethod(
  25715. $core.method({
  25716. selector: "registerProgressHandler:",
  25717. protocol: "services",
  25718. fn: function (aProgressHandler){
  25719. var self=this,$self=this;
  25720. return $core.withContext(function($ctx1) {
  25721. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  25722. return self;
  25723. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  25724. },
  25725. args: ["aProgressHandler"],
  25726. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  25727. referencedClasses: ["ProgressHandler"],
  25728. messageSends: ["register:"]
  25729. }),
  25730. $globals.Environment);
  25731. $core.addMethod(
  25732. $core.method({
  25733. selector: "registerTranscript:",
  25734. protocol: "services",
  25735. fn: function (aTranscript){
  25736. var self=this,$self=this;
  25737. return $core.withContext(function($ctx1) {
  25738. $recv($globals.Transcript)._register_(aTranscript);
  25739. return self;
  25740. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  25741. },
  25742. args: ["aTranscript"],
  25743. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  25744. referencedClasses: ["Transcript"],
  25745. messageSends: ["register:"]
  25746. }),
  25747. $globals.Environment);
  25748. $core.addMethod(
  25749. $core.method({
  25750. selector: "removeClass:",
  25751. protocol: "actions",
  25752. fn: function (aClass){
  25753. var self=this,$self=this;
  25754. return $core.withContext(function($ctx1) {
  25755. $recv($globals.Smalltalk)._removeClass_(aClass);
  25756. return self;
  25757. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  25758. },
  25759. args: ["aClass"],
  25760. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  25761. referencedClasses: ["Smalltalk"],
  25762. messageSends: ["removeClass:"]
  25763. }),
  25764. $globals.Environment);
  25765. $core.addMethod(
  25766. $core.method({
  25767. selector: "removeMethod:",
  25768. protocol: "actions",
  25769. fn: function (aMethod){
  25770. var self=this,$self=this;
  25771. return $core.withContext(function($ctx1) {
  25772. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25773. return self;
  25774. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  25775. },
  25776. args: ["aMethod"],
  25777. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  25778. referencedClasses: [],
  25779. messageSends: ["removeCompiledMethod:", "methodClass"]
  25780. }),
  25781. $globals.Environment);
  25782. $core.addMethod(
  25783. $core.method({
  25784. selector: "removeProtocol:from:",
  25785. protocol: "actions",
  25786. fn: function (aString,aClass){
  25787. var self=this,$self=this;
  25788. return $core.withContext(function($ctx1) {
  25789. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25790. return $core.withContext(function($ctx2) {
  25791. return $recv(aClass)._removeCompiledMethod_(each);
  25792. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25793. }));
  25794. return self;
  25795. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  25796. },
  25797. args: ["aString", "aClass"],
  25798. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  25799. referencedClasses: [],
  25800. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  25801. }),
  25802. $globals.Environment);
  25803. $core.addMethod(
  25804. $core.method({
  25805. selector: "renameClass:to:",
  25806. protocol: "actions",
  25807. fn: function (aClass,aClassName){
  25808. var self=this,$self=this;
  25809. return $core.withContext(function($ctx1) {
  25810. var $1,$2,$receiver;
  25811. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25812. if(($receiver = $1) == null || $receiver.a$nil){
  25813. $1;
  25814. } else {
  25815. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25816. $ctx1.sendIdx[","]=1;
  25817. $self._error_($2);
  25818. }
  25819. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  25820. return self;
  25821. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25822. },
  25823. args: ["aClass", "aClassName"],
  25824. 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",
  25825. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25826. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  25827. }),
  25828. $globals.Environment);
  25829. $core.addMethod(
  25830. $core.method({
  25831. selector: "renamePackage:to:",
  25832. protocol: "actions",
  25833. fn: function (aPackageName,aNewPackageName){
  25834. var self=this,$self=this;
  25835. return $core.withContext(function($ctx1) {
  25836. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  25837. return self;
  25838. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  25839. },
  25840. args: ["aPackageName", "aNewPackageName"],
  25841. source: "renamePackage: aPackageName to: aNewPackageName\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  25842. referencedClasses: ["Smalltalk"],
  25843. messageSends: ["renamePackage:to:"]
  25844. }),
  25845. $globals.Environment);
  25846. $core.addMethod(
  25847. $core.method({
  25848. selector: "renameProtocol:to:in:",
  25849. protocol: "actions",
  25850. fn: function (aString,anotherString,aClass){
  25851. var self=this,$self=this;
  25852. return $core.withContext(function($ctx1) {
  25853. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25854. return $core.withContext(function($ctx2) {
  25855. return $recv(each)._protocol_(anotherString);
  25856. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25857. }));
  25858. return self;
  25859. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  25860. },
  25861. args: ["aString", "anotherString", "aClass"],
  25862. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  25863. referencedClasses: [],
  25864. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  25865. }),
  25866. $globals.Environment);
  25867. $core.addMethod(
  25868. $core.method({
  25869. selector: "setClassCommentOf:to:",
  25870. protocol: "actions",
  25871. fn: function (aClass,aString){
  25872. var self=this,$self=this;
  25873. return $core.withContext(function($ctx1) {
  25874. $recv(aClass)._comment_(aString);
  25875. return self;
  25876. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  25877. },
  25878. args: ["aClass", "aString"],
  25879. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  25880. referencedClasses: [],
  25881. messageSends: ["comment:"]
  25882. }),
  25883. $globals.Environment);
  25884. $core.addMethod(
  25885. $core.method({
  25886. selector: "systemAnnouncer",
  25887. protocol: "accessing",
  25888. fn: function (){
  25889. var self=this,$self=this;
  25890. return $core.withContext(function($ctx1) {
  25891. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  25892. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  25893. },
  25894. args: [],
  25895. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  25896. referencedClasses: ["Smalltalk"],
  25897. messageSends: ["current", "at:", "globals"]
  25898. }),
  25899. $globals.Environment);
  25900. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  25901. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  25902. $core.addMethod(
  25903. $core.method({
  25904. selector: "do:on:displaying:",
  25905. protocol: "progress handling",
  25906. fn: function (aBlock,aCollection,aString){
  25907. var self=this,$self=this;
  25908. return $core.withContext(function($ctx1) {
  25909. $recv(aCollection)._do_(aBlock);
  25910. return self;
  25911. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  25912. },
  25913. args: ["aBlock", "aCollection", "aString"],
  25914. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  25915. referencedClasses: [],
  25916. messageSends: ["do:"]
  25917. }),
  25918. $globals.NullProgressHandler);
  25919. $globals.NullProgressHandler.a$cls.iVarNames = ["current"];
  25920. $core.addMethod(
  25921. $core.method({
  25922. selector: "initialize",
  25923. protocol: "initialization",
  25924. fn: function (){
  25925. var self=this,$self=this;
  25926. return $core.withContext(function($ctx1) {
  25927. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  25928. return self;
  25929. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.a$cls)});
  25930. },
  25931. args: [],
  25932. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  25933. referencedClasses: ["ProgressHandler"],
  25934. messageSends: ["registerIfNone:", "new"]
  25935. }),
  25936. $globals.NullProgressHandler.a$cls);
  25937. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  25938. $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.";
  25939. $globals.Service.a$cls.iVarNames = ["current"];
  25940. $core.addMethod(
  25941. $core.method({
  25942. selector: "current",
  25943. protocol: "accessing",
  25944. fn: function (){
  25945. var self=this,$self=this;
  25946. return $self["@current"];
  25947. },
  25948. args: [],
  25949. source: "current\x0a\x09^ current",
  25950. referencedClasses: [],
  25951. messageSends: []
  25952. }),
  25953. $globals.Service.a$cls);
  25954. $core.addMethod(
  25955. $core.method({
  25956. selector: "new",
  25957. protocol: "instance creation",
  25958. fn: function (){
  25959. var self=this,$self=this;
  25960. return $core.withContext(function($ctx1) {
  25961. $self._shouldNotImplement();
  25962. return self;
  25963. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.a$cls)});
  25964. },
  25965. args: [],
  25966. source: "new\x0a\x09self shouldNotImplement",
  25967. referencedClasses: [],
  25968. messageSends: ["shouldNotImplement"]
  25969. }),
  25970. $globals.Service.a$cls);
  25971. $core.addMethod(
  25972. $core.method({
  25973. selector: "register:",
  25974. protocol: "registration",
  25975. fn: function (anObject){
  25976. var self=this,$self=this;
  25977. $self["@current"]=anObject;
  25978. return self;
  25979. },
  25980. args: ["anObject"],
  25981. source: "register: anObject\x0a\x09current := anObject",
  25982. referencedClasses: [],
  25983. messageSends: []
  25984. }),
  25985. $globals.Service.a$cls);
  25986. $core.addMethod(
  25987. $core.method({
  25988. selector: "registerIfNone:",
  25989. protocol: "registration",
  25990. fn: function (anObject){
  25991. var self=this,$self=this;
  25992. return $core.withContext(function($ctx1) {
  25993. var $1,$receiver;
  25994. $1=$self._current();
  25995. if(($receiver = $1) == null || $receiver.a$nil){
  25996. $self._register_(anObject);
  25997. } else {
  25998. $1;
  25999. }
  26000. return self;
  26001. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.a$cls)});
  26002. },
  26003. args: ["anObject"],
  26004. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  26005. referencedClasses: [],
  26006. messageSends: ["ifNil:", "current", "register:"]
  26007. }),
  26008. $globals.Service.a$cls);
  26009. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  26010. $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.";
  26011. $core.addMethod(
  26012. $core.method({
  26013. selector: "handleError:",
  26014. protocol: "error handling",
  26015. fn: function (anError){
  26016. var self=this,$self=this;
  26017. return $core.withContext(function($ctx1) {
  26018. var $1;
  26019. $1=$recv((function(){
  26020. return $core.withContext(function($ctx2) {
  26021. return $recv(anError)._isSmalltalkError();
  26022. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26023. }))._tryCatch_((function(){
  26024. return false;
  26025. }));
  26026. if($core.assert($1)){
  26027. $self._handleUnhandledError_(anError);
  26028. $ctx1.sendIdx["handleUnhandledError:"]=1;
  26029. } else {
  26030. var smalltalkError;
  26031. smalltalkError=$recv($globals.JavaScriptException)._on_(anError);
  26032. $recv(smalltalkError)._wrap();
  26033. $self._handleUnhandledError_(smalltalkError);
  26034. }
  26035. return self;
  26036. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26037. },
  26038. args: ["anError"],
  26039. 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 ]",
  26040. referencedClasses: ["JavaScriptException"],
  26041. messageSends: ["ifTrue:ifFalse:", "tryCatch:", "isSmalltalkError", "handleUnhandledError:", "on:", "wrap"]
  26042. }),
  26043. $globals.ErrorHandler.a$cls);
  26044. $core.addMethod(
  26045. $core.method({
  26046. selector: "handleUnhandledError:",
  26047. protocol: "error handling",
  26048. fn: function (anError){
  26049. var self=this,$self=this;
  26050. return $core.withContext(function($ctx1) {
  26051. var $1;
  26052. $1=$recv(anError)._wasHandled();
  26053. if(!$core.assert($1)){
  26054. $recv($self._current())._handleError_(anError);
  26055. $recv(anError)._beHandled();
  26056. }
  26057. return self;
  26058. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26059. },
  26060. args: ["anError"],
  26061. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifFalse: [\x0a\x09\x09self current handleError: anError.\x0a\x09\x09anError beHandled ]",
  26062. referencedClasses: [],
  26063. messageSends: ["ifFalse:", "wasHandled", "handleError:", "current", "beHandled"]
  26064. }),
  26065. $globals.ErrorHandler.a$cls);
  26066. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  26067. $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.";
  26068. $core.addMethod(
  26069. $core.method({
  26070. selector: "findClass:",
  26071. protocol: "finding",
  26072. fn: function (aClass){
  26073. var self=this,$self=this;
  26074. return $core.withContext(function($ctx1) {
  26075. return $recv($self._current())._findClass_(aClass);
  26076. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.a$cls)});
  26077. },
  26078. args: ["aClass"],
  26079. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  26080. referencedClasses: [],
  26081. messageSends: ["findClass:", "current"]
  26082. }),
  26083. $globals.Finder.a$cls);
  26084. $core.addMethod(
  26085. $core.method({
  26086. selector: "findMethod:",
  26087. protocol: "finding",
  26088. fn: function (aCompiledMethod){
  26089. var self=this,$self=this;
  26090. return $core.withContext(function($ctx1) {
  26091. return $recv($self._current())._findMethod_(aCompiledMethod);
  26092. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.a$cls)});
  26093. },
  26094. args: ["aCompiledMethod"],
  26095. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  26096. referencedClasses: [],
  26097. messageSends: ["findMethod:", "current"]
  26098. }),
  26099. $globals.Finder.a$cls);
  26100. $core.addMethod(
  26101. $core.method({
  26102. selector: "findString:",
  26103. protocol: "finding",
  26104. fn: function (aString){
  26105. var self=this,$self=this;
  26106. return $core.withContext(function($ctx1) {
  26107. return $recv($self._current())._findString_(aString);
  26108. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.a$cls)});
  26109. },
  26110. args: ["aString"],
  26111. source: "findString: aString\x0a\x09^ self current findString: aString",
  26112. referencedClasses: [],
  26113. messageSends: ["findString:", "current"]
  26114. }),
  26115. $globals.Finder.a$cls);
  26116. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  26117. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  26118. $core.addMethod(
  26119. $core.method({
  26120. selector: "inspect:",
  26121. protocol: "inspecting",
  26122. fn: function (anObject){
  26123. var self=this,$self=this;
  26124. return $core.withContext(function($ctx1) {
  26125. return $recv($self._current())._inspect_(anObject);
  26126. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.a$cls)});
  26127. },
  26128. args: ["anObject"],
  26129. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  26130. referencedClasses: [],
  26131. messageSends: ["inspect:", "current"]
  26132. }),
  26133. $globals.Inspector.a$cls);
  26134. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  26135. $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";
  26136. $core.addMethod(
  26137. $core.method({
  26138. selector: "globals",
  26139. protocol: "accessing",
  26140. fn: function (){
  26141. var self=this,$self=this;
  26142. return $core.withContext(function($ctx1) {
  26143. return $recv($self._current())._globals();
  26144. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.a$cls)});
  26145. },
  26146. args: [],
  26147. source: "globals\x0a\x09^ self current globals",
  26148. referencedClasses: [],
  26149. messageSends: ["globals", "current"]
  26150. }),
  26151. $globals.Platform.a$cls);
  26152. $core.addMethod(
  26153. $core.method({
  26154. selector: "includesGlobal:",
  26155. protocol: "testing",
  26156. fn: function (aString){
  26157. var self=this,$self=this;
  26158. return $core.withContext(function($ctx1) {
  26159. return $recv($self._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  26160. return true;
  26161. }),(function(){
  26162. return false;
  26163. }));
  26164. }, function($ctx1) {$ctx1.fill(self,"includesGlobal:",{aString:aString},$globals.Platform.a$cls)});
  26165. },
  26166. args: ["aString"],
  26167. source: "includesGlobal: aString\x0a\x09^ self globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  26168. referencedClasses: [],
  26169. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  26170. }),
  26171. $globals.Platform.a$cls);
  26172. $core.addMethod(
  26173. $core.method({
  26174. selector: "newXhr",
  26175. protocol: "accessing",
  26176. fn: function (){
  26177. var self=this,$self=this;
  26178. return $core.withContext(function($ctx1) {
  26179. return $recv($self._current())._newXhr();
  26180. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.a$cls)});
  26181. },
  26182. args: [],
  26183. source: "newXhr\x0a\x09^ self current newXhr",
  26184. referencedClasses: [],
  26185. messageSends: ["newXhr", "current"]
  26186. }),
  26187. $globals.Platform.a$cls);
  26188. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  26189. $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`.";
  26190. $core.addMethod(
  26191. $core.method({
  26192. selector: "do:on:displaying:",
  26193. protocol: "progress handling",
  26194. fn: function (aBlock,aCollection,aString){
  26195. var self=this,$self=this;
  26196. return $core.withContext(function($ctx1) {
  26197. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  26198. return self;
  26199. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.a$cls)});
  26200. },
  26201. args: ["aBlock", "aCollection", "aString"],
  26202. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  26203. referencedClasses: [],
  26204. messageSends: ["do:on:displaying:", "current"]
  26205. }),
  26206. $globals.ProgressHandler.a$cls);
  26207. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  26208. $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:'.";
  26209. $core.addMethod(
  26210. $core.method({
  26211. selector: "alert:",
  26212. protocol: "dialogs",
  26213. fn: function (aString){
  26214. var self=this,$self=this;
  26215. return $core.withContext(function($ctx1) {
  26216. return $recv($self._current())._alert_(aString);
  26217. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.a$cls)});
  26218. },
  26219. args: ["aString"],
  26220. source: "alert: aString\x0a\x09^ self current alert: aString",
  26221. referencedClasses: [],
  26222. messageSends: ["alert:", "current"]
  26223. }),
  26224. $globals.Terminal.a$cls);
  26225. $core.addMethod(
  26226. $core.method({
  26227. selector: "confirm:",
  26228. protocol: "dialogs",
  26229. fn: function (aString){
  26230. var self=this,$self=this;
  26231. return $core.withContext(function($ctx1) {
  26232. return $recv($self._current())._confirm_(aString);
  26233. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.a$cls)});
  26234. },
  26235. args: ["aString"],
  26236. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  26237. referencedClasses: [],
  26238. messageSends: ["confirm:", "current"]
  26239. }),
  26240. $globals.Terminal.a$cls);
  26241. $core.addMethod(
  26242. $core.method({
  26243. selector: "prompt:",
  26244. protocol: "dialogs",
  26245. fn: function (aString){
  26246. var self=this,$self=this;
  26247. return $core.withContext(function($ctx1) {
  26248. return $recv($self._current())._prompt_(aString);
  26249. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.a$cls)});
  26250. },
  26251. args: ["aString"],
  26252. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  26253. referencedClasses: [],
  26254. messageSends: ["prompt:", "current"]
  26255. }),
  26256. $globals.Terminal.a$cls);
  26257. $core.addMethod(
  26258. $core.method({
  26259. selector: "prompt:default:",
  26260. protocol: "dialogs",
  26261. fn: function (aString,defaultString){
  26262. var self=this,$self=this;
  26263. return $core.withContext(function($ctx1) {
  26264. return $recv($self._current())._prompt_default_(aString,defaultString);
  26265. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.a$cls)});
  26266. },
  26267. args: ["aString", "defaultString"],
  26268. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  26269. referencedClasses: [],
  26270. messageSends: ["prompt:default:", "current"]
  26271. }),
  26272. $globals.Terminal.a$cls);
  26273. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  26274. $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.";
  26275. $core.addMethod(
  26276. $core.method({
  26277. selector: "clear",
  26278. protocol: "printing",
  26279. fn: function (){
  26280. var self=this,$self=this;
  26281. return $core.withContext(function($ctx1) {
  26282. $recv($self._current())._clear();
  26283. return self;
  26284. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.a$cls)});
  26285. },
  26286. args: [],
  26287. source: "clear\x0a\x09self current clear",
  26288. referencedClasses: [],
  26289. messageSends: ["clear", "current"]
  26290. }),
  26291. $globals.Transcript.a$cls);
  26292. $core.addMethod(
  26293. $core.method({
  26294. selector: "cr",
  26295. protocol: "printing",
  26296. fn: function (){
  26297. var self=this,$self=this;
  26298. return $core.withContext(function($ctx1) {
  26299. $recv($self._current())._show_($recv($globals.String)._cr());
  26300. return self;
  26301. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.a$cls)});
  26302. },
  26303. args: [],
  26304. source: "cr\x0a\x09self current show: String cr",
  26305. referencedClasses: ["String"],
  26306. messageSends: ["show:", "current", "cr"]
  26307. }),
  26308. $globals.Transcript.a$cls);
  26309. $core.addMethod(
  26310. $core.method({
  26311. selector: "inspect:",
  26312. protocol: "printing",
  26313. fn: function (anObject){
  26314. var self=this,$self=this;
  26315. return $core.withContext(function($ctx1) {
  26316. $self._show_(anObject);
  26317. return self;
  26318. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.a$cls)});
  26319. },
  26320. args: ["anObject"],
  26321. source: "inspect: anObject\x0a\x09self show: anObject",
  26322. referencedClasses: [],
  26323. messageSends: ["show:"]
  26324. }),
  26325. $globals.Transcript.a$cls);
  26326. $core.addMethod(
  26327. $core.method({
  26328. selector: "open",
  26329. protocol: "instance creation",
  26330. fn: function (){
  26331. var self=this,$self=this;
  26332. return $core.withContext(function($ctx1) {
  26333. $recv($self._current())._open();
  26334. return self;
  26335. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.a$cls)});
  26336. },
  26337. args: [],
  26338. source: "open\x0a\x09self current open",
  26339. referencedClasses: [],
  26340. messageSends: ["open", "current"]
  26341. }),
  26342. $globals.Transcript.a$cls);
  26343. $core.addMethod(
  26344. $core.method({
  26345. selector: "show:",
  26346. protocol: "printing",
  26347. fn: function (anObject){
  26348. var self=this,$self=this;
  26349. return $core.withContext(function($ctx1) {
  26350. $recv($self._current())._show_(anObject);
  26351. return self;
  26352. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.a$cls)});
  26353. },
  26354. args: ["anObject"],
  26355. source: "show: anObject\x0a\x09self current show: anObject",
  26356. referencedClasses: [],
  26357. messageSends: ["show:", "current"]
  26358. }),
  26359. $globals.Transcript.a$cls);
  26360. $core.addMethod(
  26361. $core.method({
  26362. selector: "inspectOn:",
  26363. protocol: "*Platform-Services",
  26364. fn: function (anInspector){
  26365. var self=this,$self=this;
  26366. var variables;
  26367. return $core.withContext(function($ctx1) {
  26368. variables=$recv($globals.Dictionary)._new();
  26369. $recv(variables)._at_put_("#self",self);
  26370. $ctx1.sendIdx["at:put:"]=1;
  26371. $recv(variables)._at_put_("#keys",$self._keys());
  26372. $ctx1.sendIdx["at:put:"]=2;
  26373. $self._keysAndValuesDo_((function(key,value){
  26374. return $core.withContext(function($ctx2) {
  26375. return $recv(variables)._at_put_(key,value);
  26376. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  26377. }));
  26378. $recv(anInspector)._setLabel_($self._printString());
  26379. $recv(anInspector)._setVariables_(variables);
  26380. return self;
  26381. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  26382. },
  26383. args: ["anInspector"],
  26384. 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",
  26385. referencedClasses: ["Dictionary"],
  26386. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  26387. }),
  26388. $globals.AssociativeCollection);
  26389. $core.addMethod(
  26390. $core.method({
  26391. selector: "inspectOn:",
  26392. protocol: "*Platform-Services",
  26393. fn: function (anInspector){
  26394. var self=this,$self=this;
  26395. var variables;
  26396. return $core.withContext(function($ctx1) {
  26397. variables=$recv($globals.Dictionary)._new();
  26398. $recv(variables)._at_put_("#self",self);
  26399. $ctx1.sendIdx["at:put:"]=1;
  26400. $self._withIndexDo_((function(each,i){
  26401. return $core.withContext(function($ctx2) {
  26402. return $recv(variables)._at_put_(i,each);
  26403. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  26404. }));
  26405. $recv(anInspector)._setLabel_($self._printString());
  26406. $recv(anInspector)._setVariables_(variables);
  26407. return self;
  26408. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  26409. },
  26410. args: ["anInspector"],
  26411. 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",
  26412. referencedClasses: ["Dictionary"],
  26413. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  26414. }),
  26415. $globals.Collection);
  26416. $core.addMethod(
  26417. $core.method({
  26418. selector: "inspectOn:",
  26419. protocol: "*Platform-Services",
  26420. fn: function (anInspector){
  26421. var self=this,$self=this;
  26422. var variables;
  26423. return $core.withContext(function($ctx1) {
  26424. variables=$recv($globals.Dictionary)._new();
  26425. $recv(variables)._at_put_("#self",self);
  26426. $ctx1.sendIdx["at:put:"]=1;
  26427. $recv(variables)._at_put_("#year",$self._year());
  26428. $ctx1.sendIdx["at:put:"]=2;
  26429. $recv(variables)._at_put_("#month",$self._month());
  26430. $ctx1.sendIdx["at:put:"]=3;
  26431. $recv(variables)._at_put_("#day",$self._day());
  26432. $ctx1.sendIdx["at:put:"]=4;
  26433. $recv(variables)._at_put_("#hours",$self._hours());
  26434. $ctx1.sendIdx["at:put:"]=5;
  26435. $recv(variables)._at_put_("#minutes",$self._minutes());
  26436. $ctx1.sendIdx["at:put:"]=6;
  26437. $recv(variables)._at_put_("#seconds",$self._seconds());
  26438. $ctx1.sendIdx["at:put:"]=7;
  26439. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  26440. $recv(anInspector)._setLabel_($self._printString());
  26441. $recv(anInspector)._setVariables_(variables);
  26442. return self;
  26443. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  26444. },
  26445. args: ["anInspector"],
  26446. 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",
  26447. referencedClasses: ["Dictionary"],
  26448. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  26449. }),
  26450. $globals.Date);
  26451. $core.addMethod(
  26452. $core.method({
  26453. selector: "inspectOn:",
  26454. protocol: "*Platform-Services",
  26455. fn: function (anInspector){
  26456. var self=this,$self=this;
  26457. var variables;
  26458. return $core.withContext(function($ctx1) {
  26459. variables=$recv($globals.Dictionary)._new();
  26460. $recv(variables)._at_put_("#self",$self._jsObject());
  26461. $recv(anInspector)._setLabel_($self._printString());
  26462. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  26463. $recv(anInspector)._setVariables_(variables);
  26464. return self;
  26465. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  26466. },
  26467. args: ["anInspector"],
  26468. 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",
  26469. referencedClasses: ["Dictionary", "JSObjectProxy"],
  26470. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  26471. }),
  26472. $globals.JSObjectProxy);
  26473. $core.addMethod(
  26474. $core.method({
  26475. selector: "inspectOn:",
  26476. protocol: "*Platform-Services",
  26477. fn: function (anInspector){
  26478. var self=this,$self=this;
  26479. var variables;
  26480. return $core.withContext(function($ctx1) {
  26481. variables=$recv($globals.Dictionary)._new();
  26482. $recv(variables)._at_put_("#self",self);
  26483. $ctx1.sendIdx["at:put:"]=1;
  26484. $recv(variables)._at_put_("#home",$self._home());
  26485. $ctx1.sendIdx["at:put:"]=2;
  26486. $recv(variables)._at_put_("#receiver",$self._receiver());
  26487. $ctx1.sendIdx["at:put:"]=3;
  26488. $recv(variables)._at_put_("#selector",$self._selector());
  26489. $ctx1.sendIdx["at:put:"]=4;
  26490. $recv(variables)._at_put_("#locals",$self._locals());
  26491. $ctx1.sendIdx["at:put:"]=5;
  26492. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  26493. return $core.withContext(function($ctx2) {
  26494. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26495. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26496. }));
  26497. $recv(anInspector)._setLabel_($self._printString());
  26498. $recv(anInspector)._setVariables_(variables);
  26499. return self;
  26500. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  26501. },
  26502. args: ["anInspector"],
  26503. 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",
  26504. referencedClasses: ["Dictionary"],
  26505. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26506. }),
  26507. $globals.MethodContext);
  26508. $core.addMethod(
  26509. $core.method({
  26510. selector: "inspectOn:",
  26511. protocol: "*Platform-Services",
  26512. fn: function (anInspector){
  26513. var self=this,$self=this;
  26514. var variables;
  26515. return $core.withContext(function($ctx1) {
  26516. variables=$recv($globals.Dictionary)._new();
  26517. $recv(variables)._at_put_("#self",self);
  26518. $ctx1.sendIdx["at:put:"]=1;
  26519. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  26520. return $core.withContext(function($ctx2) {
  26521. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26523. }));
  26524. $recv(anInspector)._setLabel_($self._printString());
  26525. $recv(anInspector)._setVariables_(variables);
  26526. return self;
  26527. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  26528. },
  26529. args: ["anInspector"],
  26530. 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",
  26531. referencedClasses: ["Dictionary"],
  26532. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26533. }),
  26534. $globals.Object);
  26535. $core.addMethod(
  26536. $core.method({
  26537. selector: "do:displayingProgress:",
  26538. protocol: "*Platform-Services",
  26539. fn: function (aBlock,aString){
  26540. var self=this,$self=this;
  26541. return $core.withContext(function($ctx1) {
  26542. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  26543. return self;
  26544. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  26545. },
  26546. args: ["aBlock", "aString"],
  26547. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  26548. referencedClasses: ["ProgressHandler"],
  26549. messageSends: ["do:on:displaying:"]
  26550. }),
  26551. $globals.SequenceableCollection);
  26552. $core.addMethod(
  26553. $core.method({
  26554. selector: "inspectOn:",
  26555. protocol: "*Platform-Services",
  26556. fn: function (anInspector){
  26557. var self=this,$self=this;
  26558. var variables,i;
  26559. return $core.withContext(function($ctx1) {
  26560. variables=$recv($globals.Dictionary)._new();
  26561. $recv(variables)._at_put_("#self",self);
  26562. $ctx1.sendIdx["at:put:"]=1;
  26563. i=(1);
  26564. $self._do_((function(each){
  26565. return $core.withContext(function($ctx2) {
  26566. $recv(variables)._at_put_(i,each);
  26567. i=$recv(i).__plus((1));
  26568. return i;
  26569. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26570. }));
  26571. $recv(anInspector)._setLabel_($self._printString());
  26572. $recv(anInspector)._setVariables_(variables);
  26573. return self;
  26574. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  26575. },
  26576. args: ["anInspector"],
  26577. 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",
  26578. referencedClasses: ["Dictionary"],
  26579. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  26580. }),
  26581. $globals.Set);
  26582. $core.addMethod(
  26583. $core.method({
  26584. selector: "inspectOn:",
  26585. protocol: "*Platform-Services",
  26586. fn: function (anInspector){
  26587. var self=this,$self=this;
  26588. var label;
  26589. return $core.withContext(function($ctx1) {
  26590. var $3,$2,$1,$5,$4;
  26591. (
  26592. $ctx1.supercall = true,
  26593. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($self, [anInspector]));
  26594. $ctx1.supercall = false;
  26595. $3=$self._printString();
  26596. $ctx1.sendIdx["printString"]=1;
  26597. $2=$recv($3)._size();
  26598. $1=$recv($2).__gt((30));
  26599. if($core.assert($1)){
  26600. $5=$self._printString();
  26601. $ctx1.sendIdx["printString"]=2;
  26602. $4=$recv($5)._copyFrom_to_((1),(30));
  26603. label=$recv($4).__comma("...'");
  26604. label;
  26605. } else {
  26606. label=$self._printString();
  26607. label;
  26608. }
  26609. $recv(anInspector)._setLabel_(label);
  26610. return self;
  26611. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  26612. },
  26613. args: ["anInspector"],
  26614. 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",
  26615. referencedClasses: [],
  26616. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  26617. }),
  26618. $globals.String);
  26619. });
  26620. define('amber/deploy',[
  26621. './helpers',
  26622. './boot', // pre-fetch, dep of ./helpers
  26623. // --- packages of the core Amber begin here ---
  26624. 'amber_core/Kernel-Helpers',
  26625. 'amber_core/Kernel-Objects',
  26626. 'amber_core/Kernel-Classes',
  26627. 'amber_core/Kernel-Methods',
  26628. 'amber_core/Kernel-Collections',
  26629. 'amber_core/Kernel-Dag',
  26630. 'amber_core/Kernel-Infrastructure',
  26631. 'amber_core/Kernel-Promises',
  26632. 'amber_core/Kernel-Exceptions',
  26633. 'amber_core/Kernel-Announcements',
  26634. 'amber_core/Platform-Services',
  26635. // --- packages of the core Amber end here ---
  26636. ], function (amber) {
  26637. return amber;
  26638. });
  26639. // jshint ignore:start
  26640. define('amber/parser',['./boot'], function($boot) {
  26641. var $globals = $boot.globals;
  26642. $globals.SmalltalkParser = (function() {
  26643. "use strict";
  26644. /*
  26645. * Generated by PEG.js 0.9.0.
  26646. *
  26647. * http://pegjs.org/
  26648. */
  26649. function peg$subclass(child, parent) {
  26650. function ctor() { this.constructor = child; }
  26651. ctor.prototype = parent.prototype;
  26652. child.prototype = new ctor();
  26653. }
  26654. function peg$SyntaxError(message, expected, found, location) {
  26655. this.message = message;
  26656. this.expected = expected;
  26657. this.found = found;
  26658. this.location = location;
  26659. this.name = "SyntaxError";
  26660. if (typeof Error.captureStackTrace === "function") {
  26661. Error.captureStackTrace(this, peg$SyntaxError);
  26662. }
  26663. }
  26664. peg$subclass(peg$SyntaxError, Error);
  26665. function peg$parse(input) {
  26666. var options = arguments.length > 1 ? arguments[1] : {},
  26667. parser = this,
  26668. peg$FAILED = {},
  26669. peg$startRuleFunctions = { start: peg$parsestart },
  26670. peg$startRuleFunction = peg$parsestart,
  26671. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  26672. 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]" },
  26673. peg$c2 = "\"",
  26674. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  26675. peg$c4 = /^[^"]/,
  26676. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  26677. peg$c6 = ".",
  26678. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  26679. peg$c8 = /^[a-zA-Z]/,
  26680. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  26681. peg$c10 = /^[a-zA-Z0-9]/,
  26682. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  26683. peg$c12 = ":",
  26684. peg$c13 = { type: "literal", value: ":", description: "\":\"" },
  26685. peg$c14 = /^[A-Z]/,
  26686. peg$c15 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  26687. peg$c16 = function(val) {
  26688. return $globals.ValueNode._new()
  26689. ._location_(location())
  26690. ._source_(text())
  26691. ._value_(val);
  26692. },
  26693. peg$c17 = "'",
  26694. peg$c18 = { type: "literal", value: "'", description: "\"'\"" },
  26695. peg$c19 = "''",
  26696. peg$c20 = { type: "literal", value: "''", description: "\"''\"" },
  26697. peg$c21 = function() {return '\'';},
  26698. peg$c22 = /^[^']/,
  26699. peg$c23 = { type: "class", value: "[^']", description: "[^']" },
  26700. peg$c24 = function(val) {return val.join('');},
  26701. peg$c25 = "$",
  26702. peg$c26 = { type: "literal", value: "$", description: "\"$\"" },
  26703. peg$c27 = { type: "any", description: "any character" },
  26704. peg$c28 = function(char) {
  26705. return $globals.ValueNode._new()
  26706. ._location_(location())
  26707. ._source_(text())
  26708. ._value_(char);
  26709. },
  26710. peg$c29 = "#",
  26711. peg$c30 = { type: "literal", value: "#", description: "\"#\"" },
  26712. peg$c31 = function(rest) {return rest;},
  26713. peg$c32 = "e",
  26714. peg$c33 = { type: "literal", value: "e", description: "\"e\"" },
  26715. peg$c34 = function(n) {return parseFloat(n);},
  26716. peg$c35 = "-",
  26717. peg$c36 = { type: "literal", value: "-", description: "\"-\"" },
  26718. peg$c37 = "16r",
  26719. peg$c38 = { type: "literal", value: "16r", description: "\"16r\"" },
  26720. peg$c39 = /^[0-9a-fA-F]/,
  26721. peg$c40 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  26722. peg$c41 = function(neg, num) {
  26723. return parseInt(((neg || '') + num), 16);
  26724. },
  26725. peg$c42 = /^[0-9]/,
  26726. peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
  26727. peg$c44 = function(n) {return parseFloat(n, 10);},
  26728. peg$c45 = function(n) {return parseInt(n, 10);},
  26729. peg$c46 = "#(",
  26730. peg$c47 = { type: "literal", value: "#(", description: "\"#(\"" },
  26731. peg$c48 = ")",
  26732. peg$c49 = { type: "literal", value: ")", description: "\")\"" },
  26733. peg$c50 = function(rest) {
  26734. return rest
  26735. ._location_(location())
  26736. ._source_(text());
  26737. },
  26738. peg$c51 = "(",
  26739. peg$c52 = { type: "literal", value: "(", description: "\"(\"" },
  26740. peg$c53 = function(lit) {return lit._value();},
  26741. peg$c54 = function(lits) {
  26742. return $globals.ValueNode._new()
  26743. ._value_(lits);
  26744. },
  26745. peg$c55 = "{",
  26746. peg$c56 = { type: "literal", value: "{", description: "\"{\"" },
  26747. peg$c57 = "}",
  26748. peg$c58 = { type: "literal", value: "}", description: "\"}\"" },
  26749. peg$c59 = function(expressions) {
  26750. return $globals.DynamicArrayNode._new()
  26751. ._location_(location())
  26752. ._source_(text())
  26753. ._dagChildren_(expressions || []);
  26754. },
  26755. peg$c60 = "#{",
  26756. peg$c61 = { type: "literal", value: "#{", description: "\"#{\"" },
  26757. peg$c62 = function(expressions) {
  26758. return $globals.DynamicDictionaryNode._new()
  26759. ._location_(location())
  26760. ._source_(text())
  26761. ._dagChildren_(expressions || []);
  26762. },
  26763. peg$c63 = "true",
  26764. peg$c64 = { type: "literal", value: "true", description: "\"true\"" },
  26765. peg$c65 = function() {return true;},
  26766. peg$c66 = "false",
  26767. peg$c67 = { type: "literal", value: "false", description: "\"false\"" },
  26768. peg$c68 = function() {return false;},
  26769. peg$c69 = "nil",
  26770. peg$c70 = { type: "literal", value: "nil", description: "\"nil\"" },
  26771. peg$c71 = function() {return null;},
  26772. peg$c72 = function(identifier) {
  26773. return $globals.VariableNode._new()
  26774. ._location_(location())
  26775. ._source_(text())
  26776. ._value_(identifier);
  26777. },
  26778. peg$c73 = /^[\\+*\/=><,@%~|&\-]/,
  26779. peg$c74 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  26780. peg$c75 = function(key, arg) {return {key:key, arg:arg};},
  26781. peg$c76 = function(pairs) {
  26782. var selector = '';
  26783. var params = [];
  26784. for(var i = 0; i < pairs.length; i++) {
  26785. selector += pairs[i].key;
  26786. params.push(pairs[i].arg);
  26787. }
  26788. return [selector, params];
  26789. },
  26790. peg$c77 = function(selector, arg) {
  26791. return [selector, [arg]];
  26792. },
  26793. peg$c78 = function(selector) {return [selector, []];},
  26794. peg$c79 = function(expression) {
  26795. return expression;
  26796. },
  26797. peg$c80 = function(first, others) {
  26798. return [first].concat(others);
  26799. },
  26800. peg$c81 = function(selector) {
  26801. return $globals.Message._selector_arguments_(selector, []);
  26802. },
  26803. peg$c82 = function(pairs) {
  26804. var selector = '';
  26805. var args = [];
  26806. for(var i = 0; i < pairs.length; i++) {
  26807. selector += pairs[i].key;
  26808. args.push(pairs[i].arg._value());
  26809. }
  26810. return $globals.Message._selector_arguments_(selector, args)
  26811. },
  26812. peg$c83 = "<",
  26813. peg$c84 = { type: "literal", value: "<", description: "\"<\"" },
  26814. peg$c85 = ">",
  26815. peg$c86 = { type: "literal", value: ">", description: "\">\"" },
  26816. peg$c87 = function(message) {return message;},
  26817. peg$c88 = ":=",
  26818. peg$c89 = { type: "literal", value: ":=", description: "\":=\"" },
  26819. peg$c90 = function(variable, expression) {
  26820. return $globals.AssignmentNode._new()
  26821. ._location_(location())
  26822. ._source_(text())
  26823. ._left_(variable)
  26824. ._right_(expression);
  26825. },
  26826. peg$c91 = "^",
  26827. peg$c92 = { type: "literal", value: "^", description: "\"^\"" },
  26828. peg$c93 = function(expression) {
  26829. return $globals.ReturnNode._new()
  26830. ._location_(location())
  26831. ._source_(text())
  26832. ._dagChildren_([expression]);
  26833. },
  26834. peg$c94 = "|",
  26835. peg$c95 = { type: "literal", value: "|", description: "\"|\"" },
  26836. peg$c96 = function(variable) {return variable;},
  26837. peg$c97 = function(vars) {
  26838. return vars;
  26839. },
  26840. peg$c98 = function(param) {return param;},
  26841. peg$c99 = function(params) {
  26842. return params;
  26843. },
  26844. peg$c100 = function(ret) {return [ret];},
  26845. peg$c101 = function(exps, ret) {
  26846. var expressions = exps;
  26847. expressions.push(ret);
  26848. return expressions;
  26849. },
  26850. peg$c102 = function(expressions) {return expressions || [];},
  26851. peg$c103 = function(aPragmas, temps, zPragmas, statements) {
  26852. return $globals.SequenceNode._new()
  26853. ._location_(location())
  26854. ._source_(text())
  26855. ._temps_(temps || [])
  26856. ._pragmas_((aPragmas || []).concat(zPragmas || []))
  26857. ._dagChildren_(statements || []);
  26858. },
  26859. peg$c104 = "[",
  26860. peg$c105 = { type: "literal", value: "[", description: "\"[\"" },
  26861. peg$c106 = "]",
  26862. peg$c107 = { type: "literal", value: "]", description: "\"]\"" },
  26863. peg$c108 = function(params, sequence) {
  26864. return $globals.BlockNode._new()
  26865. ._location_(location())
  26866. ._source_(text())
  26867. ._parameters_(params || [])
  26868. ._dagChildren_([sequence._asBlockSequenceNode()]);
  26869. },
  26870. peg$c109 = function(selector) {
  26871. return $globals.SendNode._new()
  26872. ._location_(location())
  26873. ._source_(text())
  26874. ._selector_(selector);
  26875. },
  26876. peg$c110 = function(receiver, tail) {
  26877. return receiver._withTail_(tail);
  26878. },
  26879. peg$c111 = function(selector, arg) {
  26880. return $globals.SendNode._new()
  26881. ._location_(location())
  26882. ._source_(text())
  26883. ._selector_(selector)
  26884. ._arguments_([arg]);
  26885. },
  26886. peg$c112 = function(unarys, binarys) { return unarys.concat(binarys); },
  26887. peg$c113 = function(pairs) {
  26888. var selector = '';
  26889. var args = [];
  26890. for(var i = 0; i < pairs.length; i++) {
  26891. selector += pairs[i].key;
  26892. args.push(pairs[i].arg);
  26893. }
  26894. return $globals.SendNode._new()
  26895. ._location_(location())
  26896. ._source_(text())
  26897. ._selector_(selector)
  26898. ._arguments_(args);
  26899. },
  26900. peg$c114 = function(binarys, final) {
  26901. if (final) binarys.push(final);
  26902. return binarys;
  26903. },
  26904. peg$c115 = function(receiver, tail) {return tail.length > 0;},
  26905. peg$c116 = ";",
  26906. peg$c117 = { type: "literal", value: ";", description: "\";\"" },
  26907. peg$c118 = function(receiver, tail, mess) {return mess;},
  26908. peg$c119 = function(receiver, tail, messages) {
  26909. messages.unshift(receiver._withTail_(tail));
  26910. return $globals.CascadeNode._new()
  26911. ._location_(location())
  26912. ._source_(text())
  26913. ._dagChildren_(messages);
  26914. },
  26915. peg$c120 = function(pattern, sequence) {
  26916. return $globals.MethodNode._new()
  26917. ._location_(location())
  26918. ._source_(text())
  26919. ._selector_(pattern[0])
  26920. ._arguments_(pattern[1])
  26921. ._dagChildren_([sequence]);
  26922. },
  26923. peg$c121 = function(receiver, tail) { return tail.length > 0 && tail[tail.length-1]._selector() === '->' },
  26924. peg$c122 = function(receiver, tail) {
  26925. var last = tail.pop();
  26926. return [receiver._withTail_(tail), last._arguments()[0]];
  26927. },
  26928. peg$c123 = function(first, others) {
  26929. return first.concat.apply(first, others);
  26930. },
  26931. peg$currPos = 0,
  26932. peg$savedPos = 0,
  26933. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  26934. peg$maxFailPos = 0,
  26935. peg$maxFailExpected = [],
  26936. peg$silentFails = 0,
  26937. peg$resultsCache = {},
  26938. peg$result;
  26939. if ("startRule" in options) {
  26940. if (!(options.startRule in peg$startRuleFunctions)) {
  26941. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  26942. }
  26943. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  26944. }
  26945. function text() {
  26946. return input.substring(peg$savedPos, peg$currPos);
  26947. }
  26948. function location() {
  26949. return peg$computeLocation(peg$savedPos, peg$currPos);
  26950. }
  26951. function expected(description) {
  26952. throw peg$buildException(
  26953. null,
  26954. [{ type: "other", description: description }],
  26955. input.substring(peg$savedPos, peg$currPos),
  26956. peg$computeLocation(peg$savedPos, peg$currPos)
  26957. );
  26958. }
  26959. function error(message) {
  26960. throw peg$buildException(
  26961. message,
  26962. null,
  26963. input.substring(peg$savedPos, peg$currPos),
  26964. peg$computeLocation(peg$savedPos, peg$currPos)
  26965. );
  26966. }
  26967. function peg$computePosDetails(pos) {
  26968. var details = peg$posDetailsCache[pos],
  26969. p, ch;
  26970. if (details) {
  26971. return details;
  26972. } else {
  26973. p = pos - 1;
  26974. while (!peg$posDetailsCache[p]) {
  26975. p--;
  26976. }
  26977. details = peg$posDetailsCache[p];
  26978. details = {
  26979. line: details.line,
  26980. column: details.column,
  26981. seenCR: details.seenCR
  26982. };
  26983. while (p < pos) {
  26984. ch = input.charAt(p);
  26985. if (ch === "\n") {
  26986. if (!details.seenCR) { details.line++; }
  26987. details.column = 1;
  26988. details.seenCR = false;
  26989. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  26990. details.line++;
  26991. details.column = 1;
  26992. details.seenCR = true;
  26993. } else {
  26994. details.column++;
  26995. details.seenCR = false;
  26996. }
  26997. p++;
  26998. }
  26999. peg$posDetailsCache[pos] = details;
  27000. return details;
  27001. }
  27002. }
  27003. function peg$computeLocation(startPos, endPos) {
  27004. var startPosDetails = peg$computePosDetails(startPos),
  27005. endPosDetails = peg$computePosDetails(endPos);
  27006. return {
  27007. start: {
  27008. offset: startPos,
  27009. line: startPosDetails.line,
  27010. column: startPosDetails.column
  27011. },
  27012. end: {
  27013. offset: endPos,
  27014. line: endPosDetails.line,
  27015. column: endPosDetails.column
  27016. }
  27017. };
  27018. }
  27019. function peg$fail(expected) {
  27020. if (peg$currPos < peg$maxFailPos) { return; }
  27021. if (peg$currPos > peg$maxFailPos) {
  27022. peg$maxFailPos = peg$currPos;
  27023. peg$maxFailExpected = [];
  27024. }
  27025. peg$maxFailExpected.push(expected);
  27026. }
  27027. function peg$buildException(message, expected, found, location) {
  27028. function cleanupExpected(expected) {
  27029. var i = 1;
  27030. expected.sort(function(a, b) {
  27031. if (a.description < b.description) {
  27032. return -1;
  27033. } else if (a.description > b.description) {
  27034. return 1;
  27035. } else {
  27036. return 0;
  27037. }
  27038. });
  27039. while (i < expected.length) {
  27040. if (expected[i - 1] === expected[i]) {
  27041. expected.splice(i, 1);
  27042. } else {
  27043. i++;
  27044. }
  27045. }
  27046. }
  27047. function buildMessage(expected, found) {
  27048. function stringEscape(s) {
  27049. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  27050. return s
  27051. .replace(/\\/g, '\\\\')
  27052. .replace(/"/g, '\\"')
  27053. .replace(/\x08/g, '\\b')
  27054. .replace(/\t/g, '\\t')
  27055. .replace(/\n/g, '\\n')
  27056. .replace(/\f/g, '\\f')
  27057. .replace(/\r/g, '\\r')
  27058. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  27059. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  27060. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  27061. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  27062. }
  27063. var expectedDescs = new Array(expected.length),
  27064. expectedDesc, foundDesc, i;
  27065. for (i = 0; i < expected.length; i++) {
  27066. expectedDescs[i] = expected[i].description;
  27067. }
  27068. expectedDesc = expected.length > 1
  27069. ? expectedDescs.slice(0, -1).join(", ")
  27070. + " or "
  27071. + expectedDescs[expected.length - 1]
  27072. : expectedDescs[0];
  27073. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  27074. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  27075. }
  27076. if (expected !== null) {
  27077. cleanupExpected(expected);
  27078. }
  27079. return new peg$SyntaxError(
  27080. message !== null ? message : buildMessage(expected, found),
  27081. expected,
  27082. found,
  27083. location
  27084. );
  27085. }
  27086. function peg$parsestart() {
  27087. var s0;
  27088. var key = peg$currPos * 66 + 0,
  27089. cached = peg$resultsCache[key];
  27090. if (cached) {
  27091. peg$currPos = cached.nextPos;
  27092. return cached.result;
  27093. }
  27094. s0 = peg$parsemethod();
  27095. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27096. return s0;
  27097. }
  27098. function peg$parseseparator() {
  27099. var s0, s1;
  27100. var key = peg$currPos * 66 + 1,
  27101. cached = peg$resultsCache[key];
  27102. if (cached) {
  27103. peg$currPos = cached.nextPos;
  27104. return cached.result;
  27105. }
  27106. s0 = [];
  27107. if (peg$c0.test(input.charAt(peg$currPos))) {
  27108. s1 = input.charAt(peg$currPos);
  27109. peg$currPos++;
  27110. } else {
  27111. s1 = peg$FAILED;
  27112. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27113. }
  27114. if (s1 !== peg$FAILED) {
  27115. while (s1 !== peg$FAILED) {
  27116. s0.push(s1);
  27117. if (peg$c0.test(input.charAt(peg$currPos))) {
  27118. s1 = input.charAt(peg$currPos);
  27119. peg$currPos++;
  27120. } else {
  27121. s1 = peg$FAILED;
  27122. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27123. }
  27124. }
  27125. } else {
  27126. s0 = peg$FAILED;
  27127. }
  27128. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27129. return s0;
  27130. }
  27131. function peg$parsecomments() {
  27132. var s0, s1, s2, s3, s4;
  27133. var key = peg$currPos * 66 + 2,
  27134. cached = peg$resultsCache[key];
  27135. if (cached) {
  27136. peg$currPos = cached.nextPos;
  27137. return cached.result;
  27138. }
  27139. s0 = [];
  27140. s1 = peg$currPos;
  27141. if (input.charCodeAt(peg$currPos) === 34) {
  27142. s2 = peg$c2;
  27143. peg$currPos++;
  27144. } else {
  27145. s2 = peg$FAILED;
  27146. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27147. }
  27148. if (s2 !== peg$FAILED) {
  27149. s3 = [];
  27150. if (peg$c4.test(input.charAt(peg$currPos))) {
  27151. s4 = input.charAt(peg$currPos);
  27152. peg$currPos++;
  27153. } else {
  27154. s4 = peg$FAILED;
  27155. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27156. }
  27157. while (s4 !== peg$FAILED) {
  27158. s3.push(s4);
  27159. if (peg$c4.test(input.charAt(peg$currPos))) {
  27160. s4 = input.charAt(peg$currPos);
  27161. peg$currPos++;
  27162. } else {
  27163. s4 = peg$FAILED;
  27164. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27165. }
  27166. }
  27167. if (s3 !== peg$FAILED) {
  27168. if (input.charCodeAt(peg$currPos) === 34) {
  27169. s4 = peg$c2;
  27170. peg$currPos++;
  27171. } else {
  27172. s4 = peg$FAILED;
  27173. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27174. }
  27175. if (s4 !== peg$FAILED) {
  27176. s2 = [s2, s3, s4];
  27177. s1 = s2;
  27178. } else {
  27179. peg$currPos = s1;
  27180. s1 = peg$FAILED;
  27181. }
  27182. } else {
  27183. peg$currPos = s1;
  27184. s1 = peg$FAILED;
  27185. }
  27186. } else {
  27187. peg$currPos = s1;
  27188. s1 = peg$FAILED;
  27189. }
  27190. if (s1 !== peg$FAILED) {
  27191. while (s1 !== peg$FAILED) {
  27192. s0.push(s1);
  27193. s1 = peg$currPos;
  27194. if (input.charCodeAt(peg$currPos) === 34) {
  27195. s2 = peg$c2;
  27196. peg$currPos++;
  27197. } else {
  27198. s2 = peg$FAILED;
  27199. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27200. }
  27201. if (s2 !== peg$FAILED) {
  27202. s3 = [];
  27203. if (peg$c4.test(input.charAt(peg$currPos))) {
  27204. s4 = input.charAt(peg$currPos);
  27205. peg$currPos++;
  27206. } else {
  27207. s4 = peg$FAILED;
  27208. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27209. }
  27210. while (s4 !== peg$FAILED) {
  27211. s3.push(s4);
  27212. if (peg$c4.test(input.charAt(peg$currPos))) {
  27213. s4 = input.charAt(peg$currPos);
  27214. peg$currPos++;
  27215. } else {
  27216. s4 = peg$FAILED;
  27217. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27218. }
  27219. }
  27220. if (s3 !== peg$FAILED) {
  27221. if (input.charCodeAt(peg$currPos) === 34) {
  27222. s4 = peg$c2;
  27223. peg$currPos++;
  27224. } else {
  27225. s4 = peg$FAILED;
  27226. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27227. }
  27228. if (s4 !== peg$FAILED) {
  27229. s2 = [s2, s3, s4];
  27230. s1 = s2;
  27231. } else {
  27232. peg$currPos = s1;
  27233. s1 = peg$FAILED;
  27234. }
  27235. } else {
  27236. peg$currPos = s1;
  27237. s1 = peg$FAILED;
  27238. }
  27239. } else {
  27240. peg$currPos = s1;
  27241. s1 = peg$FAILED;
  27242. }
  27243. }
  27244. } else {
  27245. s0 = peg$FAILED;
  27246. }
  27247. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27248. return s0;
  27249. }
  27250. function peg$parsews() {
  27251. var s0, s1;
  27252. var key = peg$currPos * 66 + 3,
  27253. cached = peg$resultsCache[key];
  27254. if (cached) {
  27255. peg$currPos = cached.nextPos;
  27256. return cached.result;
  27257. }
  27258. s0 = [];
  27259. s1 = peg$parseseparator();
  27260. if (s1 === peg$FAILED) {
  27261. s1 = peg$parsecomments();
  27262. }
  27263. while (s1 !== peg$FAILED) {
  27264. s0.push(s1);
  27265. s1 = peg$parseseparator();
  27266. if (s1 === peg$FAILED) {
  27267. s1 = peg$parsecomments();
  27268. }
  27269. }
  27270. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27271. return s0;
  27272. }
  27273. function peg$parsemaybeDotsWs() {
  27274. var s0, s1;
  27275. var key = peg$currPos * 66 + 4,
  27276. cached = peg$resultsCache[key];
  27277. if (cached) {
  27278. peg$currPos = cached.nextPos;
  27279. return cached.result;
  27280. }
  27281. s0 = [];
  27282. if (input.charCodeAt(peg$currPos) === 46) {
  27283. s1 = peg$c6;
  27284. peg$currPos++;
  27285. } else {
  27286. s1 = peg$FAILED;
  27287. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27288. }
  27289. if (s1 === peg$FAILED) {
  27290. s1 = peg$parseseparator();
  27291. if (s1 === peg$FAILED) {
  27292. s1 = peg$parsecomments();
  27293. }
  27294. }
  27295. while (s1 !== peg$FAILED) {
  27296. s0.push(s1);
  27297. if (input.charCodeAt(peg$currPos) === 46) {
  27298. s1 = peg$c6;
  27299. peg$currPos++;
  27300. } else {
  27301. s1 = peg$FAILED;
  27302. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27303. }
  27304. if (s1 === peg$FAILED) {
  27305. s1 = peg$parseseparator();
  27306. if (s1 === peg$FAILED) {
  27307. s1 = peg$parsecomments();
  27308. }
  27309. }
  27310. }
  27311. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27312. return s0;
  27313. }
  27314. function peg$parsesomeDotsWs() {
  27315. var s0, s1, s2, s3;
  27316. var key = peg$currPos * 66 + 5,
  27317. cached = peg$resultsCache[key];
  27318. if (cached) {
  27319. peg$currPos = cached.nextPos;
  27320. return cached.result;
  27321. }
  27322. s0 = peg$currPos;
  27323. s1 = peg$parsews();
  27324. if (s1 !== peg$FAILED) {
  27325. if (input.charCodeAt(peg$currPos) === 46) {
  27326. s2 = peg$c6;
  27327. peg$currPos++;
  27328. } else {
  27329. s2 = peg$FAILED;
  27330. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27331. }
  27332. if (s2 !== peg$FAILED) {
  27333. s3 = peg$parsemaybeDotsWs();
  27334. if (s3 !== peg$FAILED) {
  27335. s1 = [s1, s2, s3];
  27336. s0 = s1;
  27337. } else {
  27338. peg$currPos = s0;
  27339. s0 = peg$FAILED;
  27340. }
  27341. } else {
  27342. peg$currPos = s0;
  27343. s0 = peg$FAILED;
  27344. }
  27345. } else {
  27346. peg$currPos = s0;
  27347. s0 = peg$FAILED;
  27348. }
  27349. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27350. return s0;
  27351. }
  27352. function peg$parseidentifier() {
  27353. var s0, s1, s2, s3, s4;
  27354. var key = peg$currPos * 66 + 6,
  27355. cached = peg$resultsCache[key];
  27356. if (cached) {
  27357. peg$currPos = cached.nextPos;
  27358. return cached.result;
  27359. }
  27360. s0 = peg$currPos;
  27361. s1 = peg$currPos;
  27362. if (peg$c8.test(input.charAt(peg$currPos))) {
  27363. s2 = input.charAt(peg$currPos);
  27364. peg$currPos++;
  27365. } else {
  27366. s2 = peg$FAILED;
  27367. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  27368. }
  27369. if (s2 !== peg$FAILED) {
  27370. s3 = [];
  27371. if (peg$c10.test(input.charAt(peg$currPos))) {
  27372. s4 = input.charAt(peg$currPos);
  27373. peg$currPos++;
  27374. } else {
  27375. s4 = peg$FAILED;
  27376. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27377. }
  27378. while (s4 !== peg$FAILED) {
  27379. s3.push(s4);
  27380. if (peg$c10.test(input.charAt(peg$currPos))) {
  27381. s4 = input.charAt(peg$currPos);
  27382. peg$currPos++;
  27383. } else {
  27384. s4 = peg$FAILED;
  27385. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27386. }
  27387. }
  27388. if (s3 !== peg$FAILED) {
  27389. s2 = [s2, s3];
  27390. s1 = s2;
  27391. } else {
  27392. peg$currPos = s1;
  27393. s1 = peg$FAILED;
  27394. }
  27395. } else {
  27396. peg$currPos = s1;
  27397. s1 = peg$FAILED;
  27398. }
  27399. if (s1 !== peg$FAILED) {
  27400. s0 = input.substring(s0, peg$currPos);
  27401. } else {
  27402. s0 = s1;
  27403. }
  27404. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27405. return s0;
  27406. }
  27407. function peg$parsekeyword() {
  27408. var s0, s1, s2, s3;
  27409. var key = peg$currPos * 66 + 7,
  27410. cached = peg$resultsCache[key];
  27411. if (cached) {
  27412. peg$currPos = cached.nextPos;
  27413. return cached.result;
  27414. }
  27415. s0 = peg$currPos;
  27416. s1 = peg$currPos;
  27417. s2 = peg$parseidentifier();
  27418. if (s2 !== peg$FAILED) {
  27419. if (input.charCodeAt(peg$currPos) === 58) {
  27420. s3 = peg$c12;
  27421. peg$currPos++;
  27422. } else {
  27423. s3 = peg$FAILED;
  27424. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27425. }
  27426. if (s3 !== peg$FAILED) {
  27427. s2 = [s2, s3];
  27428. s1 = s2;
  27429. } else {
  27430. peg$currPos = s1;
  27431. s1 = peg$FAILED;
  27432. }
  27433. } else {
  27434. peg$currPos = s1;
  27435. s1 = peg$FAILED;
  27436. }
  27437. if (s1 !== peg$FAILED) {
  27438. s0 = input.substring(s0, peg$currPos);
  27439. } else {
  27440. s0 = s1;
  27441. }
  27442. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27443. return s0;
  27444. }
  27445. function peg$parseclassName() {
  27446. var s0, s1, s2, s3, s4;
  27447. var key = peg$currPos * 66 + 8,
  27448. cached = peg$resultsCache[key];
  27449. if (cached) {
  27450. peg$currPos = cached.nextPos;
  27451. return cached.result;
  27452. }
  27453. s0 = peg$currPos;
  27454. s1 = peg$currPos;
  27455. if (peg$c14.test(input.charAt(peg$currPos))) {
  27456. s2 = input.charAt(peg$currPos);
  27457. peg$currPos++;
  27458. } else {
  27459. s2 = peg$FAILED;
  27460. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  27461. }
  27462. if (s2 !== peg$FAILED) {
  27463. s3 = [];
  27464. if (peg$c10.test(input.charAt(peg$currPos))) {
  27465. s4 = input.charAt(peg$currPos);
  27466. peg$currPos++;
  27467. } else {
  27468. s4 = peg$FAILED;
  27469. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27470. }
  27471. while (s4 !== peg$FAILED) {
  27472. s3.push(s4);
  27473. if (peg$c10.test(input.charAt(peg$currPos))) {
  27474. s4 = input.charAt(peg$currPos);
  27475. peg$currPos++;
  27476. } else {
  27477. s4 = peg$FAILED;
  27478. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27479. }
  27480. }
  27481. if (s3 !== peg$FAILED) {
  27482. s2 = [s2, s3];
  27483. s1 = s2;
  27484. } else {
  27485. peg$currPos = s1;
  27486. s1 = peg$FAILED;
  27487. }
  27488. } else {
  27489. peg$currPos = s1;
  27490. s1 = peg$FAILED;
  27491. }
  27492. if (s1 !== peg$FAILED) {
  27493. s0 = input.substring(s0, peg$currPos);
  27494. } else {
  27495. s0 = s1;
  27496. }
  27497. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27498. return s0;
  27499. }
  27500. function peg$parsestring() {
  27501. var s0, s1;
  27502. var key = peg$currPos * 66 + 9,
  27503. cached = peg$resultsCache[key];
  27504. if (cached) {
  27505. peg$currPos = cached.nextPos;
  27506. return cached.result;
  27507. }
  27508. s0 = peg$currPos;
  27509. s1 = peg$parserawString();
  27510. if (s1 !== peg$FAILED) {
  27511. peg$savedPos = s0;
  27512. s1 = peg$c16(s1);
  27513. }
  27514. s0 = s1;
  27515. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27516. return s0;
  27517. }
  27518. function peg$parserawString() {
  27519. var s0, s1, s2, s3, s4;
  27520. var key = peg$currPos * 66 + 10,
  27521. cached = peg$resultsCache[key];
  27522. if (cached) {
  27523. peg$currPos = cached.nextPos;
  27524. return cached.result;
  27525. }
  27526. s0 = peg$currPos;
  27527. if (input.charCodeAt(peg$currPos) === 39) {
  27528. s1 = peg$c17;
  27529. peg$currPos++;
  27530. } else {
  27531. s1 = peg$FAILED;
  27532. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27533. }
  27534. if (s1 !== peg$FAILED) {
  27535. s2 = [];
  27536. s3 = peg$currPos;
  27537. if (input.substr(peg$currPos, 2) === peg$c19) {
  27538. s4 = peg$c19;
  27539. peg$currPos += 2;
  27540. } else {
  27541. s4 = peg$FAILED;
  27542. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27543. }
  27544. if (s4 !== peg$FAILED) {
  27545. peg$savedPos = s3;
  27546. s4 = peg$c21();
  27547. }
  27548. s3 = s4;
  27549. if (s3 === peg$FAILED) {
  27550. if (peg$c22.test(input.charAt(peg$currPos))) {
  27551. s3 = input.charAt(peg$currPos);
  27552. peg$currPos++;
  27553. } else {
  27554. s3 = peg$FAILED;
  27555. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27556. }
  27557. }
  27558. while (s3 !== peg$FAILED) {
  27559. s2.push(s3);
  27560. s3 = peg$currPos;
  27561. if (input.substr(peg$currPos, 2) === peg$c19) {
  27562. s4 = peg$c19;
  27563. peg$currPos += 2;
  27564. } else {
  27565. s4 = peg$FAILED;
  27566. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27567. }
  27568. if (s4 !== peg$FAILED) {
  27569. peg$savedPos = s3;
  27570. s4 = peg$c21();
  27571. }
  27572. s3 = s4;
  27573. if (s3 === peg$FAILED) {
  27574. if (peg$c22.test(input.charAt(peg$currPos))) {
  27575. s3 = input.charAt(peg$currPos);
  27576. peg$currPos++;
  27577. } else {
  27578. s3 = peg$FAILED;
  27579. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27580. }
  27581. }
  27582. }
  27583. if (s2 !== peg$FAILED) {
  27584. if (input.charCodeAt(peg$currPos) === 39) {
  27585. s3 = peg$c17;
  27586. peg$currPos++;
  27587. } else {
  27588. s3 = peg$FAILED;
  27589. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27590. }
  27591. if (s3 !== peg$FAILED) {
  27592. peg$savedPos = s0;
  27593. s1 = peg$c24(s2);
  27594. s0 = s1;
  27595. } else {
  27596. peg$currPos = s0;
  27597. s0 = peg$FAILED;
  27598. }
  27599. } else {
  27600. peg$currPos = s0;
  27601. s0 = peg$FAILED;
  27602. }
  27603. } else {
  27604. peg$currPos = s0;
  27605. s0 = peg$FAILED;
  27606. }
  27607. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27608. return s0;
  27609. }
  27610. function peg$parsecharacter() {
  27611. var s0, s1, s2;
  27612. var key = peg$currPos * 66 + 11,
  27613. cached = peg$resultsCache[key];
  27614. if (cached) {
  27615. peg$currPos = cached.nextPos;
  27616. return cached.result;
  27617. }
  27618. s0 = peg$currPos;
  27619. if (input.charCodeAt(peg$currPos) === 36) {
  27620. s1 = peg$c25;
  27621. peg$currPos++;
  27622. } else {
  27623. s1 = peg$FAILED;
  27624. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  27625. }
  27626. if (s1 !== peg$FAILED) {
  27627. if (input.length > peg$currPos) {
  27628. s2 = input.charAt(peg$currPos);
  27629. peg$currPos++;
  27630. } else {
  27631. s2 = peg$FAILED;
  27632. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  27633. }
  27634. if (s2 !== peg$FAILED) {
  27635. peg$savedPos = s0;
  27636. s1 = peg$c28(s2);
  27637. s0 = s1;
  27638. } else {
  27639. peg$currPos = s0;
  27640. s0 = peg$FAILED;
  27641. }
  27642. } else {
  27643. peg$currPos = s0;
  27644. s0 = peg$FAILED;
  27645. }
  27646. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27647. return s0;
  27648. }
  27649. function peg$parsesymbol() {
  27650. var s0, s1, s2;
  27651. var key = peg$currPos * 66 + 12,
  27652. cached = peg$resultsCache[key];
  27653. if (cached) {
  27654. peg$currPos = cached.nextPos;
  27655. return cached.result;
  27656. }
  27657. s0 = peg$currPos;
  27658. if (input.charCodeAt(peg$currPos) === 35) {
  27659. s1 = peg$c29;
  27660. peg$currPos++;
  27661. } else {
  27662. s1 = peg$FAILED;
  27663. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  27664. }
  27665. if (s1 !== peg$FAILED) {
  27666. s2 = peg$parsebareSymbol();
  27667. if (s2 !== peg$FAILED) {
  27668. peg$savedPos = s0;
  27669. s1 = peg$c31(s2);
  27670. s0 = s1;
  27671. } else {
  27672. peg$currPos = s0;
  27673. s0 = peg$FAILED;
  27674. }
  27675. } else {
  27676. peg$currPos = s0;
  27677. s0 = peg$FAILED;
  27678. }
  27679. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27680. return s0;
  27681. }
  27682. function peg$parsebareSymbol() {
  27683. var s0, s1, s2, s3;
  27684. var key = peg$currPos * 66 + 13,
  27685. cached = peg$resultsCache[key];
  27686. if (cached) {
  27687. peg$currPos = cached.nextPos;
  27688. return cached.result;
  27689. }
  27690. s0 = peg$currPos;
  27691. s1 = peg$currPos;
  27692. s2 = [];
  27693. s3 = peg$parsekeyword();
  27694. if (s3 !== peg$FAILED) {
  27695. while (s3 !== peg$FAILED) {
  27696. s2.push(s3);
  27697. s3 = peg$parsekeyword();
  27698. }
  27699. } else {
  27700. s2 = peg$FAILED;
  27701. }
  27702. if (s2 !== peg$FAILED) {
  27703. s1 = input.substring(s1, peg$currPos);
  27704. } else {
  27705. s1 = s2;
  27706. }
  27707. if (s1 === peg$FAILED) {
  27708. s1 = peg$parsebinarySelector();
  27709. if (s1 === peg$FAILED) {
  27710. s1 = peg$parseidentifier();
  27711. if (s1 === peg$FAILED) {
  27712. s1 = peg$parserawString();
  27713. }
  27714. }
  27715. }
  27716. if (s1 !== peg$FAILED) {
  27717. peg$savedPos = s0;
  27718. s1 = peg$c16(s1);
  27719. }
  27720. s0 = s1;
  27721. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27722. return s0;
  27723. }
  27724. function peg$parsenumber() {
  27725. var s0, s1;
  27726. var key = peg$currPos * 66 + 14,
  27727. cached = peg$resultsCache[key];
  27728. if (cached) {
  27729. peg$currPos = cached.nextPos;
  27730. return cached.result;
  27731. }
  27732. s0 = peg$currPos;
  27733. s1 = peg$parserawNumber();
  27734. if (s1 !== peg$FAILED) {
  27735. peg$savedPos = s0;
  27736. s1 = peg$c16(s1);
  27737. }
  27738. s0 = s1;
  27739. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27740. return s0;
  27741. }
  27742. function peg$parserawNumber() {
  27743. var s0;
  27744. var key = peg$currPos * 66 + 15,
  27745. cached = peg$resultsCache[key];
  27746. if (cached) {
  27747. peg$currPos = cached.nextPos;
  27748. return cached.result;
  27749. }
  27750. s0 = peg$parsenumberExp();
  27751. if (s0 === peg$FAILED) {
  27752. s0 = peg$parsehex();
  27753. if (s0 === peg$FAILED) {
  27754. s0 = peg$parsefloat();
  27755. if (s0 === peg$FAILED) {
  27756. s0 = peg$parseinteger();
  27757. }
  27758. }
  27759. }
  27760. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27761. return s0;
  27762. }
  27763. function peg$parsenumberExp() {
  27764. var s0, s1, s2, s3, s4, s5;
  27765. var key = peg$currPos * 66 + 16,
  27766. cached = peg$resultsCache[key];
  27767. if (cached) {
  27768. peg$currPos = cached.nextPos;
  27769. return cached.result;
  27770. }
  27771. s0 = peg$currPos;
  27772. s1 = peg$currPos;
  27773. s2 = peg$currPos;
  27774. s3 = peg$parsefloat();
  27775. if (s3 === peg$FAILED) {
  27776. s3 = peg$parseinteger();
  27777. }
  27778. if (s3 !== peg$FAILED) {
  27779. if (input.charCodeAt(peg$currPos) === 101) {
  27780. s4 = peg$c32;
  27781. peg$currPos++;
  27782. } else {
  27783. s4 = peg$FAILED;
  27784. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  27785. }
  27786. if (s4 !== peg$FAILED) {
  27787. s5 = peg$parseinteger();
  27788. if (s5 !== peg$FAILED) {
  27789. s3 = [s3, s4, s5];
  27790. s2 = s3;
  27791. } else {
  27792. peg$currPos = s2;
  27793. s2 = peg$FAILED;
  27794. }
  27795. } else {
  27796. peg$currPos = s2;
  27797. s2 = peg$FAILED;
  27798. }
  27799. } else {
  27800. peg$currPos = s2;
  27801. s2 = peg$FAILED;
  27802. }
  27803. if (s2 !== peg$FAILED) {
  27804. s1 = input.substring(s1, peg$currPos);
  27805. } else {
  27806. s1 = s2;
  27807. }
  27808. if (s1 !== peg$FAILED) {
  27809. peg$savedPos = s0;
  27810. s1 = peg$c34(s1);
  27811. }
  27812. s0 = s1;
  27813. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27814. return s0;
  27815. }
  27816. function peg$parsehex() {
  27817. var s0, s1, s2, s3, s4, s5;
  27818. var key = peg$currPos * 66 + 17,
  27819. cached = peg$resultsCache[key];
  27820. if (cached) {
  27821. peg$currPos = cached.nextPos;
  27822. return cached.result;
  27823. }
  27824. s0 = peg$currPos;
  27825. if (input.charCodeAt(peg$currPos) === 45) {
  27826. s1 = peg$c35;
  27827. peg$currPos++;
  27828. } else {
  27829. s1 = peg$FAILED;
  27830. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27831. }
  27832. if (s1 === peg$FAILED) {
  27833. s1 = null;
  27834. }
  27835. if (s1 !== peg$FAILED) {
  27836. if (input.substr(peg$currPos, 3) === peg$c37) {
  27837. s2 = peg$c37;
  27838. peg$currPos += 3;
  27839. } else {
  27840. s2 = peg$FAILED;
  27841. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  27842. }
  27843. if (s2 !== peg$FAILED) {
  27844. s3 = peg$currPos;
  27845. s4 = [];
  27846. if (peg$c39.test(input.charAt(peg$currPos))) {
  27847. s5 = input.charAt(peg$currPos);
  27848. peg$currPos++;
  27849. } else {
  27850. s5 = peg$FAILED;
  27851. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27852. }
  27853. if (s5 !== peg$FAILED) {
  27854. while (s5 !== peg$FAILED) {
  27855. s4.push(s5);
  27856. if (peg$c39.test(input.charAt(peg$currPos))) {
  27857. s5 = input.charAt(peg$currPos);
  27858. peg$currPos++;
  27859. } else {
  27860. s5 = peg$FAILED;
  27861. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27862. }
  27863. }
  27864. } else {
  27865. s4 = peg$FAILED;
  27866. }
  27867. if (s4 !== peg$FAILED) {
  27868. s3 = input.substring(s3, peg$currPos);
  27869. } else {
  27870. s3 = s4;
  27871. }
  27872. if (s3 !== peg$FAILED) {
  27873. peg$savedPos = s0;
  27874. s1 = peg$c41(s1, s3);
  27875. s0 = s1;
  27876. } else {
  27877. peg$currPos = s0;
  27878. s0 = peg$FAILED;
  27879. }
  27880. } else {
  27881. peg$currPos = s0;
  27882. s0 = peg$FAILED;
  27883. }
  27884. } else {
  27885. peg$currPos = s0;
  27886. s0 = peg$FAILED;
  27887. }
  27888. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27889. return s0;
  27890. }
  27891. function peg$parsefloat() {
  27892. var s0, s1, s2, s3, s4, s5, s6, s7;
  27893. var key = peg$currPos * 66 + 18,
  27894. cached = peg$resultsCache[key];
  27895. if (cached) {
  27896. peg$currPos = cached.nextPos;
  27897. return cached.result;
  27898. }
  27899. s0 = peg$currPos;
  27900. s1 = peg$currPos;
  27901. s2 = peg$currPos;
  27902. if (input.charCodeAt(peg$currPos) === 45) {
  27903. s3 = peg$c35;
  27904. peg$currPos++;
  27905. } else {
  27906. s3 = peg$FAILED;
  27907. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27908. }
  27909. if (s3 === peg$FAILED) {
  27910. s3 = null;
  27911. }
  27912. if (s3 !== peg$FAILED) {
  27913. s4 = [];
  27914. if (peg$c42.test(input.charAt(peg$currPos))) {
  27915. s5 = input.charAt(peg$currPos);
  27916. peg$currPos++;
  27917. } else {
  27918. s5 = peg$FAILED;
  27919. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27920. }
  27921. if (s5 !== peg$FAILED) {
  27922. while (s5 !== peg$FAILED) {
  27923. s4.push(s5);
  27924. if (peg$c42.test(input.charAt(peg$currPos))) {
  27925. s5 = input.charAt(peg$currPos);
  27926. peg$currPos++;
  27927. } else {
  27928. s5 = peg$FAILED;
  27929. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27930. }
  27931. }
  27932. } else {
  27933. s4 = peg$FAILED;
  27934. }
  27935. if (s4 !== peg$FAILED) {
  27936. if (input.charCodeAt(peg$currPos) === 46) {
  27937. s5 = peg$c6;
  27938. peg$currPos++;
  27939. } else {
  27940. s5 = peg$FAILED;
  27941. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27942. }
  27943. if (s5 !== peg$FAILED) {
  27944. s6 = [];
  27945. if (peg$c42.test(input.charAt(peg$currPos))) {
  27946. s7 = input.charAt(peg$currPos);
  27947. peg$currPos++;
  27948. } else {
  27949. s7 = peg$FAILED;
  27950. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27951. }
  27952. if (s7 !== peg$FAILED) {
  27953. while (s7 !== peg$FAILED) {
  27954. s6.push(s7);
  27955. if (peg$c42.test(input.charAt(peg$currPos))) {
  27956. s7 = input.charAt(peg$currPos);
  27957. peg$currPos++;
  27958. } else {
  27959. s7 = peg$FAILED;
  27960. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27961. }
  27962. }
  27963. } else {
  27964. s6 = peg$FAILED;
  27965. }
  27966. if (s6 !== peg$FAILED) {
  27967. s3 = [s3, s4, s5, s6];
  27968. s2 = s3;
  27969. } else {
  27970. peg$currPos = s2;
  27971. s2 = peg$FAILED;
  27972. }
  27973. } else {
  27974. peg$currPos = s2;
  27975. s2 = peg$FAILED;
  27976. }
  27977. } else {
  27978. peg$currPos = s2;
  27979. s2 = peg$FAILED;
  27980. }
  27981. } else {
  27982. peg$currPos = s2;
  27983. s2 = peg$FAILED;
  27984. }
  27985. if (s2 !== peg$FAILED) {
  27986. s1 = input.substring(s1, peg$currPos);
  27987. } else {
  27988. s1 = s2;
  27989. }
  27990. if (s1 !== peg$FAILED) {
  27991. peg$savedPos = s0;
  27992. s1 = peg$c44(s1);
  27993. }
  27994. s0 = s1;
  27995. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27996. return s0;
  27997. }
  27998. function peg$parseinteger() {
  27999. var s0, s1, s2, s3, s4, s5;
  28000. var key = peg$currPos * 66 + 19,
  28001. cached = peg$resultsCache[key];
  28002. if (cached) {
  28003. peg$currPos = cached.nextPos;
  28004. return cached.result;
  28005. }
  28006. s0 = peg$currPos;
  28007. s1 = peg$currPos;
  28008. s2 = peg$currPos;
  28009. if (input.charCodeAt(peg$currPos) === 45) {
  28010. s3 = peg$c35;
  28011. peg$currPos++;
  28012. } else {
  28013. s3 = peg$FAILED;
  28014. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28015. }
  28016. if (s3 === peg$FAILED) {
  28017. s3 = null;
  28018. }
  28019. if (s3 !== peg$FAILED) {
  28020. s4 = [];
  28021. if (peg$c42.test(input.charAt(peg$currPos))) {
  28022. s5 = input.charAt(peg$currPos);
  28023. peg$currPos++;
  28024. } else {
  28025. s5 = peg$FAILED;
  28026. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28027. }
  28028. if (s5 !== peg$FAILED) {
  28029. while (s5 !== peg$FAILED) {
  28030. s4.push(s5);
  28031. if (peg$c42.test(input.charAt(peg$currPos))) {
  28032. s5 = input.charAt(peg$currPos);
  28033. peg$currPos++;
  28034. } else {
  28035. s5 = peg$FAILED;
  28036. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28037. }
  28038. }
  28039. } else {
  28040. s4 = peg$FAILED;
  28041. }
  28042. if (s4 !== peg$FAILED) {
  28043. s3 = [s3, s4];
  28044. s2 = s3;
  28045. } else {
  28046. peg$currPos = s2;
  28047. s2 = peg$FAILED;
  28048. }
  28049. } else {
  28050. peg$currPos = s2;
  28051. s2 = peg$FAILED;
  28052. }
  28053. if (s2 !== peg$FAILED) {
  28054. s1 = input.substring(s1, peg$currPos);
  28055. } else {
  28056. s1 = s2;
  28057. }
  28058. if (s1 !== peg$FAILED) {
  28059. peg$savedPos = s0;
  28060. s1 = peg$c45(s1);
  28061. }
  28062. s0 = s1;
  28063. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28064. return s0;
  28065. }
  28066. function peg$parseliteralArray() {
  28067. var s0, s1, s2, s3, s4;
  28068. var key = peg$currPos * 66 + 20,
  28069. cached = peg$resultsCache[key];
  28070. if (cached) {
  28071. peg$currPos = cached.nextPos;
  28072. return cached.result;
  28073. }
  28074. s0 = peg$currPos;
  28075. if (input.substr(peg$currPos, 2) === peg$c46) {
  28076. s1 = peg$c46;
  28077. peg$currPos += 2;
  28078. } else {
  28079. s1 = peg$FAILED;
  28080. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  28081. }
  28082. if (s1 !== peg$FAILED) {
  28083. s2 = peg$parsewsLiteralArrayContents();
  28084. if (s2 !== peg$FAILED) {
  28085. s3 = peg$parsews();
  28086. if (s3 !== peg$FAILED) {
  28087. if (input.charCodeAt(peg$currPos) === 41) {
  28088. s4 = peg$c48;
  28089. peg$currPos++;
  28090. } else {
  28091. s4 = peg$FAILED;
  28092. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28093. }
  28094. if (s4 !== peg$FAILED) {
  28095. peg$savedPos = s0;
  28096. s1 = peg$c50(s2);
  28097. s0 = s1;
  28098. } else {
  28099. peg$currPos = s0;
  28100. s0 = peg$FAILED;
  28101. }
  28102. } else {
  28103. peg$currPos = s0;
  28104. s0 = peg$FAILED;
  28105. }
  28106. } else {
  28107. peg$currPos = s0;
  28108. s0 = peg$FAILED;
  28109. }
  28110. } else {
  28111. peg$currPos = s0;
  28112. s0 = peg$FAILED;
  28113. }
  28114. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28115. return s0;
  28116. }
  28117. function peg$parsebareLiteralArray() {
  28118. var s0, s1, s2, s3, s4;
  28119. var key = peg$currPos * 66 + 21,
  28120. cached = peg$resultsCache[key];
  28121. if (cached) {
  28122. peg$currPos = cached.nextPos;
  28123. return cached.result;
  28124. }
  28125. s0 = peg$currPos;
  28126. if (input.charCodeAt(peg$currPos) === 40) {
  28127. s1 = peg$c51;
  28128. peg$currPos++;
  28129. } else {
  28130. s1 = peg$FAILED;
  28131. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  28132. }
  28133. if (s1 !== peg$FAILED) {
  28134. s2 = peg$parsewsLiteralArrayContents();
  28135. if (s2 !== peg$FAILED) {
  28136. s3 = peg$parsews();
  28137. if (s3 !== peg$FAILED) {
  28138. if (input.charCodeAt(peg$currPos) === 41) {
  28139. s4 = peg$c48;
  28140. peg$currPos++;
  28141. } else {
  28142. s4 = peg$FAILED;
  28143. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28144. }
  28145. if (s4 !== peg$FAILED) {
  28146. peg$savedPos = s0;
  28147. s1 = peg$c50(s2);
  28148. s0 = s1;
  28149. } else {
  28150. peg$currPos = s0;
  28151. s0 = peg$FAILED;
  28152. }
  28153. } else {
  28154. peg$currPos = s0;
  28155. s0 = peg$FAILED;
  28156. }
  28157. } else {
  28158. peg$currPos = s0;
  28159. s0 = peg$FAILED;
  28160. }
  28161. } else {
  28162. peg$currPos = s0;
  28163. s0 = peg$FAILED;
  28164. }
  28165. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28166. return s0;
  28167. }
  28168. function peg$parseliteralArrayElement() {
  28169. var s0;
  28170. var key = peg$currPos * 66 + 22,
  28171. cached = peg$resultsCache[key];
  28172. if (cached) {
  28173. peg$currPos = cached.nextPos;
  28174. return cached.result;
  28175. }
  28176. s0 = peg$parseparseTimeLiteral();
  28177. if (s0 === peg$FAILED) {
  28178. s0 = peg$parsebareLiteralArray();
  28179. if (s0 === peg$FAILED) {
  28180. s0 = peg$parsebareSymbol();
  28181. }
  28182. }
  28183. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28184. return s0;
  28185. }
  28186. function peg$parsewsLiteralArrayContents() {
  28187. var s0, s1, s2, s3, s4;
  28188. var key = peg$currPos * 66 + 23,
  28189. cached = peg$resultsCache[key];
  28190. if (cached) {
  28191. peg$currPos = cached.nextPos;
  28192. return cached.result;
  28193. }
  28194. s0 = peg$currPos;
  28195. s1 = [];
  28196. s2 = peg$currPos;
  28197. s3 = peg$parsews();
  28198. if (s3 !== peg$FAILED) {
  28199. s4 = peg$parseliteralArrayElement();
  28200. if (s4 !== peg$FAILED) {
  28201. peg$savedPos = s2;
  28202. s3 = peg$c53(s4);
  28203. s2 = s3;
  28204. } else {
  28205. peg$currPos = s2;
  28206. s2 = peg$FAILED;
  28207. }
  28208. } else {
  28209. peg$currPos = s2;
  28210. s2 = peg$FAILED;
  28211. }
  28212. while (s2 !== peg$FAILED) {
  28213. s1.push(s2);
  28214. s2 = peg$currPos;
  28215. s3 = peg$parsews();
  28216. if (s3 !== peg$FAILED) {
  28217. s4 = peg$parseliteralArrayElement();
  28218. if (s4 !== peg$FAILED) {
  28219. peg$savedPos = s2;
  28220. s3 = peg$c53(s4);
  28221. s2 = s3;
  28222. } else {
  28223. peg$currPos = s2;
  28224. s2 = peg$FAILED;
  28225. }
  28226. } else {
  28227. peg$currPos = s2;
  28228. s2 = peg$FAILED;
  28229. }
  28230. }
  28231. if (s1 !== peg$FAILED) {
  28232. peg$savedPos = s0;
  28233. s1 = peg$c54(s1);
  28234. }
  28235. s0 = s1;
  28236. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28237. return s0;
  28238. }
  28239. function peg$parsedynamicArray() {
  28240. var s0, s1, s2, s3, s4;
  28241. var key = peg$currPos * 66 + 24,
  28242. cached = peg$resultsCache[key];
  28243. if (cached) {
  28244. peg$currPos = cached.nextPos;
  28245. return cached.result;
  28246. }
  28247. s0 = peg$currPos;
  28248. if (input.charCodeAt(peg$currPos) === 123) {
  28249. s1 = peg$c55;
  28250. peg$currPos++;
  28251. } else {
  28252. s1 = peg$FAILED;
  28253. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  28254. }
  28255. if (s1 !== peg$FAILED) {
  28256. s2 = peg$parsewsExpressions();
  28257. if (s2 === peg$FAILED) {
  28258. s2 = null;
  28259. }
  28260. if (s2 !== peg$FAILED) {
  28261. s3 = peg$parsemaybeDotsWs();
  28262. if (s3 !== peg$FAILED) {
  28263. if (input.charCodeAt(peg$currPos) === 125) {
  28264. s4 = peg$c57;
  28265. peg$currPos++;
  28266. } else {
  28267. s4 = peg$FAILED;
  28268. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28269. }
  28270. if (s4 !== peg$FAILED) {
  28271. peg$savedPos = s0;
  28272. s1 = peg$c59(s2);
  28273. s0 = s1;
  28274. } else {
  28275. peg$currPos = s0;
  28276. s0 = peg$FAILED;
  28277. }
  28278. } else {
  28279. peg$currPos = s0;
  28280. s0 = peg$FAILED;
  28281. }
  28282. } else {
  28283. peg$currPos = s0;
  28284. s0 = peg$FAILED;
  28285. }
  28286. } else {
  28287. peg$currPos = s0;
  28288. s0 = peg$FAILED;
  28289. }
  28290. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28291. return s0;
  28292. }
  28293. function peg$parsedynamicDictionary() {
  28294. var s0, s1, s2, s3, s4;
  28295. var key = peg$currPos * 66 + 25,
  28296. cached = peg$resultsCache[key];
  28297. if (cached) {
  28298. peg$currPos = cached.nextPos;
  28299. return cached.result;
  28300. }
  28301. s0 = peg$currPos;
  28302. if (input.substr(peg$currPos, 2) === peg$c60) {
  28303. s1 = peg$c60;
  28304. peg$currPos += 2;
  28305. } else {
  28306. s1 = peg$FAILED;
  28307. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  28308. }
  28309. if (s1 !== peg$FAILED) {
  28310. s2 = peg$parsewsAssociations();
  28311. if (s2 === peg$FAILED) {
  28312. s2 = null;
  28313. }
  28314. if (s2 !== peg$FAILED) {
  28315. s3 = peg$parsemaybeDotsWs();
  28316. if (s3 !== peg$FAILED) {
  28317. if (input.charCodeAt(peg$currPos) === 125) {
  28318. s4 = peg$c57;
  28319. peg$currPos++;
  28320. } else {
  28321. s4 = peg$FAILED;
  28322. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28323. }
  28324. if (s4 !== peg$FAILED) {
  28325. peg$savedPos = s0;
  28326. s1 = peg$c62(s2);
  28327. s0 = s1;
  28328. } else {
  28329. peg$currPos = s0;
  28330. s0 = peg$FAILED;
  28331. }
  28332. } else {
  28333. peg$currPos = s0;
  28334. s0 = peg$FAILED;
  28335. }
  28336. } else {
  28337. peg$currPos = s0;
  28338. s0 = peg$FAILED;
  28339. }
  28340. } else {
  28341. peg$currPos = s0;
  28342. s0 = peg$FAILED;
  28343. }
  28344. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28345. return s0;
  28346. }
  28347. function peg$parsepseudoVariable() {
  28348. var s0, s1, s2;
  28349. var key = peg$currPos * 66 + 26,
  28350. cached = peg$resultsCache[key];
  28351. if (cached) {
  28352. peg$currPos = cached.nextPos;
  28353. return cached.result;
  28354. }
  28355. s0 = peg$currPos;
  28356. s1 = peg$currPos;
  28357. if (input.substr(peg$currPos, 4) === peg$c63) {
  28358. s2 = peg$c63;
  28359. peg$currPos += 4;
  28360. } else {
  28361. s2 = peg$FAILED;
  28362. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  28363. }
  28364. if (s2 !== peg$FAILED) {
  28365. peg$savedPos = s1;
  28366. s2 = peg$c65();
  28367. }
  28368. s1 = s2;
  28369. if (s1 === peg$FAILED) {
  28370. s1 = peg$currPos;
  28371. if (input.substr(peg$currPos, 5) === peg$c66) {
  28372. s2 = peg$c66;
  28373. peg$currPos += 5;
  28374. } else {
  28375. s2 = peg$FAILED;
  28376. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  28377. }
  28378. if (s2 !== peg$FAILED) {
  28379. peg$savedPos = s1;
  28380. s2 = peg$c68();
  28381. }
  28382. s1 = s2;
  28383. if (s1 === peg$FAILED) {
  28384. s1 = peg$currPos;
  28385. if (input.substr(peg$currPos, 3) === peg$c69) {
  28386. s2 = peg$c69;
  28387. peg$currPos += 3;
  28388. } else {
  28389. s2 = peg$FAILED;
  28390. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  28391. }
  28392. if (s2 !== peg$FAILED) {
  28393. peg$savedPos = s1;
  28394. s2 = peg$c71();
  28395. }
  28396. s1 = s2;
  28397. }
  28398. }
  28399. if (s1 !== peg$FAILED) {
  28400. peg$savedPos = s0;
  28401. s1 = peg$c16(s1);
  28402. }
  28403. s0 = s1;
  28404. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28405. return s0;
  28406. }
  28407. function peg$parseparseTimeLiteral() {
  28408. var s0;
  28409. var key = peg$currPos * 66 + 27,
  28410. cached = peg$resultsCache[key];
  28411. if (cached) {
  28412. peg$currPos = cached.nextPos;
  28413. return cached.result;
  28414. }
  28415. s0 = peg$parsepseudoVariable();
  28416. if (s0 === peg$FAILED) {
  28417. s0 = peg$parsenumber();
  28418. if (s0 === peg$FAILED) {
  28419. s0 = peg$parseliteralArray();
  28420. if (s0 === peg$FAILED) {
  28421. s0 = peg$parsestring();
  28422. if (s0 === peg$FAILED) {
  28423. s0 = peg$parsesymbol();
  28424. if (s0 === peg$FAILED) {
  28425. s0 = peg$parsecharacter();
  28426. }
  28427. }
  28428. }
  28429. }
  28430. }
  28431. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28432. return s0;
  28433. }
  28434. function peg$parseruntimeLiteral() {
  28435. var s0;
  28436. var key = peg$currPos * 66 + 28,
  28437. cached = peg$resultsCache[key];
  28438. if (cached) {
  28439. peg$currPos = cached.nextPos;
  28440. return cached.result;
  28441. }
  28442. s0 = peg$parsedynamicDictionary();
  28443. if (s0 === peg$FAILED) {
  28444. s0 = peg$parsedynamicArray();
  28445. if (s0 === peg$FAILED) {
  28446. s0 = peg$parseblock();
  28447. }
  28448. }
  28449. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28450. return s0;
  28451. }
  28452. function peg$parseliteral() {
  28453. var s0;
  28454. var key = peg$currPos * 66 + 29,
  28455. cached = peg$resultsCache[key];
  28456. if (cached) {
  28457. peg$currPos = cached.nextPos;
  28458. return cached.result;
  28459. }
  28460. s0 = peg$parseruntimeLiteral();
  28461. if (s0 === peg$FAILED) {
  28462. s0 = peg$parseparseTimeLiteral();
  28463. }
  28464. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28465. return s0;
  28466. }
  28467. function peg$parsevariable() {
  28468. var s0, s1;
  28469. var key = peg$currPos * 66 + 30,
  28470. cached = peg$resultsCache[key];
  28471. if (cached) {
  28472. peg$currPos = cached.nextPos;
  28473. return cached.result;
  28474. }
  28475. s0 = peg$currPos;
  28476. s1 = peg$parseidentifier();
  28477. if (s1 !== peg$FAILED) {
  28478. peg$savedPos = s0;
  28479. s1 = peg$c72(s1);
  28480. }
  28481. s0 = s1;
  28482. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28483. return s0;
  28484. }
  28485. function peg$parsebinarySelector() {
  28486. var s0, s1, s2;
  28487. var key = peg$currPos * 66 + 31,
  28488. cached = peg$resultsCache[key];
  28489. if (cached) {
  28490. peg$currPos = cached.nextPos;
  28491. return cached.result;
  28492. }
  28493. s0 = peg$currPos;
  28494. s1 = [];
  28495. if (peg$c73.test(input.charAt(peg$currPos))) {
  28496. s2 = input.charAt(peg$currPos);
  28497. peg$currPos++;
  28498. } else {
  28499. s2 = peg$FAILED;
  28500. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28501. }
  28502. if (s2 !== peg$FAILED) {
  28503. while (s2 !== peg$FAILED) {
  28504. s1.push(s2);
  28505. if (peg$c73.test(input.charAt(peg$currPos))) {
  28506. s2 = input.charAt(peg$currPos);
  28507. peg$currPos++;
  28508. } else {
  28509. s2 = peg$FAILED;
  28510. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28511. }
  28512. }
  28513. } else {
  28514. s1 = peg$FAILED;
  28515. }
  28516. if (s1 !== peg$FAILED) {
  28517. s0 = input.substring(s0, peg$currPos);
  28518. } else {
  28519. s0 = s1;
  28520. }
  28521. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28522. return s0;
  28523. }
  28524. function peg$parsewsKeywordPattern() {
  28525. var s0, s1, s2, s3, s4, s5, s6;
  28526. var key = peg$currPos * 66 + 32,
  28527. cached = peg$resultsCache[key];
  28528. if (cached) {
  28529. peg$currPos = cached.nextPos;
  28530. return cached.result;
  28531. }
  28532. s0 = peg$currPos;
  28533. s1 = [];
  28534. s2 = peg$currPos;
  28535. s3 = peg$parsews();
  28536. if (s3 !== peg$FAILED) {
  28537. s4 = peg$parsekeyword();
  28538. if (s4 !== peg$FAILED) {
  28539. s5 = peg$parsews();
  28540. if (s5 !== peg$FAILED) {
  28541. s6 = peg$parseidentifier();
  28542. if (s6 !== peg$FAILED) {
  28543. peg$savedPos = s2;
  28544. s3 = peg$c75(s4, s6);
  28545. s2 = s3;
  28546. } else {
  28547. peg$currPos = s2;
  28548. s2 = peg$FAILED;
  28549. }
  28550. } else {
  28551. peg$currPos = s2;
  28552. s2 = peg$FAILED;
  28553. }
  28554. } else {
  28555. peg$currPos = s2;
  28556. s2 = peg$FAILED;
  28557. }
  28558. } else {
  28559. peg$currPos = s2;
  28560. s2 = peg$FAILED;
  28561. }
  28562. if (s2 !== peg$FAILED) {
  28563. while (s2 !== peg$FAILED) {
  28564. s1.push(s2);
  28565. s2 = peg$currPos;
  28566. s3 = peg$parsews();
  28567. if (s3 !== peg$FAILED) {
  28568. s4 = peg$parsekeyword();
  28569. if (s4 !== peg$FAILED) {
  28570. s5 = peg$parsews();
  28571. if (s5 !== peg$FAILED) {
  28572. s6 = peg$parseidentifier();
  28573. if (s6 !== peg$FAILED) {
  28574. peg$savedPos = s2;
  28575. s3 = peg$c75(s4, s6);
  28576. s2 = s3;
  28577. } else {
  28578. peg$currPos = s2;
  28579. s2 = peg$FAILED;
  28580. }
  28581. } else {
  28582. peg$currPos = s2;
  28583. s2 = peg$FAILED;
  28584. }
  28585. } else {
  28586. peg$currPos = s2;
  28587. s2 = peg$FAILED;
  28588. }
  28589. } else {
  28590. peg$currPos = s2;
  28591. s2 = peg$FAILED;
  28592. }
  28593. }
  28594. } else {
  28595. s1 = peg$FAILED;
  28596. }
  28597. if (s1 !== peg$FAILED) {
  28598. peg$savedPos = s0;
  28599. s1 = peg$c76(s1);
  28600. }
  28601. s0 = s1;
  28602. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28603. return s0;
  28604. }
  28605. function peg$parsewsBinaryPattern() {
  28606. var s0, s1, s2, s3, s4;
  28607. var key = peg$currPos * 66 + 33,
  28608. cached = peg$resultsCache[key];
  28609. if (cached) {
  28610. peg$currPos = cached.nextPos;
  28611. return cached.result;
  28612. }
  28613. s0 = peg$currPos;
  28614. s1 = peg$parsews();
  28615. if (s1 !== peg$FAILED) {
  28616. s2 = peg$parsebinarySelector();
  28617. if (s2 !== peg$FAILED) {
  28618. s3 = peg$parsews();
  28619. if (s3 !== peg$FAILED) {
  28620. s4 = peg$parseidentifier();
  28621. if (s4 !== peg$FAILED) {
  28622. peg$savedPos = s0;
  28623. s1 = peg$c77(s2, s4);
  28624. s0 = s1;
  28625. } else {
  28626. peg$currPos = s0;
  28627. s0 = peg$FAILED;
  28628. }
  28629. } else {
  28630. peg$currPos = s0;
  28631. s0 = peg$FAILED;
  28632. }
  28633. } else {
  28634. peg$currPos = s0;
  28635. s0 = peg$FAILED;
  28636. }
  28637. } else {
  28638. peg$currPos = s0;
  28639. s0 = peg$FAILED;
  28640. }
  28641. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28642. return s0;
  28643. }
  28644. function peg$parsewsUnaryPattern() {
  28645. var s0, s1, s2;
  28646. var key = peg$currPos * 66 + 34,
  28647. cached = peg$resultsCache[key];
  28648. if (cached) {
  28649. peg$currPos = cached.nextPos;
  28650. return cached.result;
  28651. }
  28652. s0 = peg$currPos;
  28653. s1 = peg$parsews();
  28654. if (s1 !== peg$FAILED) {
  28655. s2 = peg$parseidentifier();
  28656. if (s2 !== peg$FAILED) {
  28657. peg$savedPos = s0;
  28658. s1 = peg$c78(s2);
  28659. s0 = s1;
  28660. } else {
  28661. peg$currPos = s0;
  28662. s0 = peg$FAILED;
  28663. }
  28664. } else {
  28665. peg$currPos = s0;
  28666. s0 = peg$FAILED;
  28667. }
  28668. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28669. return s0;
  28670. }
  28671. function peg$parseexpression() {
  28672. var s0;
  28673. var key = peg$currPos * 66 + 35,
  28674. cached = peg$resultsCache[key];
  28675. if (cached) {
  28676. peg$currPos = cached.nextPos;
  28677. return cached.result;
  28678. }
  28679. s0 = peg$parseassignment();
  28680. if (s0 === peg$FAILED) {
  28681. s0 = peg$parsecascade();
  28682. if (s0 === peg$FAILED) {
  28683. s0 = peg$parsekeywordSend();
  28684. }
  28685. }
  28686. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28687. return s0;
  28688. }
  28689. function peg$parsewsExpressionsRest() {
  28690. var s0, s1, s2;
  28691. var key = peg$currPos * 66 + 36,
  28692. cached = peg$resultsCache[key];
  28693. if (cached) {
  28694. peg$currPos = cached.nextPos;
  28695. return cached.result;
  28696. }
  28697. s0 = peg$currPos;
  28698. s1 = peg$parsesomeDotsWs();
  28699. if (s1 !== peg$FAILED) {
  28700. s2 = peg$parseexpression();
  28701. if (s2 !== peg$FAILED) {
  28702. peg$savedPos = s0;
  28703. s1 = peg$c79(s2);
  28704. s0 = s1;
  28705. } else {
  28706. peg$currPos = s0;
  28707. s0 = peg$FAILED;
  28708. }
  28709. } else {
  28710. peg$currPos = s0;
  28711. s0 = peg$FAILED;
  28712. }
  28713. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28714. return s0;
  28715. }
  28716. function peg$parsewsExpressions() {
  28717. var s0, s1, s2, s3, s4;
  28718. var key = peg$currPos * 66 + 37,
  28719. cached = peg$resultsCache[key];
  28720. if (cached) {
  28721. peg$currPos = cached.nextPos;
  28722. return cached.result;
  28723. }
  28724. s0 = peg$currPos;
  28725. s1 = peg$parsemaybeDotsWs();
  28726. if (s1 !== peg$FAILED) {
  28727. s2 = peg$parseexpression();
  28728. if (s2 !== peg$FAILED) {
  28729. s3 = [];
  28730. s4 = peg$parsewsExpressionsRest();
  28731. while (s4 !== peg$FAILED) {
  28732. s3.push(s4);
  28733. s4 = peg$parsewsExpressionsRest();
  28734. }
  28735. if (s3 !== peg$FAILED) {
  28736. peg$savedPos = s0;
  28737. s1 = peg$c80(s2, s3);
  28738. s0 = s1;
  28739. } else {
  28740. peg$currPos = s0;
  28741. s0 = peg$FAILED;
  28742. }
  28743. } else {
  28744. peg$currPos = s0;
  28745. s0 = peg$FAILED;
  28746. }
  28747. } else {
  28748. peg$currPos = s0;
  28749. s0 = peg$FAILED;
  28750. }
  28751. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28752. return s0;
  28753. }
  28754. function peg$parsewsUnaryPragmaMessage() {
  28755. var s0, s1, s2, s3, s4;
  28756. var key = peg$currPos * 66 + 38,
  28757. cached = peg$resultsCache[key];
  28758. if (cached) {
  28759. peg$currPos = cached.nextPos;
  28760. return cached.result;
  28761. }
  28762. s0 = peg$currPos;
  28763. s1 = peg$parsews();
  28764. if (s1 !== peg$FAILED) {
  28765. s2 = peg$parseidentifier();
  28766. if (s2 !== peg$FAILED) {
  28767. s3 = peg$currPos;
  28768. peg$silentFails++;
  28769. if (input.charCodeAt(peg$currPos) === 58) {
  28770. s4 = peg$c12;
  28771. peg$currPos++;
  28772. } else {
  28773. s4 = peg$FAILED;
  28774. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  28775. }
  28776. peg$silentFails--;
  28777. if (s4 === peg$FAILED) {
  28778. s3 = void 0;
  28779. } else {
  28780. peg$currPos = s3;
  28781. s3 = peg$FAILED;
  28782. }
  28783. if (s3 !== peg$FAILED) {
  28784. peg$savedPos = s0;
  28785. s1 = peg$c81(s2);
  28786. s0 = s1;
  28787. } else {
  28788. peg$currPos = s0;
  28789. s0 = peg$FAILED;
  28790. }
  28791. } else {
  28792. peg$currPos = s0;
  28793. s0 = peg$FAILED;
  28794. }
  28795. } else {
  28796. peg$currPos = s0;
  28797. s0 = peg$FAILED;
  28798. }
  28799. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28800. return s0;
  28801. }
  28802. function peg$parsewsKeywordPragmaMessage() {
  28803. var s0, s1, s2, s3, s4, s5, s6;
  28804. var key = peg$currPos * 66 + 39,
  28805. cached = peg$resultsCache[key];
  28806. if (cached) {
  28807. peg$currPos = cached.nextPos;
  28808. return cached.result;
  28809. }
  28810. s0 = peg$currPos;
  28811. s1 = [];
  28812. s2 = peg$currPos;
  28813. s3 = peg$parsews();
  28814. if (s3 !== peg$FAILED) {
  28815. s4 = peg$parsekeyword();
  28816. if (s4 !== peg$FAILED) {
  28817. s5 = peg$parsews();
  28818. if (s5 !== peg$FAILED) {
  28819. s6 = peg$parseparseTimeLiteral();
  28820. if (s6 !== peg$FAILED) {
  28821. peg$savedPos = s2;
  28822. s3 = peg$c75(s4, s6);
  28823. s2 = s3;
  28824. } else {
  28825. peg$currPos = s2;
  28826. s2 = peg$FAILED;
  28827. }
  28828. } else {
  28829. peg$currPos = s2;
  28830. s2 = peg$FAILED;
  28831. }
  28832. } else {
  28833. peg$currPos = s2;
  28834. s2 = peg$FAILED;
  28835. }
  28836. } else {
  28837. peg$currPos = s2;
  28838. s2 = peg$FAILED;
  28839. }
  28840. if (s2 !== peg$FAILED) {
  28841. while (s2 !== peg$FAILED) {
  28842. s1.push(s2);
  28843. s2 = peg$currPos;
  28844. s3 = peg$parsews();
  28845. if (s3 !== peg$FAILED) {
  28846. s4 = peg$parsekeyword();
  28847. if (s4 !== peg$FAILED) {
  28848. s5 = peg$parsews();
  28849. if (s5 !== peg$FAILED) {
  28850. s6 = peg$parseparseTimeLiteral();
  28851. if (s6 !== peg$FAILED) {
  28852. peg$savedPos = s2;
  28853. s3 = peg$c75(s4, s6);
  28854. s2 = s3;
  28855. } else {
  28856. peg$currPos = s2;
  28857. s2 = peg$FAILED;
  28858. }
  28859. } else {
  28860. peg$currPos = s2;
  28861. s2 = peg$FAILED;
  28862. }
  28863. } else {
  28864. peg$currPos = s2;
  28865. s2 = peg$FAILED;
  28866. }
  28867. } else {
  28868. peg$currPos = s2;
  28869. s2 = peg$FAILED;
  28870. }
  28871. }
  28872. } else {
  28873. s1 = peg$FAILED;
  28874. }
  28875. if (s1 !== peg$FAILED) {
  28876. peg$savedPos = s0;
  28877. s1 = peg$c82(s1);
  28878. }
  28879. s0 = s1;
  28880. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28881. return s0;
  28882. }
  28883. function peg$parsewsPragmaMessage() {
  28884. var s0;
  28885. var key = peg$currPos * 66 + 40,
  28886. cached = peg$resultsCache[key];
  28887. if (cached) {
  28888. peg$currPos = cached.nextPos;
  28889. return cached.result;
  28890. }
  28891. s0 = peg$parsewsUnaryPragmaMessage();
  28892. if (s0 === peg$FAILED) {
  28893. s0 = peg$parsewsKeywordPragmaMessage();
  28894. }
  28895. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28896. return s0;
  28897. }
  28898. function peg$parsewsPragmas() {
  28899. var s0, s1, s2, s3, s4, s5, s6;
  28900. var key = peg$currPos * 66 + 41,
  28901. cached = peg$resultsCache[key];
  28902. if (cached) {
  28903. peg$currPos = cached.nextPos;
  28904. return cached.result;
  28905. }
  28906. s0 = [];
  28907. s1 = peg$currPos;
  28908. s2 = peg$parsews();
  28909. if (s2 !== peg$FAILED) {
  28910. if (input.charCodeAt(peg$currPos) === 60) {
  28911. s3 = peg$c83;
  28912. peg$currPos++;
  28913. } else {
  28914. s3 = peg$FAILED;
  28915. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  28916. }
  28917. if (s3 !== peg$FAILED) {
  28918. s4 = peg$parsewsPragmaMessage();
  28919. if (s4 !== peg$FAILED) {
  28920. s5 = peg$parsews();
  28921. if (s5 !== peg$FAILED) {
  28922. if (input.charCodeAt(peg$currPos) === 62) {
  28923. s6 = peg$c85;
  28924. peg$currPos++;
  28925. } else {
  28926. s6 = peg$FAILED;
  28927. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  28928. }
  28929. if (s6 !== peg$FAILED) {
  28930. peg$savedPos = s1;
  28931. s2 = peg$c87(s4);
  28932. s1 = s2;
  28933. } else {
  28934. peg$currPos = s1;
  28935. s1 = peg$FAILED;
  28936. }
  28937. } else {
  28938. peg$currPos = s1;
  28939. s1 = peg$FAILED;
  28940. }
  28941. } else {
  28942. peg$currPos = s1;
  28943. s1 = peg$FAILED;
  28944. }
  28945. } else {
  28946. peg$currPos = s1;
  28947. s1 = peg$FAILED;
  28948. }
  28949. } else {
  28950. peg$currPos = s1;
  28951. s1 = peg$FAILED;
  28952. }
  28953. while (s1 !== peg$FAILED) {
  28954. s0.push(s1);
  28955. s1 = peg$currPos;
  28956. s2 = peg$parsews();
  28957. if (s2 !== peg$FAILED) {
  28958. if (input.charCodeAt(peg$currPos) === 60) {
  28959. s3 = peg$c83;
  28960. peg$currPos++;
  28961. } else {
  28962. s3 = peg$FAILED;
  28963. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  28964. }
  28965. if (s3 !== peg$FAILED) {
  28966. s4 = peg$parsewsPragmaMessage();
  28967. if (s4 !== peg$FAILED) {
  28968. s5 = peg$parsews();
  28969. if (s5 !== peg$FAILED) {
  28970. if (input.charCodeAt(peg$currPos) === 62) {
  28971. s6 = peg$c85;
  28972. peg$currPos++;
  28973. } else {
  28974. s6 = peg$FAILED;
  28975. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  28976. }
  28977. if (s6 !== peg$FAILED) {
  28978. peg$savedPos = s1;
  28979. s2 = peg$c87(s4);
  28980. s1 = s2;
  28981. } else {
  28982. peg$currPos = s1;
  28983. s1 = peg$FAILED;
  28984. }
  28985. } else {
  28986. peg$currPos = s1;
  28987. s1 = peg$FAILED;
  28988. }
  28989. } else {
  28990. peg$currPos = s1;
  28991. s1 = peg$FAILED;
  28992. }
  28993. } else {
  28994. peg$currPos = s1;
  28995. s1 = peg$FAILED;
  28996. }
  28997. } else {
  28998. peg$currPos = s1;
  28999. s1 = peg$FAILED;
  29000. }
  29001. }
  29002. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29003. return s0;
  29004. }
  29005. function peg$parseassignment() {
  29006. var s0, s1, s2, s3, s4, s5;
  29007. var key = peg$currPos * 66 + 42,
  29008. cached = peg$resultsCache[key];
  29009. if (cached) {
  29010. peg$currPos = cached.nextPos;
  29011. return cached.result;
  29012. }
  29013. s0 = peg$currPos;
  29014. s1 = peg$parsevariable();
  29015. if (s1 !== peg$FAILED) {
  29016. s2 = peg$parsews();
  29017. if (s2 !== peg$FAILED) {
  29018. if (input.substr(peg$currPos, 2) === peg$c88) {
  29019. s3 = peg$c88;
  29020. peg$currPos += 2;
  29021. } else {
  29022. s3 = peg$FAILED;
  29023. if (peg$silentFails === 0) { peg$fail(peg$c89); }
  29024. }
  29025. if (s3 !== peg$FAILED) {
  29026. s4 = peg$parsews();
  29027. if (s4 !== peg$FAILED) {
  29028. s5 = peg$parseexpression();
  29029. if (s5 !== peg$FAILED) {
  29030. peg$savedPos = s0;
  29031. s1 = peg$c90(s1, s5);
  29032. s0 = s1;
  29033. } else {
  29034. peg$currPos = s0;
  29035. s0 = peg$FAILED;
  29036. }
  29037. } else {
  29038. peg$currPos = s0;
  29039. s0 = peg$FAILED;
  29040. }
  29041. } else {
  29042. peg$currPos = s0;
  29043. s0 = peg$FAILED;
  29044. }
  29045. } else {
  29046. peg$currPos = s0;
  29047. s0 = peg$FAILED;
  29048. }
  29049. } else {
  29050. peg$currPos = s0;
  29051. s0 = peg$FAILED;
  29052. }
  29053. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29054. return s0;
  29055. }
  29056. function peg$parseret() {
  29057. var s0, s1, s2, s3;
  29058. var key = peg$currPos * 66 + 43,
  29059. cached = peg$resultsCache[key];
  29060. if (cached) {
  29061. peg$currPos = cached.nextPos;
  29062. return cached.result;
  29063. }
  29064. s0 = peg$currPos;
  29065. if (input.charCodeAt(peg$currPos) === 94) {
  29066. s1 = peg$c91;
  29067. peg$currPos++;
  29068. } else {
  29069. s1 = peg$FAILED;
  29070. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  29071. }
  29072. if (s1 !== peg$FAILED) {
  29073. s2 = peg$parsews();
  29074. if (s2 !== peg$FAILED) {
  29075. s3 = peg$parseexpression();
  29076. if (s3 !== peg$FAILED) {
  29077. peg$savedPos = s0;
  29078. s1 = peg$c93(s3);
  29079. s0 = s1;
  29080. } else {
  29081. peg$currPos = s0;
  29082. s0 = peg$FAILED;
  29083. }
  29084. } else {
  29085. peg$currPos = s0;
  29086. s0 = peg$FAILED;
  29087. }
  29088. } else {
  29089. peg$currPos = s0;
  29090. s0 = peg$FAILED;
  29091. }
  29092. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29093. return s0;
  29094. }
  29095. function peg$parsetemps() {
  29096. var s0, s1, s2, s3, s4, s5;
  29097. var key = peg$currPos * 66 + 44,
  29098. cached = peg$resultsCache[key];
  29099. if (cached) {
  29100. peg$currPos = cached.nextPos;
  29101. return cached.result;
  29102. }
  29103. s0 = peg$currPos;
  29104. if (input.charCodeAt(peg$currPos) === 124) {
  29105. s1 = peg$c94;
  29106. peg$currPos++;
  29107. } else {
  29108. s1 = peg$FAILED;
  29109. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29110. }
  29111. if (s1 !== peg$FAILED) {
  29112. s2 = [];
  29113. s3 = peg$currPos;
  29114. s4 = peg$parsews();
  29115. if (s4 !== peg$FAILED) {
  29116. s5 = peg$parseidentifier();
  29117. if (s5 !== peg$FAILED) {
  29118. peg$savedPos = s3;
  29119. s4 = peg$c96(s5);
  29120. s3 = s4;
  29121. } else {
  29122. peg$currPos = s3;
  29123. s3 = peg$FAILED;
  29124. }
  29125. } else {
  29126. peg$currPos = s3;
  29127. s3 = peg$FAILED;
  29128. }
  29129. while (s3 !== peg$FAILED) {
  29130. s2.push(s3);
  29131. s3 = peg$currPos;
  29132. s4 = peg$parsews();
  29133. if (s4 !== peg$FAILED) {
  29134. s5 = peg$parseidentifier();
  29135. if (s5 !== peg$FAILED) {
  29136. peg$savedPos = s3;
  29137. s4 = peg$c96(s5);
  29138. s3 = s4;
  29139. } else {
  29140. peg$currPos = s3;
  29141. s3 = peg$FAILED;
  29142. }
  29143. } else {
  29144. peg$currPos = s3;
  29145. s3 = peg$FAILED;
  29146. }
  29147. }
  29148. if (s2 !== peg$FAILED) {
  29149. s3 = peg$parsews();
  29150. if (s3 !== peg$FAILED) {
  29151. if (input.charCodeAt(peg$currPos) === 124) {
  29152. s4 = peg$c94;
  29153. peg$currPos++;
  29154. } else {
  29155. s4 = peg$FAILED;
  29156. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29157. }
  29158. if (s4 !== peg$FAILED) {
  29159. peg$savedPos = s0;
  29160. s1 = peg$c97(s2);
  29161. s0 = s1;
  29162. } else {
  29163. peg$currPos = s0;
  29164. s0 = peg$FAILED;
  29165. }
  29166. } else {
  29167. peg$currPos = s0;
  29168. s0 = peg$FAILED;
  29169. }
  29170. } else {
  29171. peg$currPos = s0;
  29172. s0 = peg$FAILED;
  29173. }
  29174. } else {
  29175. peg$currPos = s0;
  29176. s0 = peg$FAILED;
  29177. }
  29178. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29179. return s0;
  29180. }
  29181. function peg$parsewsBlockParamList() {
  29182. var s0, s1, s2, s3, s4, s5, s6;
  29183. var key = peg$currPos * 66 + 45,
  29184. cached = peg$resultsCache[key];
  29185. if (cached) {
  29186. peg$currPos = cached.nextPos;
  29187. return cached.result;
  29188. }
  29189. s0 = peg$currPos;
  29190. s1 = [];
  29191. s2 = peg$currPos;
  29192. s3 = peg$parsews();
  29193. if (s3 !== peg$FAILED) {
  29194. if (input.charCodeAt(peg$currPos) === 58) {
  29195. s4 = peg$c12;
  29196. peg$currPos++;
  29197. } else {
  29198. s4 = peg$FAILED;
  29199. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29200. }
  29201. if (s4 !== peg$FAILED) {
  29202. s5 = peg$parsews();
  29203. if (s5 !== peg$FAILED) {
  29204. s6 = peg$parseidentifier();
  29205. if (s6 !== peg$FAILED) {
  29206. peg$savedPos = s2;
  29207. s3 = peg$c98(s6);
  29208. s2 = s3;
  29209. } else {
  29210. peg$currPos = s2;
  29211. s2 = peg$FAILED;
  29212. }
  29213. } else {
  29214. peg$currPos = s2;
  29215. s2 = peg$FAILED;
  29216. }
  29217. } else {
  29218. peg$currPos = s2;
  29219. s2 = peg$FAILED;
  29220. }
  29221. } else {
  29222. peg$currPos = s2;
  29223. s2 = peg$FAILED;
  29224. }
  29225. if (s2 !== peg$FAILED) {
  29226. while (s2 !== peg$FAILED) {
  29227. s1.push(s2);
  29228. s2 = peg$currPos;
  29229. s3 = peg$parsews();
  29230. if (s3 !== peg$FAILED) {
  29231. if (input.charCodeAt(peg$currPos) === 58) {
  29232. s4 = peg$c12;
  29233. peg$currPos++;
  29234. } else {
  29235. s4 = peg$FAILED;
  29236. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29237. }
  29238. if (s4 !== peg$FAILED) {
  29239. s5 = peg$parsews();
  29240. if (s5 !== peg$FAILED) {
  29241. s6 = peg$parseidentifier();
  29242. if (s6 !== peg$FAILED) {
  29243. peg$savedPos = s2;
  29244. s3 = peg$c98(s6);
  29245. s2 = s3;
  29246. } else {
  29247. peg$currPos = s2;
  29248. s2 = peg$FAILED;
  29249. }
  29250. } else {
  29251. peg$currPos = s2;
  29252. s2 = peg$FAILED;
  29253. }
  29254. } else {
  29255. peg$currPos = s2;
  29256. s2 = peg$FAILED;
  29257. }
  29258. } else {
  29259. peg$currPos = s2;
  29260. s2 = peg$FAILED;
  29261. }
  29262. }
  29263. } else {
  29264. s1 = peg$FAILED;
  29265. }
  29266. if (s1 !== peg$FAILED) {
  29267. s2 = peg$parsews();
  29268. if (s2 !== peg$FAILED) {
  29269. if (input.charCodeAt(peg$currPos) === 124) {
  29270. s3 = peg$c94;
  29271. peg$currPos++;
  29272. } else {
  29273. s3 = peg$FAILED;
  29274. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29275. }
  29276. if (s3 !== peg$FAILED) {
  29277. peg$savedPos = s0;
  29278. s1 = peg$c99(s1);
  29279. s0 = s1;
  29280. } else {
  29281. peg$currPos = s0;
  29282. s0 = peg$FAILED;
  29283. }
  29284. } else {
  29285. peg$currPos = s0;
  29286. s0 = peg$FAILED;
  29287. }
  29288. } else {
  29289. peg$currPos = s0;
  29290. s0 = peg$FAILED;
  29291. }
  29292. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29293. return s0;
  29294. }
  29295. function peg$parsesubexpression() {
  29296. var s0, s1, s2, s3, s4, s5;
  29297. var key = peg$currPos * 66 + 46,
  29298. cached = peg$resultsCache[key];
  29299. if (cached) {
  29300. peg$currPos = cached.nextPos;
  29301. return cached.result;
  29302. }
  29303. s0 = peg$currPos;
  29304. if (input.charCodeAt(peg$currPos) === 40) {
  29305. s1 = peg$c51;
  29306. peg$currPos++;
  29307. } else {
  29308. s1 = peg$FAILED;
  29309. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  29310. }
  29311. if (s1 !== peg$FAILED) {
  29312. s2 = peg$parsews();
  29313. if (s2 !== peg$FAILED) {
  29314. s3 = peg$parseexpression();
  29315. if (s3 !== peg$FAILED) {
  29316. s4 = peg$parsews();
  29317. if (s4 !== peg$FAILED) {
  29318. if (input.charCodeAt(peg$currPos) === 41) {
  29319. s5 = peg$c48;
  29320. peg$currPos++;
  29321. } else {
  29322. s5 = peg$FAILED;
  29323. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  29324. }
  29325. if (s5 !== peg$FAILED) {
  29326. peg$savedPos = s0;
  29327. s1 = peg$c79(s3);
  29328. s0 = s1;
  29329. } else {
  29330. peg$currPos = s0;
  29331. s0 = peg$FAILED;
  29332. }
  29333. } else {
  29334. peg$currPos = s0;
  29335. s0 = peg$FAILED;
  29336. }
  29337. } else {
  29338. peg$currPos = s0;
  29339. s0 = peg$FAILED;
  29340. }
  29341. } else {
  29342. peg$currPos = s0;
  29343. s0 = peg$FAILED;
  29344. }
  29345. } else {
  29346. peg$currPos = s0;
  29347. s0 = peg$FAILED;
  29348. }
  29349. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29350. return s0;
  29351. }
  29352. function peg$parsewsStatements() {
  29353. var s0, s1, s2, s3;
  29354. var key = peg$currPos * 66 + 47,
  29355. cached = peg$resultsCache[key];
  29356. if (cached) {
  29357. peg$currPos = cached.nextPos;
  29358. return cached.result;
  29359. }
  29360. s0 = peg$currPos;
  29361. s1 = peg$parsemaybeDotsWs();
  29362. if (s1 !== peg$FAILED) {
  29363. s2 = peg$parseret();
  29364. if (s2 !== peg$FAILED) {
  29365. peg$savedPos = s0;
  29366. s1 = peg$c100(s2);
  29367. s0 = s1;
  29368. } else {
  29369. peg$currPos = s0;
  29370. s0 = peg$FAILED;
  29371. }
  29372. } else {
  29373. peg$currPos = s0;
  29374. s0 = peg$FAILED;
  29375. }
  29376. if (s0 === peg$FAILED) {
  29377. s0 = peg$currPos;
  29378. s1 = peg$parsewsExpressions();
  29379. if (s1 !== peg$FAILED) {
  29380. s2 = peg$parsesomeDotsWs();
  29381. if (s2 !== peg$FAILED) {
  29382. s3 = peg$parseret();
  29383. if (s3 !== peg$FAILED) {
  29384. peg$savedPos = s0;
  29385. s1 = peg$c101(s1, s3);
  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. if (s0 === peg$FAILED) {
  29400. s0 = peg$currPos;
  29401. s1 = peg$parsewsExpressions();
  29402. if (s1 === peg$FAILED) {
  29403. s1 = null;
  29404. }
  29405. if (s1 !== peg$FAILED) {
  29406. peg$savedPos = s0;
  29407. s1 = peg$c102(s1);
  29408. }
  29409. s0 = s1;
  29410. }
  29411. }
  29412. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29413. return s0;
  29414. }
  29415. function peg$parsewsSequenceWs() {
  29416. var s0, s1, s2, s3, s4, s5, s6;
  29417. var key = peg$currPos * 66 + 48,
  29418. cached = peg$resultsCache[key];
  29419. if (cached) {
  29420. peg$currPos = cached.nextPos;
  29421. return cached.result;
  29422. }
  29423. s0 = peg$currPos;
  29424. s1 = peg$parsewsPragmas();
  29425. if (s1 === peg$FAILED) {
  29426. s1 = null;
  29427. }
  29428. if (s1 !== peg$FAILED) {
  29429. s2 = peg$parsews();
  29430. if (s2 !== peg$FAILED) {
  29431. s3 = peg$parsetemps();
  29432. if (s3 === peg$FAILED) {
  29433. s3 = null;
  29434. }
  29435. if (s3 !== peg$FAILED) {
  29436. s4 = peg$parsewsPragmas();
  29437. if (s4 === peg$FAILED) {
  29438. s4 = null;
  29439. }
  29440. if (s4 !== peg$FAILED) {
  29441. s5 = peg$parsewsStatements();
  29442. if (s5 === peg$FAILED) {
  29443. s5 = null;
  29444. }
  29445. if (s5 !== peg$FAILED) {
  29446. s6 = peg$parsemaybeDotsWs();
  29447. if (s6 !== peg$FAILED) {
  29448. peg$savedPos = s0;
  29449. s1 = peg$c103(s1, s3, s4, s5);
  29450. s0 = s1;
  29451. } else {
  29452. peg$currPos = s0;
  29453. s0 = peg$FAILED;
  29454. }
  29455. } else {
  29456. peg$currPos = s0;
  29457. s0 = peg$FAILED;
  29458. }
  29459. } else {
  29460. peg$currPos = s0;
  29461. s0 = peg$FAILED;
  29462. }
  29463. } else {
  29464. peg$currPos = s0;
  29465. s0 = peg$FAILED;
  29466. }
  29467. } else {
  29468. peg$currPos = s0;
  29469. s0 = peg$FAILED;
  29470. }
  29471. } else {
  29472. peg$currPos = s0;
  29473. s0 = peg$FAILED;
  29474. }
  29475. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29476. return s0;
  29477. }
  29478. function peg$parseblock() {
  29479. var s0, s1, s2, s3, s4;
  29480. var key = peg$currPos * 66 + 49,
  29481. cached = peg$resultsCache[key];
  29482. if (cached) {
  29483. peg$currPos = cached.nextPos;
  29484. return cached.result;
  29485. }
  29486. s0 = peg$currPos;
  29487. if (input.charCodeAt(peg$currPos) === 91) {
  29488. s1 = peg$c104;
  29489. peg$currPos++;
  29490. } else {
  29491. s1 = peg$FAILED;
  29492. if (peg$silentFails === 0) { peg$fail(peg$c105); }
  29493. }
  29494. if (s1 !== peg$FAILED) {
  29495. s2 = peg$parsewsBlockParamList();
  29496. if (s2 === peg$FAILED) {
  29497. s2 = null;
  29498. }
  29499. if (s2 !== peg$FAILED) {
  29500. s3 = peg$parsewsSequenceWs();
  29501. if (s3 !== peg$FAILED) {
  29502. if (input.charCodeAt(peg$currPos) === 93) {
  29503. s4 = peg$c106;
  29504. peg$currPos++;
  29505. } else {
  29506. s4 = peg$FAILED;
  29507. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  29508. }
  29509. if (s4 !== peg$FAILED) {
  29510. peg$savedPos = s0;
  29511. s1 = peg$c108(s2, s3);
  29512. s0 = s1;
  29513. } else {
  29514. peg$currPos = s0;
  29515. s0 = peg$FAILED;
  29516. }
  29517. } else {
  29518. peg$currPos = s0;
  29519. s0 = peg$FAILED;
  29520. }
  29521. } else {
  29522. peg$currPos = s0;
  29523. s0 = peg$FAILED;
  29524. }
  29525. } else {
  29526. peg$currPos = s0;
  29527. s0 = peg$FAILED;
  29528. }
  29529. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29530. return s0;
  29531. }
  29532. function peg$parseoperand() {
  29533. var s0;
  29534. var key = peg$currPos * 66 + 50,
  29535. cached = peg$resultsCache[key];
  29536. if (cached) {
  29537. peg$currPos = cached.nextPos;
  29538. return cached.result;
  29539. }
  29540. s0 = peg$parseliteral();
  29541. if (s0 === peg$FAILED) {
  29542. s0 = peg$parsevariable();
  29543. if (s0 === peg$FAILED) {
  29544. s0 = peg$parsesubexpression();
  29545. }
  29546. }
  29547. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29548. return s0;
  29549. }
  29550. function peg$parsewsUnaryMessage() {
  29551. var s0, s1, s2, s3, s4;
  29552. var key = peg$currPos * 66 + 51,
  29553. cached = peg$resultsCache[key];
  29554. if (cached) {
  29555. peg$currPos = cached.nextPos;
  29556. return cached.result;
  29557. }
  29558. s0 = peg$currPos;
  29559. s1 = peg$parsews();
  29560. if (s1 !== peg$FAILED) {
  29561. s2 = peg$parseidentifier();
  29562. if (s2 !== peg$FAILED) {
  29563. s3 = peg$currPos;
  29564. peg$silentFails++;
  29565. if (input.charCodeAt(peg$currPos) === 58) {
  29566. s4 = peg$c12;
  29567. peg$currPos++;
  29568. } else {
  29569. s4 = peg$FAILED;
  29570. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29571. }
  29572. peg$silentFails--;
  29573. if (s4 === peg$FAILED) {
  29574. s3 = void 0;
  29575. } else {
  29576. peg$currPos = s3;
  29577. s3 = peg$FAILED;
  29578. }
  29579. if (s3 !== peg$FAILED) {
  29580. peg$savedPos = s0;
  29581. s1 = peg$c109(s2);
  29582. s0 = s1;
  29583. } else {
  29584. peg$currPos = s0;
  29585. s0 = peg$FAILED;
  29586. }
  29587. } else {
  29588. peg$currPos = s0;
  29589. s0 = peg$FAILED;
  29590. }
  29591. } else {
  29592. peg$currPos = s0;
  29593. s0 = peg$FAILED;
  29594. }
  29595. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29596. return s0;
  29597. }
  29598. function peg$parsewsUnaryTail() {
  29599. var s0, s1;
  29600. var key = peg$currPos * 66 + 52,
  29601. cached = peg$resultsCache[key];
  29602. if (cached) {
  29603. peg$currPos = cached.nextPos;
  29604. return cached.result;
  29605. }
  29606. s0 = [];
  29607. s1 = peg$parsewsUnaryMessage();
  29608. while (s1 !== peg$FAILED) {
  29609. s0.push(s1);
  29610. s1 = peg$parsewsUnaryMessage();
  29611. }
  29612. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29613. return s0;
  29614. }
  29615. function peg$parseunarySend() {
  29616. var s0, s1, s2;
  29617. var key = peg$currPos * 66 + 53,
  29618. cached = peg$resultsCache[key];
  29619. if (cached) {
  29620. peg$currPos = cached.nextPos;
  29621. return cached.result;
  29622. }
  29623. s0 = peg$currPos;
  29624. s1 = peg$parseoperand();
  29625. if (s1 !== peg$FAILED) {
  29626. s2 = peg$parsewsUnaryTail();
  29627. if (s2 !== peg$FAILED) {
  29628. peg$savedPos = s0;
  29629. s1 = peg$c110(s1, s2);
  29630. s0 = s1;
  29631. } else {
  29632. peg$currPos = s0;
  29633. s0 = peg$FAILED;
  29634. }
  29635. } else {
  29636. peg$currPos = s0;
  29637. s0 = peg$FAILED;
  29638. }
  29639. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29640. return s0;
  29641. }
  29642. function peg$parsewsBinaryMessage() {
  29643. var s0, s1, s2, s3, s4;
  29644. var key = peg$currPos * 66 + 54,
  29645. cached = peg$resultsCache[key];
  29646. if (cached) {
  29647. peg$currPos = cached.nextPos;
  29648. return cached.result;
  29649. }
  29650. s0 = peg$currPos;
  29651. s1 = peg$parsews();
  29652. if (s1 !== peg$FAILED) {
  29653. s2 = peg$parsebinarySelector();
  29654. if (s2 !== peg$FAILED) {
  29655. s3 = peg$parsews();
  29656. if (s3 !== peg$FAILED) {
  29657. s4 = peg$parseunarySend();
  29658. if (s4 !== peg$FAILED) {
  29659. peg$savedPos = s0;
  29660. s1 = peg$c111(s2, s4);
  29661. s0 = s1;
  29662. } else {
  29663. peg$currPos = s0;
  29664. s0 = peg$FAILED;
  29665. }
  29666. } else {
  29667. peg$currPos = s0;
  29668. s0 = peg$FAILED;
  29669. }
  29670. } else {
  29671. peg$currPos = s0;
  29672. s0 = peg$FAILED;
  29673. }
  29674. } else {
  29675. peg$currPos = s0;
  29676. s0 = peg$FAILED;
  29677. }
  29678. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29679. return s0;
  29680. }
  29681. function peg$parsewsBinaryTail() {
  29682. var s0, s1, s2, s3;
  29683. var key = peg$currPos * 66 + 55,
  29684. cached = peg$resultsCache[key];
  29685. if (cached) {
  29686. peg$currPos = cached.nextPos;
  29687. return cached.result;
  29688. }
  29689. s0 = peg$currPos;
  29690. s1 = peg$parsewsUnaryTail();
  29691. if (s1 !== peg$FAILED) {
  29692. s2 = [];
  29693. s3 = peg$parsewsBinaryMessage();
  29694. while (s3 !== peg$FAILED) {
  29695. s2.push(s3);
  29696. s3 = peg$parsewsBinaryMessage();
  29697. }
  29698. if (s2 !== peg$FAILED) {
  29699. peg$savedPos = s0;
  29700. s1 = peg$c112(s1, s2);
  29701. s0 = s1;
  29702. } else {
  29703. peg$currPos = s0;
  29704. s0 = peg$FAILED;
  29705. }
  29706. } else {
  29707. peg$currPos = s0;
  29708. s0 = peg$FAILED;
  29709. }
  29710. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29711. return s0;
  29712. }
  29713. function peg$parsebinarySend() {
  29714. var s0, s1, s2;
  29715. var key = peg$currPos * 66 + 56,
  29716. cached = peg$resultsCache[key];
  29717. if (cached) {
  29718. peg$currPos = cached.nextPos;
  29719. return cached.result;
  29720. }
  29721. s0 = peg$currPos;
  29722. s1 = peg$parseoperand();
  29723. if (s1 !== peg$FAILED) {
  29724. s2 = peg$parsewsBinaryTail();
  29725. if (s2 !== peg$FAILED) {
  29726. peg$savedPos = s0;
  29727. s1 = peg$c110(s1, s2);
  29728. s0 = s1;
  29729. } else {
  29730. peg$currPos = s0;
  29731. s0 = peg$FAILED;
  29732. }
  29733. } else {
  29734. peg$currPos = s0;
  29735. s0 = peg$FAILED;
  29736. }
  29737. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29738. return s0;
  29739. }
  29740. function peg$parsewsKeywordMessage() {
  29741. var s0, s1, s2, s3, s4, s5, s6;
  29742. var key = peg$currPos * 66 + 57,
  29743. cached = peg$resultsCache[key];
  29744. if (cached) {
  29745. peg$currPos = cached.nextPos;
  29746. return cached.result;
  29747. }
  29748. s0 = peg$currPos;
  29749. s1 = [];
  29750. s2 = peg$currPos;
  29751. s3 = peg$parsews();
  29752. if (s3 !== peg$FAILED) {
  29753. s4 = peg$parsekeyword();
  29754. if (s4 !== peg$FAILED) {
  29755. s5 = peg$parsews();
  29756. if (s5 !== peg$FAILED) {
  29757. s6 = peg$parsebinarySend();
  29758. if (s6 !== peg$FAILED) {
  29759. peg$savedPos = s2;
  29760. s3 = peg$c75(s4, s6);
  29761. s2 = s3;
  29762. } else {
  29763. peg$currPos = s2;
  29764. s2 = peg$FAILED;
  29765. }
  29766. } else {
  29767. peg$currPos = s2;
  29768. s2 = peg$FAILED;
  29769. }
  29770. } else {
  29771. peg$currPos = s2;
  29772. s2 = peg$FAILED;
  29773. }
  29774. } else {
  29775. peg$currPos = s2;
  29776. s2 = peg$FAILED;
  29777. }
  29778. if (s2 !== peg$FAILED) {
  29779. while (s2 !== peg$FAILED) {
  29780. s1.push(s2);
  29781. s2 = peg$currPos;
  29782. s3 = peg$parsews();
  29783. if (s3 !== peg$FAILED) {
  29784. s4 = peg$parsekeyword();
  29785. if (s4 !== peg$FAILED) {
  29786. s5 = peg$parsews();
  29787. if (s5 !== peg$FAILED) {
  29788. s6 = peg$parsebinarySend();
  29789. if (s6 !== peg$FAILED) {
  29790. peg$savedPos = s2;
  29791. s3 = peg$c75(s4, s6);
  29792. s2 = s3;
  29793. } else {
  29794. peg$currPos = s2;
  29795. s2 = peg$FAILED;
  29796. }
  29797. } else {
  29798. peg$currPos = s2;
  29799. s2 = peg$FAILED;
  29800. }
  29801. } else {
  29802. peg$currPos = s2;
  29803. s2 = peg$FAILED;
  29804. }
  29805. } else {
  29806. peg$currPos = s2;
  29807. s2 = peg$FAILED;
  29808. }
  29809. }
  29810. } else {
  29811. s1 = peg$FAILED;
  29812. }
  29813. if (s1 !== peg$FAILED) {
  29814. peg$savedPos = s0;
  29815. s1 = peg$c113(s1);
  29816. }
  29817. s0 = s1;
  29818. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29819. return s0;
  29820. }
  29821. function peg$parsewsKeywordTail() {
  29822. var s0, s1, s2;
  29823. var key = peg$currPos * 66 + 58,
  29824. cached = peg$resultsCache[key];
  29825. if (cached) {
  29826. peg$currPos = cached.nextPos;
  29827. return cached.result;
  29828. }
  29829. s0 = peg$currPos;
  29830. s1 = peg$parsewsBinaryTail();
  29831. if (s1 !== peg$FAILED) {
  29832. s2 = peg$parsewsKeywordMessage();
  29833. if (s2 === peg$FAILED) {
  29834. s2 = null;
  29835. }
  29836. if (s2 !== peg$FAILED) {
  29837. peg$savedPos = s0;
  29838. s1 = peg$c114(s1, s2);
  29839. s0 = s1;
  29840. } else {
  29841. peg$currPos = s0;
  29842. s0 = peg$FAILED;
  29843. }
  29844. } else {
  29845. peg$currPos = s0;
  29846. s0 = peg$FAILED;
  29847. }
  29848. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29849. return s0;
  29850. }
  29851. function peg$parsekeywordSend() {
  29852. var s0, s1, s2;
  29853. var key = peg$currPos * 66 + 59,
  29854. cached = peg$resultsCache[key];
  29855. if (cached) {
  29856. peg$currPos = cached.nextPos;
  29857. return cached.result;
  29858. }
  29859. s0 = peg$currPos;
  29860. s1 = peg$parseoperand();
  29861. if (s1 !== peg$FAILED) {
  29862. s2 = peg$parsewsKeywordTail();
  29863. if (s2 !== peg$FAILED) {
  29864. peg$savedPos = s0;
  29865. s1 = peg$c110(s1, s2);
  29866. s0 = s1;
  29867. } else {
  29868. peg$currPos = s0;
  29869. s0 = peg$FAILED;
  29870. }
  29871. } else {
  29872. peg$currPos = s0;
  29873. s0 = peg$FAILED;
  29874. }
  29875. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29876. return s0;
  29877. }
  29878. function peg$parsewsMessage() {
  29879. var s0;
  29880. var key = peg$currPos * 66 + 60,
  29881. cached = peg$resultsCache[key];
  29882. if (cached) {
  29883. peg$currPos = cached.nextPos;
  29884. return cached.result;
  29885. }
  29886. s0 = peg$parsewsBinaryMessage();
  29887. if (s0 === peg$FAILED) {
  29888. s0 = peg$parsewsUnaryMessage();
  29889. if (s0 === peg$FAILED) {
  29890. s0 = peg$parsewsKeywordMessage();
  29891. }
  29892. }
  29893. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29894. return s0;
  29895. }
  29896. function peg$parsecascade() {
  29897. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  29898. var key = peg$currPos * 66 + 61,
  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$parseoperand();
  29906. if (s1 !== peg$FAILED) {
  29907. s2 = peg$parsewsKeywordTail();
  29908. if (s2 !== peg$FAILED) {
  29909. peg$savedPos = peg$currPos;
  29910. s3 = peg$c115(s1, s2);
  29911. if (s3) {
  29912. s3 = void 0;
  29913. } else {
  29914. s3 = peg$FAILED;
  29915. }
  29916. if (s3 !== peg$FAILED) {
  29917. s4 = [];
  29918. s5 = peg$currPos;
  29919. s6 = peg$parsews();
  29920. if (s6 !== peg$FAILED) {
  29921. if (input.charCodeAt(peg$currPos) === 59) {
  29922. s7 = peg$c116;
  29923. peg$currPos++;
  29924. } else {
  29925. s7 = peg$FAILED;
  29926. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  29927. }
  29928. if (s7 !== peg$FAILED) {
  29929. s8 = peg$parsewsMessage();
  29930. if (s8 !== peg$FAILED) {
  29931. peg$savedPos = s5;
  29932. s6 = peg$c118(s1, s2, s8);
  29933. s5 = s6;
  29934. } else {
  29935. peg$currPos = s5;
  29936. s5 = peg$FAILED;
  29937. }
  29938. } else {
  29939. peg$currPos = s5;
  29940. s5 = peg$FAILED;
  29941. }
  29942. } else {
  29943. peg$currPos = s5;
  29944. s5 = peg$FAILED;
  29945. }
  29946. if (s5 !== peg$FAILED) {
  29947. while (s5 !== peg$FAILED) {
  29948. s4.push(s5);
  29949. s5 = peg$currPos;
  29950. s6 = peg$parsews();
  29951. if (s6 !== peg$FAILED) {
  29952. if (input.charCodeAt(peg$currPos) === 59) {
  29953. s7 = peg$c116;
  29954. peg$currPos++;
  29955. } else {
  29956. s7 = peg$FAILED;
  29957. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  29958. }
  29959. if (s7 !== peg$FAILED) {
  29960. s8 = peg$parsewsMessage();
  29961. if (s8 !== peg$FAILED) {
  29962. peg$savedPos = s5;
  29963. s6 = peg$c118(s1, s2, s8);
  29964. s5 = s6;
  29965. } else {
  29966. peg$currPos = s5;
  29967. s5 = peg$FAILED;
  29968. }
  29969. } else {
  29970. peg$currPos = s5;
  29971. s5 = peg$FAILED;
  29972. }
  29973. } else {
  29974. peg$currPos = s5;
  29975. s5 = peg$FAILED;
  29976. }
  29977. }
  29978. } else {
  29979. s4 = peg$FAILED;
  29980. }
  29981. if (s4 !== peg$FAILED) {
  29982. peg$savedPos = s0;
  29983. s1 = peg$c119(s1, s2, s4);
  29984. s0 = s1;
  29985. } else {
  29986. peg$currPos = s0;
  29987. s0 = peg$FAILED;
  29988. }
  29989. } else {
  29990. peg$currPos = s0;
  29991. s0 = peg$FAILED;
  29992. }
  29993. } else {
  29994. peg$currPos = s0;
  29995. s0 = peg$FAILED;
  29996. }
  29997. } else {
  29998. peg$currPos = s0;
  29999. s0 = peg$FAILED;
  30000. }
  30001. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30002. return s0;
  30003. }
  30004. function peg$parsemethod() {
  30005. var s0, s1, s2;
  30006. var key = peg$currPos * 66 + 62,
  30007. cached = peg$resultsCache[key];
  30008. if (cached) {
  30009. peg$currPos = cached.nextPos;
  30010. return cached.result;
  30011. }
  30012. s0 = peg$currPos;
  30013. s1 = peg$parsewsKeywordPattern();
  30014. if (s1 === peg$FAILED) {
  30015. s1 = peg$parsewsBinaryPattern();
  30016. if (s1 === peg$FAILED) {
  30017. s1 = peg$parsewsUnaryPattern();
  30018. }
  30019. }
  30020. if (s1 !== peg$FAILED) {
  30021. s2 = peg$parsewsSequenceWs();
  30022. if (s2 !== peg$FAILED) {
  30023. peg$savedPos = s0;
  30024. s1 = peg$c120(s1, s2);
  30025. s0 = s1;
  30026. } else {
  30027. peg$currPos = s0;
  30028. s0 = peg$FAILED;
  30029. }
  30030. } else {
  30031. peg$currPos = s0;
  30032. s0 = peg$FAILED;
  30033. }
  30034. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30035. return s0;
  30036. }
  30037. function peg$parseassociationSend() {
  30038. var s0, s1, s2, s3;
  30039. var key = peg$currPos * 66 + 63,
  30040. cached = peg$resultsCache[key];
  30041. if (cached) {
  30042. peg$currPos = cached.nextPos;
  30043. return cached.result;
  30044. }
  30045. s0 = peg$currPos;
  30046. s1 = peg$parseoperand();
  30047. if (s1 !== peg$FAILED) {
  30048. s2 = peg$parsewsBinaryTail();
  30049. if (s2 !== peg$FAILED) {
  30050. peg$savedPos = peg$currPos;
  30051. s3 = peg$c121(s1, s2);
  30052. if (s3) {
  30053. s3 = void 0;
  30054. } else {
  30055. s3 = peg$FAILED;
  30056. }
  30057. if (s3 !== peg$FAILED) {
  30058. peg$savedPos = s0;
  30059. s1 = peg$c122(s1, s2);
  30060. s0 = s1;
  30061. } else {
  30062. peg$currPos = s0;
  30063. s0 = peg$FAILED;
  30064. }
  30065. } else {
  30066. peg$currPos = s0;
  30067. s0 = peg$FAILED;
  30068. }
  30069. } else {
  30070. peg$currPos = s0;
  30071. s0 = peg$FAILED;
  30072. }
  30073. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30074. return s0;
  30075. }
  30076. function peg$parsewsAssociationsRest() {
  30077. var s0, s1, s2;
  30078. var key = peg$currPos * 66 + 64,
  30079. cached = peg$resultsCache[key];
  30080. if (cached) {
  30081. peg$currPos = cached.nextPos;
  30082. return cached.result;
  30083. }
  30084. s0 = peg$currPos;
  30085. s1 = peg$parsesomeDotsWs();
  30086. if (s1 !== peg$FAILED) {
  30087. s2 = peg$parseassociationSend();
  30088. if (s2 !== peg$FAILED) {
  30089. peg$savedPos = s0;
  30090. s1 = peg$c79(s2);
  30091. s0 = s1;
  30092. } else {
  30093. peg$currPos = s0;
  30094. s0 = peg$FAILED;
  30095. }
  30096. } else {
  30097. peg$currPos = s0;
  30098. s0 = peg$FAILED;
  30099. }
  30100. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30101. return s0;
  30102. }
  30103. function peg$parsewsAssociations() {
  30104. var s0, s1, s2, s3, s4;
  30105. var key = peg$currPos * 66 + 65,
  30106. cached = peg$resultsCache[key];
  30107. if (cached) {
  30108. peg$currPos = cached.nextPos;
  30109. return cached.result;
  30110. }
  30111. s0 = peg$currPos;
  30112. s1 = peg$parsemaybeDotsWs();
  30113. if (s1 !== peg$FAILED) {
  30114. s2 = peg$parseassociationSend();
  30115. if (s2 !== peg$FAILED) {
  30116. s3 = [];
  30117. s4 = peg$parsewsAssociationsRest();
  30118. while (s4 !== peg$FAILED) {
  30119. s3.push(s4);
  30120. s4 = peg$parsewsAssociationsRest();
  30121. }
  30122. if (s3 !== peg$FAILED) {
  30123. peg$savedPos = s0;
  30124. s1 = peg$c123(s2, s3);
  30125. s0 = s1;
  30126. } else {
  30127. peg$currPos = s0;
  30128. s0 = peg$FAILED;
  30129. }
  30130. } else {
  30131. peg$currPos = s0;
  30132. s0 = peg$FAILED;
  30133. }
  30134. } else {
  30135. peg$currPos = s0;
  30136. s0 = peg$FAILED;
  30137. }
  30138. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30139. return s0;
  30140. }
  30141. peg$result = peg$startRuleFunction();
  30142. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  30143. return peg$result;
  30144. } else {
  30145. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  30146. peg$fail({ type: "end", description: "end of input" });
  30147. }
  30148. throw peg$buildException(
  30149. null,
  30150. peg$maxFailExpected,
  30151. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  30152. peg$maxFailPos < input.length
  30153. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  30154. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  30155. );
  30156. }
  30157. }
  30158. return {
  30159. SyntaxError: peg$SyntaxError,
  30160. parse: peg$parse
  30161. };
  30162. })();
  30163. });
  30164. 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";
  30165. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  30166. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30167. $core.addPackage("Platform-ImportExport");
  30168. ($core.packageDescriptors||$core.packages)["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  30169. ($core.packageDescriptors||$core.packages)["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30170. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  30171. $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.";
  30172. $core.addMethod(
  30173. $core.method({
  30174. selector: "exportPackage:on:",
  30175. protocol: "output",
  30176. fn: function (aPackage,aStream){
  30177. var self=this,$self=this;
  30178. return $core.withContext(function($ctx1) {
  30179. $self._subclassResponsibility();
  30180. return self;
  30181. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  30182. },
  30183. args: ["aPackage", "aStream"],
  30184. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  30185. referencedClasses: [],
  30186. messageSends: ["subclassResponsibility"]
  30187. }),
  30188. $globals.AbstractExporter);
  30189. $core.addMethod(
  30190. $core.method({
  30191. selector: "extensionMethodsOfPackage:",
  30192. protocol: "accessing",
  30193. fn: function (aPackage){
  30194. var self=this,$self=this;
  30195. var result;
  30196. return $core.withContext(function($ctx1) {
  30197. result=$recv($globals.OrderedCollection)._new();
  30198. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  30199. return $core.withContext(function($ctx2) {
  30200. return $recv(result)._addAll_($recv(each)._ownMethods());
  30201. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30202. }));
  30203. return result;
  30204. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  30205. },
  30206. args: ["aPackage"],
  30207. 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",
  30208. referencedClasses: ["OrderedCollection"],
  30209. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  30210. }),
  30211. $globals.AbstractExporter);
  30212. $core.addMethod(
  30213. $core.method({
  30214. selector: "extensionProtocolsOfPackage:",
  30215. protocol: "accessing",
  30216. fn: function (aPackage){
  30217. var self=this,$self=this;
  30218. var extensionName,result;
  30219. return $core.withContext(function($ctx1) {
  30220. var $1,$2,$3;
  30221. $1=$recv(aPackage)._name();
  30222. $ctx1.sendIdx["name"]=1;
  30223. extensionName="*".__comma($1);
  30224. result=$recv($globals.OrderedCollection)._new();
  30225. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  30226. return $core.withContext(function($ctx2) {
  30227. $2=$recv(a)._name();
  30228. $ctx2.sendIdx["name"]=2;
  30229. return $recv($2).__lt($recv(b)._name());
  30230. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30231. })))._do_((function(each){
  30232. return $core.withContext(function($ctx2) {
  30233. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._do_((function(behavior){
  30234. return $core.withContext(function($ctx3) {
  30235. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  30236. if($core.assert($3)){
  30237. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  30238. }
  30239. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  30240. }));
  30241. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30242. }));
  30243. $ctx1.sendIdx["do:"]=1;
  30244. return result;
  30245. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  30246. },
  30247. args: ["aPackage"],
  30248. 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",
  30249. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  30250. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "copyWithout:", "theMetaClass", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  30251. }),
  30252. $globals.AbstractExporter);
  30253. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30254. $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.";
  30255. $core.addMethod(
  30256. $core.method({
  30257. selector: "chunkEscape:",
  30258. protocol: "convenience",
  30259. fn: function (aString){
  30260. var self=this,$self=this;
  30261. return $core.withContext(function($ctx1) {
  30262. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  30263. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  30264. },
  30265. args: ["aString"],
  30266. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  30267. referencedClasses: [],
  30268. messageSends: ["trimBoth", "replace:with:"]
  30269. }),
  30270. $globals.ChunkExporter);
  30271. $core.addMethod(
  30272. $core.method({
  30273. selector: "exportBehavior:on:",
  30274. protocol: "output",
  30275. fn: function (aBehavior,aStream){
  30276. var self=this,$self=this;
  30277. return $core.withContext(function($ctx1) {
  30278. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30279. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  30280. return self;
  30281. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30282. },
  30283. args: ["aBehavior", "aStream"],
  30284. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  30285. referencedClasses: [],
  30286. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  30287. }),
  30288. $globals.ChunkExporter);
  30289. $core.addMethod(
  30290. $core.method({
  30291. selector: "exportCategoryEpilogueOf:on:",
  30292. protocol: "output",
  30293. fn: function (aCategory,aStream){
  30294. var self=this,$self=this;
  30295. return $core.withContext(function($ctx1) {
  30296. $recv(aStream)._write_(" !");
  30297. $recv(aStream)._lf();
  30298. $ctx1.sendIdx["lf"]=1;
  30299. $recv(aStream)._lf();
  30300. return self;
  30301. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30302. },
  30303. args: ["aCategory", "aStream"],
  30304. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30305. referencedClasses: [],
  30306. messageSends: ["write:", "lf"]
  30307. }),
  30308. $globals.ChunkExporter);
  30309. $core.addMethod(
  30310. $core.method({
  30311. selector: "exportCategoryPrologueOf:on:",
  30312. protocol: "output",
  30313. fn: function (aCategory,aStream){
  30314. var self=this,$self=this;
  30315. return $core.withContext(function($ctx1) {
  30316. $recv(aStream)._write_("!");
  30317. $ctx1.sendIdx["write:"]=1;
  30318. $recv(aStream)._print_($recv(aCategory)._theClass());
  30319. $ctx1.sendIdx["print:"]=1;
  30320. $recv(aStream)._write_(" methodsFor: ");
  30321. $ctx1.sendIdx["write:"]=2;
  30322. $recv(aStream)._print_(aCategory);
  30323. $recv(aStream)._write_("!");
  30324. return self;
  30325. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30326. },
  30327. args: ["aCategory", "aStream"],
  30328. 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: '!'",
  30329. referencedClasses: [],
  30330. messageSends: ["write:", "print:", "theClass"]
  30331. }),
  30332. $globals.ChunkExporter);
  30333. $core.addMethod(
  30334. $core.method({
  30335. selector: "exportDefinitionOf:on:",
  30336. protocol: "output",
  30337. fn: function (aClass,aStream){
  30338. var self=this,$self=this;
  30339. return $core.withContext(function($ctx1) {
  30340. var $1,$2,$3,$4;
  30341. $recv(aStream)._print_($recv(aClass)._superclass());
  30342. $ctx1.sendIdx["print:"]=1;
  30343. $recv(aStream)._write_(" subclass: ");
  30344. $ctx1.sendIdx["write:"]=1;
  30345. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30346. $1=$recv(aStream)._lf();
  30347. $ctx1.sendIdx["lf"]=1;
  30348. $recv(aStream)._tab();
  30349. $ctx1.sendIdx["tab"]=1;
  30350. $recv(aStream)._write_("instanceVariableNames: ");
  30351. $ctx1.sendIdx["write:"]=2;
  30352. $recv(aStream)._print_(" "._join_($recv(aClass)._instanceVariableNames()));
  30353. $ctx1.sendIdx["print:"]=2;
  30354. $recv(aStream)._lf();
  30355. $ctx1.sendIdx["lf"]=2;
  30356. $recv(aStream)._tab();
  30357. $recv(aStream)._write_("package: ");
  30358. $ctx1.sendIdx["write:"]=3;
  30359. $recv(aStream)._print_($recv(aClass)._category());
  30360. $ctx1.sendIdx["print:"]=3;
  30361. $recv(aStream)._write_("!");
  30362. $ctx1.sendIdx["write:"]=4;
  30363. $2=$recv(aStream)._lf();
  30364. $ctx1.sendIdx["lf"]=3;
  30365. $3=$recv(aClass)._comment();
  30366. $ctx1.sendIdx["comment"]=1;
  30367. $recv($3)._ifNotEmpty_((function(){
  30368. return $core.withContext(function($ctx2) {
  30369. $recv(aStream)._write_("!");
  30370. $ctx2.sendIdx["write:"]=5;
  30371. $recv(aStream)._print_(aClass);
  30372. $recv(aStream)._write_(" commentStamp!");
  30373. $ctx2.sendIdx["write:"]=6;
  30374. $recv(aStream)._lf();
  30375. $ctx2.sendIdx["lf"]=4;
  30376. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30377. $4=$recv(aStream)._lf();
  30378. $ctx2.sendIdx["lf"]=5;
  30379. return $4;
  30380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30381. }));
  30382. $recv(aStream)._lf();
  30383. return self;
  30384. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30385. },
  30386. args: ["aClass", "aStream"],
  30387. 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",
  30388. referencedClasses: [],
  30389. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30390. }),
  30391. $globals.ChunkExporter);
  30392. $core.addMethod(
  30393. $core.method({
  30394. selector: "exportMetaDefinitionOf:on:",
  30395. protocol: "output",
  30396. fn: function (aClass,aStream){
  30397. var self=this,$self=this;
  30398. var classIvars,classTraitComposition;
  30399. return $core.withContext(function($ctx1) {
  30400. var $1,$2;
  30401. $1=$recv(aClass)._class();
  30402. $ctx1.sendIdx["class"]=1;
  30403. classIvars=$recv($1)._instanceVariableNames();
  30404. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  30405. $2=$recv(classIvars)._notEmpty();
  30406. if($core.assert($2)){
  30407. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  30408. $ctx1.sendIdx["print:"]=1;
  30409. $recv(aStream)._space();
  30410. $recv(aStream)._write_("instanceVariableNames: ");
  30411. $ctx1.sendIdx["write:"]=1;
  30412. $recv(aStream)._print_(" "._join_(classIvars));
  30413. $recv(aStream)._write_("!");
  30414. $recv(aStream)._lf();
  30415. $ctx1.sendIdx["lf"]=1;
  30416. $recv(aStream)._lf();
  30417. }
  30418. return self;
  30419. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition},$globals.ChunkExporter)});
  30420. },
  30421. args: ["aClass", "aStream"],
  30422. 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 ]",
  30423. referencedClasses: [],
  30424. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "lf"]
  30425. }),
  30426. $globals.ChunkExporter);
  30427. $core.addMethod(
  30428. $core.method({
  30429. selector: "exportMethod:on:",
  30430. protocol: "output",
  30431. fn: function (aMethod,aStream){
  30432. var self=this,$self=this;
  30433. return $core.withContext(function($ctx1) {
  30434. $recv(aStream)._lf();
  30435. $ctx1.sendIdx["lf"]=1;
  30436. $recv(aStream)._lf();
  30437. $ctx1.sendIdx["lf"]=2;
  30438. $recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()));
  30439. $ctx1.sendIdx["write:"]=1;
  30440. $recv(aStream)._lf();
  30441. $recv(aStream)._write_("!");
  30442. return self;
  30443. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  30444. },
  30445. args: ["aMethod", "aStream"],
  30446. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  30447. referencedClasses: [],
  30448. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  30449. }),
  30450. $globals.ChunkExporter);
  30451. $core.addMethod(
  30452. $core.method({
  30453. selector: "exportPackage:on:",
  30454. protocol: "output",
  30455. fn: function (aPackage,aStream){
  30456. var self=this,$self=this;
  30457. return $core.withContext(function($ctx1) {
  30458. var $1,$receiver;
  30459. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  30460. $self._exportPackageImportsOf_on_(aPackage,aStream);
  30461. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  30462. return $core.withContext(function($ctx2) {
  30463. $self._exportBehavior_on_(each,aStream);
  30464. $ctx2.sendIdx["exportBehavior:on:"]=1;
  30465. $1=$recv(each)._theMetaClass();
  30466. if(($receiver = $1) == null || $receiver.a$nil){
  30467. return $1;
  30468. } else {
  30469. var meta;
  30470. meta=$receiver;
  30471. return $self._exportBehavior_on_(meta,aStream);
  30472. }
  30473. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30474. }));
  30475. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  30476. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  30477. return self;
  30478. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30479. },
  30480. args: ["aPackage", "aStream"],
  30481. 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",
  30482. referencedClasses: [],
  30483. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  30484. }),
  30485. $globals.ChunkExporter);
  30486. $core.addMethod(
  30487. $core.method({
  30488. selector: "exportPackageDefinitionOf:on:",
  30489. protocol: "output",
  30490. fn: function (aPackage,aStream){
  30491. var self=this,$self=this;
  30492. return $core.withContext(function($ctx1) {
  30493. $recv(aStream)._write_("Smalltalk createPackage: ");
  30494. $ctx1.sendIdx["write:"]=1;
  30495. $recv(aStream)._print_($recv(aPackage)._name());
  30496. $recv(aStream)._write_("!");
  30497. $recv(aStream)._lf();
  30498. return self;
  30499. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30500. },
  30501. args: ["aPackage", "aStream"],
  30502. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  30503. referencedClasses: [],
  30504. messageSends: ["write:", "print:", "name", "lf"]
  30505. }),
  30506. $globals.ChunkExporter);
  30507. $core.addMethod(
  30508. $core.method({
  30509. selector: "exportPackageImportsOf:on:",
  30510. protocol: "output",
  30511. fn: function (aPackage,aStream){
  30512. var self=this,$self=this;
  30513. return $core.withContext(function($ctx1) {
  30514. var $1;
  30515. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  30516. return $core.withContext(function($ctx2) {
  30517. $recv(aStream)._write_("(Smalltalk packageAt: ");
  30518. $ctx2.sendIdx["write:"]=1;
  30519. $1=$recv(aPackage)._name();
  30520. $ctx2.sendIdx["name"]=1;
  30521. $recv(aStream)._print_($1);
  30522. $ctx2.sendIdx["print:"]=1;
  30523. $recv(aStream)._write_(" ifAbsent: [ self error: ");
  30524. $ctx2.sendIdx["write:"]=2;
  30525. $recv(aStream)._print_("Package not created: ".__comma($recv(aPackage)._name()));
  30526. $recv(aStream)._write_([" ]) imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  30527. return $recv(aStream)._lf();
  30528. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  30529. }));
  30530. return self;
  30531. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30532. },
  30533. args: ["aPackage", "aStream"],
  30534. 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 ]",
  30535. referencedClasses: [],
  30536. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", ",", "chunkEscape:", "importsDefinition", "lf"]
  30537. }),
  30538. $globals.ChunkExporter);
  30539. $core.addMethod(
  30540. $core.method({
  30541. selector: "exportPackageTraitCompositionsOf:on:",
  30542. protocol: "output",
  30543. fn: function (aPackage,aStream){
  30544. var self=this,$self=this;
  30545. return $core.withContext(function($ctx1) {
  30546. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  30547. return $core.withContext(function($ctx2) {
  30548. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  30549. return $core.withContext(function($ctx3) {
  30550. return $self._exportTraitComposition_of_on_(value,key,aStream);
  30551. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  30552. }));
  30553. $recv(aStream)._write_("! !");
  30554. $recv(aStream)._lf();
  30555. $ctx2.sendIdx["lf"]=1;
  30556. return $recv(aStream)._lf();
  30557. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  30558. }));
  30559. return self;
  30560. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30561. },
  30562. args: ["aPackage", "aStream"],
  30563. 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 ]",
  30564. referencedClasses: [],
  30565. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  30566. }),
  30567. $globals.ChunkExporter);
  30568. $core.addMethod(
  30569. $core.method({
  30570. selector: "exportProtocol:on:",
  30571. protocol: "output",
  30572. fn: function (aProtocol,aStream){
  30573. var self=this,$self=this;
  30574. return $core.withContext(function($ctx1) {
  30575. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  30576. return $core.withContext(function($ctx2) {
  30577. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  30578. $recv(methods)._do_((function(method){
  30579. return $core.withContext(function($ctx3) {
  30580. return $self._exportMethod_on_(method,aStream);
  30581. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  30582. }));
  30583. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  30584. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  30585. }));
  30586. return self;
  30587. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30588. },
  30589. args: ["aProtocol", "aStream"],
  30590. 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 ]",
  30591. referencedClasses: [],
  30592. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  30593. }),
  30594. $globals.ChunkExporter);
  30595. $core.addMethod(
  30596. $core.method({
  30597. selector: "exportProtocolEpilogueOf:on:",
  30598. protocol: "output",
  30599. fn: function (aProtocol,aStream){
  30600. var self=this,$self=this;
  30601. return $core.withContext(function($ctx1) {
  30602. $recv(aStream)._write_(" !");
  30603. $recv(aStream)._lf();
  30604. $ctx1.sendIdx["lf"]=1;
  30605. $recv(aStream)._lf();
  30606. return self;
  30607. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30608. },
  30609. args: ["aProtocol", "aStream"],
  30610. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30611. referencedClasses: [],
  30612. messageSends: ["write:", "lf"]
  30613. }),
  30614. $globals.ChunkExporter);
  30615. $core.addMethod(
  30616. $core.method({
  30617. selector: "exportProtocolPrologueOf:on:",
  30618. protocol: "output",
  30619. fn: function (aProtocol,aStream){
  30620. var self=this,$self=this;
  30621. return $core.withContext(function($ctx1) {
  30622. $recv(aStream)._write_("!");
  30623. $ctx1.sendIdx["write:"]=1;
  30624. $recv(aStream)._print_($recv(aProtocol)._theClass());
  30625. $ctx1.sendIdx["print:"]=1;
  30626. $recv(aStream)._write_(" methodsFor: ");
  30627. $ctx1.sendIdx["write:"]=2;
  30628. $recv(aStream)._print_($recv(aProtocol)._name());
  30629. $recv(aStream)._write_("!");
  30630. return self;
  30631. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30632. },
  30633. args: ["aProtocol", "aStream"],
  30634. 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: '!'",
  30635. referencedClasses: [],
  30636. messageSends: ["write:", "print:", "theClass", "name"]
  30637. }),
  30638. $globals.ChunkExporter);
  30639. $core.addMethod(
  30640. $core.method({
  30641. selector: "exportProtocols:on:",
  30642. protocol: "output",
  30643. fn: function (aCollection,aStream){
  30644. var self=this,$self=this;
  30645. return $core.withContext(function($ctx1) {
  30646. $recv(aCollection)._do_((function(each){
  30647. return $core.withContext(function($ctx2) {
  30648. return $self._exportProtocol_on_(each,aStream);
  30649. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30650. }));
  30651. return self;
  30652. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  30653. },
  30654. args: ["aCollection", "aStream"],
  30655. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  30656. referencedClasses: [],
  30657. messageSends: ["do:", "exportProtocol:on:"]
  30658. }),
  30659. $globals.ChunkExporter);
  30660. $core.addMethod(
  30661. $core.method({
  30662. selector: "exportTraitComposition:of:on:",
  30663. protocol: "output",
  30664. fn: function (aTraitComposition,aBehavior,aStream){
  30665. var self=this,$self=this;
  30666. return $core.withContext(function($ctx1) {
  30667. $recv(aStream)._print_(aBehavior);
  30668. $recv(aStream)._write_(" setTraitComposition: ");
  30669. $ctx1.sendIdx["write:"]=1;
  30670. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  30671. $ctx1.sendIdx["write:"]=2;
  30672. $recv(aStream)._write_(" asTraitComposition!");
  30673. $recv(aStream)._lf();
  30674. return self;
  30675. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30676. },
  30677. args: ["aTraitComposition", "aBehavior", "aStream"],
  30678. 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",
  30679. referencedClasses: [],
  30680. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  30681. }),
  30682. $globals.ChunkExporter);
  30683. $core.addMethod(
  30684. $core.method({
  30685. selector: "exportTraitDefinitionOf:on:",
  30686. protocol: "output",
  30687. fn: function (aClass,aStream){
  30688. var self=this,$self=this;
  30689. return $core.withContext(function($ctx1) {
  30690. var $1,$2,$3,$4;
  30691. $recv(aStream)._write_("Trait named: ");
  30692. $ctx1.sendIdx["write:"]=1;
  30693. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30694. $1=$recv(aStream)._lf();
  30695. $ctx1.sendIdx["lf"]=1;
  30696. $recv(aStream)._tab();
  30697. $recv(aStream)._write_("package: ");
  30698. $ctx1.sendIdx["write:"]=2;
  30699. $recv(aStream)._print_($recv(aClass)._category());
  30700. $ctx1.sendIdx["print:"]=1;
  30701. $recv(aStream)._write_("!");
  30702. $ctx1.sendIdx["write:"]=3;
  30703. $2=$recv(aStream)._lf();
  30704. $ctx1.sendIdx["lf"]=2;
  30705. $3=$recv(aClass)._comment();
  30706. $ctx1.sendIdx["comment"]=1;
  30707. $recv($3)._ifNotEmpty_((function(){
  30708. return $core.withContext(function($ctx2) {
  30709. $recv(aStream)._write_("!");
  30710. $ctx2.sendIdx["write:"]=4;
  30711. $recv(aStream)._print_(aClass);
  30712. $recv(aStream)._write_(" commentStamp!");
  30713. $ctx2.sendIdx["write:"]=5;
  30714. $recv(aStream)._lf();
  30715. $ctx2.sendIdx["lf"]=3;
  30716. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30717. $4=$recv(aStream)._lf();
  30718. $ctx2.sendIdx["lf"]=4;
  30719. return $4;
  30720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30721. }));
  30722. $recv(aStream)._lf();
  30723. return self;
  30724. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30725. },
  30726. args: ["aClass", "aStream"],
  30727. 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",
  30728. referencedClasses: [],
  30729. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30730. }),
  30731. $globals.ChunkExporter);
  30732. $core.addMethod(
  30733. $core.method({
  30734. selector: "extensionCategoriesOfPackage:",
  30735. protocol: "accessing",
  30736. fn: function (aPackage){
  30737. var self=this,$self=this;
  30738. var name,map,result;
  30739. return $core.withContext(function($ctx1) {
  30740. var $1;
  30741. name=$recv(aPackage)._name();
  30742. result=$recv($globals.OrderedCollection)._new();
  30743. $ctx1.sendIdx["new"]=1;
  30744. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  30745. return $core.withContext(function($ctx2) {
  30746. return $recv([each,$recv(each)._theMetaClass()])._do_((function(aClass){
  30747. return $core.withContext(function($ctx3) {
  30748. map=$recv($globals.Dictionary)._new();
  30749. $recv(aClass)._protocolsDo_((function(category,methods){
  30750. return $core.withContext(function($ctx4) {
  30751. $1=$recv(category).__eq("*".__comma(name));
  30752. if($core.assert($1)){
  30753. return $recv(map)._at_put_(category,methods);
  30754. }
  30755. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  30756. }));
  30757. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30758. return $core.withContext(function($ctx4) {
  30759. return $recv(a).__lt_eq(b);
  30760. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  30761. })))._collect_((function(category){
  30762. return $core.withContext(function($ctx4) {
  30763. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  30764. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  30765. })));
  30766. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  30767. }));
  30768. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30769. }));
  30770. $ctx1.sendIdx["do:"]=1;
  30771. return result;
  30772. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  30773. },
  30774. args: ["aPackage"],
  30775. source: "extensionCategoriesOfPackage: aPackage\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk classes) do: [ :each |\x0a\x09\x09{each. each theMetaClass} do: [ :aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [ :category :methods |\x0a\x09\x09\x09\x09category = ('*', name) ifTrue: [ map at: category put: methods ] ].\x0a\x09\x09\x09result addAll: ((map keys sorted: [ :a :b | a <= b ]) collect: [ :category |\x0a\x09\x09\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]) ] ].\x0a\x09^ result",
  30776. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  30777. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "theMetaClass", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30778. }),
  30779. $globals.ChunkExporter);
  30780. $core.addMethod(
  30781. $core.method({
  30782. selector: "ownCategoriesOfClass:",
  30783. protocol: "accessing",
  30784. fn: function (aClass){
  30785. var self=this,$self=this;
  30786. var map;
  30787. return $core.withContext(function($ctx1) {
  30788. var $1;
  30789. map=$recv($globals.Dictionary)._new();
  30790. $recv(aClass)._protocolsDo_((function(each,methods){
  30791. return $core.withContext(function($ctx2) {
  30792. $1=$recv(each)._match_("^\x5c*");
  30793. if(!$core.assert($1)){
  30794. return $recv(map)._at_put_(each,methods);
  30795. }
  30796. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  30797. }));
  30798. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30799. return $core.withContext(function($ctx2) {
  30800. return $recv(a).__lt_eq(b);
  30801. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  30802. })))._collect_((function(each){
  30803. return $core.withContext(function($ctx2) {
  30804. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  30805. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  30806. }));
  30807. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  30808. },
  30809. args: ["aClass"],
  30810. source: "ownCategoriesOfClass: aClass\x0a\x09\x22Answer the protocols of aClass that are not package extensions\x22\x0a\x09\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| map |\x0a\x09map := Dictionary new.\x0a\x09aClass protocolsDo: [ :each :methods |\x0a\x09\x09(each match: '^\x5c*') ifFalse: [ map at: each put: methods ] ].\x0a\x09^ (map keys sorted: [ :a :b | a <= b ]) collect: [ :each |\x0a\x09\x09MethodCategory name: each theClass: aClass methods: (map at: each) ]",
  30811. referencedClasses: ["Dictionary", "MethodCategory"],
  30812. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30813. }),
  30814. $globals.ChunkExporter);
  30815. $core.addMethod(
  30816. $core.method({
  30817. selector: "ownCategoriesOfMetaClass:",
  30818. protocol: "accessing",
  30819. fn: function (aClass){
  30820. var self=this,$self=this;
  30821. return $core.withContext(function($ctx1) {
  30822. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  30823. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  30824. },
  30825. args: ["aClass"],
  30826. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  30827. referencedClasses: [],
  30828. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  30829. }),
  30830. $globals.ChunkExporter);
  30831. $core.addMethod(
  30832. $core.method({
  30833. selector: "ownMethodProtocolsOfClass:",
  30834. protocol: "accessing",
  30835. fn: function (aClass){
  30836. var self=this,$self=this;
  30837. return $core.withContext(function($ctx1) {
  30838. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  30839. return $core.withContext(function($ctx2) {
  30840. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  30841. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30842. }));
  30843. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  30844. },
  30845. args: ["aClass"],
  30846. source: "ownMethodProtocolsOfClass: aClass\x0a\x09\x22Answer a collection of ExportMethodProtocol object of aClass that are not package extensions\x22\x0a\x09\x0a\x09^ aClass ownProtocols collect: [ :each |\x0a\x09\x09ExportMethodProtocol name: each theClass: aClass ]",
  30847. referencedClasses: ["ExportMethodProtocol"],
  30848. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  30849. }),
  30850. $globals.ChunkExporter);
  30851. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30852. $globals.Exporter.comment="I am responsible for outputting Amber code into a JavaScript string.\x0a\x0aThe generated output is enough to reconstruct the exported data, including Smalltalk source code and other metadata.\x0a\x0a## Use case\x0a\x0aI am typically used to save code outside of the Amber runtime (committing to disk, etc.).";
  30853. $core.addMethod(
  30854. $core.method({
  30855. selector: "exportBehavior:on:",
  30856. protocol: "output",
  30857. fn: function (aBehavior,aStream){
  30858. var self=this,$self=this;
  30859. return $core.withContext(function($ctx1) {
  30860. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30861. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  30862. return $core.withContext(function($ctx2) {
  30863. return $self._exportMethod_on_(method,aStream);
  30864. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  30865. }));
  30866. return self;
  30867. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  30868. },
  30869. args: ["aBehavior", "aStream"],
  30870. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  30871. referencedClasses: [],
  30872. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  30873. }),
  30874. $globals.Exporter);
  30875. $core.addMethod(
  30876. $core.method({
  30877. selector: "exportDefinitionOf:on:",
  30878. protocol: "output",
  30879. fn: function (aClass,aStream){
  30880. var self=this,$self=this;
  30881. return $core.withContext(function($ctx1) {
  30882. var $3,$5,$4,$6,$7,$2,$1,$8,$10,$9,$receiver;
  30883. $recv(aStream)._lf();
  30884. $ctx1.sendIdx["lf"]=1;
  30885. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  30886. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30887. $5=$recv(aClass)._superclass();
  30888. if(($receiver = $5) == null || $receiver.a$nil){
  30889. $4="null";
  30890. } else {
  30891. var superclass;
  30892. superclass=$receiver;
  30893. $4=$recv(superclass)._asJavaScriptSource();
  30894. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30895. }
  30896. $6=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  30897. $ctx1.sendIdx["asJavaScriptSource"]=3;
  30898. $7=$recv($recv(aClass)._category())._asJavaScriptSource();
  30899. $ctx1.sendIdx["asJavaScriptSource"]=4;
  30900. $2=["$core.addClass(",$3,", ",$4,", ",$6,", ",$7,");"];
  30901. $1=$recv(aStream)._write_($2);
  30902. $ctx1.sendIdx["write:"]=1;
  30903. $8=$recv(aClass)._comment();
  30904. $ctx1.sendIdx["comment"]=1;
  30905. $recv($8)._ifNotEmpty_((function(){
  30906. return $core.withContext(function($ctx2) {
  30907. $recv(aStream)._lf();
  30908. $ctx2.sendIdx["lf"]=2;
  30909. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  30910. $ctx2.sendIdx["write:"]=2;
  30911. $recv(aStream)._lf();
  30912. $ctx2.sendIdx["lf"]=3;
  30913. $10=$recv(aClass)._asJavaScriptSource();
  30914. $ctx2.sendIdx["asJavaScriptSource"]=5;
  30915. $9=[$10,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  30916. $recv(aStream)._write_($9);
  30917. $ctx2.sendIdx["write:"]=3;
  30918. $recv(aStream)._lf();
  30919. $ctx2.sendIdx["lf"]=4;
  30920. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  30921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  30922. }));
  30923. $recv(aStream)._lf();
  30924. return self;
  30925. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30926. },
  30927. args: ["aClass", "aStream"],
  30928. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09write: {\x0a\x09\x09\x09'$core.addClass('.\x0a\x09\x09\x09aClass name asJavaScriptSource. ', '.\x0a\x09\x09\x09aClass superclass ifNil: [ 'null' ] ifNotNil: [ :superclass | superclass asJavaScriptSource ]. ', '.\x0a\x09\x09\x09aClass instanceVariableNames asJavaScriptSource. ', '.\x0a\x09\x09\x09aClass category asJavaScriptSource.\x0a\x09\x09\x09');' }.\x0a\x09aClass comment ifNotEmpty: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09\x09write: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);'; lf;\x0a\x09\x09\x09write: { aClass asJavaScriptSource. '.comment='. aClass comment crlfSanitized asJavaScriptSource. ';' }; lf;\x0a\x09\x09\x09write: '//>>excludeEnd(\x22ide\x22);' ].\x0a\x09aStream lf",
  30929. referencedClasses: [],
  30930. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  30931. }),
  30932. $globals.Exporter);
  30933. $core.addMethod(
  30934. $core.method({
  30935. selector: "exportMetaDefinitionOf:on:",
  30936. protocol: "output",
  30937. fn: function (aClass,aStream){
  30938. var self=this,$self=this;
  30939. return $core.withContext(function($ctx1) {
  30940. var $2,$1,$4,$3;
  30941. $recv(aStream)._lf();
  30942. $ctx1.sendIdx["lf"]=1;
  30943. $2=$recv(aClass)._theMetaClass();
  30944. $ctx1.sendIdx["theMetaClass"]=1;
  30945. $1=$recv($2)._instanceVariableNames();
  30946. $recv($1)._ifNotEmpty_((function(classIvars){
  30947. return $core.withContext(function($ctx2) {
  30948. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  30949. $ctx2.sendIdx["asJavaScriptSource"]=1;
  30950. $3=[$4,".iVarNames = ",$recv(classIvars)._asJavaScriptSource(),";"];
  30951. $recv(aStream)._write_($3);
  30952. return $recv(aStream)._lf();
  30953. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  30954. }));
  30955. return self;
  30956. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30957. },
  30958. args: ["aClass", "aStream"],
  30959. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass theMetaClass instanceVariableNames ifNotEmpty: [ :classIvars | aStream\x0a\x09\x09write: { aClass theMetaClass asJavaScriptSource. '.iVarNames = '. classIvars asJavaScriptSource. ';' };\x0a\x09\x09lf ]",
  30960. referencedClasses: [],
  30961. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  30962. }),
  30963. $globals.Exporter);
  30964. $core.addMethod(
  30965. $core.method({
  30966. selector: "exportMethod:on:",
  30967. protocol: "output",
  30968. fn: function (aMethod,aStream){
  30969. var self=this,$self=this;
  30970. return $core.withContext(function($ctx1) {
  30971. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  30972. $recv(aStream)._write_("$core.addMethod(");
  30973. $ctx1.sendIdx["write:"]=1;
  30974. $recv(aStream)._lf();
  30975. $ctx1.sendIdx["lf"]=1;
  30976. $recv(aStream)._write_("$core.method({");
  30977. $ctx1.sendIdx["write:"]=2;
  30978. $recv(aStream)._lf();
  30979. $ctx1.sendIdx["lf"]=2;
  30980. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  30981. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30982. $1=["selector: ",$2,","];
  30983. $recv(aStream)._write_($1);
  30984. $ctx1.sendIdx["write:"]=3;
  30985. $recv(aStream)._lf();
  30986. $ctx1.sendIdx["lf"]=3;
  30987. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  30988. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30989. $3=["protocol: ",$4,","];
  30990. $recv(aStream)._write_($3);
  30991. $ctx1.sendIdx["write:"]=4;
  30992. $recv(aStream)._lf();
  30993. $ctx1.sendIdx["lf"]=4;
  30994. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  30995. $ctx1.sendIdx["write:"]=5;
  30996. $recv(aStream)._lf();
  30997. $ctx1.sendIdx["lf"]=5;
  30998. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  30999. $ctx1.sendIdx["write:"]=6;
  31000. $recv(aStream)._lf();
  31001. $ctx1.sendIdx["lf"]=6;
  31002. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  31003. $ctx1.sendIdx["asJavaScriptSource"]=3;
  31004. $5=["args: ",$6,","];
  31005. $recv(aStream)._write_($5);
  31006. $ctx1.sendIdx["write:"]=7;
  31007. $recv(aStream)._lf();
  31008. $ctx1.sendIdx["lf"]=7;
  31009. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  31010. $ctx1.sendIdx["asJavaScriptSource"]=4;
  31011. $7=["source: ",$8,","];
  31012. $recv(aStream)._write_($7);
  31013. $ctx1.sendIdx["write:"]=8;
  31014. $recv(aStream)._lf();
  31015. $ctx1.sendIdx["lf"]=8;
  31016. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  31017. $ctx1.sendIdx["asJavaScriptSource"]=5;
  31018. $9=["referencedClasses: ",$10,","];
  31019. $recv(aStream)._write_($9);
  31020. $ctx1.sendIdx["write:"]=9;
  31021. $recv(aStream)._lf();
  31022. $ctx1.sendIdx["lf"]=9;
  31023. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31024. $ctx1.sendIdx["write:"]=10;
  31025. $recv(aStream)._lf();
  31026. $ctx1.sendIdx["lf"]=10;
  31027. $12=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  31028. $ctx1.sendIdx["asJavaScriptSource"]=6;
  31029. $11=["messageSends: ",$12];
  31030. $recv(aStream)._write_($11);
  31031. $ctx1.sendIdx["write:"]=11;
  31032. $recv(aStream)._lf();
  31033. $ctx1.sendIdx["lf"]=11;
  31034. $recv(aStream)._write_("}),");
  31035. $ctx1.sendIdx["write:"]=12;
  31036. $recv(aStream)._lf();
  31037. $ctx1.sendIdx["lf"]=12;
  31038. $recv(aStream)._write_([$recv($recv(aMethod)._methodClass())._asJavaScriptSource(),");"]);
  31039. $recv(aStream)._lf();
  31040. $ctx1.sendIdx["lf"]=13;
  31041. $recv(aStream)._lf();
  31042. return self;
  31043. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  31044. },
  31045. args: ["aMethod", "aStream"],
  31046. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09write: '$core.addMethod('; lf;\x0a\x09\x09write: '$core.method({'; lf;\x0a\x09\x09write: { 'selector: '. aMethod selector asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'protocol: '. aMethod protocol asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'fn: '. aMethod fn compiledSource. ',' }; lf;\x0a\x09\x09write: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);'; lf;\x0a\x09\x09write: { 'args: '. aMethod arguments asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'source: '. aMethod source asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'referencedClasses: '. aMethod referencedClasses asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: '//>>excludeEnd(\x22ide\x22);'; lf;\x0a\x09\x09write: { 'messageSends: '. aMethod messageSends asJavaScriptSource }; lf;\x0a\x09\x09write: '}),'; lf;\x0a\x09\x09write: { aMethod methodClass asJavaScriptSource. ');' }; lf; lf",
  31047. referencedClasses: [],
  31048. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "methodClass"]
  31049. }),
  31050. $globals.Exporter);
  31051. $core.addMethod(
  31052. $core.method({
  31053. selector: "exportPackage:on:",
  31054. protocol: "output",
  31055. fn: function (aPackage,aStream){
  31056. var self=this,$self=this;
  31057. return $core.withContext(function($ctx1) {
  31058. var $1,$receiver;
  31059. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  31060. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  31061. $self._exportPackageContextOf_on_(aPackage,aStream);
  31062. $self._exportPackageImportsOf_on_(aPackage,aStream);
  31063. $self._exportPackageTransportOf_on_(aPackage,aStream);
  31064. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  31065. return $core.withContext(function($ctx2) {
  31066. $self._exportBehavior_on_(each,aStream);
  31067. $ctx2.sendIdx["exportBehavior:on:"]=1;
  31068. $1=$recv(each)._theMetaClass();
  31069. if(($receiver = $1) == null || $receiver.a$nil){
  31070. return $1;
  31071. } else {
  31072. var meta;
  31073. meta=$receiver;
  31074. return $self._exportBehavior_on_(meta,aStream);
  31075. }
  31076. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31077. }));
  31078. $ctx1.sendIdx["do:"]=1;
  31079. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  31080. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  31081. return $core.withContext(function($ctx2) {
  31082. return $self._exportMethod_on_(each,aStream);
  31083. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  31084. }));
  31085. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  31086. return self;
  31087. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31088. },
  31089. args: ["aPackage", "aStream"],
  31090. source: "exportPackage: aPackage on: aStream\x0a\x09\x0a\x09self \x0a\x09\x09exportPackagePrologueOf: aPackage on: aStream;\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageContextOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream;\x0a\x09\x09exportPackageTransportOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportBehavior: each on: aStream.\x0a\x09\x09each theMetaClass ifNotNil: [ :meta | self exportBehavior: meta on: aStream ] ].\x0a\x09\x09\x09\x0a\x09self exportPackageTraitCompositionsOf: aPackage on: aStream.\x0a\x0a\x09(self extensionMethodsOfPackage: aPackage) do: [ :each |\x0a\x09\x09self exportMethod: each on: aStream ].\x0a\x09\x09\x0a\x09self exportPackageEpilogueOf: aPackage on: aStream",
  31091. referencedClasses: [],
  31092. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  31093. }),
  31094. $globals.Exporter);
  31095. $core.addMethod(
  31096. $core.method({
  31097. selector: "exportPackageBodyBlockPrologueOf:on:",
  31098. protocol: "output",
  31099. fn: function (aPackage,aStream){
  31100. var self=this,$self=this;
  31101. return $core.withContext(function($ctx1) {
  31102. $recv(aStream)._write_("if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;");
  31103. $ctx1.sendIdx["write:"]=1;
  31104. $recv(aStream)._lf();
  31105. $ctx1.sendIdx["lf"]=1;
  31106. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  31107. $recv(aStream)._lf();
  31108. return self;
  31109. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31110. },
  31111. args: ["aPackage", "aStream"],
  31112. source: "exportPackageBodyBlockPrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;'; lf;\x0a\x09\x09write: 'var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;'; lf",
  31113. referencedClasses: [],
  31114. messageSends: ["write:", "lf"]
  31115. }),
  31116. $globals.Exporter);
  31117. $core.addMethod(
  31118. $core.method({
  31119. selector: "exportPackageContextOf:on:",
  31120. protocol: "output",
  31121. fn: function (aPackage,aStream){
  31122. var self=this,$self=this;
  31123. return $core.withContext(function($ctx1) {
  31124. $recv(aStream)._write_(["($core.packageDescriptors||$core.packages)[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].innerEval = ","function (expr) { return eval(expr); }",";"]);
  31125. $recv(aStream)._lf();
  31126. return self;
  31127. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31128. },
  31129. args: ["aPackage", "aStream"],
  31130. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'($core.packageDescriptors||$core.packages)['.\x0a\x09\x09\x09aPackage name asJavaScriptSource.\x0a\x09\x09\x09'].innerEval = '.\x0a\x09\x09\x09'function (expr) { return eval(expr); }'.\x0a\x09\x09\x09';' };\x0a\x09\x09lf",
  31131. referencedClasses: [],
  31132. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31133. }),
  31134. $globals.Exporter);
  31135. $core.addMethod(
  31136. $core.method({
  31137. selector: "exportPackageDefinitionOf:on:",
  31138. protocol: "output",
  31139. fn: function (aPackage,aStream){
  31140. var self=this,$self=this;
  31141. return $core.withContext(function($ctx1) {
  31142. $recv(aStream)._write_(["$core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  31143. $recv(aStream)._lf();
  31144. return self;
  31145. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31146. },
  31147. args: ["aPackage", "aStream"],
  31148. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  31149. referencedClasses: [],
  31150. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31151. }),
  31152. $globals.Exporter);
  31153. $core.addMethod(
  31154. $core.method({
  31155. selector: "exportPackageEpilogueOf:on:",
  31156. protocol: "output",
  31157. fn: function (aPackage,aStream){
  31158. var self=this,$self=this;
  31159. return $core.withContext(function($ctx1) {
  31160. $self._subclassResponsibility();
  31161. return self;
  31162. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31163. },
  31164. args: ["aPackage", "aStream"],
  31165. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31166. referencedClasses: [],
  31167. messageSends: ["subclassResponsibility"]
  31168. }),
  31169. $globals.Exporter);
  31170. $core.addMethod(
  31171. $core.method({
  31172. selector: "exportPackageImportsOf:on:",
  31173. protocol: "output",
  31174. fn: function (aPackage,aStream){
  31175. var self=this,$self=this;
  31176. return $core.withContext(function($ctx1) {
  31177. var $2,$1;
  31178. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  31179. return $core.withContext(function($ctx2) {
  31180. $2=$recv($recv(aPackage)._name())._asJavaScriptSource();
  31181. $ctx2.sendIdx["asJavaScriptSource"]=1;
  31182. $1=["($core.packageDescriptors||$core.packages)[",$2,"].imports = ",$recv(imports)._asJavaScriptSource(),";"];
  31183. $recv(aStream)._write_($1);
  31184. return $recv(aStream)._lf();
  31185. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  31186. }));
  31187. return self;
  31188. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31189. },
  31190. args: ["aPackage", "aStream"],
  31191. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09write: {\x0a\x09\x09\x09\x09'($core.packageDescriptors||$core.packages)['.\x0a\x09\x09\x09\x09aPackage name asJavaScriptSource.\x0a\x09\x09\x09\x09'].imports = '.\x0a\x09\x09\x09\x09imports asJavaScriptSource.\x0a\x09\x09\x09\x09';' };\x0a\x09\x09\x09lf ]",
  31192. referencedClasses: [],
  31193. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "name", "lf"]
  31194. }),
  31195. $globals.Exporter);
  31196. $core.addMethod(
  31197. $core.method({
  31198. selector: "exportPackagePrologueOf:on:",
  31199. protocol: "output",
  31200. fn: function (aPackage,aStream){
  31201. var self=this,$self=this;
  31202. return $core.withContext(function($ctx1) {
  31203. $self._subclassResponsibility();
  31204. return self;
  31205. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31206. },
  31207. args: ["aPackage", "aStream"],
  31208. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31209. referencedClasses: [],
  31210. messageSends: ["subclassResponsibility"]
  31211. }),
  31212. $globals.Exporter);
  31213. $core.addMethod(
  31214. $core.method({
  31215. selector: "exportPackageTraitCompositionsOf:on:",
  31216. protocol: "output",
  31217. fn: function (aPackage,aStream){
  31218. var self=this,$self=this;
  31219. return $core.withContext(function($ctx1) {
  31220. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  31221. return $core.withContext(function($ctx2) {
  31222. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  31223. return $core.withContext(function($ctx3) {
  31224. return $self._exportTraitComposition_of_on_(value,key,aStream);
  31225. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  31226. }));
  31227. return $recv(aStream)._lf();
  31228. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  31229. }));
  31230. return self;
  31231. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31232. },
  31233. args: ["aPackage", "aStream"],
  31234. source: "exportPackageTraitCompositionsOf: aPackage on: aStream\x0a\x09aPackage traitCompositions ifNotEmpty: [ :traitCompositions |\x0a\x09\x09traitCompositions keysAndValuesDo: [ :key :value | self exportTraitComposition: value of: key on: aStream ].\x0a\x09\x09aStream lf ]",
  31235. referencedClasses: [],
  31236. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  31237. }),
  31238. $globals.Exporter);
  31239. $core.addMethod(
  31240. $core.method({
  31241. selector: "exportPackageTransportOf:on:",
  31242. protocol: "output",
  31243. fn: function (aPackage,aStream){
  31244. var self=this,$self=this;
  31245. return $core.withContext(function($ctx1) {
  31246. $recv(aStream)._write_(["($core.packageDescriptors||$core.packages)[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  31247. $recv(aStream)._lf();
  31248. return self;
  31249. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31250. },
  31251. args: ["aPackage", "aStream"],
  31252. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'($core.packageDescriptors||$core.packages)['.\x0a\x09\x09\x09aPackage name asJavaScriptSource.\x0a\x09\x09\x09'].transport = '.\x0a\x09\x09\x09aPackage transport asJSONString.\x0a\x09\x09\x09';' };\x0a\x09\x09lf",
  31253. referencedClasses: [],
  31254. messageSends: ["write:", "asJavaScriptSource", "name", "asJSONString", "transport", "lf"]
  31255. }),
  31256. $globals.Exporter);
  31257. $core.addMethod(
  31258. $core.method({
  31259. selector: "exportTraitComposition:of:on:",
  31260. protocol: "output",
  31261. fn: function (aTraitComposition,aBehavior,aStream){
  31262. var self=this,$self=this;
  31263. return $core.withContext(function($ctx1) {
  31264. var $2,$1;
  31265. $2=$recv(aTraitComposition)._asJavaScriptSource();
  31266. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31267. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  31268. $recv(aStream)._write_($1);
  31269. $recv(aStream)._lf();
  31270. return self;
  31271. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  31272. },
  31273. args: ["aTraitComposition", "aBehavior", "aStream"],
  31274. source: "exportTraitComposition: aTraitComposition of: aBehavior on: aStream\x0a\x09aStream write: {\x0a\x09\x09'$core.setTraitComposition('.\x0a\x09\x09aTraitComposition asJavaScriptSource.\x0a\x09\x09', '.\x0a\x09\x09aBehavior asJavaScriptSource.\x0a\x09\x09');' };\x0a\x09lf",
  31275. referencedClasses: [],
  31276. messageSends: ["write:", "asJavaScriptSource", "lf"]
  31277. }),
  31278. $globals.Exporter);
  31279. $core.addMethod(
  31280. $core.method({
  31281. selector: "exportTraitDefinitionOf:on:",
  31282. protocol: "output",
  31283. fn: function (aClass,aStream){
  31284. var self=this,$self=this;
  31285. return $core.withContext(function($ctx1) {
  31286. var $3,$4,$2,$1,$5,$7,$6;
  31287. $recv(aStream)._lf();
  31288. $ctx1.sendIdx["lf"]=1;
  31289. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31290. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31291. $4=$recv($recv(aClass)._category())._asJavaScriptSource();
  31292. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31293. $2=["$core.addTrait(",$3,", ",$4,");"];
  31294. $1=$recv(aStream)._write_($2);
  31295. $ctx1.sendIdx["write:"]=1;
  31296. $5=$recv(aClass)._comment();
  31297. $ctx1.sendIdx["comment"]=1;
  31298. $recv($5)._ifNotEmpty_((function(){
  31299. return $core.withContext(function($ctx2) {
  31300. $recv(aStream)._lf();
  31301. $ctx2.sendIdx["lf"]=2;
  31302. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31303. $ctx2.sendIdx["write:"]=2;
  31304. $recv(aStream)._lf();
  31305. $ctx2.sendIdx["lf"]=3;
  31306. $7=$recv(aClass)._asJavaScriptSource();
  31307. $ctx2.sendIdx["asJavaScriptSource"]=3;
  31308. $6=[$7,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31309. $recv(aStream)._write_($6);
  31310. $ctx2.sendIdx["write:"]=3;
  31311. $recv(aStream)._lf();
  31312. $ctx2.sendIdx["lf"]=4;
  31313. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31314. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31315. }));
  31316. $recv(aStream)._lf();
  31317. return self;
  31318. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31319. },
  31320. args: ["aClass", "aStream"],
  31321. source: "exportTraitDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09write: {\x0a\x09\x09\x09'$core.addTrait('.\x0a\x09\x09\x09aClass name asJavaScriptSource. ', '.\x0a\x09\x09\x09aClass category asJavaScriptSource.\x0a\x09\x09\x09');' }.\x0a\x09aClass comment ifNotEmpty: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09\x09write: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);'; lf;\x0a\x09\x09\x09write: { aClass asJavaScriptSource. '.comment='. aClass comment crlfSanitized asJavaScriptSource. ';' }; lf;\x0a\x09\x09\x09write: '//>>excludeEnd(\x22ide\x22);' ].\x0a\x09aStream lf",
  31322. referencedClasses: [],
  31323. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31324. }),
  31325. $globals.Exporter);
  31326. $core.addMethod(
  31327. $core.method({
  31328. selector: "ownMethodsOfClass:",
  31329. protocol: "accessing",
  31330. fn: function (aClass){
  31331. var self=this,$self=this;
  31332. return $core.withContext(function($ctx1) {
  31333. var $1;
  31334. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  31335. return $core.withContext(function($ctx2) {
  31336. $1=$recv(a)._selector();
  31337. $ctx2.sendIdx["selector"]=1;
  31338. return $recv($1).__lt_eq($recv(b)._selector());
  31339. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31340. })))._reject_((function(each){
  31341. return $core.withContext(function($ctx2) {
  31342. return $recv($recv(each)._protocol())._match_("^\x5c*");
  31343. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31344. }));
  31345. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  31346. },
  31347. args: ["aClass"],
  31348. source: "ownMethodsOfClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ ((aClass methodDictionary values) sorted: [ :a :b | a selector <= b selector ])\x0a\x09\x09reject: [ :each | (each protocol match: '^\x5c*') ]",
  31349. referencedClasses: [],
  31350. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  31351. }),
  31352. $globals.Exporter);
  31353. $core.addMethod(
  31354. $core.method({
  31355. selector: "ownMethodsOfMetaClass:",
  31356. protocol: "accessing",
  31357. fn: function (aClass){
  31358. var self=this,$self=this;
  31359. return $core.withContext(function($ctx1) {
  31360. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  31361. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  31362. },
  31363. args: ["aClass"],
  31364. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  31365. referencedClasses: [],
  31366. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  31367. }),
  31368. $globals.Exporter);
  31369. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  31370. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  31371. $core.addMethod(
  31372. $core.method({
  31373. selector: "amdNamesOfPackages:",
  31374. protocol: "private",
  31375. fn: function (anArray){
  31376. var self=this,$self=this;
  31377. return $core.withContext(function($ctx1) {
  31378. var $1;
  31379. return $recv($recv(anArray)._select_((function(each){
  31380. return $core.withContext(function($ctx2) {
  31381. $1=$self._amdNamespaceOfPackage_(each);
  31382. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  31383. return $recv($1)._notNil();
  31384. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31385. })))._collect_((function(each){
  31386. return $core.withContext(function($ctx2) {
  31387. return $recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  31388. $ctx2.sendIdx[","]=1;
  31389. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31390. }));
  31391. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  31392. },
  31393. args: ["anArray"],
  31394. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  31395. referencedClasses: [],
  31396. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  31397. }),
  31398. $globals.AmdExporter);
  31399. $core.addMethod(
  31400. $core.method({
  31401. selector: "amdNamespaceOfPackage:",
  31402. protocol: "private",
  31403. fn: function (aPackage){
  31404. var self=this,$self=this;
  31405. return $core.withContext(function($ctx1) {
  31406. var $3,$2,$1;
  31407. $3=$recv(aPackage)._transport();
  31408. $ctx1.sendIdx["transport"]=1;
  31409. $2=$recv($3)._type();
  31410. $1=$recv($2).__eq("amd");
  31411. if($core.assert($1)){
  31412. return $recv($recv(aPackage)._transport())._namespace();
  31413. } else {
  31414. return nil;
  31415. }
  31416. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  31417. },
  31418. args: ["aPackage"],
  31419. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  31420. referencedClasses: [],
  31421. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  31422. }),
  31423. $globals.AmdExporter);
  31424. $core.addMethod(
  31425. $core.method({
  31426. selector: "exportPackageEpilogueOf:on:",
  31427. protocol: "output",
  31428. fn: function (aPackage,aStream){
  31429. var self=this,$self=this;
  31430. return $core.withContext(function($ctx1) {
  31431. $recv(aStream)._write_("});");
  31432. $recv(aStream)._lf();
  31433. return self;
  31434. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  31435. },
  31436. args: ["aPackage", "aStream"],
  31437. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  31438. referencedClasses: [],
  31439. messageSends: ["write:", "lf"]
  31440. }),
  31441. $globals.AmdExporter);
  31442. $core.addMethod(
  31443. $core.method({
  31444. selector: "exportPackagePrologueOf:on:",
  31445. protocol: "output",
  31446. fn: function (aPackage,aStream){
  31447. var self=this,$self=this;
  31448. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  31449. return $core.withContext(function($ctx1) {
  31450. var $1,$3,$2,$4,$6,$5,$7,$14,$13,$12,$11,$10,$9,$18,$17,$16,$15,$8;
  31451. pragmaStart="";
  31452. pragmaEnd="";
  31453. importsForOutput=$self._importsForOutput_(aPackage);
  31454. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  31455. $1=$recv(importsForOutput)._value();
  31456. $ctx1.sendIdx["value"]=1;
  31457. $recv($1)._ifNotEmpty_((function(){
  31458. return $core.withContext(function($ctx2) {
  31459. $3=$recv($globals.String)._lf();
  31460. $ctx2.sendIdx["lf"]=1;
  31461. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  31462. $ctx2.sendIdx[","]=2;
  31463. $4=$recv($globals.String)._lf();
  31464. $ctx2.sendIdx["lf"]=2;
  31465. pragmaStart=$recv($2).__comma($4);
  31466. $ctx2.sendIdx[","]=1;
  31467. $6=$recv($globals.String)._lf();
  31468. $ctx2.sendIdx["lf"]=3;
  31469. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  31470. $ctx2.sendIdx[","]=4;
  31471. $7=$recv($globals.String)._lf();
  31472. $ctx2.sendIdx["lf"]=4;
  31473. pragmaEnd=$recv($5).__comma($7);
  31474. $ctx2.sendIdx[","]=3;
  31475. return pragmaEnd;
  31476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31477. }));
  31478. $14=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  31479. $ctx1.sendIdx[","]=7;
  31480. $13=$recv($14).__comma([":2:"]);
  31481. $ctx1.sendIdx[","]=6;
  31482. $12=$recv($13).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  31483. $ctx1.sendIdx[","]=5;
  31484. $11=$recv($12)._asJavaScriptSource();
  31485. $10=$recv($11)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  31486. $ctx1.sendIdx["replace:with:"]=2;
  31487. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  31488. $ctx1.sendIdx["replace:with:"]=1;
  31489. $18=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  31490. $ctx1.sendIdx[","]=8;
  31491. $17=$recv($18)._join_(",");
  31492. $16=$recv($17)._replace_with_(",\x5cs*:1:",pragmaStart);
  31493. $15=$recv($16)._replace_with_(",\x5cs*:2:",pragmaEnd);
  31494. $ctx1.sendIdx["replace:with:"]=3;
  31495. $8=["define(",$9,", function(",$15,"){\x22use strict\x22;"];
  31496. $recv(aStream)._write_($8);
  31497. $recv(aStream)._lf();
  31498. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  31499. return self;
  31500. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  31501. },
  31502. args: ["aPackage", "aStream"],
  31503. 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",
  31504. referencedClasses: ["String"],
  31505. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "write:", "replace:with:", "asJavaScriptSource", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  31506. }),
  31507. $globals.AmdExporter);
  31508. $core.addMethod(
  31509. $core.method({
  31510. selector: "importsForOutput:",
  31511. protocol: "private",
  31512. fn: function (aPackage){
  31513. var self=this,$self=this;
  31514. var namedImports,anonImports,importVarNames;
  31515. return $core.withContext(function($ctx1) {
  31516. var $1;
  31517. namedImports=[];
  31518. anonImports=[];
  31519. importVarNames=[];
  31520. $recv($recv(aPackage)._imports())._do_((function(each){
  31521. return $core.withContext(function($ctx2) {
  31522. $1=$recv(each)._isString();
  31523. if($core.assert($1)){
  31524. return $recv(anonImports)._add_(each);
  31525. $ctx2.sendIdx["add:"]=1;
  31526. } else {
  31527. $recv(namedImports)._add_($recv(each)._value());
  31528. $ctx2.sendIdx["add:"]=2;
  31529. return $recv(importVarNames)._add_($recv(each)._key());
  31530. }
  31531. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31532. }));
  31533. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  31534. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  31535. },
  31536. args: ["aPackage"],
  31537. 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)",
  31538. referencedClasses: [],
  31539. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  31540. }),
  31541. $globals.AmdExporter);
  31542. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  31543. $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";
  31544. $core.addMethod(
  31545. $core.method({
  31546. selector: "last",
  31547. protocol: "accessing",
  31548. fn: function (){
  31549. var self=this,$self=this;
  31550. return $self["@last"];
  31551. },
  31552. args: [],
  31553. source: "last\x0a\x09^ last",
  31554. referencedClasses: [],
  31555. messageSends: []
  31556. }),
  31557. $globals.ChunkParser);
  31558. $core.addMethod(
  31559. $core.method({
  31560. selector: "nextChunk",
  31561. protocol: "reading",
  31562. fn: function (){
  31563. var self=this,$self=this;
  31564. var char,result,chunk;
  31565. return $core.withContext(function($ctx1) {
  31566. var $1,$2,$3,$4;
  31567. var $early={};
  31568. try {
  31569. result=""._writeStream();
  31570. $recv((function(){
  31571. return $core.withContext(function($ctx2) {
  31572. char=$recv($self["@stream"])._next();
  31573. $ctx2.sendIdx["next"]=1;
  31574. return $recv(char)._notNil();
  31575. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31576. }))._whileTrue_((function(){
  31577. return $core.withContext(function($ctx2) {
  31578. $1=$recv(char).__eq("!");
  31579. $ctx2.sendIdx["="]=1;
  31580. if($core.assert($1)){
  31581. $2=$recv($recv($self["@stream"])._peek()).__eq("!");
  31582. if($core.assert($2)){
  31583. $recv($self["@stream"])._next();
  31584. } else {
  31585. $self["@last"]=$recv($recv(result)._contents())._trimBoth();
  31586. $3=$self["@last"];
  31587. throw $early=[$3];
  31588. }
  31589. }
  31590. return $recv(result)._nextPut_(char);
  31591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31592. }));
  31593. $self["@last"]=nil;
  31594. $4=$self["@last"];
  31595. return $4;
  31596. }
  31597. catch(e) {if(e===$early)return e[0]; throw e}
  31598. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  31599. },
  31600. args: [],
  31601. 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",
  31602. referencedClasses: [],
  31603. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  31604. }),
  31605. $globals.ChunkParser);
  31606. $core.addMethod(
  31607. $core.method({
  31608. selector: "stream:",
  31609. protocol: "accessing",
  31610. fn: function (aStream){
  31611. var self=this,$self=this;
  31612. $self["@stream"]=aStream;
  31613. return self;
  31614. },
  31615. args: ["aStream"],
  31616. source: "stream: aStream\x0a\x09stream := aStream",
  31617. referencedClasses: [],
  31618. messageSends: []
  31619. }),
  31620. $globals.ChunkParser);
  31621. $core.addMethod(
  31622. $core.method({
  31623. selector: "on:",
  31624. protocol: "instance creation",
  31625. fn: function (aStream){
  31626. var self=this,$self=this;
  31627. return $core.withContext(function($ctx1) {
  31628. return $recv($self._new())._stream_(aStream);
  31629. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.a$cls)});
  31630. },
  31631. args: ["aStream"],
  31632. source: "on: aStream\x0a\x09^ self new stream: aStream",
  31633. referencedClasses: [],
  31634. messageSends: ["stream:", "new"]
  31635. }),
  31636. $globals.ChunkParser.a$cls);
  31637. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  31638. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  31639. $core.addMethod(
  31640. $core.method({
  31641. selector: "class:",
  31642. protocol: "accessing",
  31643. fn: function (aClass){
  31644. var self=this,$self=this;
  31645. $self["@class"]=aClass;
  31646. return self;
  31647. },
  31648. args: ["aClass"],
  31649. source: "class: aClass\x0a\x09class := aClass",
  31650. referencedClasses: [],
  31651. messageSends: []
  31652. }),
  31653. $globals.ClassCommentReader);
  31654. $core.addMethod(
  31655. $core.method({
  31656. selector: "initialize",
  31657. protocol: "initialization",
  31658. fn: function (){
  31659. var self=this,$self=this;
  31660. return $core.withContext(function($ctx1) {
  31661. (
  31662. $ctx1.supercall = true,
  31663. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31664. $ctx1.supercall = false;
  31665. return self;
  31666. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  31667. },
  31668. args: [],
  31669. source: "initialize\x0a\x09super initialize.",
  31670. referencedClasses: [],
  31671. messageSends: ["initialize"]
  31672. }),
  31673. $globals.ClassCommentReader);
  31674. $core.addMethod(
  31675. $core.method({
  31676. selector: "scanFrom:",
  31677. protocol: "fileIn",
  31678. fn: function (aChunkParser){
  31679. var self=this,$self=this;
  31680. var chunk;
  31681. return $core.withContext(function($ctx1) {
  31682. chunk=$recv(aChunkParser)._nextChunk();
  31683. $recv(chunk)._ifNotEmpty_((function(){
  31684. return $core.withContext(function($ctx2) {
  31685. return $self._setComment_(chunk);
  31686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31687. }));
  31688. return self;
  31689. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  31690. },
  31691. args: ["aChunkParser"],
  31692. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  31693. referencedClasses: [],
  31694. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  31695. }),
  31696. $globals.ClassCommentReader);
  31697. $core.addMethod(
  31698. $core.method({
  31699. selector: "setComment:",
  31700. protocol: "private",
  31701. fn: function (aString){
  31702. var self=this,$self=this;
  31703. return $core.withContext(function($ctx1) {
  31704. $recv($self["@class"])._comment_(aString);
  31705. return self;
  31706. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  31707. },
  31708. args: ["aString"],
  31709. source: "setComment: aString\x0a\x09class comment: aString",
  31710. referencedClasses: [],
  31711. messageSends: ["comment:"]
  31712. }),
  31713. $globals.ClassCommentReader);
  31714. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  31715. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  31716. $core.addMethod(
  31717. $core.method({
  31718. selector: "class:category:",
  31719. protocol: "accessing",
  31720. fn: function (aClass,aString){
  31721. var self=this,$self=this;
  31722. $self["@class"]=aClass;
  31723. $self["@category"]=aString;
  31724. return self;
  31725. },
  31726. args: ["aClass", "aString"],
  31727. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  31728. referencedClasses: [],
  31729. messageSends: []
  31730. }),
  31731. $globals.ClassProtocolReader);
  31732. $core.addMethod(
  31733. $core.method({
  31734. selector: "compileMethod:",
  31735. protocol: "private",
  31736. fn: function (aString){
  31737. var self=this,$self=this;
  31738. return $core.withContext(function($ctx1) {
  31739. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self["@class"],$self["@category"]);
  31740. return self;
  31741. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  31742. },
  31743. args: ["aString"],
  31744. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  31745. referencedClasses: ["Compiler"],
  31746. messageSends: ["install:forClass:protocol:", "new"]
  31747. }),
  31748. $globals.ClassProtocolReader);
  31749. $core.addMethod(
  31750. $core.method({
  31751. selector: "initialize",
  31752. protocol: "initialization",
  31753. fn: function (){
  31754. var self=this,$self=this;
  31755. return $core.withContext(function($ctx1) {
  31756. (
  31757. $ctx1.supercall = true,
  31758. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31759. $ctx1.supercall = false;
  31760. return self;
  31761. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  31762. },
  31763. args: [],
  31764. source: "initialize\x0a\x09super initialize.",
  31765. referencedClasses: [],
  31766. messageSends: ["initialize"]
  31767. }),
  31768. $globals.ClassProtocolReader);
  31769. $core.addMethod(
  31770. $core.method({
  31771. selector: "scanFrom:",
  31772. protocol: "fileIn",
  31773. fn: function (aChunkParser){
  31774. var self=this,$self=this;
  31775. var chunk;
  31776. return $core.withContext(function($ctx1) {
  31777. $recv((function(){
  31778. return $core.withContext(function($ctx2) {
  31779. chunk=$recv(aChunkParser)._nextChunk();
  31780. return $recv(chunk)._isEmpty();
  31781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31782. }))._whileFalse_((function(){
  31783. return $core.withContext(function($ctx2) {
  31784. return $self._compileMethod_(chunk);
  31785. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31786. }));
  31787. return self;
  31788. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  31789. },
  31790. args: ["aChunkParser"],
  31791. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  31792. referencedClasses: [],
  31793. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  31794. }),
  31795. $globals.ClassProtocolReader);
  31796. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  31797. $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.";
  31798. $core.addMethod(
  31799. $core.method({
  31800. selector: "methods",
  31801. protocol: "accessing",
  31802. fn: function (){
  31803. var self=this,$self=this;
  31804. return $core.withContext(function($ctx1) {
  31805. var $1;
  31806. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  31807. return $core.withContext(function($ctx2) {
  31808. $1=$recv(a)._selector();
  31809. $ctx2.sendIdx["selector"]=1;
  31810. return $recv($1).__lt_eq($recv(b)._selector());
  31811. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31812. }));
  31813. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  31814. },
  31815. args: [],
  31816. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31817. referencedClasses: [],
  31818. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  31819. }),
  31820. $globals.ExportMethodProtocol);
  31821. $core.addMethod(
  31822. $core.method({
  31823. selector: "name",
  31824. protocol: "accessing",
  31825. fn: function (){
  31826. var self=this,$self=this;
  31827. return $self["@name"];
  31828. },
  31829. args: [],
  31830. source: "name\x0a\x09^ name",
  31831. referencedClasses: [],
  31832. messageSends: []
  31833. }),
  31834. $globals.ExportMethodProtocol);
  31835. $core.addMethod(
  31836. $core.method({
  31837. selector: "name:",
  31838. protocol: "accessing",
  31839. fn: function (aString){
  31840. var self=this,$self=this;
  31841. $self["@name"]=aString;
  31842. return self;
  31843. },
  31844. args: ["aString"],
  31845. source: "name: aString\x0a\x09name := aString",
  31846. referencedClasses: [],
  31847. messageSends: []
  31848. }),
  31849. $globals.ExportMethodProtocol);
  31850. $core.addMethod(
  31851. $core.method({
  31852. selector: "ownMethods",
  31853. protocol: "accessing",
  31854. fn: function (){
  31855. var self=this,$self=this;
  31856. return $core.withContext(function($ctx1) {
  31857. var $1;
  31858. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  31859. return $core.withContext(function($ctx2) {
  31860. $1=$recv(a)._selector();
  31861. $ctx2.sendIdx["selector"]=1;
  31862. return $recv($1).__lt_eq($recv(b)._selector());
  31863. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31864. }));
  31865. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.ExportMethodProtocol)});
  31866. },
  31867. args: [],
  31868. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31869. referencedClasses: [],
  31870. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  31871. }),
  31872. $globals.ExportMethodProtocol);
  31873. $core.addMethod(
  31874. $core.method({
  31875. selector: "theClass",
  31876. protocol: "accessing",
  31877. fn: function (){
  31878. var self=this,$self=this;
  31879. return $self["@theClass"];
  31880. },
  31881. args: [],
  31882. source: "theClass\x0a\x09^ theClass",
  31883. referencedClasses: [],
  31884. messageSends: []
  31885. }),
  31886. $globals.ExportMethodProtocol);
  31887. $core.addMethod(
  31888. $core.method({
  31889. selector: "theClass:",
  31890. protocol: "accessing",
  31891. fn: function (aClass){
  31892. var self=this,$self=this;
  31893. $self["@theClass"]=aClass;
  31894. return self;
  31895. },
  31896. args: ["aClass"],
  31897. source: "theClass: aClass\x0a\x09theClass := aClass",
  31898. referencedClasses: [],
  31899. messageSends: []
  31900. }),
  31901. $globals.ExportMethodProtocol);
  31902. $core.addMethod(
  31903. $core.method({
  31904. selector: "name:theClass:",
  31905. protocol: "instance creation",
  31906. fn: function (aString,aClass){
  31907. var self=this,$self=this;
  31908. return $core.withContext(function($ctx1) {
  31909. var $1;
  31910. $1=$self._new();
  31911. $recv($1)._name_(aString);
  31912. $recv($1)._theClass_(aClass);
  31913. return $recv($1)._yourself();
  31914. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.a$cls)});
  31915. },
  31916. args: ["aString", "aClass"],
  31917. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  31918. referencedClasses: [],
  31919. messageSends: ["name:", "new", "theClass:", "yourself"]
  31920. }),
  31921. $globals.ExportMethodProtocol.a$cls);
  31922. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  31923. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  31924. $core.addMethod(
  31925. $core.method({
  31926. selector: "import:",
  31927. protocol: "fileIn",
  31928. fn: function (aStream){
  31929. var self=this,$self=this;
  31930. var chunk,result,parser,lastEmpty;
  31931. return $core.withContext(function($ctx1) {
  31932. var $1;
  31933. parser=$recv($globals.ChunkParser)._on_(aStream);
  31934. lastEmpty=false;
  31935. $self["@lastSection"]="n/a, not started";
  31936. $self["@lastChunk"]=nil;
  31937. $recv((function(){
  31938. return $core.withContext(function($ctx2) {
  31939. $recv((function(){
  31940. return $core.withContext(function($ctx3) {
  31941. chunk=$recv(parser)._nextChunk();
  31942. return $recv(chunk)._isNil();
  31943. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31944. }))._whileFalse_((function(){
  31945. return $core.withContext(function($ctx3) {
  31946. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  31947. lastEmpty=true;
  31948. return lastEmpty;
  31949. }),(function(){
  31950. return $core.withContext(function($ctx4) {
  31951. $self["@lastSection"]=chunk;
  31952. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  31953. $1=lastEmpty;
  31954. if($core.assert($1)){
  31955. lastEmpty=false;
  31956. return $recv(result)._scanFrom_(parser);
  31957. }
  31958. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  31959. }));
  31960. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  31961. }));
  31962. $self["@lastSection"]="n/a, finished";
  31963. return $self["@lastSection"];
  31964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31965. }))._on_do_($globals.Error,(function(e){
  31966. return $core.withContext(function($ctx2) {
  31967. $self["@lastChunk"]=$recv(parser)._last();
  31968. return $recv(e)._pass();
  31969. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  31970. }));
  31971. return self;
  31972. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  31973. },
  31974. args: ["aStream"],
  31975. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk\x0a\x09\x09\x09ifEmpty: [ lastEmpty := true ]\x0a\x09\x09\x09ifNotEmpty: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e pass ].",
  31976. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  31977. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "pass"]
  31978. }),
  31979. $globals.Importer);
  31980. $core.addMethod(
  31981. $core.method({
  31982. selector: "lastChunk",
  31983. protocol: "accessing",
  31984. fn: function (){
  31985. var self=this,$self=this;
  31986. return $self["@lastChunk"];
  31987. },
  31988. args: [],
  31989. source: "lastChunk\x0a\x09^ lastChunk",
  31990. referencedClasses: [],
  31991. messageSends: []
  31992. }),
  31993. $globals.Importer);
  31994. $core.addMethod(
  31995. $core.method({
  31996. selector: "lastSection",
  31997. protocol: "accessing",
  31998. fn: function (){
  31999. var self=this,$self=this;
  32000. return $self["@lastSection"];
  32001. },
  32002. args: [],
  32003. source: "lastSection\x0a\x09^ lastSection",
  32004. referencedClasses: [],
  32005. messageSends: []
  32006. }),
  32007. $globals.Importer);
  32008. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  32009. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  32010. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  32011. $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.";
  32012. $core.addMethod(
  32013. $core.method({
  32014. selector: "ajaxPutAt:data:onSuccess:onError:",
  32015. protocol: "private",
  32016. fn: function (aURL,aString,aBlock,anotherBlock){
  32017. var self=this,$self=this;
  32018. var xhr;
  32019. return $core.withContext(function($ctx1) {
  32020. var $1,$4,$3,$2;
  32021. xhr=$recv($globals.Platform)._newXhr();
  32022. $recv(xhr)._open_url_async_("PUT",aURL,true);
  32023. $recv(xhr)._onreadystatechange_((function(){
  32024. return $core.withContext(function($ctx2) {
  32025. $1=$recv($recv(xhr)._readyState()).__eq((4));
  32026. if($core.assert($1)){
  32027. $4=$recv(xhr)._status();
  32028. $ctx2.sendIdx["status"]=1;
  32029. $3=$recv($4).__gt_eq((200));
  32030. $2=$recv($3)._and_((function(){
  32031. return $core.withContext(function($ctx3) {
  32032. return $recv($recv(xhr)._status()).__lt((300));
  32033. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32034. }));
  32035. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  32036. }
  32037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32038. }));
  32039. $recv(xhr)._send_(aString);
  32040. return self;
  32041. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  32042. },
  32043. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  32044. 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",
  32045. referencedClasses: ["Platform"],
  32046. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  32047. }),
  32048. $globals.PackageHandler);
  32049. $core.addMethod(
  32050. $core.method({
  32051. selector: "chunkContentsFor:",
  32052. protocol: "accessing",
  32053. fn: function (aPackage){
  32054. var self=this,$self=this;
  32055. return $core.withContext(function($ctx1) {
  32056. return $recv($globals.String)._streamContents_((function(str){
  32057. return $core.withContext(function($ctx2) {
  32058. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  32059. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32060. }));
  32061. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32062. },
  32063. args: ["aPackage"],
  32064. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  32065. referencedClasses: ["String"],
  32066. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  32067. }),
  32068. $globals.PackageHandler);
  32069. $core.addMethod(
  32070. $core.method({
  32071. selector: "chunkExporter",
  32072. protocol: "factory",
  32073. fn: function (){
  32074. var self=this,$self=this;
  32075. return $core.withContext(function($ctx1) {
  32076. return $recv($self._chunkExporterClass())._new();
  32077. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  32078. },
  32079. args: [],
  32080. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  32081. referencedClasses: [],
  32082. messageSends: ["new", "chunkExporterClass"]
  32083. }),
  32084. $globals.PackageHandler);
  32085. $core.addMethod(
  32086. $core.method({
  32087. selector: "chunkExporterClass",
  32088. protocol: "accessing",
  32089. fn: function (){
  32090. var self=this,$self=this;
  32091. return $globals.ChunkExporter;
  32092. },
  32093. args: [],
  32094. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  32095. referencedClasses: ["ChunkExporter"],
  32096. messageSends: []
  32097. }),
  32098. $globals.PackageHandler);
  32099. $core.addMethod(
  32100. $core.method({
  32101. selector: "commit:",
  32102. protocol: "committing",
  32103. fn: function (aPackage){
  32104. var self=this,$self=this;
  32105. return $core.withContext(function($ctx1) {
  32106. var $1,$2;
  32107. $self._commit_onSuccess_onError_(aPackage,(function(){
  32108. }),(function(error){
  32109. return $core.withContext(function($ctx2) {
  32110. $1=$recv($globals.PackageCommitError)._new();
  32111. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  32112. $ctx2.sendIdx[","]=1;
  32113. $recv($1)._messageText_($2);
  32114. return $recv($1)._signal();
  32115. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  32116. }));
  32117. return self;
  32118. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  32119. },
  32120. args: ["aPackage"],
  32121. 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 ]",
  32122. referencedClasses: ["PackageCommitError"],
  32123. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  32124. }),
  32125. $globals.PackageHandler);
  32126. $core.addMethod(
  32127. $core.method({
  32128. selector: "commit:onSuccess:onError:",
  32129. protocol: "committing",
  32130. fn: function (aPackage,aBlock,anotherBlock){
  32131. var self=this,$self=this;
  32132. return $core.withContext(function($ctx1) {
  32133. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  32134. return $core.withContext(function($ctx2) {
  32135. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  32136. return $core.withContext(function($ctx3) {
  32137. $recv(aPackage)._beClean();
  32138. return $recv(aBlock)._value();
  32139. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32140. }),anotherBlock);
  32141. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32142. }),anotherBlock);
  32143. return self;
  32144. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32145. },
  32146. args: ["aPackage", "aBlock", "anotherBlock"],
  32147. 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",
  32148. referencedClasses: [],
  32149. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  32150. }),
  32151. $globals.PackageHandler);
  32152. $core.addMethod(
  32153. $core.method({
  32154. selector: "commitJsFileFor:onSuccess:onError:",
  32155. protocol: "committing",
  32156. fn: function (aPackage,aBlock,anotherBlock){
  32157. var self=this,$self=this;
  32158. return $core.withContext(function($ctx1) {
  32159. var $2,$1;
  32160. $2=$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32161. $ctx1.sendIdx[","]=2;
  32162. $1=$recv($2).__comma(".js");
  32163. $ctx1.sendIdx[","]=1;
  32164. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._contentsFor_(aPackage),aBlock,anotherBlock);
  32165. return self;
  32166. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32167. },
  32168. args: ["aPackage", "aBlock", "anotherBlock"],
  32169. 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",
  32170. referencedClasses: [],
  32171. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  32172. }),
  32173. $globals.PackageHandler);
  32174. $core.addMethod(
  32175. $core.method({
  32176. selector: "commitPathJsFor:",
  32177. protocol: "accessing",
  32178. fn: function (aPackage){
  32179. var self=this,$self=this;
  32180. return $core.withContext(function($ctx1) {
  32181. $self._subclassResponsibility();
  32182. return self;
  32183. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32184. },
  32185. args: ["aPackage"],
  32186. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  32187. referencedClasses: [],
  32188. messageSends: ["subclassResponsibility"]
  32189. }),
  32190. $globals.PackageHandler);
  32191. $core.addMethod(
  32192. $core.method({
  32193. selector: "commitPathStFor:",
  32194. protocol: "accessing",
  32195. fn: function (aPackage){
  32196. var self=this,$self=this;
  32197. return $core.withContext(function($ctx1) {
  32198. $self._subclassResponsibility();
  32199. return self;
  32200. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32201. },
  32202. args: ["aPackage"],
  32203. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  32204. referencedClasses: [],
  32205. messageSends: ["subclassResponsibility"]
  32206. }),
  32207. $globals.PackageHandler);
  32208. $core.addMethod(
  32209. $core.method({
  32210. selector: "commitStFileFor:onSuccess:onError:",
  32211. protocol: "committing",
  32212. fn: function (aPackage,aBlock,anotherBlock){
  32213. var self=this,$self=this;
  32214. return $core.withContext(function($ctx1) {
  32215. var $2,$1;
  32216. $2=$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32217. $ctx1.sendIdx[","]=2;
  32218. $1=$recv($2).__comma(".st");
  32219. $ctx1.sendIdx[","]=1;
  32220. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  32221. return self;
  32222. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32223. },
  32224. args: ["aPackage", "aBlock", "anotherBlock"],
  32225. 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",
  32226. referencedClasses: [],
  32227. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  32228. }),
  32229. $globals.PackageHandler);
  32230. $core.addMethod(
  32231. $core.method({
  32232. selector: "contentsFor:",
  32233. protocol: "accessing",
  32234. fn: function (aPackage){
  32235. var self=this,$self=this;
  32236. return $core.withContext(function($ctx1) {
  32237. return $recv($globals.String)._streamContents_((function(str){
  32238. return $core.withContext(function($ctx2) {
  32239. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  32240. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32241. }));
  32242. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32243. },
  32244. args: ["aPackage"],
  32245. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  32246. referencedClasses: ["String"],
  32247. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  32248. }),
  32249. $globals.PackageHandler);
  32250. $core.addMethod(
  32251. $core.method({
  32252. selector: "exporter",
  32253. protocol: "factory",
  32254. fn: function (){
  32255. var self=this,$self=this;
  32256. return $core.withContext(function($ctx1) {
  32257. return $recv($self._exporterClass())._new();
  32258. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  32259. },
  32260. args: [],
  32261. source: "exporter\x0a\x09^ self exporterClass new",
  32262. referencedClasses: [],
  32263. messageSends: ["new", "exporterClass"]
  32264. }),
  32265. $globals.PackageHandler);
  32266. $core.addMethod(
  32267. $core.method({
  32268. selector: "exporterClass",
  32269. protocol: "accessing",
  32270. fn: function (){
  32271. var self=this,$self=this;
  32272. return $core.withContext(function($ctx1) {
  32273. $self._subclassResponsibility();
  32274. return self;
  32275. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  32276. },
  32277. args: [],
  32278. source: "exporterClass\x0a\x09self subclassResponsibility",
  32279. referencedClasses: [],
  32280. messageSends: ["subclassResponsibility"]
  32281. }),
  32282. $globals.PackageHandler);
  32283. $core.addMethod(
  32284. $core.method({
  32285. selector: "load:",
  32286. protocol: "loading",
  32287. fn: function (aPackage){
  32288. var self=this,$self=this;
  32289. return $core.withContext(function($ctx1) {
  32290. $self._subclassResponsibility();
  32291. return self;
  32292. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  32293. },
  32294. args: ["aPackage"],
  32295. source: "load: aPackage\x0a\x09\x22Should return a TThenable\x22\x0a\x09self subclassResponsibility",
  32296. referencedClasses: [],
  32297. messageSends: ["subclassResponsibility"]
  32298. }),
  32299. $globals.PackageHandler);
  32300. $core.addMethod(
  32301. $core.method({
  32302. selector: "onCommitError:",
  32303. protocol: "error handling",
  32304. fn: function (anError){
  32305. var self=this,$self=this;
  32306. return $core.withContext(function($ctx1) {
  32307. var $1,$2;
  32308. $1=$recv($globals.PackageCommitError)._new();
  32309. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  32310. $ctx1.sendIdx[","]=1;
  32311. $recv($1)._messageText_($2);
  32312. $recv($1)._signal();
  32313. return self;
  32314. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  32315. },
  32316. args: ["anError"],
  32317. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  32318. referencedClasses: ["PackageCommitError"],
  32319. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  32320. }),
  32321. $globals.PackageHandler);
  32322. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  32323. $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.";
  32324. $core.addMethod(
  32325. $core.method({
  32326. selector: "commitPathJsFor:",
  32327. protocol: "accessing",
  32328. fn: function (aPackage){
  32329. var self=this,$self=this;
  32330. return $core.withContext(function($ctx1) {
  32331. return $self._toUrl_($self._namespaceFor_(aPackage));
  32332. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32333. },
  32334. args: ["aPackage"],
  32335. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  32336. referencedClasses: [],
  32337. messageSends: ["toUrl:", "namespaceFor:"]
  32338. }),
  32339. $globals.AmdPackageHandler);
  32340. $core.addMethod(
  32341. $core.method({
  32342. selector: "commitPathStFor:",
  32343. protocol: "accessing",
  32344. fn: function (aPackage){
  32345. var self=this,$self=this;
  32346. var path,pathWithout;
  32347. return $core.withContext(function($ctx1) {
  32348. var $1,$2;
  32349. $1=$recv($self._namespaceFor_(aPackage)).__comma("/_source");
  32350. $ctx1.sendIdx[","]=1;
  32351. path=$self._toUrl_($1);
  32352. pathWithout=$self._commitPathJsFor_(aPackage);
  32353. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  32354. if($core.assert($2)){
  32355. return pathWithout;
  32356. } else {
  32357. return path;
  32358. }
  32359. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  32360. },
  32361. args: ["aPackage"],
  32362. 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 ]",
  32363. referencedClasses: [],
  32364. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  32365. }),
  32366. $globals.AmdPackageHandler);
  32367. $core.addMethod(
  32368. $core.method({
  32369. selector: "exporterClass",
  32370. protocol: "accessing",
  32371. fn: function (){
  32372. var self=this,$self=this;
  32373. return $globals.AmdExporter;
  32374. },
  32375. args: [],
  32376. source: "exporterClass\x0a\x09^ AmdExporter",
  32377. referencedClasses: ["AmdExporter"],
  32378. messageSends: []
  32379. }),
  32380. $globals.AmdPackageHandler);
  32381. $core.addMethod(
  32382. $core.method({
  32383. selector: "load:",
  32384. protocol: "loading",
  32385. fn: function (aPackage){
  32386. var self=this,$self=this;
  32387. return $core.withContext(function($ctx1) {
  32388. var $1,$3,$2,$receiver;
  32389. return $recv($globals.Promise)._new_((function(model){
  32390. return $core.withContext(function($ctx2) {
  32391. $1=$recv($globals.Smalltalk)._amdRequire();
  32392. if(($receiver = $1) == null || $receiver.a$nil){
  32393. return $self._error_("AMD loader not present");
  32394. } else {
  32395. var require;
  32396. require=$receiver;
  32397. $3=$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32398. $ctx2.sendIdx[","]=1;
  32399. $2=[$3];
  32400. return $recv(require)._value_value_value_($2,(function(result){
  32401. return $core.withContext(function($ctx3) {
  32402. return $recv(model)._value_(result);
  32403. }, function($ctx3) {$ctx3.fillBlock({result:result},$ctx2,4)});
  32404. }),(function(error){
  32405. return $core.withContext(function($ctx3) {
  32406. return $recv(model)._signal_(error);
  32407. }, function($ctx3) {$ctx3.fillBlock({error:error},$ctx2,5)});
  32408. }));
  32409. }
  32410. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)});
  32411. }));
  32412. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32413. },
  32414. args: ["aPackage"],
  32415. source: "load: aPackage\x0a\x09^ Promise new: [ :model |\x0a\x09\x09Smalltalk amdRequire\x0a\x09\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09\x09require\x0a\x09\x09\x09\x09\x09value: { (self namespaceFor: aPackage), '/', aPackage name }\x0a\x09\x09\x09\x09\x09value: [ :result | model value: result ]\x0a\x09\x09\x09\x09\x09value: [ :error | model signal: error ] ] ]",
  32416. referencedClasses: ["Promise", "Smalltalk"],
  32417. messageSends: ["new:", "ifNil:ifNotNil:", "amdRequire", "error:", "value:value:value:", ",", "namespaceFor:", "name", "value:", "signal:"]
  32418. }),
  32419. $globals.AmdPackageHandler);
  32420. $core.addMethod(
  32421. $core.method({
  32422. selector: "namespaceFor:",
  32423. protocol: "committing",
  32424. fn: function (aPackage){
  32425. var self=this,$self=this;
  32426. return $core.withContext(function($ctx1) {
  32427. return $recv($recv(aPackage)._transport())._namespace();
  32428. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32429. },
  32430. args: ["aPackage"],
  32431. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  32432. referencedClasses: [],
  32433. messageSends: ["namespace", "transport"]
  32434. }),
  32435. $globals.AmdPackageHandler);
  32436. $core.addMethod(
  32437. $core.method({
  32438. selector: "toUrl:",
  32439. protocol: "private",
  32440. fn: function (aString){
  32441. var self=this,$self=this;
  32442. return $core.withContext(function($ctx1) {
  32443. var $1,$receiver;
  32444. $1=$recv($globals.Smalltalk)._amdRequire();
  32445. if(($receiver = $1) == null || $receiver.a$nil){
  32446. return $self._error_("AMD loader not present");
  32447. } else {
  32448. var require;
  32449. require=$receiver;
  32450. return $recv($recv(require)._provided())._toUrl_(aString);
  32451. }
  32452. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  32453. },
  32454. args: ["aString"],
  32455. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | require provided toUrl: aString ]",
  32456. referencedClasses: ["Smalltalk"],
  32457. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "toUrl:", "provided"]
  32458. }),
  32459. $globals.AmdPackageHandler);
  32460. $core.addMethod(
  32461. $core.method({
  32462. selector: "defaultNamespace",
  32463. protocol: "commit paths",
  32464. fn: function (){
  32465. var self=this,$self=this;
  32466. return $core.withContext(function($ctx1) {
  32467. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32468. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.a$cls)});
  32469. },
  32470. args: [],
  32471. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32472. referencedClasses: ["Smalltalk"],
  32473. messageSends: ["defaultAmdNamespace"]
  32474. }),
  32475. $globals.AmdPackageHandler.a$cls);
  32476. $core.addMethod(
  32477. $core.method({
  32478. selector: "defaultNamespace:",
  32479. protocol: "commit paths",
  32480. fn: function (aString){
  32481. var self=this,$self=this;
  32482. return $core.withContext(function($ctx1) {
  32483. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  32484. return self;
  32485. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.a$cls)});
  32486. },
  32487. args: ["aString"],
  32488. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  32489. referencedClasses: ["Smalltalk"],
  32490. messageSends: ["defaultAmdNamespace:"]
  32491. }),
  32492. $globals.AmdPackageHandler.a$cls);
  32493. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  32494. $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.";
  32495. $core.addMethod(
  32496. $core.method({
  32497. selector: "asJavaScriptObject",
  32498. protocol: "converting",
  32499. fn: function (){
  32500. var self=this,$self=this;
  32501. return $core.withContext(function($ctx1) {
  32502. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  32503. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.PackageTransport)});
  32504. },
  32505. args: [],
  32506. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  32507. referencedClasses: [],
  32508. messageSends: ["type"]
  32509. }),
  32510. $globals.PackageTransport);
  32511. $core.addMethod(
  32512. $core.method({
  32513. selector: "commit",
  32514. protocol: "committing",
  32515. fn: function (){
  32516. var self=this,$self=this;
  32517. return $core.withContext(function($ctx1) {
  32518. $recv($self._commitHandler())._commit_($self._package());
  32519. return self;
  32520. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  32521. },
  32522. args: [],
  32523. source: "commit\x0a\x09self commitHandler commit: self package",
  32524. referencedClasses: [],
  32525. messageSends: ["commit:", "commitHandler", "package"]
  32526. }),
  32527. $globals.PackageTransport);
  32528. $core.addMethod(
  32529. $core.method({
  32530. selector: "commitHandler",
  32531. protocol: "factory",
  32532. fn: function (){
  32533. var self=this,$self=this;
  32534. return $core.withContext(function($ctx1) {
  32535. return $recv($self._commitHandlerClass())._new();
  32536. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  32537. },
  32538. args: [],
  32539. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  32540. referencedClasses: [],
  32541. messageSends: ["new", "commitHandlerClass"]
  32542. }),
  32543. $globals.PackageTransport);
  32544. $core.addMethod(
  32545. $core.method({
  32546. selector: "commitHandlerClass",
  32547. protocol: "accessing",
  32548. fn: function (){
  32549. var self=this,$self=this;
  32550. return $core.withContext(function($ctx1) {
  32551. $self._subclassResponsibility();
  32552. return self;
  32553. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  32554. },
  32555. args: [],
  32556. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  32557. referencedClasses: [],
  32558. messageSends: ["subclassResponsibility"]
  32559. }),
  32560. $globals.PackageTransport);
  32561. $core.addMethod(
  32562. $core.method({
  32563. selector: "commitOnSuccess:onError:",
  32564. protocol: "committing",
  32565. fn: function (aBlock,anotherBlock){
  32566. var self=this,$self=this;
  32567. return $core.withContext(function($ctx1) {
  32568. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  32569. return self;
  32570. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  32571. },
  32572. args: ["aBlock", "anotherBlock"],
  32573. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  32574. referencedClasses: [],
  32575. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  32576. }),
  32577. $globals.PackageTransport);
  32578. $core.addMethod(
  32579. $core.method({
  32580. selector: "definition",
  32581. protocol: "accessing",
  32582. fn: function (){
  32583. var self=this,$self=this;
  32584. return "";
  32585. },
  32586. args: [],
  32587. source: "definition\x0a\x09^ ''",
  32588. referencedClasses: [],
  32589. messageSends: []
  32590. }),
  32591. $globals.PackageTransport);
  32592. $core.addMethod(
  32593. $core.method({
  32594. selector: "load",
  32595. protocol: "loading",
  32596. fn: function (){
  32597. var self=this,$self=this;
  32598. return $core.withContext(function($ctx1) {
  32599. return $recv($recv($self._commitHandler())._load_($self._package()))._then_((function(){
  32600. return $core.withContext(function($ctx2) {
  32601. return $recv($globals.Smalltalk)._postLoad();
  32602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32603. }));
  32604. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  32605. },
  32606. args: [],
  32607. source: "load\x0a\x09^ (self commitHandler load: self package)\x0a\x09\x09then: [ Smalltalk postLoad ]",
  32608. referencedClasses: ["Smalltalk"],
  32609. messageSends: ["then:", "load:", "commitHandler", "package", "postLoad"]
  32610. }),
  32611. $globals.PackageTransport);
  32612. $core.addMethod(
  32613. $core.method({
  32614. selector: "package",
  32615. protocol: "accessing",
  32616. fn: function (){
  32617. var self=this,$self=this;
  32618. return $self["@package"];
  32619. },
  32620. args: [],
  32621. source: "package\x0a\x09^ package",
  32622. referencedClasses: [],
  32623. messageSends: []
  32624. }),
  32625. $globals.PackageTransport);
  32626. $core.addMethod(
  32627. $core.method({
  32628. selector: "package:",
  32629. protocol: "accessing",
  32630. fn: function (aPackage){
  32631. var self=this,$self=this;
  32632. $self["@package"]=aPackage;
  32633. return self;
  32634. },
  32635. args: ["aPackage"],
  32636. source: "package: aPackage\x0a\x09package := aPackage",
  32637. referencedClasses: [],
  32638. messageSends: []
  32639. }),
  32640. $globals.PackageTransport);
  32641. $core.addMethod(
  32642. $core.method({
  32643. selector: "setupFromJson:",
  32644. protocol: "initialization",
  32645. fn: function (anObject){
  32646. var self=this,$self=this;
  32647. return self;
  32648. },
  32649. args: ["anObject"],
  32650. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  32651. referencedClasses: [],
  32652. messageSends: []
  32653. }),
  32654. $globals.PackageTransport);
  32655. $core.addMethod(
  32656. $core.method({
  32657. selector: "type",
  32658. protocol: "accessing",
  32659. fn: function (){
  32660. var self=this,$self=this;
  32661. return $core.withContext(function($ctx1) {
  32662. return $recv($self._class())._type();
  32663. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  32664. },
  32665. args: [],
  32666. source: "type\x0a\x09^ self class type",
  32667. referencedClasses: [],
  32668. messageSends: ["type", "class"]
  32669. }),
  32670. $globals.PackageTransport);
  32671. $globals.PackageTransport.a$cls.iVarNames = ["registry"];
  32672. $core.addMethod(
  32673. $core.method({
  32674. selector: "classRegisteredFor:",
  32675. protocol: "accessing",
  32676. fn: function (aString){
  32677. var self=this,$self=this;
  32678. return $core.withContext(function($ctx1) {
  32679. return $recv($self["@registry"])._at_(aString);
  32680. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.a$cls)});
  32681. },
  32682. args: ["aString"],
  32683. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  32684. referencedClasses: [],
  32685. messageSends: ["at:"]
  32686. }),
  32687. $globals.PackageTransport.a$cls);
  32688. $core.addMethod(
  32689. $core.method({
  32690. selector: "defaultType",
  32691. protocol: "accessing",
  32692. fn: function (){
  32693. var self=this,$self=this;
  32694. return $core.withContext(function($ctx1) {
  32695. return $recv($globals.AmdPackageTransport)._type();
  32696. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.a$cls)});
  32697. },
  32698. args: [],
  32699. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  32700. referencedClasses: ["AmdPackageTransport"],
  32701. messageSends: ["type"]
  32702. }),
  32703. $globals.PackageTransport.a$cls);
  32704. $core.addMethod(
  32705. $core.method({
  32706. selector: "for:",
  32707. protocol: "instance creation",
  32708. fn: function (aString){
  32709. var self=this,$self=this;
  32710. return $core.withContext(function($ctx1) {
  32711. return $recv($self._classRegisteredFor_(aString))._new();
  32712. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.a$cls)});
  32713. },
  32714. args: ["aString"],
  32715. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  32716. referencedClasses: [],
  32717. messageSends: ["new", "classRegisteredFor:"]
  32718. }),
  32719. $globals.PackageTransport.a$cls);
  32720. $core.addMethod(
  32721. $core.method({
  32722. selector: "fromJson:",
  32723. protocol: "instance creation",
  32724. fn: function (anObject){
  32725. var self=this,$self=this;
  32726. return $core.withContext(function($ctx1) {
  32727. var $1,$2,$receiver;
  32728. if(($receiver = anObject) == null || $receiver.a$nil){
  32729. $1=$self._for_($self._defaultType());
  32730. $ctx1.sendIdx["for:"]=1;
  32731. return $1;
  32732. } else {
  32733. anObject;
  32734. }
  32735. $2=$self._for_($recv(anObject)._type());
  32736. $recv($2)._setupFromJson_(anObject);
  32737. return $recv($2)._yourself();
  32738. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.a$cls)});
  32739. },
  32740. args: ["anObject"],
  32741. 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",
  32742. referencedClasses: [],
  32743. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  32744. }),
  32745. $globals.PackageTransport.a$cls);
  32746. $core.addMethod(
  32747. $core.method({
  32748. selector: "initialize",
  32749. protocol: "initialization",
  32750. fn: function (){
  32751. var self=this,$self=this;
  32752. return $core.withContext(function($ctx1) {
  32753. var $1;
  32754. (
  32755. $ctx1.supercall = true,
  32756. ($globals.PackageTransport.a$cls.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  32757. $ctx1.supercall = false;
  32758. $1=$self.__eq_eq($globals.PackageTransport);
  32759. if($core.assert($1)){
  32760. $self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  32761. $self["@registry"];
  32762. } else {
  32763. $self._register();
  32764. }
  32765. return self;
  32766. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.a$cls)});
  32767. },
  32768. args: [],
  32769. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  32770. referencedClasses: ["PackageTransport"],
  32771. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  32772. }),
  32773. $globals.PackageTransport.a$cls);
  32774. $core.addMethod(
  32775. $core.method({
  32776. selector: "register",
  32777. protocol: "registration",
  32778. fn: function (){
  32779. var self=this,$self=this;
  32780. return $core.withContext(function($ctx1) {
  32781. $recv($globals.PackageTransport)._register_(self);
  32782. return self;
  32783. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.a$cls)});
  32784. },
  32785. args: [],
  32786. source: "register\x0a\x09PackageTransport register: self",
  32787. referencedClasses: ["PackageTransport"],
  32788. messageSends: ["register:"]
  32789. }),
  32790. $globals.PackageTransport.a$cls);
  32791. $core.addMethod(
  32792. $core.method({
  32793. selector: "register:",
  32794. protocol: "registration",
  32795. fn: function (aClass){
  32796. var self=this,$self=this;
  32797. return $core.withContext(function($ctx1) {
  32798. var $1,$receiver;
  32799. $1=$recv(aClass)._type();
  32800. $ctx1.sendIdx["type"]=1;
  32801. if(($receiver = $1) == null || $receiver.a$nil){
  32802. $1;
  32803. } else {
  32804. $recv($self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  32805. }
  32806. return self;
  32807. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.a$cls)});
  32808. },
  32809. args: ["aClass"],
  32810. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  32811. referencedClasses: [],
  32812. messageSends: ["ifNotNil:", "type", "at:put:"]
  32813. }),
  32814. $globals.PackageTransport.a$cls);
  32815. $core.addMethod(
  32816. $core.method({
  32817. selector: "type",
  32818. protocol: "accessing",
  32819. fn: function (){
  32820. var self=this,$self=this;
  32821. return nil;
  32822. },
  32823. args: [],
  32824. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  32825. referencedClasses: [],
  32826. messageSends: []
  32827. }),
  32828. $globals.PackageTransport.a$cls);
  32829. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  32830. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  32831. $core.addMethod(
  32832. $core.method({
  32833. selector: "asJavaScriptObject",
  32834. protocol: "converting",
  32835. fn: function (){
  32836. var self=this,$self=this;
  32837. return $core.withContext(function($ctx1) {
  32838. var $1;
  32839. $1=(
  32840. $ctx1.supercall = true,
  32841. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($self, []));
  32842. $ctx1.supercall = false;
  32843. $recv($1)._at_put_("amdNamespace",$self._namespace());
  32844. return $recv($1)._yourself();
  32845. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.AmdPackageTransport)});
  32846. },
  32847. args: [],
  32848. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  32849. referencedClasses: [],
  32850. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  32851. }),
  32852. $globals.AmdPackageTransport);
  32853. $core.addMethod(
  32854. $core.method({
  32855. selector: "commitHandlerClass",
  32856. protocol: "accessing",
  32857. fn: function (){
  32858. var self=this,$self=this;
  32859. return $globals.AmdPackageHandler;
  32860. },
  32861. args: [],
  32862. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  32863. referencedClasses: ["AmdPackageHandler"],
  32864. messageSends: []
  32865. }),
  32866. $globals.AmdPackageTransport);
  32867. $core.addMethod(
  32868. $core.method({
  32869. selector: "defaultNamespace",
  32870. protocol: "defaults",
  32871. fn: function (){
  32872. var self=this,$self=this;
  32873. return $core.withContext(function($ctx1) {
  32874. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32875. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  32876. },
  32877. args: [],
  32878. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32879. referencedClasses: ["Smalltalk"],
  32880. messageSends: ["defaultAmdNamespace"]
  32881. }),
  32882. $globals.AmdPackageTransport);
  32883. $core.addMethod(
  32884. $core.method({
  32885. selector: "definition",
  32886. protocol: "accessing",
  32887. fn: function (){
  32888. var self=this,$self=this;
  32889. return $core.withContext(function($ctx1) {
  32890. return $recv($globals.String)._streamContents_((function(stream){
  32891. return $core.withContext(function($ctx2) {
  32892. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  32893. return $recv(stream)._print_($self._namespace());
  32894. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  32895. }));
  32896. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  32897. },
  32898. args: [],
  32899. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  32900. referencedClasses: ["String"],
  32901. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  32902. }),
  32903. $globals.AmdPackageTransport);
  32904. $core.addMethod(
  32905. $core.method({
  32906. selector: "namespace",
  32907. protocol: "accessing",
  32908. fn: function (){
  32909. var self=this,$self=this;
  32910. return $core.withContext(function($ctx1) {
  32911. var $1,$receiver;
  32912. $1=$self["@namespace"];
  32913. if(($receiver = $1) == null || $receiver.a$nil){
  32914. return $self._defaultNamespace();
  32915. } else {
  32916. return $1;
  32917. }
  32918. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  32919. },
  32920. args: [],
  32921. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  32922. referencedClasses: [],
  32923. messageSends: ["ifNil:", "defaultNamespace"]
  32924. }),
  32925. $globals.AmdPackageTransport);
  32926. $core.addMethod(
  32927. $core.method({
  32928. selector: "namespace:",
  32929. protocol: "accessing",
  32930. fn: function (aString){
  32931. var self=this,$self=this;
  32932. $self["@namespace"]=aString;
  32933. return self;
  32934. },
  32935. args: ["aString"],
  32936. source: "namespace: aString\x0a\x09namespace := aString",
  32937. referencedClasses: [],
  32938. messageSends: []
  32939. }),
  32940. $globals.AmdPackageTransport);
  32941. $core.addMethod(
  32942. $core.method({
  32943. selector: "printOn:",
  32944. protocol: "printing",
  32945. fn: function (aStream){
  32946. var self=this,$self=this;
  32947. return $core.withContext(function($ctx1) {
  32948. (
  32949. $ctx1.supercall = true,
  32950. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  32951. $ctx1.supercall = false;
  32952. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  32953. $ctx1.sendIdx["nextPutAll:"]=1;
  32954. $recv(aStream)._nextPutAll_($self._namespace());
  32955. $ctx1.sendIdx["nextPutAll:"]=2;
  32956. $recv(aStream)._nextPutAll_(")");
  32957. return self;
  32958. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  32959. },
  32960. args: ["aStream"],
  32961. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  32962. referencedClasses: [],
  32963. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  32964. }),
  32965. $globals.AmdPackageTransport);
  32966. $core.addMethod(
  32967. $core.method({
  32968. selector: "setPath:",
  32969. protocol: "actions",
  32970. fn: function (aString){
  32971. var self=this,$self=this;
  32972. return $core.withContext(function($ctx1) {
  32973. $recv($recv(require)._provided())._config_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespace(),aString])]));
  32974. return self;
  32975. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  32976. },
  32977. args: ["aString"],
  32978. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09require provided config: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  32979. referencedClasses: [],
  32980. messageSends: ["config:", "provided", "namespace"]
  32981. }),
  32982. $globals.AmdPackageTransport);
  32983. $core.addMethod(
  32984. $core.method({
  32985. selector: "setupFromJson:",
  32986. protocol: "initialization",
  32987. fn: function (anObject){
  32988. var self=this,$self=this;
  32989. return $core.withContext(function($ctx1) {
  32990. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  32991. return self;
  32992. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  32993. },
  32994. args: ["anObject"],
  32995. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  32996. referencedClasses: [],
  32997. messageSends: ["namespace:", "at:"]
  32998. }),
  32999. $globals.AmdPackageTransport);
  33000. $core.addMethod(
  33001. $core.method({
  33002. selector: "namespace:",
  33003. protocol: "instance creation",
  33004. fn: function (aString){
  33005. var self=this,$self=this;
  33006. return $core.withContext(function($ctx1) {
  33007. var $1;
  33008. $1=$self._new();
  33009. $recv($1)._namespace_(aString);
  33010. return $recv($1)._yourself();
  33011. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.a$cls)});
  33012. },
  33013. args: ["aString"],
  33014. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  33015. referencedClasses: [],
  33016. messageSends: ["namespace:", "new", "yourself"]
  33017. }),
  33018. $globals.AmdPackageTransport.a$cls);
  33019. $core.addMethod(
  33020. $core.method({
  33021. selector: "type",
  33022. protocol: "accessing",
  33023. fn: function (){
  33024. var self=this,$self=this;
  33025. return "amd";
  33026. },
  33027. args: [],
  33028. source: "type\x0a\x09^ 'amd'",
  33029. referencedClasses: [],
  33030. messageSends: []
  33031. }),
  33032. $globals.AmdPackageTransport.a$cls);
  33033. $core.addMethod(
  33034. $core.method({
  33035. selector: "exportBehaviorDefinitionTo:using:",
  33036. protocol: "*Platform-ImportExport",
  33037. fn: function (aStream,anExporter){
  33038. var self=this,$self=this;
  33039. return $core.withContext(function($ctx1) {
  33040. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  33041. return self;
  33042. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Class)});
  33043. },
  33044. args: ["aStream", "anExporter"],
  33045. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  33046. referencedClasses: [],
  33047. messageSends: ["exportDefinitionOf:on:"]
  33048. }),
  33049. $globals.Class);
  33050. $core.addMethod(
  33051. $core.method({
  33052. selector: "exportBehaviorDefinitionTo:using:",
  33053. protocol: "*Platform-ImportExport",
  33054. fn: function (aStream,anExporter){
  33055. var self=this,$self=this;
  33056. return $core.withContext(function($ctx1) {
  33057. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  33058. return self;
  33059. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Metaclass)});
  33060. },
  33061. args: ["aStream", "anExporter"],
  33062. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  33063. referencedClasses: [],
  33064. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  33065. }),
  33066. $globals.Metaclass);
  33067. $core.addMethod(
  33068. $core.method({
  33069. selector: "commit",
  33070. protocol: "*Platform-ImportExport",
  33071. fn: function (){
  33072. var self=this,$self=this;
  33073. return $core.withContext(function($ctx1) {
  33074. return $recv($self._transport())._commit();
  33075. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  33076. },
  33077. args: [],
  33078. source: "commit\x0a\x09^ self transport commit",
  33079. referencedClasses: [],
  33080. messageSends: ["commit", "transport"]
  33081. }),
  33082. $globals.Package);
  33083. $core.addMethod(
  33084. $core.method({
  33085. selector: "load",
  33086. protocol: "*Platform-ImportExport",
  33087. fn: function (){
  33088. var self=this,$self=this;
  33089. return $core.withContext(function($ctx1) {
  33090. return $recv($self._transport())._load();
  33091. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  33092. },
  33093. args: [],
  33094. source: "load\x0a\x09^ self transport load",
  33095. referencedClasses: [],
  33096. messageSends: ["load", "transport"]
  33097. }),
  33098. $globals.Package);
  33099. $core.addMethod(
  33100. $core.method({
  33101. selector: "loadFromNamespace:",
  33102. protocol: "*Platform-ImportExport",
  33103. fn: function (aString){
  33104. var self=this,$self=this;
  33105. return $core.withContext(function($ctx1) {
  33106. var $1;
  33107. $1=$self._transport();
  33108. $recv($1)._namespace_(aString);
  33109. return $recv($1)._load();
  33110. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  33111. },
  33112. args: ["aString"],
  33113. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  33114. referencedClasses: [],
  33115. messageSends: ["namespace:", "transport", "load"]
  33116. }),
  33117. $globals.Package);
  33118. $core.addMethod(
  33119. $core.method({
  33120. selector: "load:",
  33121. protocol: "*Platform-ImportExport",
  33122. fn: function (aPackageName){
  33123. var self=this,$self=this;
  33124. return $core.withContext(function($ctx1) {
  33125. return $recv($self._named_(aPackageName))._load();
  33126. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  33127. },
  33128. args: ["aPackageName"],
  33129. source: "load: aPackageName\x0a\x09^ (self named: aPackageName) load",
  33130. referencedClasses: [],
  33131. messageSends: ["load", "named:"]
  33132. }),
  33133. $globals.Package.a$cls);
  33134. $core.addMethod(
  33135. $core.method({
  33136. selector: "load:fromNamespace:",
  33137. protocol: "*Platform-ImportExport",
  33138. fn: function (aPackageName,aString){
  33139. var self=this,$self=this;
  33140. return $core.withContext(function($ctx1) {
  33141. return $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  33142. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.a$cls)});
  33143. },
  33144. args: ["aPackageName", "aString"],
  33145. source: "load: aPackageName fromNamespace: aString\x0a\x09^ (self named: aPackageName) loadFromNamespace: aString",
  33146. referencedClasses: [],
  33147. messageSends: ["loadFromNamespace:", "named:"]
  33148. }),
  33149. $globals.Package.a$cls);
  33150. $core.addMethod(
  33151. $core.method({
  33152. selector: "methodsFor:",
  33153. protocol: "*Platform-ImportExport",
  33154. fn: function (aString){
  33155. var self=this,$self=this;
  33156. return $core.withContext(function($ctx1) {
  33157. var $1;
  33158. $1=$recv($globals.ClassProtocolReader)._new();
  33159. $recv($1)._class_category_(self,aString);
  33160. return $recv($1)._yourself();
  33161. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.TBehaviorProvider)});
  33162. },
  33163. args: ["aString"],
  33164. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  33165. referencedClasses: ["ClassProtocolReader"],
  33166. messageSends: ["class:category:", "new", "yourself"]
  33167. }),
  33168. $globals.TBehaviorProvider);
  33169. $core.addMethod(
  33170. $core.method({
  33171. selector: "methodsFor:stamp:",
  33172. protocol: "*Platform-ImportExport",
  33173. fn: function (aString,aStamp){
  33174. var self=this,$self=this;
  33175. return $core.withContext(function($ctx1) {
  33176. return $self._methodsFor_(aString);
  33177. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.TBehaviorProvider)});
  33178. },
  33179. args: ["aString", "aStamp"],
  33180. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  33181. referencedClasses: [],
  33182. messageSends: ["methodsFor:"]
  33183. }),
  33184. $globals.TBehaviorProvider);
  33185. $core.addMethod(
  33186. $core.method({
  33187. selector: "commentStamp",
  33188. protocol: "*Platform-ImportExport",
  33189. fn: function (){
  33190. var self=this,$self=this;
  33191. return $core.withContext(function($ctx1) {
  33192. var $1;
  33193. $1=$recv($globals.ClassCommentReader)._new();
  33194. $recv($1)._class_(self);
  33195. return $recv($1)._yourself();
  33196. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.TMasterBehavior)});
  33197. },
  33198. args: [],
  33199. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  33200. referencedClasses: ["ClassCommentReader"],
  33201. messageSends: ["class:", "new", "yourself"]
  33202. }),
  33203. $globals.TMasterBehavior);
  33204. $core.addMethod(
  33205. $core.method({
  33206. selector: "commentStamp:prior:",
  33207. protocol: "*Platform-ImportExport",
  33208. fn: function (aStamp,prior){
  33209. var self=this,$self=this;
  33210. return $core.withContext(function($ctx1) {
  33211. return $self._commentStamp();
  33212. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.TMasterBehavior)});
  33213. },
  33214. args: ["aStamp", "prior"],
  33215. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  33216. referencedClasses: [],
  33217. messageSends: ["commentStamp"]
  33218. }),
  33219. $globals.TMasterBehavior);
  33220. $core.addMethod(
  33221. $core.method({
  33222. selector: "exportBehaviorDefinitionTo:using:",
  33223. protocol: "*Platform-ImportExport",
  33224. fn: function (aStream,anExporter){
  33225. var self=this,$self=this;
  33226. return $core.withContext(function($ctx1) {
  33227. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  33228. return self;
  33229. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Trait)});
  33230. },
  33231. args: ["aStream", "anExporter"],
  33232. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  33233. referencedClasses: [],
  33234. messageSends: ["exportTraitDefinitionOf:on:"]
  33235. }),
  33236. $globals.Trait);
  33237. });
  33238. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Methods"], function($boot){"use strict";
  33239. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  33240. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33241. $core.addPackage("Compiler-AST");
  33242. ($core.packageDescriptors||$core.packages)["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  33243. ($core.packageDescriptors||$core.packages)["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33244. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  33245. $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.";
  33246. $core.addMethod(
  33247. $core.method({
  33248. selector: "inPosition:",
  33249. protocol: "testing",
  33250. fn: function (aPoint){
  33251. var self=this,$self=this;
  33252. return $core.withContext(function($ctx1) {
  33253. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  33254. return $core.withContext(function($ctx2) {
  33255. return $recv($self._positionEnd()).__gt_eq(aPoint);
  33256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33257. }));
  33258. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  33259. },
  33260. args: ["aPoint"],
  33261. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  33262. referencedClasses: [],
  33263. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  33264. }),
  33265. $globals.ASTNode);
  33266. $core.addMethod(
  33267. $core.method({
  33268. selector: "isAssignmentNode",
  33269. protocol: "testing",
  33270. fn: function (){
  33271. var self=this,$self=this;
  33272. return false;
  33273. },
  33274. args: [],
  33275. source: "isAssignmentNode\x0a\x09^ false",
  33276. referencedClasses: [],
  33277. messageSends: []
  33278. }),
  33279. $globals.ASTNode);
  33280. $core.addMethod(
  33281. $core.method({
  33282. selector: "isBlockNode",
  33283. protocol: "testing",
  33284. fn: function (){
  33285. var self=this,$self=this;
  33286. return false;
  33287. },
  33288. args: [],
  33289. source: "isBlockNode\x0a\x09^ false",
  33290. referencedClasses: [],
  33291. messageSends: []
  33292. }),
  33293. $globals.ASTNode);
  33294. $core.addMethod(
  33295. $core.method({
  33296. selector: "isBlockSequenceNode",
  33297. protocol: "testing",
  33298. fn: function (){
  33299. var self=this,$self=this;
  33300. return false;
  33301. },
  33302. args: [],
  33303. source: "isBlockSequenceNode\x0a\x09^ false",
  33304. referencedClasses: [],
  33305. messageSends: []
  33306. }),
  33307. $globals.ASTNode);
  33308. $core.addMethod(
  33309. $core.method({
  33310. selector: "isCascadeNode",
  33311. protocol: "testing",
  33312. fn: function (){
  33313. var self=this,$self=this;
  33314. return false;
  33315. },
  33316. args: [],
  33317. source: "isCascadeNode\x0a\x09^ false",
  33318. referencedClasses: [],
  33319. messageSends: []
  33320. }),
  33321. $globals.ASTNode);
  33322. $core.addMethod(
  33323. $core.method({
  33324. selector: "isImmutable",
  33325. protocol: "testing",
  33326. fn: function (){
  33327. var self=this,$self=this;
  33328. return false;
  33329. },
  33330. args: [],
  33331. source: "isImmutable\x0a\x09^ false",
  33332. referencedClasses: [],
  33333. messageSends: []
  33334. }),
  33335. $globals.ASTNode);
  33336. $core.addMethod(
  33337. $core.method({
  33338. selector: "isJSStatementNode",
  33339. protocol: "testing",
  33340. fn: function (){
  33341. var self=this,$self=this;
  33342. return false;
  33343. },
  33344. args: [],
  33345. source: "isJSStatementNode\x0a\x09^ false",
  33346. referencedClasses: [],
  33347. messageSends: []
  33348. }),
  33349. $globals.ASTNode);
  33350. $core.addMethod(
  33351. $core.method({
  33352. selector: "isNavigationNode",
  33353. protocol: "testing",
  33354. fn: function (){
  33355. var self=this,$self=this;
  33356. return false;
  33357. },
  33358. args: [],
  33359. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  33360. referencedClasses: [],
  33361. messageSends: []
  33362. }),
  33363. $globals.ASTNode);
  33364. $core.addMethod(
  33365. $core.method({
  33366. selector: "isReturnNode",
  33367. protocol: "testing",
  33368. fn: function (){
  33369. var self=this,$self=this;
  33370. return false;
  33371. },
  33372. args: [],
  33373. source: "isReturnNode\x0a\x09^ false",
  33374. referencedClasses: [],
  33375. messageSends: []
  33376. }),
  33377. $globals.ASTNode);
  33378. $core.addMethod(
  33379. $core.method({
  33380. selector: "isSendNode",
  33381. protocol: "testing",
  33382. fn: function (){
  33383. var self=this,$self=this;
  33384. return false;
  33385. },
  33386. args: [],
  33387. source: "isSendNode\x0a\x09^ false",
  33388. referencedClasses: [],
  33389. messageSends: []
  33390. }),
  33391. $globals.ASTNode);
  33392. $core.addMethod(
  33393. $core.method({
  33394. selector: "isSequenceNode",
  33395. protocol: "testing",
  33396. fn: function (){
  33397. var self=this,$self=this;
  33398. return false;
  33399. },
  33400. args: [],
  33401. source: "isSequenceNode\x0a\x09^ false",
  33402. referencedClasses: [],
  33403. messageSends: []
  33404. }),
  33405. $globals.ASTNode);
  33406. $core.addMethod(
  33407. $core.method({
  33408. selector: "isSuperKeyword",
  33409. protocol: "testing",
  33410. fn: function (){
  33411. var self=this,$self=this;
  33412. return false;
  33413. },
  33414. args: [],
  33415. source: "isSuperKeyword\x0a\x09^ false",
  33416. referencedClasses: [],
  33417. messageSends: []
  33418. }),
  33419. $globals.ASTNode);
  33420. $core.addMethod(
  33421. $core.method({
  33422. selector: "isValueNode",
  33423. protocol: "testing",
  33424. fn: function (){
  33425. var self=this,$self=this;
  33426. return false;
  33427. },
  33428. args: [],
  33429. source: "isValueNode\x0a\x09^ false",
  33430. referencedClasses: [],
  33431. messageSends: []
  33432. }),
  33433. $globals.ASTNode);
  33434. $core.addMethod(
  33435. $core.method({
  33436. selector: "isVariableNode",
  33437. protocol: "testing",
  33438. fn: function (){
  33439. var self=this,$self=this;
  33440. return false;
  33441. },
  33442. args: [],
  33443. source: "isVariableNode\x0a\x09^ false",
  33444. referencedClasses: [],
  33445. messageSends: []
  33446. }),
  33447. $globals.ASTNode);
  33448. $core.addMethod(
  33449. $core.method({
  33450. selector: "location:",
  33451. protocol: "accessing",
  33452. fn: function (aLocation){
  33453. var self=this,$self=this;
  33454. return $core.withContext(function($ctx1) {
  33455. var $3,$2,$1;
  33456. $3=$recv(aLocation)._start();
  33457. $ctx1.sendIdx["start"]=1;
  33458. $2=$recv($3)._line();
  33459. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  33460. $self._position_($1);
  33461. return self;
  33462. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  33463. },
  33464. args: ["aLocation"],
  33465. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  33466. referencedClasses: [],
  33467. messageSends: ["position:", "@", "line", "start", "column"]
  33468. }),
  33469. $globals.ASTNode);
  33470. $core.addMethod(
  33471. $core.method({
  33472. selector: "method",
  33473. protocol: "accessing",
  33474. fn: function (){
  33475. var self=this,$self=this;
  33476. return $core.withContext(function($ctx1) {
  33477. var $1,$receiver;
  33478. $1=$self._parent();
  33479. if(($receiver = $1) == null || $receiver.a$nil){
  33480. return $1;
  33481. } else {
  33482. var node;
  33483. node=$receiver;
  33484. return $recv(node)._method();
  33485. }
  33486. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  33487. },
  33488. args: [],
  33489. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  33490. referencedClasses: [],
  33491. messageSends: ["ifNotNil:", "parent", "method"]
  33492. }),
  33493. $globals.ASTNode);
  33494. $core.addMethod(
  33495. $core.method({
  33496. selector: "navigationNodeAt:ifAbsent:",
  33497. protocol: "accessing",
  33498. fn: function (aPoint,aBlock){
  33499. var self=this,$self=this;
  33500. var children;
  33501. return $core.withContext(function($ctx1) {
  33502. var $2,$1;
  33503. var $early={};
  33504. try {
  33505. children=$recv($self._allDagChildren())._select_((function(each){
  33506. return $core.withContext(function($ctx2) {
  33507. return $recv($recv(each)._isNavigationNode())._and_((function(){
  33508. return $core.withContext(function($ctx3) {
  33509. return $recv(each)._inPosition_(aPoint);
  33510. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33511. }));
  33512. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33513. }));
  33514. $recv(children)._ifEmpty_((function(){
  33515. return $core.withContext(function($ctx2) {
  33516. throw $early=[$recv(aBlock)._value()];
  33517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  33518. }));
  33519. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  33520. return $core.withContext(function($ctx2) {
  33521. $2=$recv(a)._positionStart();
  33522. $ctx2.sendIdx["positionStart"]=1;
  33523. $1=$recv($2)._dist_(aPoint);
  33524. $ctx2.sendIdx["dist:"]=1;
  33525. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  33526. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  33527. })))._first();
  33528. }
  33529. catch(e) {if(e===$early)return e[0]; throw e}
  33530. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  33531. },
  33532. args: ["aPoint", "aBlock"],
  33533. 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",
  33534. referencedClasses: [],
  33535. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  33536. }),
  33537. $globals.ASTNode);
  33538. $core.addMethod(
  33539. $core.method({
  33540. selector: "parent",
  33541. protocol: "accessing",
  33542. fn: function (){
  33543. var self=this,$self=this;
  33544. return $self["@parent"];
  33545. },
  33546. args: [],
  33547. source: "parent\x0a\x09^ parent",
  33548. referencedClasses: [],
  33549. messageSends: []
  33550. }),
  33551. $globals.ASTNode);
  33552. $core.addMethod(
  33553. $core.method({
  33554. selector: "parent:",
  33555. protocol: "accessing",
  33556. fn: function (aNode){
  33557. var self=this,$self=this;
  33558. $self["@parent"]=aNode;
  33559. return self;
  33560. },
  33561. args: ["aNode"],
  33562. source: "parent: aNode\x0a\x09parent := aNode",
  33563. referencedClasses: [],
  33564. messageSends: []
  33565. }),
  33566. $globals.ASTNode);
  33567. $core.addMethod(
  33568. $core.method({
  33569. selector: "position",
  33570. protocol: "accessing",
  33571. fn: function (){
  33572. var self=this,$self=this;
  33573. return $core.withContext(function($ctx1) {
  33574. var $1,$2,$receiver;
  33575. $1=$self["@position"];
  33576. if(($receiver = $1) == null || $receiver.a$nil){
  33577. $2=$self._parent();
  33578. if(($receiver = $2) == null || $receiver.a$nil){
  33579. return $2;
  33580. } else {
  33581. var node;
  33582. node=$receiver;
  33583. return $recv(node)._position();
  33584. }
  33585. } else {
  33586. return $1;
  33587. }
  33588. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  33589. },
  33590. args: [],
  33591. 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 ] ]",
  33592. referencedClasses: [],
  33593. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  33594. }),
  33595. $globals.ASTNode);
  33596. $core.addMethod(
  33597. $core.method({
  33598. selector: "position:",
  33599. protocol: "accessing",
  33600. fn: function (aPosition){
  33601. var self=this,$self=this;
  33602. $self["@position"]=aPosition;
  33603. return self;
  33604. },
  33605. args: ["aPosition"],
  33606. source: "position: aPosition\x0a\x09position := aPosition",
  33607. referencedClasses: [],
  33608. messageSends: []
  33609. }),
  33610. $globals.ASTNode);
  33611. $core.addMethod(
  33612. $core.method({
  33613. selector: "positionEnd",
  33614. protocol: "accessing",
  33615. fn: function (){
  33616. var self=this,$self=this;
  33617. return $core.withContext(function($ctx1) {
  33618. var $1,$6,$5,$4,$3,$2;
  33619. $1=$self._positionStart();
  33620. $6=$self._source();
  33621. $ctx1.sendIdx["source"]=1;
  33622. $5=$recv($6)._lines();
  33623. $ctx1.sendIdx["lines"]=1;
  33624. $4=$recv($5)._size();
  33625. $ctx1.sendIdx["size"]=1;
  33626. $3=$recv($4).__minus((1));
  33627. $ctx1.sendIdx["-"]=1;
  33628. $2=$recv($3).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1)));
  33629. return $recv($1).__plus($2);
  33630. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  33631. },
  33632. args: [],
  33633. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  33634. referencedClasses: [],
  33635. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  33636. }),
  33637. $globals.ASTNode);
  33638. $core.addMethod(
  33639. $core.method({
  33640. selector: "positionStart",
  33641. protocol: "accessing",
  33642. fn: function (){
  33643. var self=this,$self=this;
  33644. return $core.withContext(function($ctx1) {
  33645. return $self._position();
  33646. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  33647. },
  33648. args: [],
  33649. source: "positionStart\x0a\x09^ self position",
  33650. referencedClasses: [],
  33651. messageSends: ["position"]
  33652. }),
  33653. $globals.ASTNode);
  33654. $core.addMethod(
  33655. $core.method({
  33656. selector: "requiresSmalltalkContext",
  33657. protocol: "testing",
  33658. fn: function (){
  33659. var self=this,$self=this;
  33660. return $core.withContext(function($ctx1) {
  33661. return $recv($recv($self._dagChildren())._detect_ifNone_((function(each){
  33662. return $core.withContext(function($ctx2) {
  33663. return $recv(each)._requiresSmalltalkContext();
  33664. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33665. }),(function(){
  33666. return nil;
  33667. })))._notNil();
  33668. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  33669. },
  33670. args: [],
  33671. 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",
  33672. referencedClasses: [],
  33673. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  33674. }),
  33675. $globals.ASTNode);
  33676. $core.addMethod(
  33677. $core.method({
  33678. selector: "shouldBeAliased",
  33679. protocol: "accessing",
  33680. fn: function (){
  33681. var self=this,$self=this;
  33682. return $core.withContext(function($ctx1) {
  33683. var $1,$receiver;
  33684. $1=$self["@shouldBeAliased"];
  33685. if(($receiver = $1) == null || $receiver.a$nil){
  33686. return false;
  33687. } else {
  33688. return $1;
  33689. }
  33690. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  33691. },
  33692. args: [],
  33693. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  33694. referencedClasses: [],
  33695. messageSends: ["ifNil:"]
  33696. }),
  33697. $globals.ASTNode);
  33698. $core.addMethod(
  33699. $core.method({
  33700. selector: "shouldBeAliased:",
  33701. protocol: "accessing",
  33702. fn: function (aBoolean){
  33703. var self=this,$self=this;
  33704. $self["@shouldBeAliased"]=aBoolean;
  33705. return self;
  33706. },
  33707. args: ["aBoolean"],
  33708. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  33709. referencedClasses: [],
  33710. messageSends: []
  33711. }),
  33712. $globals.ASTNode);
  33713. $core.addMethod(
  33714. $core.method({
  33715. selector: "size",
  33716. protocol: "accessing",
  33717. fn: function (){
  33718. var self=this,$self=this;
  33719. return $core.withContext(function($ctx1) {
  33720. return $recv($self._source())._size();
  33721. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  33722. },
  33723. args: [],
  33724. source: "size\x0a\x09^ self source size",
  33725. referencedClasses: [],
  33726. messageSends: ["size", "source"]
  33727. }),
  33728. $globals.ASTNode);
  33729. $core.addMethod(
  33730. $core.method({
  33731. selector: "source",
  33732. protocol: "accessing",
  33733. fn: function (){
  33734. var self=this,$self=this;
  33735. return $core.withContext(function($ctx1) {
  33736. var $1,$receiver;
  33737. $1=$self["@source"];
  33738. if(($receiver = $1) == null || $receiver.a$nil){
  33739. return "";
  33740. } else {
  33741. return $1;
  33742. }
  33743. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  33744. },
  33745. args: [],
  33746. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33747. referencedClasses: [],
  33748. messageSends: ["ifNil:"]
  33749. }),
  33750. $globals.ASTNode);
  33751. $core.addMethod(
  33752. $core.method({
  33753. selector: "source:",
  33754. protocol: "accessing",
  33755. fn: function (aString){
  33756. var self=this,$self=this;
  33757. $self["@source"]=aString;
  33758. return self;
  33759. },
  33760. args: ["aString"],
  33761. source: "source: aString\x0a\x09source := aString",
  33762. referencedClasses: [],
  33763. messageSends: []
  33764. }),
  33765. $globals.ASTNode);
  33766. $core.addMethod(
  33767. $core.method({
  33768. selector: "withTail:",
  33769. protocol: "building",
  33770. fn: function (aCollection){
  33771. var self=this,$self=this;
  33772. return $core.withContext(function($ctx1) {
  33773. var $1;
  33774. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  33775. return $core.withContext(function($ctx2) {
  33776. $1=$recv($globals.SendNode)._new();
  33777. $recv($1)._position_($recv(send)._position());
  33778. $recv($1)._source_($recv(send)._source());
  33779. $recv($1)._receiver_(receiver);
  33780. $recv($1)._selector_($recv(send)._selector());
  33781. $recv($1)._arguments_($recv(send)._arguments());
  33782. return $recv($1)._yourself();
  33783. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  33784. }));
  33785. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  33786. },
  33787. args: ["aCollection"],
  33788. 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 ]",
  33789. referencedClasses: ["SendNode"],
  33790. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  33791. }),
  33792. $globals.ASTNode);
  33793. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  33794. $globals.AssignmentNode.comment="I represent an assignment node.";
  33795. $core.addMethod(
  33796. $core.method({
  33797. selector: "acceptDagVisitor:",
  33798. protocol: "visiting",
  33799. fn: function (aVisitor){
  33800. var self=this,$self=this;
  33801. return $core.withContext(function($ctx1) {
  33802. return $recv(aVisitor)._visitAssignmentNode_(self);
  33803. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  33804. },
  33805. args: ["aVisitor"],
  33806. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  33807. referencedClasses: [],
  33808. messageSends: ["visitAssignmentNode:"]
  33809. }),
  33810. $globals.AssignmentNode);
  33811. $core.addMethod(
  33812. $core.method({
  33813. selector: "dagChildren",
  33814. protocol: "accessing",
  33815. fn: function (){
  33816. var self=this,$self=this;
  33817. return $core.withContext(function($ctx1) {
  33818. return $recv($globals.Array)._with_with_($self._left(),$self._right());
  33819. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  33820. },
  33821. args: [],
  33822. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  33823. referencedClasses: ["Array"],
  33824. messageSends: ["with:with:", "left", "right"]
  33825. }),
  33826. $globals.AssignmentNode);
  33827. $core.addMethod(
  33828. $core.method({
  33829. selector: "isAssignmentNode",
  33830. protocol: "testing",
  33831. fn: function (){
  33832. var self=this,$self=this;
  33833. return true;
  33834. },
  33835. args: [],
  33836. source: "isAssignmentNode\x0a\x09^ true",
  33837. referencedClasses: [],
  33838. messageSends: []
  33839. }),
  33840. $globals.AssignmentNode);
  33841. $core.addMethod(
  33842. $core.method({
  33843. selector: "left",
  33844. protocol: "accessing",
  33845. fn: function (){
  33846. var self=this,$self=this;
  33847. return $self["@left"];
  33848. },
  33849. args: [],
  33850. source: "left\x0a\x09^ left",
  33851. referencedClasses: [],
  33852. messageSends: []
  33853. }),
  33854. $globals.AssignmentNode);
  33855. $core.addMethod(
  33856. $core.method({
  33857. selector: "left:",
  33858. protocol: "accessing",
  33859. fn: function (aNode){
  33860. var self=this,$self=this;
  33861. $self["@left"]=aNode;
  33862. return self;
  33863. },
  33864. args: ["aNode"],
  33865. source: "left: aNode\x0a\x09left := aNode",
  33866. referencedClasses: [],
  33867. messageSends: []
  33868. }),
  33869. $globals.AssignmentNode);
  33870. $core.addMethod(
  33871. $core.method({
  33872. selector: "right",
  33873. protocol: "accessing",
  33874. fn: function (){
  33875. var self=this,$self=this;
  33876. return $self["@right"];
  33877. },
  33878. args: [],
  33879. source: "right\x0a\x09^ right",
  33880. referencedClasses: [],
  33881. messageSends: []
  33882. }),
  33883. $globals.AssignmentNode);
  33884. $core.addMethod(
  33885. $core.method({
  33886. selector: "right:",
  33887. protocol: "accessing",
  33888. fn: function (aNode){
  33889. var self=this,$self=this;
  33890. $self["@right"]=aNode;
  33891. return self;
  33892. },
  33893. args: ["aNode"],
  33894. source: "right: aNode\x0a\x09right := aNode",
  33895. referencedClasses: [],
  33896. messageSends: []
  33897. }),
  33898. $globals.AssignmentNode);
  33899. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  33900. $globals.BlockNode.comment="I represent an block closure node.";
  33901. $core.addMethod(
  33902. $core.method({
  33903. selector: "acceptDagVisitor:",
  33904. protocol: "visiting",
  33905. fn: function (aVisitor){
  33906. var self=this,$self=this;
  33907. return $core.withContext(function($ctx1) {
  33908. return $recv(aVisitor)._visitBlockNode_(self);
  33909. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  33910. },
  33911. args: ["aVisitor"],
  33912. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  33913. referencedClasses: [],
  33914. messageSends: ["visitBlockNode:"]
  33915. }),
  33916. $globals.BlockNode);
  33917. $core.addMethod(
  33918. $core.method({
  33919. selector: "isBlockNode",
  33920. protocol: "testing",
  33921. fn: function (){
  33922. var self=this,$self=this;
  33923. return true;
  33924. },
  33925. args: [],
  33926. source: "isBlockNode\x0a\x09^ true",
  33927. referencedClasses: [],
  33928. messageSends: []
  33929. }),
  33930. $globals.BlockNode);
  33931. $core.addMethod(
  33932. $core.method({
  33933. selector: "parameters",
  33934. protocol: "accessing",
  33935. fn: function (){
  33936. var self=this,$self=this;
  33937. return $core.withContext(function($ctx1) {
  33938. var $1,$receiver;
  33939. $1=$self["@parameters"];
  33940. if(($receiver = $1) == null || $receiver.a$nil){
  33941. $self["@parameters"]=$recv($globals.Array)._new();
  33942. return $self["@parameters"];
  33943. } else {
  33944. return $1;
  33945. }
  33946. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  33947. },
  33948. args: [],
  33949. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  33950. referencedClasses: ["Array"],
  33951. messageSends: ["ifNil:", "new"]
  33952. }),
  33953. $globals.BlockNode);
  33954. $core.addMethod(
  33955. $core.method({
  33956. selector: "parameters:",
  33957. protocol: "accessing",
  33958. fn: function (aCollection){
  33959. var self=this,$self=this;
  33960. $self["@parameters"]=aCollection;
  33961. return self;
  33962. },
  33963. args: ["aCollection"],
  33964. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  33965. referencedClasses: [],
  33966. messageSends: []
  33967. }),
  33968. $globals.BlockNode);
  33969. $core.addMethod(
  33970. $core.method({
  33971. selector: "scope",
  33972. protocol: "accessing",
  33973. fn: function (){
  33974. var self=this,$self=this;
  33975. return $self["@scope"];
  33976. },
  33977. args: [],
  33978. source: "scope\x0a\x09^ scope",
  33979. referencedClasses: [],
  33980. messageSends: []
  33981. }),
  33982. $globals.BlockNode);
  33983. $core.addMethod(
  33984. $core.method({
  33985. selector: "scope:",
  33986. protocol: "accessing",
  33987. fn: function (aLexicalScope){
  33988. var self=this,$self=this;
  33989. $self["@scope"]=aLexicalScope;
  33990. return self;
  33991. },
  33992. args: ["aLexicalScope"],
  33993. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33994. referencedClasses: [],
  33995. messageSends: []
  33996. }),
  33997. $globals.BlockNode);
  33998. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  33999. $globals.CascadeNode.comment="I represent an cascade node.";
  34000. $core.addMethod(
  34001. $core.method({
  34002. selector: "acceptDagVisitor:",
  34003. protocol: "visiting",
  34004. fn: function (aVisitor){
  34005. var self=this,$self=this;
  34006. return $core.withContext(function($ctx1) {
  34007. return $recv(aVisitor)._visitCascadeNode_(self);
  34008. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  34009. },
  34010. args: ["aVisitor"],
  34011. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  34012. referencedClasses: [],
  34013. messageSends: ["visitCascadeNode:"]
  34014. }),
  34015. $globals.CascadeNode);
  34016. $core.addMethod(
  34017. $core.method({
  34018. selector: "isCascadeNode",
  34019. protocol: "testing",
  34020. fn: function (){
  34021. var self=this,$self=this;
  34022. return true;
  34023. },
  34024. args: [],
  34025. source: "isCascadeNode\x0a\x09^ true",
  34026. referencedClasses: [],
  34027. messageSends: []
  34028. }),
  34029. $globals.CascadeNode);
  34030. $core.addMethod(
  34031. $core.method({
  34032. selector: "receiver",
  34033. protocol: "accessing",
  34034. fn: function (){
  34035. var self=this,$self=this;
  34036. return $self["@receiver"];
  34037. },
  34038. args: [],
  34039. source: "receiver\x0a\x09^ receiver",
  34040. referencedClasses: [],
  34041. messageSends: []
  34042. }),
  34043. $globals.CascadeNode);
  34044. $core.addMethod(
  34045. $core.method({
  34046. selector: "receiver:",
  34047. protocol: "accessing",
  34048. fn: function (aNode){
  34049. var self=this,$self=this;
  34050. $self["@receiver"]=aNode;
  34051. return self;
  34052. },
  34053. args: ["aNode"],
  34054. source: "receiver: aNode\x0a\x09receiver := aNode",
  34055. referencedClasses: [],
  34056. messageSends: []
  34057. }),
  34058. $globals.CascadeNode);
  34059. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  34060. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  34061. $core.addMethod(
  34062. $core.method({
  34063. selector: "acceptDagVisitor:",
  34064. protocol: "visiting",
  34065. fn: function (aVisitor){
  34066. var self=this,$self=this;
  34067. return $core.withContext(function($ctx1) {
  34068. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  34069. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  34070. },
  34071. args: ["aVisitor"],
  34072. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  34073. referencedClasses: [],
  34074. messageSends: ["visitDynamicArrayNode:"]
  34075. }),
  34076. $globals.DynamicArrayNode);
  34077. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  34078. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  34079. $core.addMethod(
  34080. $core.method({
  34081. selector: "acceptDagVisitor:",
  34082. protocol: "visiting",
  34083. fn: function (aVisitor){
  34084. var self=this,$self=this;
  34085. return $core.withContext(function($ctx1) {
  34086. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  34087. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  34088. },
  34089. args: ["aVisitor"],
  34090. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  34091. referencedClasses: [],
  34092. messageSends: ["visitDynamicDictionaryNode:"]
  34093. }),
  34094. $globals.DynamicDictionaryNode);
  34095. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  34096. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  34097. $core.addMethod(
  34098. $core.method({
  34099. selector: "acceptDagVisitor:",
  34100. protocol: "visiting",
  34101. fn: function (aVisitor){
  34102. var self=this,$self=this;
  34103. return $core.withContext(function($ctx1) {
  34104. return $recv(aVisitor)._visitJSStatementNode_(self);
  34105. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  34106. },
  34107. args: ["aVisitor"],
  34108. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  34109. referencedClasses: [],
  34110. messageSends: ["visitJSStatementNode:"]
  34111. }),
  34112. $globals.JSStatementNode);
  34113. $core.addMethod(
  34114. $core.method({
  34115. selector: "isJSStatementNode",
  34116. protocol: "testing",
  34117. fn: function (){
  34118. var self=this,$self=this;
  34119. return true;
  34120. },
  34121. args: [],
  34122. source: "isJSStatementNode\x0a\x09^ true",
  34123. referencedClasses: [],
  34124. messageSends: []
  34125. }),
  34126. $globals.JSStatementNode);
  34127. $core.addMethod(
  34128. $core.method({
  34129. selector: "requiresSmalltalkContext",
  34130. protocol: "testing",
  34131. fn: function (){
  34132. var self=this,$self=this;
  34133. return true;
  34134. },
  34135. args: [],
  34136. source: "requiresSmalltalkContext\x0a\x09^ true",
  34137. referencedClasses: [],
  34138. messageSends: []
  34139. }),
  34140. $globals.JSStatementNode);
  34141. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  34142. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  34143. $core.addMethod(
  34144. $core.method({
  34145. selector: "acceptDagVisitor:",
  34146. protocol: "visiting",
  34147. fn: function (aVisitor){
  34148. var self=this,$self=this;
  34149. return $core.withContext(function($ctx1) {
  34150. return $recv(aVisitor)._visitMethodNode_(self);
  34151. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  34152. },
  34153. args: ["aVisitor"],
  34154. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  34155. referencedClasses: [],
  34156. messageSends: ["visitMethodNode:"]
  34157. }),
  34158. $globals.MethodNode);
  34159. $core.addMethod(
  34160. $core.method({
  34161. selector: "arguments",
  34162. protocol: "accessing",
  34163. fn: function (){
  34164. var self=this,$self=this;
  34165. return $core.withContext(function($ctx1) {
  34166. var $1,$receiver;
  34167. $1=$self["@arguments"];
  34168. if(($receiver = $1) == null || $receiver.a$nil){
  34169. return [];
  34170. } else {
  34171. return $1;
  34172. }
  34173. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  34174. },
  34175. args: [],
  34176. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  34177. referencedClasses: [],
  34178. messageSends: ["ifNil:"]
  34179. }),
  34180. $globals.MethodNode);
  34181. $core.addMethod(
  34182. $core.method({
  34183. selector: "arguments:",
  34184. protocol: "accessing",
  34185. fn: function (aCollection){
  34186. var self=this,$self=this;
  34187. $self["@arguments"]=aCollection;
  34188. return self;
  34189. },
  34190. args: ["aCollection"],
  34191. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34192. referencedClasses: [],
  34193. messageSends: []
  34194. }),
  34195. $globals.MethodNode);
  34196. $core.addMethod(
  34197. $core.method({
  34198. selector: "classReferences",
  34199. protocol: "accessing",
  34200. fn: function (){
  34201. var self=this,$self=this;
  34202. return $self["@classReferences"];
  34203. },
  34204. args: [],
  34205. source: "classReferences\x0a\x09^ classReferences",
  34206. referencedClasses: [],
  34207. messageSends: []
  34208. }),
  34209. $globals.MethodNode);
  34210. $core.addMethod(
  34211. $core.method({
  34212. selector: "classReferences:",
  34213. protocol: "accessing",
  34214. fn: function (aCollection){
  34215. var self=this,$self=this;
  34216. $self["@classReferences"]=aCollection;
  34217. return self;
  34218. },
  34219. args: ["aCollection"],
  34220. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  34221. referencedClasses: [],
  34222. messageSends: []
  34223. }),
  34224. $globals.MethodNode);
  34225. $core.addMethod(
  34226. $core.method({
  34227. selector: "messageSends",
  34228. protocol: "accessing",
  34229. fn: function (){
  34230. var self=this,$self=this;
  34231. return $core.withContext(function($ctx1) {
  34232. return $recv($self._sendIndexes())._keys();
  34233. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  34234. },
  34235. args: [],
  34236. source: "messageSends\x0a\x09^ self sendIndexes keys",
  34237. referencedClasses: [],
  34238. messageSends: ["keys", "sendIndexes"]
  34239. }),
  34240. $globals.MethodNode);
  34241. $core.addMethod(
  34242. $core.method({
  34243. selector: "method",
  34244. protocol: "accessing",
  34245. fn: function (){
  34246. var self=this,$self=this;
  34247. return self;
  34248. },
  34249. args: [],
  34250. source: "method\x0a\x09^ self",
  34251. referencedClasses: [],
  34252. messageSends: []
  34253. }),
  34254. $globals.MethodNode);
  34255. $core.addMethod(
  34256. $core.method({
  34257. selector: "scope",
  34258. protocol: "accessing",
  34259. fn: function (){
  34260. var self=this,$self=this;
  34261. return $self["@scope"];
  34262. },
  34263. args: [],
  34264. source: "scope\x0a\x09^ scope",
  34265. referencedClasses: [],
  34266. messageSends: []
  34267. }),
  34268. $globals.MethodNode);
  34269. $core.addMethod(
  34270. $core.method({
  34271. selector: "scope:",
  34272. protocol: "accessing",
  34273. fn: function (aMethodScope){
  34274. var self=this,$self=this;
  34275. $self["@scope"]=aMethodScope;
  34276. return self;
  34277. },
  34278. args: ["aMethodScope"],
  34279. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  34280. referencedClasses: [],
  34281. messageSends: []
  34282. }),
  34283. $globals.MethodNode);
  34284. $core.addMethod(
  34285. $core.method({
  34286. selector: "selector",
  34287. protocol: "accessing",
  34288. fn: function (){
  34289. var self=this,$self=this;
  34290. return $self["@selector"];
  34291. },
  34292. args: [],
  34293. source: "selector\x0a\x09^ selector",
  34294. referencedClasses: [],
  34295. messageSends: []
  34296. }),
  34297. $globals.MethodNode);
  34298. $core.addMethod(
  34299. $core.method({
  34300. selector: "selector:",
  34301. protocol: "accessing",
  34302. fn: function (aString){
  34303. var self=this,$self=this;
  34304. $self["@selector"]=aString;
  34305. return self;
  34306. },
  34307. args: ["aString"],
  34308. source: "selector: aString\x0a\x09selector := aString",
  34309. referencedClasses: [],
  34310. messageSends: []
  34311. }),
  34312. $globals.MethodNode);
  34313. $core.addMethod(
  34314. $core.method({
  34315. selector: "sendIndexes",
  34316. protocol: "accessing",
  34317. fn: function (){
  34318. var self=this,$self=this;
  34319. return $self["@sendIndexes"];
  34320. },
  34321. args: [],
  34322. source: "sendIndexes\x0a\x09^ sendIndexes",
  34323. referencedClasses: [],
  34324. messageSends: []
  34325. }),
  34326. $globals.MethodNode);
  34327. $core.addMethod(
  34328. $core.method({
  34329. selector: "sendIndexes:",
  34330. protocol: "accessing",
  34331. fn: function (aDictionary){
  34332. var self=this,$self=this;
  34333. $self["@sendIndexes"]=aDictionary;
  34334. return self;
  34335. },
  34336. args: ["aDictionary"],
  34337. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  34338. referencedClasses: [],
  34339. messageSends: []
  34340. }),
  34341. $globals.MethodNode);
  34342. $core.addMethod(
  34343. $core.method({
  34344. selector: "sequenceNode",
  34345. protocol: "accessing",
  34346. fn: function (){
  34347. var self=this,$self=this;
  34348. return $core.withContext(function($ctx1) {
  34349. var $1;
  34350. var $early={};
  34351. try {
  34352. $recv($self._dagChildren())._do_((function(each){
  34353. return $core.withContext(function($ctx2) {
  34354. $1=$recv(each)._isSequenceNode();
  34355. if($core.assert($1)){
  34356. throw $early=[each];
  34357. }
  34358. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34359. }));
  34360. return nil;
  34361. }
  34362. catch(e) {if(e===$early)return e[0]; throw e}
  34363. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  34364. },
  34365. args: [],
  34366. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  34367. referencedClasses: [],
  34368. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  34369. }),
  34370. $globals.MethodNode);
  34371. $core.addMethod(
  34372. $core.method({
  34373. selector: "source",
  34374. protocol: "accessing",
  34375. fn: function (){
  34376. var self=this,$self=this;
  34377. return $self["@source"];
  34378. },
  34379. args: [],
  34380. source: "source\x0a\x09^ source",
  34381. referencedClasses: [],
  34382. messageSends: []
  34383. }),
  34384. $globals.MethodNode);
  34385. $core.addMethod(
  34386. $core.method({
  34387. selector: "source:",
  34388. protocol: "accessing",
  34389. fn: function (aString){
  34390. var self=this,$self=this;
  34391. $self["@source"]=aString;
  34392. return self;
  34393. },
  34394. args: ["aString"],
  34395. source: "source: aString\x0a\x09source := aString",
  34396. referencedClasses: [],
  34397. messageSends: []
  34398. }),
  34399. $globals.MethodNode);
  34400. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  34401. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  34402. $core.addMethod(
  34403. $core.method({
  34404. selector: "acceptDagVisitor:",
  34405. protocol: "visiting",
  34406. fn: function (aVisitor){
  34407. var self=this,$self=this;
  34408. return $core.withContext(function($ctx1) {
  34409. return $recv(aVisitor)._visitReturnNode_(self);
  34410. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  34411. },
  34412. args: ["aVisitor"],
  34413. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  34414. referencedClasses: [],
  34415. messageSends: ["visitReturnNode:"]
  34416. }),
  34417. $globals.ReturnNode);
  34418. $core.addMethod(
  34419. $core.method({
  34420. selector: "isReturnNode",
  34421. protocol: "testing",
  34422. fn: function (){
  34423. var self=this,$self=this;
  34424. return true;
  34425. },
  34426. args: [],
  34427. source: "isReturnNode\x0a\x09^ true",
  34428. referencedClasses: [],
  34429. messageSends: []
  34430. }),
  34431. $globals.ReturnNode);
  34432. $core.addMethod(
  34433. $core.method({
  34434. selector: "nonLocalReturn",
  34435. protocol: "testing",
  34436. fn: function (){
  34437. var self=this,$self=this;
  34438. return $core.withContext(function($ctx1) {
  34439. return $recv($recv($self._scope())._isMethodScope())._not();
  34440. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  34441. },
  34442. args: [],
  34443. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  34444. referencedClasses: [],
  34445. messageSends: ["not", "isMethodScope", "scope"]
  34446. }),
  34447. $globals.ReturnNode);
  34448. $core.addMethod(
  34449. $core.method({
  34450. selector: "scope",
  34451. protocol: "accessing",
  34452. fn: function (){
  34453. var self=this,$self=this;
  34454. return $self["@scope"];
  34455. },
  34456. args: [],
  34457. source: "scope\x0a\x09^ scope",
  34458. referencedClasses: [],
  34459. messageSends: []
  34460. }),
  34461. $globals.ReturnNode);
  34462. $core.addMethod(
  34463. $core.method({
  34464. selector: "scope:",
  34465. protocol: "accessing",
  34466. fn: function (aLexicalScope){
  34467. var self=this,$self=this;
  34468. $self["@scope"]=aLexicalScope;
  34469. return self;
  34470. },
  34471. args: ["aLexicalScope"],
  34472. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34473. referencedClasses: [],
  34474. messageSends: []
  34475. }),
  34476. $globals.ReturnNode);
  34477. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  34478. $globals.SendNode.comment="I represent an message send node.";
  34479. $core.addMethod(
  34480. $core.method({
  34481. selector: "acceptDagVisitor:",
  34482. protocol: "visiting",
  34483. fn: function (aVisitor){
  34484. var self=this,$self=this;
  34485. return $core.withContext(function($ctx1) {
  34486. return $recv(aVisitor)._visitSendNode_(self);
  34487. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  34488. },
  34489. args: ["aVisitor"],
  34490. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  34491. referencedClasses: [],
  34492. messageSends: ["visitSendNode:"]
  34493. }),
  34494. $globals.SendNode);
  34495. $core.addMethod(
  34496. $core.method({
  34497. selector: "arguments",
  34498. protocol: "accessing",
  34499. fn: function (){
  34500. var self=this,$self=this;
  34501. return $core.withContext(function($ctx1) {
  34502. var $1,$receiver;
  34503. $1=$self["@arguments"];
  34504. if(($receiver = $1) == null || $receiver.a$nil){
  34505. $self["@arguments"]=[];
  34506. return $self["@arguments"];
  34507. } else {
  34508. return $1;
  34509. }
  34510. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  34511. },
  34512. args: [],
  34513. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  34514. referencedClasses: [],
  34515. messageSends: ["ifNil:"]
  34516. }),
  34517. $globals.SendNode);
  34518. $core.addMethod(
  34519. $core.method({
  34520. selector: "arguments:",
  34521. protocol: "accessing",
  34522. fn: function (aCollection){
  34523. var self=this,$self=this;
  34524. $self["@arguments"]=aCollection;
  34525. return self;
  34526. },
  34527. args: ["aCollection"],
  34528. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34529. referencedClasses: [],
  34530. messageSends: []
  34531. }),
  34532. $globals.SendNode);
  34533. $core.addMethod(
  34534. $core.method({
  34535. selector: "dagChildren",
  34536. protocol: "accessing",
  34537. fn: function (){
  34538. var self=this,$self=this;
  34539. return $core.withContext(function($ctx1) {
  34540. var $1,$2,$3,$receiver;
  34541. $1=$self._receiver();
  34542. $ctx1.sendIdx["receiver"]=1;
  34543. if(($receiver = $1) == null || $receiver.a$nil){
  34544. $2=$self._arguments();
  34545. $ctx1.sendIdx["arguments"]=1;
  34546. return $recv($2)._copy();
  34547. } else {
  34548. $1;
  34549. }
  34550. $3=$recv($globals.Array)._with_($self._receiver());
  34551. $recv($3)._addAll_($self._arguments());
  34552. return $recv($3)._yourself();
  34553. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  34554. },
  34555. args: [],
  34556. 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",
  34557. referencedClasses: ["Array"],
  34558. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  34559. }),
  34560. $globals.SendNode);
  34561. $core.addMethod(
  34562. $core.method({
  34563. selector: "index",
  34564. protocol: "accessing",
  34565. fn: function (){
  34566. var self=this,$self=this;
  34567. return $self["@index"];
  34568. },
  34569. args: [],
  34570. source: "index\x0a\x09^ index",
  34571. referencedClasses: [],
  34572. messageSends: []
  34573. }),
  34574. $globals.SendNode);
  34575. $core.addMethod(
  34576. $core.method({
  34577. selector: "index:",
  34578. protocol: "accessing",
  34579. fn: function (anInteger){
  34580. var self=this,$self=this;
  34581. $self["@index"]=anInteger;
  34582. return self;
  34583. },
  34584. args: ["anInteger"],
  34585. source: "index: anInteger\x0a\x09index := anInteger",
  34586. referencedClasses: [],
  34587. messageSends: []
  34588. }),
  34589. $globals.SendNode);
  34590. $core.addMethod(
  34591. $core.method({
  34592. selector: "isNavigationNode",
  34593. protocol: "testing",
  34594. fn: function (){
  34595. var self=this,$self=this;
  34596. return true;
  34597. },
  34598. args: [],
  34599. source: "isNavigationNode\x0a\x09^ true",
  34600. referencedClasses: [],
  34601. messageSends: []
  34602. }),
  34603. $globals.SendNode);
  34604. $core.addMethod(
  34605. $core.method({
  34606. selector: "isSendNode",
  34607. protocol: "testing",
  34608. fn: function (){
  34609. var self=this,$self=this;
  34610. return true;
  34611. },
  34612. args: [],
  34613. source: "isSendNode\x0a\x09^ true",
  34614. referencedClasses: [],
  34615. messageSends: []
  34616. }),
  34617. $globals.SendNode);
  34618. $core.addMethod(
  34619. $core.method({
  34620. selector: "navigationLink",
  34621. protocol: "accessing",
  34622. fn: function (){
  34623. var self=this,$self=this;
  34624. return $core.withContext(function($ctx1) {
  34625. return $self._selector();
  34626. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  34627. },
  34628. args: [],
  34629. source: "navigationLink\x0a\x09^ self selector",
  34630. referencedClasses: [],
  34631. messageSends: ["selector"]
  34632. }),
  34633. $globals.SendNode);
  34634. $core.addMethod(
  34635. $core.method({
  34636. selector: "receiver",
  34637. protocol: "accessing",
  34638. fn: function (){
  34639. var self=this,$self=this;
  34640. return $self["@receiver"];
  34641. },
  34642. args: [],
  34643. source: "receiver\x0a\x09^ receiver",
  34644. referencedClasses: [],
  34645. messageSends: []
  34646. }),
  34647. $globals.SendNode);
  34648. $core.addMethod(
  34649. $core.method({
  34650. selector: "receiver:",
  34651. protocol: "accessing",
  34652. fn: function (aNode){
  34653. var self=this,$self=this;
  34654. $self["@receiver"]=aNode;
  34655. return self;
  34656. },
  34657. args: ["aNode"],
  34658. source: "receiver: aNode\x0a\x09receiver := aNode",
  34659. referencedClasses: [],
  34660. messageSends: []
  34661. }),
  34662. $globals.SendNode);
  34663. $core.addMethod(
  34664. $core.method({
  34665. selector: "requiresSmalltalkContext",
  34666. protocol: "testing",
  34667. fn: function (){
  34668. var self=this,$self=this;
  34669. return true;
  34670. },
  34671. args: [],
  34672. source: "requiresSmalltalkContext\x0a\x09^ true",
  34673. referencedClasses: [],
  34674. messageSends: []
  34675. }),
  34676. $globals.SendNode);
  34677. $core.addMethod(
  34678. $core.method({
  34679. selector: "selector",
  34680. protocol: "accessing",
  34681. fn: function (){
  34682. var self=this,$self=this;
  34683. return $self["@selector"];
  34684. },
  34685. args: [],
  34686. source: "selector\x0a\x09^ selector",
  34687. referencedClasses: [],
  34688. messageSends: []
  34689. }),
  34690. $globals.SendNode);
  34691. $core.addMethod(
  34692. $core.method({
  34693. selector: "selector:",
  34694. protocol: "accessing",
  34695. fn: function (aString){
  34696. var self=this,$self=this;
  34697. $self["@selector"]=aString;
  34698. return self;
  34699. },
  34700. args: ["aString"],
  34701. source: "selector: aString\x0a\x09selector := aString",
  34702. referencedClasses: [],
  34703. messageSends: []
  34704. }),
  34705. $globals.SendNode);
  34706. $core.addMethod(
  34707. $core.method({
  34708. selector: "shouldBeInlined",
  34709. protocol: "accessing",
  34710. fn: function (){
  34711. var self=this,$self=this;
  34712. return $core.withContext(function($ctx1) {
  34713. var $1,$receiver;
  34714. $1=$self["@shouldBeInlined"];
  34715. if(($receiver = $1) == null || $receiver.a$nil){
  34716. return false;
  34717. } else {
  34718. return $1;
  34719. }
  34720. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  34721. },
  34722. args: [],
  34723. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  34724. referencedClasses: [],
  34725. messageSends: ["ifNil:"]
  34726. }),
  34727. $globals.SendNode);
  34728. $core.addMethod(
  34729. $core.method({
  34730. selector: "shouldBeInlined:",
  34731. protocol: "accessing",
  34732. fn: function (aBoolean){
  34733. var self=this,$self=this;
  34734. $self["@shouldBeInlined"]=aBoolean;
  34735. return self;
  34736. },
  34737. args: ["aBoolean"],
  34738. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  34739. referencedClasses: [],
  34740. messageSends: []
  34741. }),
  34742. $globals.SendNode);
  34743. $core.addMethod(
  34744. $core.method({
  34745. selector: "superSend",
  34746. protocol: "accessing",
  34747. fn: function (){
  34748. var self=this,$self=this;
  34749. return $core.withContext(function($ctx1) {
  34750. var $2,$1;
  34751. $2=$self._receiver();
  34752. $ctx1.sendIdx["receiver"]=1;
  34753. $1=$recv($2)._notNil();
  34754. return $recv($1)._and_((function(){
  34755. return $core.withContext(function($ctx2) {
  34756. return $recv($self._receiver())._isSuperKeyword();
  34757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34758. }));
  34759. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  34760. },
  34761. args: [],
  34762. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  34763. referencedClasses: [],
  34764. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  34765. }),
  34766. $globals.SendNode);
  34767. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "pragmas", "scope"], "Compiler-AST");
  34768. $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).";
  34769. $core.addMethod(
  34770. $core.method({
  34771. selector: "acceptDagVisitor:",
  34772. protocol: "visiting",
  34773. fn: function (aVisitor){
  34774. var self=this,$self=this;
  34775. return $core.withContext(function($ctx1) {
  34776. return $recv(aVisitor)._visitSequenceNode_(self);
  34777. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  34778. },
  34779. args: ["aVisitor"],
  34780. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  34781. referencedClasses: [],
  34782. messageSends: ["visitSequenceNode:"]
  34783. }),
  34784. $globals.SequenceNode);
  34785. $core.addMethod(
  34786. $core.method({
  34787. selector: "asBlockSequenceNode",
  34788. protocol: "building",
  34789. fn: function (){
  34790. var self=this,$self=this;
  34791. return $core.withContext(function($ctx1) {
  34792. var $1;
  34793. $1=$recv($globals.BlockSequenceNode)._new();
  34794. $recv($1)._position_($self._position());
  34795. $recv($1)._source_($self._source());
  34796. $recv($1)._dagChildren_($self._dagChildren());
  34797. $recv($1)._temps_($self._temps());
  34798. $recv($1)._pragmas_($self._pragmas());
  34799. return $recv($1)._yourself();
  34800. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  34801. },
  34802. args: [],
  34803. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09dagChildren: self dagChildren;\x0a\x09\x09temps: self temps;\x0a\x09\x09pragmas: self pragmas;\x0a\x09\x09yourself",
  34804. referencedClasses: ["BlockSequenceNode"],
  34805. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "pragmas:", "pragmas", "yourself"]
  34806. }),
  34807. $globals.SequenceNode);
  34808. $core.addMethod(
  34809. $core.method({
  34810. selector: "isSequenceNode",
  34811. protocol: "testing",
  34812. fn: function (){
  34813. var self=this,$self=this;
  34814. return true;
  34815. },
  34816. args: [],
  34817. source: "isSequenceNode\x0a\x09^ true",
  34818. referencedClasses: [],
  34819. messageSends: []
  34820. }),
  34821. $globals.SequenceNode);
  34822. $core.addMethod(
  34823. $core.method({
  34824. selector: "pragmas",
  34825. protocol: "accessing",
  34826. fn: function (){
  34827. var self=this,$self=this;
  34828. return $core.withContext(function($ctx1) {
  34829. var $1,$receiver;
  34830. $1=$self["@pragmas"];
  34831. if(($receiver = $1) == null || $receiver.a$nil){
  34832. return [];
  34833. } else {
  34834. return $1;
  34835. }
  34836. }, function($ctx1) {$ctx1.fill(self,"pragmas",{},$globals.SequenceNode)});
  34837. },
  34838. args: [],
  34839. source: "pragmas\x0a\x09^ pragmas ifNil: [ #() ]",
  34840. referencedClasses: [],
  34841. messageSends: ["ifNil:"]
  34842. }),
  34843. $globals.SequenceNode);
  34844. $core.addMethod(
  34845. $core.method({
  34846. selector: "pragmas:",
  34847. protocol: "accessing",
  34848. fn: function (aCollection){
  34849. var self=this,$self=this;
  34850. $self["@pragmas"]=aCollection;
  34851. return self;
  34852. },
  34853. args: ["aCollection"],
  34854. source: "pragmas: aCollection\x0a\x09pragmas := aCollection",
  34855. referencedClasses: [],
  34856. messageSends: []
  34857. }),
  34858. $globals.SequenceNode);
  34859. $core.addMethod(
  34860. $core.method({
  34861. selector: "scope",
  34862. protocol: "accessing",
  34863. fn: function (){
  34864. var self=this,$self=this;
  34865. return $self["@scope"];
  34866. },
  34867. args: [],
  34868. source: "scope\x0a\x09^ scope",
  34869. referencedClasses: [],
  34870. messageSends: []
  34871. }),
  34872. $globals.SequenceNode);
  34873. $core.addMethod(
  34874. $core.method({
  34875. selector: "scope:",
  34876. protocol: "accessing",
  34877. fn: function (aLexicalScope){
  34878. var self=this,$self=this;
  34879. $self["@scope"]=aLexicalScope;
  34880. return self;
  34881. },
  34882. args: ["aLexicalScope"],
  34883. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34884. referencedClasses: [],
  34885. messageSends: []
  34886. }),
  34887. $globals.SequenceNode);
  34888. $core.addMethod(
  34889. $core.method({
  34890. selector: "temps",
  34891. protocol: "accessing",
  34892. fn: function (){
  34893. var self=this,$self=this;
  34894. return $core.withContext(function($ctx1) {
  34895. var $1,$receiver;
  34896. $1=$self["@temps"];
  34897. if(($receiver = $1) == null || $receiver.a$nil){
  34898. return [];
  34899. } else {
  34900. return $1;
  34901. }
  34902. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  34903. },
  34904. args: [],
  34905. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  34906. referencedClasses: [],
  34907. messageSends: ["ifNil:"]
  34908. }),
  34909. $globals.SequenceNode);
  34910. $core.addMethod(
  34911. $core.method({
  34912. selector: "temps:",
  34913. protocol: "accessing",
  34914. fn: function (aCollection){
  34915. var self=this,$self=this;
  34916. $self["@temps"]=aCollection;
  34917. return self;
  34918. },
  34919. args: ["aCollection"],
  34920. source: "temps: aCollection\x0a\x09temps := aCollection",
  34921. referencedClasses: [],
  34922. messageSends: []
  34923. }),
  34924. $globals.SequenceNode);
  34925. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  34926. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  34927. $core.addMethod(
  34928. $core.method({
  34929. selector: "acceptDagVisitor:",
  34930. protocol: "visiting",
  34931. fn: function (aVisitor){
  34932. var self=this,$self=this;
  34933. return $core.withContext(function($ctx1) {
  34934. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  34935. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  34936. },
  34937. args: ["aVisitor"],
  34938. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  34939. referencedClasses: [],
  34940. messageSends: ["visitBlockSequenceNode:"]
  34941. }),
  34942. $globals.BlockSequenceNode);
  34943. $core.addMethod(
  34944. $core.method({
  34945. selector: "isBlockSequenceNode",
  34946. protocol: "testing",
  34947. fn: function (){
  34948. var self=this,$self=this;
  34949. return true;
  34950. },
  34951. args: [],
  34952. source: "isBlockSequenceNode\x0a\x09^ true",
  34953. referencedClasses: [],
  34954. messageSends: []
  34955. }),
  34956. $globals.BlockSequenceNode);
  34957. $core.addMethod(
  34958. $core.method({
  34959. selector: "pragmas:",
  34960. protocol: "visiting",
  34961. fn: function (aCollection){
  34962. var self=this,$self=this;
  34963. return $core.withContext(function($ctx1) {
  34964. var $1;
  34965. $recv(aCollection)._ifNotEmpty_((function(){
  34966. return $core.withContext(function($ctx2) {
  34967. return $recv($globals.CompilerError)._signal_("Block must have no pragmas.");
  34968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34969. }));
  34970. $1=(
  34971. $ctx1.supercall = true,
  34972. ($globals.BlockSequenceNode.superclass||$boot.nilAsClass).fn.prototype._pragmas_.apply($self, [aCollection]));
  34973. $ctx1.supercall = false;
  34974. return $1;
  34975. }, function($ctx1) {$ctx1.fill(self,"pragmas:",{aCollection:aCollection},$globals.BlockSequenceNode)});
  34976. },
  34977. args: ["aCollection"],
  34978. source: "pragmas: aCollection\x0a\x09aCollection ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'Block must have no pragmas.' ].\x0a\x09^ super pragmas: aCollection",
  34979. referencedClasses: ["CompilerError"],
  34980. messageSends: ["ifNotEmpty:", "signal:", "pragmas:"]
  34981. }),
  34982. $globals.BlockSequenceNode);
  34983. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  34984. $globals.ValueNode.comment="I represent a value node.";
  34985. $core.addMethod(
  34986. $core.method({
  34987. selector: "acceptDagVisitor:",
  34988. protocol: "visiting",
  34989. fn: function (aVisitor){
  34990. var self=this,$self=this;
  34991. return $core.withContext(function($ctx1) {
  34992. return $recv(aVisitor)._visitValueNode_(self);
  34993. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  34994. },
  34995. args: ["aVisitor"],
  34996. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  34997. referencedClasses: [],
  34998. messageSends: ["visitValueNode:"]
  34999. }),
  35000. $globals.ValueNode);
  35001. $core.addMethod(
  35002. $core.method({
  35003. selector: "isImmutable",
  35004. protocol: "testing",
  35005. fn: function (){
  35006. var self=this,$self=this;
  35007. return $core.withContext(function($ctx1) {
  35008. return $recv($self._value())._isImmutable();
  35009. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  35010. },
  35011. args: [],
  35012. source: "isImmutable\x0a\x09^ self value isImmutable",
  35013. referencedClasses: [],
  35014. messageSends: ["isImmutable", "value"]
  35015. }),
  35016. $globals.ValueNode);
  35017. $core.addMethod(
  35018. $core.method({
  35019. selector: "isValueNode",
  35020. protocol: "testing",
  35021. fn: function (){
  35022. var self=this,$self=this;
  35023. return true;
  35024. },
  35025. args: [],
  35026. source: "isValueNode\x0a\x09^ true",
  35027. referencedClasses: [],
  35028. messageSends: []
  35029. }),
  35030. $globals.ValueNode);
  35031. $core.addMethod(
  35032. $core.method({
  35033. selector: "value",
  35034. protocol: "accessing",
  35035. fn: function (){
  35036. var self=this,$self=this;
  35037. return $self["@value"];
  35038. },
  35039. args: [],
  35040. source: "value\x0a\x09^ value",
  35041. referencedClasses: [],
  35042. messageSends: []
  35043. }),
  35044. $globals.ValueNode);
  35045. $core.addMethod(
  35046. $core.method({
  35047. selector: "value:",
  35048. protocol: "accessing",
  35049. fn: function (anObject){
  35050. var self=this,$self=this;
  35051. $self["@value"]=anObject;
  35052. return self;
  35053. },
  35054. args: ["anObject"],
  35055. source: "value: anObject\x0a\x09value := anObject",
  35056. referencedClasses: [],
  35057. messageSends: []
  35058. }),
  35059. $globals.ValueNode);
  35060. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  35061. $globals.VariableNode.comment="I represent an variable node.";
  35062. $core.addMethod(
  35063. $core.method({
  35064. selector: "acceptDagVisitor:",
  35065. protocol: "visiting",
  35066. fn: function (aVisitor){
  35067. var self=this,$self=this;
  35068. return $core.withContext(function($ctx1) {
  35069. return $recv(aVisitor)._visitVariableNode_(self);
  35070. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  35071. },
  35072. args: ["aVisitor"],
  35073. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  35074. referencedClasses: [],
  35075. messageSends: ["visitVariableNode:"]
  35076. }),
  35077. $globals.VariableNode);
  35078. $core.addMethod(
  35079. $core.method({
  35080. selector: "alias",
  35081. protocol: "accessing",
  35082. fn: function (){
  35083. var self=this,$self=this;
  35084. return $core.withContext(function($ctx1) {
  35085. return $recv($self._binding())._alias();
  35086. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  35087. },
  35088. args: [],
  35089. source: "alias\x0a\x09^ self binding alias",
  35090. referencedClasses: [],
  35091. messageSends: ["alias", "binding"]
  35092. }),
  35093. $globals.VariableNode);
  35094. $core.addMethod(
  35095. $core.method({
  35096. selector: "assigned",
  35097. protocol: "accessing",
  35098. fn: function (){
  35099. var self=this,$self=this;
  35100. return $core.withContext(function($ctx1) {
  35101. var $1,$receiver;
  35102. $1=$self["@assigned"];
  35103. if(($receiver = $1) == null || $receiver.a$nil){
  35104. return false;
  35105. } else {
  35106. return $1;
  35107. }
  35108. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  35109. },
  35110. args: [],
  35111. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  35112. referencedClasses: [],
  35113. messageSends: ["ifNil:"]
  35114. }),
  35115. $globals.VariableNode);
  35116. $core.addMethod(
  35117. $core.method({
  35118. selector: "assigned:",
  35119. protocol: "accessing",
  35120. fn: function (aBoolean){
  35121. var self=this,$self=this;
  35122. $self["@assigned"]=aBoolean;
  35123. return self;
  35124. },
  35125. args: ["aBoolean"],
  35126. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  35127. referencedClasses: [],
  35128. messageSends: []
  35129. }),
  35130. $globals.VariableNode);
  35131. $core.addMethod(
  35132. $core.method({
  35133. selector: "beAssigned",
  35134. protocol: "accessing",
  35135. fn: function (){
  35136. var self=this,$self=this;
  35137. return $core.withContext(function($ctx1) {
  35138. $recv($self._binding())._validateAssignment();
  35139. $self["@assigned"]=true;
  35140. return self;
  35141. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  35142. },
  35143. args: [],
  35144. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  35145. referencedClasses: [],
  35146. messageSends: ["validateAssignment", "binding"]
  35147. }),
  35148. $globals.VariableNode);
  35149. $core.addMethod(
  35150. $core.method({
  35151. selector: "binding",
  35152. protocol: "accessing",
  35153. fn: function (){
  35154. var self=this,$self=this;
  35155. return $self["@binding"];
  35156. },
  35157. args: [],
  35158. source: "binding\x0a\x09^ binding",
  35159. referencedClasses: [],
  35160. messageSends: []
  35161. }),
  35162. $globals.VariableNode);
  35163. $core.addMethod(
  35164. $core.method({
  35165. selector: "binding:",
  35166. protocol: "accessing",
  35167. fn: function (aScopeVar){
  35168. var self=this,$self=this;
  35169. $self["@binding"]=aScopeVar;
  35170. return self;
  35171. },
  35172. args: ["aScopeVar"],
  35173. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  35174. referencedClasses: [],
  35175. messageSends: []
  35176. }),
  35177. $globals.VariableNode);
  35178. $core.addMethod(
  35179. $core.method({
  35180. selector: "isArgument",
  35181. protocol: "testing",
  35182. fn: function (){
  35183. var self=this,$self=this;
  35184. return $core.withContext(function($ctx1) {
  35185. return $recv($self._binding())._isArgVar();
  35186. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  35187. },
  35188. args: [],
  35189. source: "isArgument\x0a\x09^ self binding isArgVar",
  35190. referencedClasses: [],
  35191. messageSends: ["isArgVar", "binding"]
  35192. }),
  35193. $globals.VariableNode);
  35194. $core.addMethod(
  35195. $core.method({
  35196. selector: "isImmutable",
  35197. protocol: "testing",
  35198. fn: function (){
  35199. var self=this,$self=this;
  35200. return $core.withContext(function($ctx1) {
  35201. return $recv($self._binding())._isImmutable();
  35202. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  35203. },
  35204. args: [],
  35205. source: "isImmutable\x0a\x09^ self binding isImmutable",
  35206. referencedClasses: [],
  35207. messageSends: ["isImmutable", "binding"]
  35208. }),
  35209. $globals.VariableNode);
  35210. $core.addMethod(
  35211. $core.method({
  35212. selector: "isNavigationNode",
  35213. protocol: "testing",
  35214. fn: function (){
  35215. var self=this,$self=this;
  35216. return true;
  35217. },
  35218. args: [],
  35219. source: "isNavigationNode\x0a\x09^ true",
  35220. referencedClasses: [],
  35221. messageSends: []
  35222. }),
  35223. $globals.VariableNode);
  35224. $core.addMethod(
  35225. $core.method({
  35226. selector: "isSuperKeyword",
  35227. protocol: "testing",
  35228. fn: function (){
  35229. var self=this,$self=this;
  35230. return $core.withContext(function($ctx1) {
  35231. return $recv($self._value()).__eq("super");
  35232. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  35233. },
  35234. args: [],
  35235. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  35236. referencedClasses: [],
  35237. messageSends: ["=", "value"]
  35238. }),
  35239. $globals.VariableNode);
  35240. $core.addMethod(
  35241. $core.method({
  35242. selector: "isVariableNode",
  35243. protocol: "testing",
  35244. fn: function (){
  35245. var self=this,$self=this;
  35246. return true;
  35247. },
  35248. args: [],
  35249. source: "isVariableNode\x0a\x09^ true",
  35250. referencedClasses: [],
  35251. messageSends: []
  35252. }),
  35253. $globals.VariableNode);
  35254. $core.addMethod(
  35255. $core.method({
  35256. selector: "navigationLink",
  35257. protocol: "accessing",
  35258. fn: function (){
  35259. var self=this,$self=this;
  35260. return $core.withContext(function($ctx1) {
  35261. return $self._value();
  35262. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  35263. },
  35264. args: [],
  35265. source: "navigationLink\x0a\x09^ self value",
  35266. referencedClasses: [],
  35267. messageSends: ["value"]
  35268. }),
  35269. $globals.VariableNode);
  35270. $core.addClass("CompilerError", $globals.Error, [], "Compiler-AST");
  35271. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  35272. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  35273. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  35274. $core.addMethod(
  35275. $core.method({
  35276. selector: "visit:",
  35277. protocol: "visiting",
  35278. fn: function (aNode){
  35279. var self=this,$self=this;
  35280. return $core.withContext(function($ctx1) {
  35281. var $1;
  35282. $recv($self._path())._ifNotEmpty_((function(p){
  35283. return $core.withContext(function($ctx2) {
  35284. return $recv(aNode)._parent_($recv(p)._last());
  35285. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  35286. }));
  35287. $1=(
  35288. $ctx1.supercall = true,
  35289. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  35290. $ctx1.supercall = false;
  35291. return $1;
  35292. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  35293. },
  35294. args: ["aNode"],
  35295. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  35296. referencedClasses: [],
  35297. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  35298. }),
  35299. $globals.ParentFakingPathDagVisitor);
  35300. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  35301. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  35302. $core.addMethod(
  35303. $core.method({
  35304. selector: "visitAssignmentNode:",
  35305. protocol: "visiting",
  35306. fn: function (aNode){
  35307. var self=this,$self=this;
  35308. return $core.withContext(function($ctx1) {
  35309. return $self._visitDagNode_(aNode);
  35310. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  35311. },
  35312. args: ["aNode"],
  35313. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35314. referencedClasses: [],
  35315. messageSends: ["visitDagNode:"]
  35316. }),
  35317. $globals.NodeVisitor);
  35318. $core.addMethod(
  35319. $core.method({
  35320. selector: "visitBlockNode:",
  35321. protocol: "visiting",
  35322. fn: function (aNode){
  35323. var self=this,$self=this;
  35324. return $core.withContext(function($ctx1) {
  35325. return $self._visitDagNode_(aNode);
  35326. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  35327. },
  35328. args: ["aNode"],
  35329. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35330. referencedClasses: [],
  35331. messageSends: ["visitDagNode:"]
  35332. }),
  35333. $globals.NodeVisitor);
  35334. $core.addMethod(
  35335. $core.method({
  35336. selector: "visitBlockSequenceNode:",
  35337. protocol: "visiting",
  35338. fn: function (aNode){
  35339. var self=this,$self=this;
  35340. return $core.withContext(function($ctx1) {
  35341. return $self._visitSequenceNode_(aNode);
  35342. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35343. },
  35344. args: ["aNode"],
  35345. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  35346. referencedClasses: [],
  35347. messageSends: ["visitSequenceNode:"]
  35348. }),
  35349. $globals.NodeVisitor);
  35350. $core.addMethod(
  35351. $core.method({
  35352. selector: "visitCascadeNode:",
  35353. protocol: "visiting",
  35354. fn: function (aNode){
  35355. var self=this,$self=this;
  35356. return $core.withContext(function($ctx1) {
  35357. return $self._visitDagNode_(aNode);
  35358. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  35359. },
  35360. args: ["aNode"],
  35361. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35362. referencedClasses: [],
  35363. messageSends: ["visitDagNode:"]
  35364. }),
  35365. $globals.NodeVisitor);
  35366. $core.addMethod(
  35367. $core.method({
  35368. selector: "visitDagNode:",
  35369. protocol: "visiting",
  35370. fn: function (aNode){
  35371. var self=this,$self=this;
  35372. return $core.withContext(function($ctx1) {
  35373. return $self._visitDagNodeVariantSimple_(aNode);
  35374. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  35375. },
  35376. args: ["aNode"],
  35377. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  35378. referencedClasses: [],
  35379. messageSends: ["visitDagNodeVariantSimple:"]
  35380. }),
  35381. $globals.NodeVisitor);
  35382. $core.addMethod(
  35383. $core.method({
  35384. selector: "visitDynamicArrayNode:",
  35385. protocol: "visiting",
  35386. fn: function (aNode){
  35387. var self=this,$self=this;
  35388. return $core.withContext(function($ctx1) {
  35389. return $self._visitDagNode_(aNode);
  35390. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  35391. },
  35392. args: ["aNode"],
  35393. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35394. referencedClasses: [],
  35395. messageSends: ["visitDagNode:"]
  35396. }),
  35397. $globals.NodeVisitor);
  35398. $core.addMethod(
  35399. $core.method({
  35400. selector: "visitDynamicDictionaryNode:",
  35401. protocol: "visiting",
  35402. fn: function (aNode){
  35403. var self=this,$self=this;
  35404. return $core.withContext(function($ctx1) {
  35405. return $self._visitDagNode_(aNode);
  35406. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  35407. },
  35408. args: ["aNode"],
  35409. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35410. referencedClasses: [],
  35411. messageSends: ["visitDagNode:"]
  35412. }),
  35413. $globals.NodeVisitor);
  35414. $core.addMethod(
  35415. $core.method({
  35416. selector: "visitJSStatementNode:",
  35417. protocol: "visiting",
  35418. fn: function (aNode){
  35419. var self=this,$self=this;
  35420. return $core.withContext(function($ctx1) {
  35421. return $self._visitDagNode_(aNode);
  35422. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  35423. },
  35424. args: ["aNode"],
  35425. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35426. referencedClasses: [],
  35427. messageSends: ["visitDagNode:"]
  35428. }),
  35429. $globals.NodeVisitor);
  35430. $core.addMethod(
  35431. $core.method({
  35432. selector: "visitMethodNode:",
  35433. protocol: "visiting",
  35434. fn: function (aNode){
  35435. var self=this,$self=this;
  35436. return $core.withContext(function($ctx1) {
  35437. return $self._visitDagNode_(aNode);
  35438. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  35439. },
  35440. args: ["aNode"],
  35441. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35442. referencedClasses: [],
  35443. messageSends: ["visitDagNode:"]
  35444. }),
  35445. $globals.NodeVisitor);
  35446. $core.addMethod(
  35447. $core.method({
  35448. selector: "visitReturnNode:",
  35449. protocol: "visiting",
  35450. fn: function (aNode){
  35451. var self=this,$self=this;
  35452. return $core.withContext(function($ctx1) {
  35453. return $self._visitDagNode_(aNode);
  35454. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  35455. },
  35456. args: ["aNode"],
  35457. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35458. referencedClasses: [],
  35459. messageSends: ["visitDagNode:"]
  35460. }),
  35461. $globals.NodeVisitor);
  35462. $core.addMethod(
  35463. $core.method({
  35464. selector: "visitSendNode:",
  35465. protocol: "visiting",
  35466. fn: function (aNode){
  35467. var self=this,$self=this;
  35468. return $core.withContext(function($ctx1) {
  35469. return $self._visitDagNode_(aNode);
  35470. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  35471. },
  35472. args: ["aNode"],
  35473. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35474. referencedClasses: [],
  35475. messageSends: ["visitDagNode:"]
  35476. }),
  35477. $globals.NodeVisitor);
  35478. $core.addMethod(
  35479. $core.method({
  35480. selector: "visitSequenceNode:",
  35481. protocol: "visiting",
  35482. fn: function (aNode){
  35483. var self=this,$self=this;
  35484. return $core.withContext(function($ctx1) {
  35485. return $self._visitDagNode_(aNode);
  35486. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35487. },
  35488. args: ["aNode"],
  35489. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35490. referencedClasses: [],
  35491. messageSends: ["visitDagNode:"]
  35492. }),
  35493. $globals.NodeVisitor);
  35494. $core.addMethod(
  35495. $core.method({
  35496. selector: "visitValueNode:",
  35497. protocol: "visiting",
  35498. fn: function (aNode){
  35499. var self=this,$self=this;
  35500. return $core.withContext(function($ctx1) {
  35501. return $self._visitDagNode_(aNode);
  35502. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  35503. },
  35504. args: ["aNode"],
  35505. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35506. referencedClasses: [],
  35507. messageSends: ["visitDagNode:"]
  35508. }),
  35509. $globals.NodeVisitor);
  35510. $core.addMethod(
  35511. $core.method({
  35512. selector: "visitVariableNode:",
  35513. protocol: "visiting",
  35514. fn: function (aNode){
  35515. var self=this,$self=this;
  35516. return $core.withContext(function($ctx1) {
  35517. return $self._visitDagNode_(aNode);
  35518. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  35519. },
  35520. args: ["aNode"],
  35521. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35522. referencedClasses: [],
  35523. messageSends: ["visitDagNode:"]
  35524. }),
  35525. $globals.NodeVisitor);
  35526. $core.addMethod(
  35527. $core.method({
  35528. selector: "ast",
  35529. protocol: "*Compiler-AST",
  35530. fn: function (){
  35531. var self=this,$self=this;
  35532. return $core.withContext(function($ctx1) {
  35533. var $1;
  35534. $1=$self._source();
  35535. $ctx1.sendIdx["source"]=1;
  35536. $recv($1)._ifEmpty_((function(){
  35537. return $core.withContext(function($ctx2) {
  35538. return $recv($globals.CompilerError)._signal_("Method source is empty");
  35539. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35540. }));
  35541. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_($self._source(),$self._methodClass(),$self._protocol());
  35542. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  35543. },
  35544. args: [],
  35545. source: "ast\x0a\x09self source ifEmpty: [ CompilerError signal: 'Method source is empty' ].\x0a\x09\x0a\x09^ Compiler new\x0a\x09\x09ast: self source\x0a\x09\x09forClass: self methodClass\x0a\x09\x09protocol: self protocol",
  35546. referencedClasses: ["CompilerError", "Compiler"],
  35547. messageSends: ["ifEmpty:", "source", "signal:", "ast:forClass:protocol:", "new", "methodClass", "protocol"]
  35548. }),
  35549. $globals.CompiledMethod);
  35550. });
  35551. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Collections", "amber_core/Kernel-Objects"], function($boot){"use strict";
  35552. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  35553. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  35554. $core.addPackage("Compiler-Core");
  35555. ($core.packageDescriptors||$core.packages)["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  35556. ($core.packageDescriptors||$core.packages)["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35557. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  35558. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  35559. $core.addMethod(
  35560. $core.method({
  35561. selector: "compileNode:",
  35562. protocol: "compiling",
  35563. fn: function (aNode){
  35564. var self=this,$self=this;
  35565. return $core.withContext(function($ctx1) {
  35566. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  35567. return $core.withContext(function($ctx2) {
  35568. return $recv(transformer)._value_(input);
  35569. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  35570. }));
  35571. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  35572. },
  35573. args: ["aNode"],
  35574. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  35575. referencedClasses: [],
  35576. messageSends: ["inject:into:", "transformers", "value:"]
  35577. }),
  35578. $globals.AbstractCodeGenerator);
  35579. $core.addMethod(
  35580. $core.method({
  35581. selector: "currentClass",
  35582. protocol: "accessing",
  35583. fn: function (){
  35584. var self=this,$self=this;
  35585. return $self["@currentClass"];
  35586. },
  35587. args: [],
  35588. source: "currentClass\x0a\x09^ currentClass",
  35589. referencedClasses: [],
  35590. messageSends: []
  35591. }),
  35592. $globals.AbstractCodeGenerator);
  35593. $core.addMethod(
  35594. $core.method({
  35595. selector: "currentClass:",
  35596. protocol: "accessing",
  35597. fn: function (aClass){
  35598. var self=this,$self=this;
  35599. $self["@currentClass"]=aClass;
  35600. return self;
  35601. },
  35602. args: ["aClass"],
  35603. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  35604. referencedClasses: [],
  35605. messageSends: []
  35606. }),
  35607. $globals.AbstractCodeGenerator);
  35608. $core.addMethod(
  35609. $core.method({
  35610. selector: "currentPackage",
  35611. protocol: "accessing",
  35612. fn: function (){
  35613. var self=this,$self=this;
  35614. return $self["@currentPackage"];
  35615. },
  35616. args: [],
  35617. source: "currentPackage\x0a\x09^ currentPackage",
  35618. referencedClasses: [],
  35619. messageSends: []
  35620. }),
  35621. $globals.AbstractCodeGenerator);
  35622. $core.addMethod(
  35623. $core.method({
  35624. selector: "currentPackage:",
  35625. protocol: "accessing",
  35626. fn: function (anObject){
  35627. var self=this,$self=this;
  35628. $self["@currentPackage"]=anObject;
  35629. return self;
  35630. },
  35631. args: ["anObject"],
  35632. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  35633. referencedClasses: [],
  35634. messageSends: []
  35635. }),
  35636. $globals.AbstractCodeGenerator);
  35637. $core.addMethod(
  35638. $core.method({
  35639. selector: "pseudoVariables",
  35640. protocol: "accessing",
  35641. fn: function (){
  35642. var self=this,$self=this;
  35643. return $core.withContext(function($ctx1) {
  35644. return $recv($globals.Smalltalk)._pseudoVariableNames();
  35645. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  35646. },
  35647. args: [],
  35648. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  35649. referencedClasses: ["Smalltalk"],
  35650. messageSends: ["pseudoVariableNames"]
  35651. }),
  35652. $globals.AbstractCodeGenerator);
  35653. $core.addMethod(
  35654. $core.method({
  35655. selector: "source",
  35656. protocol: "accessing",
  35657. fn: function (){
  35658. var self=this,$self=this;
  35659. return $core.withContext(function($ctx1) {
  35660. var $1,$receiver;
  35661. $1=$self["@source"];
  35662. if(($receiver = $1) == null || $receiver.a$nil){
  35663. return "";
  35664. } else {
  35665. return $1;
  35666. }
  35667. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  35668. },
  35669. args: [],
  35670. source: "source\x0a\x09^ source ifNil: [ '' ]",
  35671. referencedClasses: [],
  35672. messageSends: ["ifNil:"]
  35673. }),
  35674. $globals.AbstractCodeGenerator);
  35675. $core.addMethod(
  35676. $core.method({
  35677. selector: "source:",
  35678. protocol: "accessing",
  35679. fn: function (aString){
  35680. var self=this,$self=this;
  35681. $self["@source"]=aString;
  35682. return self;
  35683. },
  35684. args: ["aString"],
  35685. source: "source: aString\x0a\x09source := aString",
  35686. referencedClasses: [],
  35687. messageSends: []
  35688. }),
  35689. $globals.AbstractCodeGenerator);
  35690. $core.addMethod(
  35691. $core.method({
  35692. selector: "transformers",
  35693. protocol: "compiling",
  35694. fn: function (){
  35695. var self=this,$self=this;
  35696. var dict;
  35697. return $core.withContext(function($ctx1) {
  35698. dict=$self._transformersDictionary();
  35699. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  35700. return $core.withContext(function($ctx2) {
  35701. return $recv(dict)._at_(each);
  35702. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35703. }));
  35704. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  35705. },
  35706. args: [],
  35707. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  35708. referencedClasses: [],
  35709. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  35710. }),
  35711. $globals.AbstractCodeGenerator);
  35712. $core.addMethod(
  35713. $core.method({
  35714. selector: "transformersDictionary",
  35715. protocol: "compiling",
  35716. fn: function (){
  35717. var self=this,$self=this;
  35718. return $core.withContext(function($ctx1) {
  35719. $self._subclassResponsibility();
  35720. return self;
  35721. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  35722. },
  35723. args: [],
  35724. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  35725. referencedClasses: [],
  35726. messageSends: ["subclassResponsibility"]
  35727. }),
  35728. $globals.AbstractCodeGenerator);
  35729. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  35730. $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.";
  35731. $core.addMethod(
  35732. $core.method({
  35733. selector: "irTranslator",
  35734. protocol: "compiling",
  35735. fn: function (){
  35736. var self=this,$self=this;
  35737. return $core.withContext(function($ctx1) {
  35738. var $1;
  35739. $1=$recv($self._irTranslatorClass())._new();
  35740. $recv($1)._currentClass_($self._currentClass());
  35741. return $recv($1)._yourself();
  35742. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  35743. },
  35744. args: [],
  35745. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  35746. referencedClasses: [],
  35747. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  35748. }),
  35749. $globals.CodeGenerator);
  35750. $core.addMethod(
  35751. $core.method({
  35752. selector: "irTranslatorClass",
  35753. protocol: "compiling",
  35754. fn: function (){
  35755. var self=this,$self=this;
  35756. return $globals.IRJSTranslator;
  35757. },
  35758. args: [],
  35759. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  35760. referencedClasses: ["IRJSTranslator"],
  35761. messageSends: []
  35762. }),
  35763. $globals.CodeGenerator);
  35764. $core.addMethod(
  35765. $core.method({
  35766. selector: "semanticAnalyzer",
  35767. protocol: "compiling",
  35768. fn: function (){
  35769. var self=this,$self=this;
  35770. return $core.withContext(function($ctx1) {
  35771. var $1;
  35772. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  35773. $recv($1)._thePackage_($self._currentPackage());
  35774. return $recv($1)._yourself();
  35775. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  35776. },
  35777. args: [],
  35778. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  35779. referencedClasses: ["SemanticAnalyzer"],
  35780. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  35781. }),
  35782. $globals.CodeGenerator);
  35783. $core.addMethod(
  35784. $core.method({
  35785. selector: "transformersDictionary",
  35786. protocol: "compiling",
  35787. fn: function (){
  35788. var self=this,$self=this;
  35789. return $core.withContext(function($ctx1) {
  35790. var $1,$2,$receiver;
  35791. $1=$self["@transformersDictionary"];
  35792. if(($receiver = $1) == null || $receiver.a$nil){
  35793. $2=$recv($globals.Dictionary)._new();
  35794. $ctx1.sendIdx["new"]=1;
  35795. $recv($2)._at_put_("1000-earlyPragmas",$recv($globals.EarlyPragmator)._new());
  35796. $ctx1.sendIdx["at:put:"]=1;
  35797. $recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer());
  35798. $ctx1.sendIdx["at:put:"]=2;
  35799. $recv($2)._at_put_("5000-astToIr",$self._translator());
  35800. $ctx1.sendIdx["at:put:"]=3;
  35801. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  35802. $self["@transformersDictionary"]=$recv($2)._yourself();
  35803. return $self["@transformersDictionary"];
  35804. } else {
  35805. return $1;
  35806. }
  35807. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  35808. },
  35809. args: [],
  35810. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary new\x0a\x09\x09at: '1000-earlyPragmas' put: EarlyPragmator new;\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  35811. referencedClasses: ["Dictionary", "EarlyPragmator"],
  35812. messageSends: ["ifNil:", "at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  35813. }),
  35814. $globals.CodeGenerator);
  35815. $core.addMethod(
  35816. $core.method({
  35817. selector: "translator",
  35818. protocol: "compiling",
  35819. fn: function (){
  35820. var self=this,$self=this;
  35821. return $core.withContext(function($ctx1) {
  35822. var $1;
  35823. $1=$recv($globals.IRASTTranslator)._new();
  35824. $recv($1)._source_($self._source());
  35825. $recv($1)._theClass_($self._currentClass());
  35826. return $recv($1)._yourself();
  35827. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  35828. },
  35829. args: [],
  35830. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  35831. referencedClasses: ["IRASTTranslator"],
  35832. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  35833. }),
  35834. $globals.CodeGenerator);
  35835. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "codeGeneratorClass", "codeGenerator"], "Compiler-Core");
  35836. $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`";
  35837. $core.addMethod(
  35838. $core.method({
  35839. selector: "ast:forClass:protocol:",
  35840. protocol: "compiling",
  35841. fn: function (aString,aClass,anotherString){
  35842. var self=this,$self=this;
  35843. return $core.withContext(function($ctx1) {
  35844. var $early={};
  35845. try {
  35846. $self._source_(aString);
  35847. $self._forClass_protocol_(aClass,anotherString);
  35848. $recv($recv($self._codeGenerator())._transformersDictionary())._at_put_("2500-astCheckpoint",(function(x){
  35849. throw $early=[x];
  35850. }));
  35851. $self._compileNode_($self._parse_(aString));
  35852. $recv($globals.CompilerError)._signal_("AST transformation failed.");
  35853. return self;
  35854. }
  35855. catch(e) {if(e===$early)return e[0]; throw e}
  35856. }, function($ctx1) {$ctx1.fill(self,"ast:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  35857. },
  35858. args: ["aString", "aClass", "anotherString"],
  35859. source: "ast: aString forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString.\x0a\x0a\x09self codeGenerator transformersDictionary at: '2500-astCheckpoint' put: [ :x | ^x ].\x0a\x09\x0a\x09self compileNode: (self parse: aString).\x0a\x0a\x09CompilerError signal: 'AST transformation failed.'",
  35860. referencedClasses: ["CompilerError"],
  35861. messageSends: ["source:", "forClass:protocol:", "at:put:", "transformersDictionary", "codeGenerator", "compileNode:", "parse:", "signal:"]
  35862. }),
  35863. $globals.Compiler);
  35864. $core.addMethod(
  35865. $core.method({
  35866. selector: "cleanCodeGenerator",
  35867. protocol: "accessing",
  35868. fn: function (){
  35869. var self=this,$self=this;
  35870. $self["@codeGenerator"]=nil;
  35871. return self;
  35872. },
  35873. args: [],
  35874. source: "cleanCodeGenerator\x0a\x09codeGenerator := nil",
  35875. referencedClasses: [],
  35876. messageSends: []
  35877. }),
  35878. $globals.Compiler);
  35879. $core.addMethod(
  35880. $core.method({
  35881. selector: "codeGenerator",
  35882. protocol: "accessing",
  35883. fn: function (){
  35884. var self=this,$self=this;
  35885. return $core.withContext(function($ctx1) {
  35886. var $1,$2,$receiver;
  35887. $1=$self["@codeGenerator"];
  35888. if(($receiver = $1) == null || $receiver.a$nil){
  35889. $2=$recv($self._codeGeneratorClass())._new();
  35890. $recv($2)._source_($self._source());
  35891. $recv($2)._currentClass_($self._currentClass());
  35892. $recv($2)._currentPackage_($self._currentPackage());
  35893. $self["@codeGenerator"]=$recv($2)._yourself();
  35894. return $self["@codeGenerator"];
  35895. } else {
  35896. return $1;
  35897. }
  35898. }, function($ctx1) {$ctx1.fill(self,"codeGenerator",{},$globals.Compiler)});
  35899. },
  35900. args: [],
  35901. source: "codeGenerator\x0a\x09^ codeGenerator ifNil: [ codeGenerator := self codeGeneratorClass new\x0a\x09\x09\x09source: self source;\x0a\x09\x09\x09currentClass: self currentClass;\x0a\x09\x09\x09currentPackage: self currentPackage;\x0a\x09\x09\x09yourself ]",
  35902. referencedClasses: [],
  35903. messageSends: ["ifNil:", "source:", "new", "codeGeneratorClass", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "yourself"]
  35904. }),
  35905. $globals.Compiler);
  35906. $core.addMethod(
  35907. $core.method({
  35908. selector: "codeGeneratorClass",
  35909. protocol: "accessing",
  35910. fn: function (){
  35911. var self=this,$self=this;
  35912. return $core.withContext(function($ctx1) {
  35913. var $1,$receiver;
  35914. $1=$self["@codeGeneratorClass"];
  35915. if(($receiver = $1) == null || $receiver.a$nil){
  35916. return $globals.InliningCodeGenerator;
  35917. } else {
  35918. return $1;
  35919. }
  35920. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  35921. },
  35922. args: [],
  35923. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  35924. referencedClasses: ["InliningCodeGenerator"],
  35925. messageSends: ["ifNil:"]
  35926. }),
  35927. $globals.Compiler);
  35928. $core.addMethod(
  35929. $core.method({
  35930. selector: "codeGeneratorClass:",
  35931. protocol: "accessing",
  35932. fn: function (aClass){
  35933. var self=this,$self=this;
  35934. $self["@codeGeneratorClass"]=aClass;
  35935. return self;
  35936. },
  35937. args: ["aClass"],
  35938. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  35939. referencedClasses: [],
  35940. messageSends: []
  35941. }),
  35942. $globals.Compiler);
  35943. $core.addMethod(
  35944. $core.method({
  35945. selector: "compile:forClass:protocol:",
  35946. protocol: "compiling",
  35947. fn: function (aString,aClass,anotherString){
  35948. var self=this,$self=this;
  35949. return $core.withContext(function($ctx1) {
  35950. $self._source_(aString);
  35951. $self._forClass_protocol_(aClass,anotherString);
  35952. return $self._compileNode_($self._parse_(aString));
  35953. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  35954. },
  35955. args: ["aString", "aClass", "anotherString"],
  35956. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString;\x0a\x09\x09compileNode: (self parse: aString)",
  35957. referencedClasses: [],
  35958. messageSends: ["source:", "forClass:protocol:", "compileNode:", "parse:"]
  35959. }),
  35960. $globals.Compiler);
  35961. $core.addMethod(
  35962. $core.method({
  35963. selector: "compileExpression:on:",
  35964. protocol: "compiling",
  35965. fn: function (aString,anObject){
  35966. var self=this,$self=this;
  35967. return $core.withContext(function($ctx1) {
  35968. var $1;
  35969. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  35970. $ctx1.sendIdx[","]=1;
  35971. return $self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  35972. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  35973. },
  35974. args: ["aString", "anObject"],
  35975. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  35976. referencedClasses: [],
  35977. messageSends: ["compile:forClass:protocol:", ",", "class"]
  35978. }),
  35979. $globals.Compiler);
  35980. $core.addMethod(
  35981. $core.method({
  35982. selector: "compileNode:",
  35983. protocol: "compiling",
  35984. fn: function (aNode){
  35985. var self=this,$self=this;
  35986. var result;
  35987. return $core.withContext(function($ctx1) {
  35988. result=$recv($self._codeGenerator())._compileNode_(aNode);
  35989. $self._cleanCodeGenerator();
  35990. return result;
  35991. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,result:result},$globals.Compiler)});
  35992. },
  35993. args: ["aNode"],
  35994. source: "compileNode: aNode\x0a | result |\x0a\x09result := self codeGenerator compileNode: aNode.\x0a\x09self cleanCodeGenerator.\x0a\x09^ result",
  35995. referencedClasses: [],
  35996. messageSends: ["compileNode:", "codeGenerator", "cleanCodeGenerator"]
  35997. }),
  35998. $globals.Compiler);
  35999. $core.addMethod(
  36000. $core.method({
  36001. selector: "currentClass",
  36002. protocol: "accessing",
  36003. fn: function (){
  36004. var self=this,$self=this;
  36005. return $self["@currentClass"];
  36006. },
  36007. args: [],
  36008. source: "currentClass\x0a\x09^ currentClass",
  36009. referencedClasses: [],
  36010. messageSends: []
  36011. }),
  36012. $globals.Compiler);
  36013. $core.addMethod(
  36014. $core.method({
  36015. selector: "currentClass:",
  36016. protocol: "accessing",
  36017. fn: function (aClass){
  36018. var self=this,$self=this;
  36019. $self["@currentClass"]=aClass;
  36020. return self;
  36021. },
  36022. args: ["aClass"],
  36023. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  36024. referencedClasses: [],
  36025. messageSends: []
  36026. }),
  36027. $globals.Compiler);
  36028. $core.addMethod(
  36029. $core.method({
  36030. selector: "currentPackage",
  36031. protocol: "accessing",
  36032. fn: function (){
  36033. var self=this,$self=this;
  36034. return $self["@currentPackage"];
  36035. },
  36036. args: [],
  36037. source: "currentPackage\x0a\x09^ currentPackage",
  36038. referencedClasses: [],
  36039. messageSends: []
  36040. }),
  36041. $globals.Compiler);
  36042. $core.addMethod(
  36043. $core.method({
  36044. selector: "currentPackage:",
  36045. protocol: "accessing",
  36046. fn: function (anObject){
  36047. var self=this,$self=this;
  36048. $self["@currentPackage"]=anObject;
  36049. return self;
  36050. },
  36051. args: ["anObject"],
  36052. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  36053. referencedClasses: [],
  36054. messageSends: []
  36055. }),
  36056. $globals.Compiler);
  36057. $core.addMethod(
  36058. $core.method({
  36059. selector: "eval:",
  36060. protocol: "compiling",
  36061. fn: function (aString){
  36062. var self=this,$self=this;
  36063. return $core.withContext(function($ctx1) {
  36064. return eval(aString);
  36065. return self;
  36066. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  36067. },
  36068. args: ["aString"],
  36069. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  36070. referencedClasses: [],
  36071. messageSends: []
  36072. }),
  36073. $globals.Compiler);
  36074. $core.addMethod(
  36075. $core.method({
  36076. selector: "eval:forPackage:",
  36077. protocol: "compiling",
  36078. fn: function (aString,aPackage){
  36079. var self=this,$self=this;
  36080. return $core.withContext(function($ctx1) {
  36081. var $receiver;
  36082. if(($receiver = aPackage) == null || $receiver.a$nil){
  36083. return $self._eval_(aString);
  36084. $ctx1.sendIdx["eval:"]=1;
  36085. } else {
  36086. return $recv(aPackage)._eval_(aString);
  36087. }
  36088. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  36089. },
  36090. args: ["aString", "aPackage"],
  36091. source: "eval: aString forPackage: aPackage\x0a\x09^ aPackage\x0a\x09\x09ifNil: [ self eval: aString ]\x0a\x09\x09ifNotNil: [ aPackage eval: aString ]",
  36092. referencedClasses: [],
  36093. messageSends: ["ifNil:ifNotNil:", "eval:"]
  36094. }),
  36095. $globals.Compiler);
  36096. $core.addMethod(
  36097. $core.method({
  36098. selector: "evaluateExpression:",
  36099. protocol: "compiling",
  36100. fn: function (aString){
  36101. var self=this,$self=this;
  36102. return $core.withContext(function($ctx1) {
  36103. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  36104. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  36105. },
  36106. args: ["aString"],
  36107. 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",
  36108. referencedClasses: ["DoIt"],
  36109. messageSends: ["evaluateExpression:on:", "new"]
  36110. }),
  36111. $globals.Compiler);
  36112. $core.addMethod(
  36113. $core.method({
  36114. selector: "evaluateExpression:on:",
  36115. protocol: "compiling",
  36116. fn: function (aString,anObject){
  36117. var self=this,$self=this;
  36118. var result,method;
  36119. return $core.withContext(function($ctx1) {
  36120. var $1;
  36121. method=$self._eval_($self._compileExpression_on_(aString,anObject));
  36122. $recv(method)._protocol_("**xxxDoIt");
  36123. $1=$recv(anObject)._class();
  36124. $ctx1.sendIdx["class"]=1;
  36125. $recv($1)._addCompiledMethod_(method);
  36126. result=$recv(anObject)._xxxDoIt();
  36127. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  36128. return result;
  36129. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  36130. },
  36131. args: ["aString", "anObject"],
  36132. 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",
  36133. referencedClasses: [],
  36134. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  36135. }),
  36136. $globals.Compiler);
  36137. $core.addMethod(
  36138. $core.method({
  36139. selector: "forClass:protocol:",
  36140. protocol: "compiling",
  36141. fn: function (aClass,anotherString){
  36142. var self=this,$self=this;
  36143. return $core.withContext(function($ctx1) {
  36144. $self._currentPackage_($recv(aClass)._packageOfProtocol_(anotherString));
  36145. $self._currentClass_(aClass);
  36146. return self;
  36147. }, function($ctx1) {$ctx1.fill(self,"forClass:protocol:",{aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36148. },
  36149. args: ["aClass", "anotherString"],
  36150. source: "forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09currentPackage: (aClass packageOfProtocol: anotherString);\x0a\x09\x09currentClass: aClass",
  36151. referencedClasses: [],
  36152. messageSends: ["currentPackage:", "packageOfProtocol:", "currentClass:"]
  36153. }),
  36154. $globals.Compiler);
  36155. $core.addMethod(
  36156. $core.method({
  36157. selector: "install:forClass:protocol:",
  36158. protocol: "compiling",
  36159. fn: function (aString,aBehavior,anotherString){
  36160. var self=this,$self=this;
  36161. var compiledMethod;
  36162. return $core.withContext(function($ctx1) {
  36163. compiledMethod=$self._eval_forPackage_($self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  36164. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  36165. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  36166. },
  36167. args: ["aString", "aBehavior", "anotherString"],
  36168. 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",
  36169. referencedClasses: ["ClassBuilder"],
  36170. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  36171. }),
  36172. $globals.Compiler);
  36173. $core.addMethod(
  36174. $core.method({
  36175. selector: "parse:",
  36176. protocol: "compiling",
  36177. fn: function (aString){
  36178. var self=this,$self=this;
  36179. return $core.withContext(function($ctx1) {
  36180. return $recv($globals.Smalltalk)._parse_(aString);
  36181. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  36182. },
  36183. args: ["aString"],
  36184. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  36185. referencedClasses: ["Smalltalk"],
  36186. messageSends: ["parse:"]
  36187. }),
  36188. $globals.Compiler);
  36189. $core.addMethod(
  36190. $core.method({
  36191. selector: "parseExpression:",
  36192. protocol: "compiling",
  36193. fn: function (aString){
  36194. var self=this,$self=this;
  36195. return $core.withContext(function($ctx1) {
  36196. var $1;
  36197. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  36198. $ctx1.sendIdx[","]=1;
  36199. return $self._parse_($1);
  36200. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  36201. },
  36202. args: ["aString"],
  36203. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  36204. referencedClasses: [],
  36205. messageSends: ["parse:", ","]
  36206. }),
  36207. $globals.Compiler);
  36208. $core.addMethod(
  36209. $core.method({
  36210. selector: "recompile:",
  36211. protocol: "compiling",
  36212. fn: function (aClass){
  36213. var self=this,$self=this;
  36214. return $core.withContext(function($ctx1) {
  36215. var $1,$2,$3,$receiver;
  36216. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  36217. return $core.withContext(function($ctx2) {
  36218. $1=$recv($recv(each)._methodClass()).__eq(aClass);
  36219. $ctx2.sendIdx["="]=1;
  36220. if($core.assert($1)){
  36221. return $self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  36222. }
  36223. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36224. }),"Recompiling ".__comma($recv(aClass)._name()));
  36225. $2=$recv(aClass)._theMetaClass();
  36226. if(($receiver = $2) == null || $receiver.a$nil){
  36227. $2;
  36228. } else {
  36229. var meta;
  36230. meta=$receiver;
  36231. $3=$recv(meta).__eq(aClass);
  36232. if(!$core.assert($3)){
  36233. $self._recompile_(meta);
  36234. }
  36235. }
  36236. return self;
  36237. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  36238. },
  36239. args: ["aClass"],
  36240. 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 ] ]",
  36241. referencedClasses: [],
  36242. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
  36243. }),
  36244. $globals.Compiler);
  36245. $core.addMethod(
  36246. $core.method({
  36247. selector: "recompileAll",
  36248. protocol: "compiling",
  36249. fn: function (){
  36250. var self=this,$self=this;
  36251. return $core.withContext(function($ctx1) {
  36252. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  36253. return $core.withContext(function($ctx2) {
  36254. return $self._recompile_(each);
  36255. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36256. }),"Compiling all classes...");
  36257. return self;
  36258. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  36259. },
  36260. args: [],
  36261. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  36262. referencedClasses: ["Smalltalk"],
  36263. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  36264. }),
  36265. $globals.Compiler);
  36266. $core.addMethod(
  36267. $core.method({
  36268. selector: "source",
  36269. protocol: "accessing",
  36270. fn: function (){
  36271. var self=this,$self=this;
  36272. return $core.withContext(function($ctx1) {
  36273. var $1,$receiver;
  36274. $1=$self["@source"];
  36275. if(($receiver = $1) == null || $receiver.a$nil){
  36276. return "";
  36277. } else {
  36278. return $1;
  36279. }
  36280. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  36281. },
  36282. args: [],
  36283. source: "source\x0a\x09^ source ifNil: [ '' ]",
  36284. referencedClasses: [],
  36285. messageSends: ["ifNil:"]
  36286. }),
  36287. $globals.Compiler);
  36288. $core.addMethod(
  36289. $core.method({
  36290. selector: "source:",
  36291. protocol: "accessing",
  36292. fn: function (aString){
  36293. var self=this,$self=this;
  36294. $self["@source"]=aString;
  36295. return self;
  36296. },
  36297. args: ["aString"],
  36298. source: "source: aString\x0a\x09source := aString",
  36299. referencedClasses: [],
  36300. messageSends: []
  36301. }),
  36302. $globals.Compiler);
  36303. $core.addMethod(
  36304. $core.method({
  36305. selector: "eval:",
  36306. protocol: "evaluating",
  36307. fn: function (aString){
  36308. var self=this,$self=this;
  36309. return $core.withContext(function($ctx1) {
  36310. return $recv($self._new())._eval_(aString);
  36311. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler.a$cls)});
  36312. },
  36313. args: ["aString"],
  36314. source: "eval: aString\x0a\x09^ self new eval: aString",
  36315. referencedClasses: [],
  36316. messageSends: ["eval:", "new"]
  36317. }),
  36318. $globals.Compiler.a$cls);
  36319. $core.addMethod(
  36320. $core.method({
  36321. selector: "recompile:",
  36322. protocol: "compiling",
  36323. fn: function (aClass){
  36324. var self=this,$self=this;
  36325. return $core.withContext(function($ctx1) {
  36326. $recv($self._new())._recompile_(aClass);
  36327. return self;
  36328. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.a$cls)});
  36329. },
  36330. args: ["aClass"],
  36331. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  36332. referencedClasses: [],
  36333. messageSends: ["recompile:", "new"]
  36334. }),
  36335. $globals.Compiler.a$cls);
  36336. $core.addMethod(
  36337. $core.method({
  36338. selector: "recompileAll",
  36339. protocol: "compiling",
  36340. fn: function (){
  36341. var self=this,$self=this;
  36342. return $core.withContext(function($ctx1) {
  36343. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  36344. return $core.withContext(function($ctx2) {
  36345. return $self._recompile_(each);
  36346. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36347. }));
  36348. return self;
  36349. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.a$cls)});
  36350. },
  36351. args: [],
  36352. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  36353. referencedClasses: ["Smalltalk"],
  36354. messageSends: ["do:", "classes", "recompile:"]
  36355. }),
  36356. $globals.Compiler.a$cls);
  36357. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  36358. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  36359. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  36360. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  36361. $core.addMethod(
  36362. $core.method({
  36363. selector: "evaluate:context:",
  36364. protocol: "evaluating",
  36365. fn: function (aString,aContext){
  36366. var self=this,$self=this;
  36367. var compiler,ast;
  36368. return $core.withContext(function($ctx1) {
  36369. var $1;
  36370. var $early={};
  36371. try {
  36372. compiler=$recv($globals.Compiler)._new();
  36373. $recv((function(){
  36374. return $core.withContext(function($ctx2) {
  36375. ast=$recv(compiler)._parseExpression_(aString);
  36376. return ast;
  36377. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36378. }))._on_do_($globals.Error,(function(ex){
  36379. return $core.withContext(function($ctx2) {
  36380. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36381. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36382. }));
  36383. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  36384. $recv($1)._context_(aContext);
  36385. $recv($1)._visit_(ast);
  36386. return $recv(aContext)._evaluateNode_(ast);
  36387. }
  36388. catch(e) {if(e===$early)return e[0]; throw e}
  36389. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  36390. },
  36391. args: ["aString", "aContext"],
  36392. 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",
  36393. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  36394. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  36395. }),
  36396. $globals.Evaluator);
  36397. $core.addMethod(
  36398. $core.method({
  36399. selector: "evaluate:for:",
  36400. protocol: "evaluating",
  36401. fn: function (aString,anObject){
  36402. var self=this,$self=this;
  36403. return $core.withContext(function($ctx1) {
  36404. return $recv(anObject)._evaluate_on_(aString,self);
  36405. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  36406. },
  36407. args: ["aString", "anObject"],
  36408. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  36409. referencedClasses: [],
  36410. messageSends: ["evaluate:on:"]
  36411. }),
  36412. $globals.Evaluator);
  36413. $core.addMethod(
  36414. $core.method({
  36415. selector: "evaluate:receiver:",
  36416. protocol: "evaluating",
  36417. fn: function (aString,anObject){
  36418. var self=this,$self=this;
  36419. var compiler;
  36420. return $core.withContext(function($ctx1) {
  36421. var $early={};
  36422. try {
  36423. compiler=$recv($globals.Compiler)._new();
  36424. $recv((function(){
  36425. return $core.withContext(function($ctx2) {
  36426. return $recv(compiler)._parseExpression_(aString);
  36427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36428. }))._on_do_($globals.Error,(function(ex){
  36429. return $core.withContext(function($ctx2) {
  36430. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36431. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36432. }));
  36433. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  36434. }
  36435. catch(e) {if(e===$early)return e[0]; throw e}
  36436. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  36437. },
  36438. args: ["aString", "anObject"],
  36439. 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",
  36440. referencedClasses: ["Compiler", "Error", "Terminal"],
  36441. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  36442. }),
  36443. $globals.Evaluator);
  36444. $core.addMethod(
  36445. $core.method({
  36446. selector: "evaluate:for:",
  36447. protocol: "instance creation",
  36448. fn: function (aString,anObject){
  36449. var self=this,$self=this;
  36450. return $core.withContext(function($ctx1) {
  36451. return $recv($self._new())._evaluate_for_(aString,anObject);
  36452. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.a$cls)});
  36453. },
  36454. args: ["aString", "anObject"],
  36455. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  36456. referencedClasses: [],
  36457. messageSends: ["evaluate:for:", "new"]
  36458. }),
  36459. $globals.Evaluator.a$cls);
  36460. $core.addClass("Pragmator", $globals.NodeVisitor, ["methodNode", "sequenceNode"], "Compiler-Core");
  36461. $globals.Pragmator.comment="I am abstract superclass for pragma-processing transformer.\x0a\x0aMy subclasses should implement messages for each pragma\x0athey process. Pragma processing checks if a message is known\x0ato a class but not to its superclass. IOW, each and only those\x0apragmas are processed which are defined as methods in the subclass.\x0a\x0aThese messages can access sequence node in which\x0aa pragma occurred and its containing method node\x0aas `self sequenceNode` and `self methodNode`.\x0a\x0aSee `EarlyPragmator` for an example.";
  36462. $core.addMethod(
  36463. $core.method({
  36464. selector: "canProcessPragma:",
  36465. protocol: "pragma processing",
  36466. fn: function (aMessage){
  36467. var self=this,$self=this;
  36468. var selector;
  36469. return $core.withContext(function($ctx1) {
  36470. selector=$recv(aMessage)._selector();
  36471. return $recv($self._respondsTo_(selector))._and_((function(){
  36472. return $core.withContext(function($ctx2) {
  36473. return $recv($recv($recv($self._class())._superclass())._canUnderstand_(selector))._not();
  36474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36475. }));
  36476. }, function($ctx1) {$ctx1.fill(self,"canProcessPragma:",{aMessage:aMessage,selector:selector},$globals.Pragmator)});
  36477. },
  36478. args: ["aMessage"],
  36479. source: "canProcessPragma: aMessage\x0a\x09| selector |\x0a\x09selector := aMessage selector.\x0a\x09^ (self respondsTo: selector) and: [\x0a\x09\x09(self class superclass canUnderstand: selector) not]",
  36480. referencedClasses: [],
  36481. messageSends: ["selector", "and:", "respondsTo:", "not", "canUnderstand:", "superclass", "class"]
  36482. }),
  36483. $globals.Pragmator);
  36484. $core.addMethod(
  36485. $core.method({
  36486. selector: "methodNode",
  36487. protocol: "accessing",
  36488. fn: function (){
  36489. var self=this,$self=this;
  36490. return $self["@methodNode"];
  36491. },
  36492. args: [],
  36493. source: "methodNode\x0a\x09^ methodNode",
  36494. referencedClasses: [],
  36495. messageSends: []
  36496. }),
  36497. $globals.Pragmator);
  36498. $core.addMethod(
  36499. $core.method({
  36500. selector: "methodNode:",
  36501. protocol: "accessing",
  36502. fn: function (anObject){
  36503. var self=this,$self=this;
  36504. $self["@methodNode"]=anObject;
  36505. return self;
  36506. },
  36507. args: ["anObject"],
  36508. source: "methodNode: anObject\x0a\x09methodNode := anObject",
  36509. referencedClasses: [],
  36510. messageSends: []
  36511. }),
  36512. $globals.Pragmator);
  36513. $core.addMethod(
  36514. $core.method({
  36515. selector: "processPragma:",
  36516. protocol: "pragma processing",
  36517. fn: function (aMessage){
  36518. var self=this,$self=this;
  36519. return $core.withContext(function($ctx1) {
  36520. var $1;
  36521. $1=$self._canProcessPragma_(aMessage);
  36522. if($core.assert($1)){
  36523. return $recv(aMessage)._sendTo_(self);
  36524. }
  36525. return self;
  36526. }, function($ctx1) {$ctx1.fill(self,"processPragma:",{aMessage:aMessage},$globals.Pragmator)});
  36527. },
  36528. args: ["aMessage"],
  36529. source: "processPragma: aMessage\x0a\x09(self canProcessPragma: aMessage) ifTrue: [\x0a\x09\x09^ aMessage sendTo: self ]",
  36530. referencedClasses: [],
  36531. messageSends: ["ifTrue:", "canProcessPragma:", "sendTo:"]
  36532. }),
  36533. $globals.Pragmator);
  36534. $core.addMethod(
  36535. $core.method({
  36536. selector: "sequenceNode",
  36537. protocol: "accessing",
  36538. fn: function (){
  36539. var self=this,$self=this;
  36540. return $self["@sequenceNode"];
  36541. },
  36542. args: [],
  36543. source: "sequenceNode\x0a\x09^ sequenceNode",
  36544. referencedClasses: [],
  36545. messageSends: []
  36546. }),
  36547. $globals.Pragmator);
  36548. $core.addMethod(
  36549. $core.method({
  36550. selector: "sequenceNode:",
  36551. protocol: "accessing",
  36552. fn: function (anObject){
  36553. var self=this,$self=this;
  36554. $self["@sequenceNode"]=anObject;
  36555. return self;
  36556. },
  36557. args: ["anObject"],
  36558. source: "sequenceNode: anObject\x0a\x09sequenceNode := anObject",
  36559. referencedClasses: [],
  36560. messageSends: []
  36561. }),
  36562. $globals.Pragmator);
  36563. $core.addMethod(
  36564. $core.method({
  36565. selector: "visitMethodNode:",
  36566. protocol: "pragma processing",
  36567. fn: function (aNode){
  36568. var self=this,$self=this;
  36569. return $core.withContext(function($ctx1) {
  36570. var $1;
  36571. $self._methodNode_(aNode);
  36572. $1=(
  36573. $ctx1.supercall = true,
  36574. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  36575. $ctx1.supercall = false;
  36576. return $1;
  36577. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.Pragmator)});
  36578. },
  36579. args: ["aNode"],
  36580. source: "visitMethodNode: aNode\x0a\x09self methodNode: aNode.\x0a\x09^ super visitMethodNode: aNode",
  36581. referencedClasses: [],
  36582. messageSends: ["methodNode:", "visitMethodNode:"]
  36583. }),
  36584. $globals.Pragmator);
  36585. $core.addMethod(
  36586. $core.method({
  36587. selector: "visitSequenceNode:",
  36588. protocol: "pragma processing",
  36589. fn: function (aNode){
  36590. var self=this,$self=this;
  36591. return $core.withContext(function($ctx1) {
  36592. var $1;
  36593. $self._sequenceNode_(aNode);
  36594. $recv($recv(aNode)._pragmas())._do_((function(each){
  36595. return $core.withContext(function($ctx2) {
  36596. return $self._processPragma_(each);
  36597. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36598. }));
  36599. $1=(
  36600. $ctx1.supercall = true,
  36601. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  36602. $ctx1.supercall = false;
  36603. return $1;
  36604. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.Pragmator)});
  36605. },
  36606. args: ["aNode"],
  36607. source: "visitSequenceNode: aNode\x0a\x09self sequenceNode: aNode.\x0a\x09aNode pragmas do: [ :each | self processPragma: each ].\x0a\x09^ super visitSequenceNode: aNode",
  36608. referencedClasses: [],
  36609. messageSends: ["sequenceNode:", "do:", "pragmas", "processPragma:", "visitSequenceNode:"]
  36610. }),
  36611. $globals.Pragmator);
  36612. $core.addClass("EarlyPragmator", $globals.Pragmator, [], "Compiler-Core");
  36613. $core.addMethod(
  36614. $core.method({
  36615. selector: "asVariableName",
  36616. protocol: "*Compiler-Core",
  36617. fn: function (){
  36618. var self=this,$self=this;
  36619. return $core.withContext(function($ctx1) {
  36620. var $1;
  36621. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  36622. if($core.assert($1)){
  36623. return $self.__comma("_");
  36624. } else {
  36625. return self;
  36626. }
  36627. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  36628. },
  36629. args: [],
  36630. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  36631. referencedClasses: ["Smalltalk"],
  36632. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  36633. }),
  36634. $globals.String);
  36635. });
  36636. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  36637. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  36638. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  36639. $core.addPackage("Compiler-Semantic");
  36640. ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  36641. ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  36642. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  36643. $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.";
  36644. $core.addMethod(
  36645. $core.method({
  36646. selector: "addArg:",
  36647. protocol: "adding",
  36648. fn: function (aString){
  36649. var self=this,$self=this;
  36650. return $core.withContext(function($ctx1) {
  36651. var $1;
  36652. $1=$self._args();
  36653. $ctx1.sendIdx["args"]=1;
  36654. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  36655. $recv($recv($self._args())._at_(aString))._scope_(self);
  36656. return self;
  36657. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  36658. },
  36659. args: ["aString"],
  36660. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  36661. referencedClasses: ["ArgVar"],
  36662. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  36663. }),
  36664. $globals.LexicalScope);
  36665. $core.addMethod(
  36666. $core.method({
  36667. selector: "addTemp:",
  36668. protocol: "adding",
  36669. fn: function (aString){
  36670. var self=this,$self=this;
  36671. return $core.withContext(function($ctx1) {
  36672. var $1;
  36673. $1=$self._temps();
  36674. $ctx1.sendIdx["temps"]=1;
  36675. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  36676. $recv($recv($self._temps())._at_(aString))._scope_(self);
  36677. return self;
  36678. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  36679. },
  36680. args: ["aString"],
  36681. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  36682. referencedClasses: ["TempVar"],
  36683. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  36684. }),
  36685. $globals.LexicalScope);
  36686. $core.addMethod(
  36687. $core.method({
  36688. selector: "alias",
  36689. protocol: "accessing",
  36690. fn: function (){
  36691. var self=this,$self=this;
  36692. return $core.withContext(function($ctx1) {
  36693. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  36694. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  36695. },
  36696. args: [],
  36697. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  36698. referencedClasses: [],
  36699. messageSends: [",", "asString", "scopeLevel"]
  36700. }),
  36701. $globals.LexicalScope);
  36702. $core.addMethod(
  36703. $core.method({
  36704. selector: "allVariableNames",
  36705. protocol: "accessing",
  36706. fn: function (){
  36707. var self=this,$self=this;
  36708. return $core.withContext(function($ctx1) {
  36709. var $1;
  36710. $1=$recv($self._args())._keys();
  36711. $ctx1.sendIdx["keys"]=1;
  36712. return $recv($1).__comma($recv($self._temps())._keys());
  36713. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  36714. },
  36715. args: [],
  36716. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  36717. referencedClasses: [],
  36718. messageSends: [",", "keys", "args", "temps"]
  36719. }),
  36720. $globals.LexicalScope);
  36721. $core.addMethod(
  36722. $core.method({
  36723. selector: "args",
  36724. protocol: "accessing",
  36725. fn: function (){
  36726. var self=this,$self=this;
  36727. return $core.withContext(function($ctx1) {
  36728. var $1,$receiver;
  36729. $1=$self["@args"];
  36730. if(($receiver = $1) == null || $receiver.a$nil){
  36731. $self["@args"]=$recv($globals.Dictionary)._new();
  36732. return $self["@args"];
  36733. } else {
  36734. return $1;
  36735. }
  36736. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  36737. },
  36738. args: [],
  36739. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  36740. referencedClasses: ["Dictionary"],
  36741. messageSends: ["ifNil:", "new"]
  36742. }),
  36743. $globals.LexicalScope);
  36744. $core.addMethod(
  36745. $core.method({
  36746. selector: "bindingFor:",
  36747. protocol: "accessing",
  36748. fn: function (aStringOrNode){
  36749. var self=this,$self=this;
  36750. return $core.withContext(function($ctx1) {
  36751. var $2,$3,$4,$5,$1;
  36752. $2=$self._pseudoVars();
  36753. $3=$recv(aStringOrNode)._value();
  36754. $ctx1.sendIdx["value"]=1;
  36755. $1=$recv($2)._at_ifAbsent_($3,(function(){
  36756. return $core.withContext(function($ctx2) {
  36757. $4=$self._args();
  36758. $5=$recv(aStringOrNode)._value();
  36759. $ctx2.sendIdx["value"]=2;
  36760. return $recv($4)._at_ifAbsent_($5,(function(){
  36761. return $core.withContext(function($ctx3) {
  36762. return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  36763. return nil;
  36764. }));
  36765. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36766. }));
  36767. $ctx2.sendIdx["at:ifAbsent:"]=2;
  36768. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36769. }));
  36770. $ctx1.sendIdx["at:ifAbsent:"]=1;
  36771. return $1;
  36772. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  36773. },
  36774. args: ["aStringOrNode"],
  36775. 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 ]]]",
  36776. referencedClasses: [],
  36777. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  36778. }),
  36779. $globals.LexicalScope);
  36780. $core.addMethod(
  36781. $core.method({
  36782. selector: "blockIndex",
  36783. protocol: "accessing",
  36784. fn: function (){
  36785. var self=this,$self=this;
  36786. return $core.withContext(function($ctx1) {
  36787. var $1,$receiver;
  36788. $1=$self["@blockIndex"];
  36789. if(($receiver = $1) == null || $receiver.a$nil){
  36790. return (0);
  36791. } else {
  36792. return $1;
  36793. }
  36794. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  36795. },
  36796. args: [],
  36797. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  36798. referencedClasses: [],
  36799. messageSends: ["ifNil:"]
  36800. }),
  36801. $globals.LexicalScope);
  36802. $core.addMethod(
  36803. $core.method({
  36804. selector: "blockIndex:",
  36805. protocol: "accessing",
  36806. fn: function (anInteger){
  36807. var self=this,$self=this;
  36808. $self["@blockIndex"]=anInteger;
  36809. return self;
  36810. },
  36811. args: ["anInteger"],
  36812. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  36813. referencedClasses: [],
  36814. messageSends: []
  36815. }),
  36816. $globals.LexicalScope);
  36817. $core.addMethod(
  36818. $core.method({
  36819. selector: "canInlineNonLocalReturns",
  36820. protocol: "testing",
  36821. fn: function (){
  36822. var self=this,$self=this;
  36823. return $core.withContext(function($ctx1) {
  36824. return $recv($self._isInlined())._and_((function(){
  36825. return $core.withContext(function($ctx2) {
  36826. return $recv($self._outerScope())._canInlineNonLocalReturns();
  36827. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36828. }));
  36829. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  36830. },
  36831. args: [],
  36832. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  36833. referencedClasses: [],
  36834. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  36835. }),
  36836. $globals.LexicalScope);
  36837. $core.addMethod(
  36838. $core.method({
  36839. selector: "instruction",
  36840. protocol: "accessing",
  36841. fn: function (){
  36842. var self=this,$self=this;
  36843. return $self["@instruction"];
  36844. },
  36845. args: [],
  36846. source: "instruction\x0a\x09^ instruction",
  36847. referencedClasses: [],
  36848. messageSends: []
  36849. }),
  36850. $globals.LexicalScope);
  36851. $core.addMethod(
  36852. $core.method({
  36853. selector: "instruction:",
  36854. protocol: "accessing",
  36855. fn: function (anIRInstruction){
  36856. var self=this,$self=this;
  36857. $self["@instruction"]=anIRInstruction;
  36858. return self;
  36859. },
  36860. args: ["anIRInstruction"],
  36861. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  36862. referencedClasses: [],
  36863. messageSends: []
  36864. }),
  36865. $globals.LexicalScope);
  36866. $core.addMethod(
  36867. $core.method({
  36868. selector: "isBlockScope",
  36869. protocol: "testing",
  36870. fn: function (){
  36871. var self=this,$self=this;
  36872. return $core.withContext(function($ctx1) {
  36873. return $recv($self._isMethodScope())._not();
  36874. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  36875. },
  36876. args: [],
  36877. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  36878. referencedClasses: [],
  36879. messageSends: ["not", "isMethodScope"]
  36880. }),
  36881. $globals.LexicalScope);
  36882. $core.addMethod(
  36883. $core.method({
  36884. selector: "isInlined",
  36885. protocol: "testing",
  36886. fn: function (){
  36887. var self=this,$self=this;
  36888. return $core.withContext(function($ctx1) {
  36889. var $2,$1;
  36890. $2=$self._instruction();
  36891. $ctx1.sendIdx["instruction"]=1;
  36892. $1=$recv($2)._notNil();
  36893. return $recv($1)._and_((function(){
  36894. return $core.withContext(function($ctx2) {
  36895. return $recv($self._instruction())._isInlined();
  36896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36897. }));
  36898. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  36899. },
  36900. args: [],
  36901. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  36902. referencedClasses: [],
  36903. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  36904. }),
  36905. $globals.LexicalScope);
  36906. $core.addMethod(
  36907. $core.method({
  36908. selector: "isMethodScope",
  36909. protocol: "testing",
  36910. fn: function (){
  36911. var self=this,$self=this;
  36912. return false;
  36913. },
  36914. args: [],
  36915. source: "isMethodScope\x0a\x09^ false",
  36916. referencedClasses: [],
  36917. messageSends: []
  36918. }),
  36919. $globals.LexicalScope);
  36920. $core.addMethod(
  36921. $core.method({
  36922. selector: "lookupVariable:",
  36923. protocol: "accessing",
  36924. fn: function (aNode){
  36925. var self=this,$self=this;
  36926. var lookup;
  36927. return $core.withContext(function($ctx1) {
  36928. var $1,$2,$receiver;
  36929. lookup=$self._bindingFor_(aNode);
  36930. $1=lookup;
  36931. if(($receiver = $1) == null || $receiver.a$nil){
  36932. $2=$self._outerScope();
  36933. $ctx1.sendIdx["outerScope"]=1;
  36934. if(($receiver = $2) == null || $receiver.a$nil){
  36935. lookup=$2;
  36936. } else {
  36937. lookup=$recv($self._outerScope())._lookupVariable_(aNode);
  36938. }
  36939. lookup;
  36940. } else {
  36941. $1;
  36942. }
  36943. return lookup;
  36944. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  36945. },
  36946. args: ["aNode"],
  36947. 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",
  36948. referencedClasses: [],
  36949. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  36950. }),
  36951. $globals.LexicalScope);
  36952. $core.addMethod(
  36953. $core.method({
  36954. selector: "methodScope",
  36955. protocol: "accessing",
  36956. fn: function (){
  36957. var self=this,$self=this;
  36958. return $core.withContext(function($ctx1) {
  36959. var $1,$receiver;
  36960. $1=$self._outerScope();
  36961. $ctx1.sendIdx["outerScope"]=1;
  36962. if(($receiver = $1) == null || $receiver.a$nil){
  36963. return $1;
  36964. } else {
  36965. return $recv($self._outerScope())._methodScope();
  36966. }
  36967. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  36968. },
  36969. args: [],
  36970. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  36971. referencedClasses: [],
  36972. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  36973. }),
  36974. $globals.LexicalScope);
  36975. $core.addMethod(
  36976. $core.method({
  36977. selector: "node",
  36978. protocol: "accessing",
  36979. fn: function (){
  36980. var self=this,$self=this;
  36981. return $self["@node"];
  36982. },
  36983. args: [],
  36984. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  36985. referencedClasses: [],
  36986. messageSends: []
  36987. }),
  36988. $globals.LexicalScope);
  36989. $core.addMethod(
  36990. $core.method({
  36991. selector: "node:",
  36992. protocol: "accessing",
  36993. fn: function (aNode){
  36994. var self=this,$self=this;
  36995. $self["@node"]=aNode;
  36996. return self;
  36997. },
  36998. args: ["aNode"],
  36999. source: "node: aNode\x0a\x09node := aNode",
  37000. referencedClasses: [],
  37001. messageSends: []
  37002. }),
  37003. $globals.LexicalScope);
  37004. $core.addMethod(
  37005. $core.method({
  37006. selector: "outerScope",
  37007. protocol: "accessing",
  37008. fn: function (){
  37009. var self=this,$self=this;
  37010. return $self["@outerScope"];
  37011. },
  37012. args: [],
  37013. source: "outerScope\x0a\x09^ outerScope",
  37014. referencedClasses: [],
  37015. messageSends: []
  37016. }),
  37017. $globals.LexicalScope);
  37018. $core.addMethod(
  37019. $core.method({
  37020. selector: "outerScope:",
  37021. protocol: "accessing",
  37022. fn: function (aLexicalScope){
  37023. var self=this,$self=this;
  37024. $self["@outerScope"]=aLexicalScope;
  37025. return self;
  37026. },
  37027. args: ["aLexicalScope"],
  37028. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  37029. referencedClasses: [],
  37030. messageSends: []
  37031. }),
  37032. $globals.LexicalScope);
  37033. $core.addMethod(
  37034. $core.method({
  37035. selector: "pseudoVars",
  37036. protocol: "accessing",
  37037. fn: function (){
  37038. var self=this,$self=this;
  37039. return $core.withContext(function($ctx1) {
  37040. return $recv($self._methodScope())._pseudoVars();
  37041. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  37042. },
  37043. args: [],
  37044. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  37045. referencedClasses: [],
  37046. messageSends: ["pseudoVars", "methodScope"]
  37047. }),
  37048. $globals.LexicalScope);
  37049. $core.addMethod(
  37050. $core.method({
  37051. selector: "scopeLevel",
  37052. protocol: "accessing",
  37053. fn: function (){
  37054. var self=this,$self=this;
  37055. return $core.withContext(function($ctx1) {
  37056. var $1,$2,$4,$3,$receiver;
  37057. $1=$self._outerScope();
  37058. $ctx1.sendIdx["outerScope"]=1;
  37059. if(($receiver = $1) == null || $receiver.a$nil){
  37060. return (1);
  37061. } else {
  37062. $1;
  37063. }
  37064. $2=$self._isInlined();
  37065. if($core.assert($2)){
  37066. $4=$self._outerScope();
  37067. $ctx1.sendIdx["outerScope"]=2;
  37068. $3=$recv($4)._scopeLevel();
  37069. $ctx1.sendIdx["scopeLevel"]=1;
  37070. return $3;
  37071. }
  37072. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  37073. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  37074. },
  37075. args: [],
  37076. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  37077. referencedClasses: [],
  37078. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  37079. }),
  37080. $globals.LexicalScope);
  37081. $core.addMethod(
  37082. $core.method({
  37083. selector: "temps",
  37084. protocol: "accessing",
  37085. fn: function (){
  37086. var self=this,$self=this;
  37087. return $core.withContext(function($ctx1) {
  37088. var $1,$receiver;
  37089. $1=$self["@temps"];
  37090. if(($receiver = $1) == null || $receiver.a$nil){
  37091. $self["@temps"]=$recv($globals.Dictionary)._new();
  37092. return $self["@temps"];
  37093. } else {
  37094. return $1;
  37095. }
  37096. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  37097. },
  37098. args: [],
  37099. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  37100. referencedClasses: ["Dictionary"],
  37101. messageSends: ["ifNil:", "new"]
  37102. }),
  37103. $globals.LexicalScope);
  37104. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  37105. $globals.MethodLexicalScope.comment="I represent a method scope.";
  37106. $core.addMethod(
  37107. $core.method({
  37108. selector: "addIVar:",
  37109. protocol: "adding",
  37110. fn: function (aString){
  37111. var self=this,$self=this;
  37112. return $core.withContext(function($ctx1) {
  37113. var $1;
  37114. $1=$self._iVars();
  37115. $ctx1.sendIdx["iVars"]=1;
  37116. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  37117. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  37118. return self;
  37119. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  37120. },
  37121. args: ["aString"],
  37122. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  37123. referencedClasses: ["InstanceVar"],
  37124. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  37125. }),
  37126. $globals.MethodLexicalScope);
  37127. $core.addMethod(
  37128. $core.method({
  37129. selector: "addNonLocalReturn:",
  37130. protocol: "adding",
  37131. fn: function (aScope){
  37132. var self=this,$self=this;
  37133. return $core.withContext(function($ctx1) {
  37134. $recv($self._nonLocalReturns())._add_(aScope);
  37135. return self;
  37136. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37137. },
  37138. args: ["aScope"],
  37139. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  37140. referencedClasses: [],
  37141. messageSends: ["add:", "nonLocalReturns"]
  37142. }),
  37143. $globals.MethodLexicalScope);
  37144. $core.addMethod(
  37145. $core.method({
  37146. selector: "allVariableNames",
  37147. protocol: "accessing",
  37148. fn: function (){
  37149. var self=this,$self=this;
  37150. return $core.withContext(function($ctx1) {
  37151. var $1;
  37152. $1=(
  37153. $ctx1.supercall = true,
  37154. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, []));
  37155. $ctx1.supercall = false;
  37156. return $recv($1).__comma($recv($self._iVars())._keys());
  37157. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  37158. },
  37159. args: [],
  37160. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  37161. referencedClasses: [],
  37162. messageSends: [",", "allVariableNames", "keys", "iVars"]
  37163. }),
  37164. $globals.MethodLexicalScope);
  37165. $core.addMethod(
  37166. $core.method({
  37167. selector: "bindingFor:",
  37168. protocol: "accessing",
  37169. fn: function (aNode){
  37170. var self=this,$self=this;
  37171. return $core.withContext(function($ctx1) {
  37172. var $1,$receiver;
  37173. $1=(
  37174. $ctx1.supercall = true,
  37175. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode]));
  37176. $ctx1.supercall = false;
  37177. if(($receiver = $1) == null || $receiver.a$nil){
  37178. return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  37179. return nil;
  37180. }));
  37181. } else {
  37182. return $1;
  37183. }
  37184. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  37185. },
  37186. args: ["aNode"],
  37187. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  37188. referencedClasses: [],
  37189. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  37190. }),
  37191. $globals.MethodLexicalScope);
  37192. $core.addMethod(
  37193. $core.method({
  37194. selector: "canInlineNonLocalReturns",
  37195. protocol: "testing",
  37196. fn: function (){
  37197. var self=this,$self=this;
  37198. return true;
  37199. },
  37200. args: [],
  37201. source: "canInlineNonLocalReturns\x0a\x09^ true",
  37202. referencedClasses: [],
  37203. messageSends: []
  37204. }),
  37205. $globals.MethodLexicalScope);
  37206. $core.addMethod(
  37207. $core.method({
  37208. selector: "hasLocalReturn",
  37209. protocol: "testing",
  37210. fn: function (){
  37211. var self=this,$self=this;
  37212. return $core.withContext(function($ctx1) {
  37213. return $self._localReturn();
  37214. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  37215. },
  37216. args: [],
  37217. source: "hasLocalReturn\x0a\x09^ self localReturn",
  37218. referencedClasses: [],
  37219. messageSends: ["localReturn"]
  37220. }),
  37221. $globals.MethodLexicalScope);
  37222. $core.addMethod(
  37223. $core.method({
  37224. selector: "hasNonLocalReturn",
  37225. protocol: "testing",
  37226. fn: function (){
  37227. var self=this,$self=this;
  37228. return $core.withContext(function($ctx1) {
  37229. return $recv($self._nonLocalReturns())._notEmpty();
  37230. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  37231. },
  37232. args: [],
  37233. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  37234. referencedClasses: [],
  37235. messageSends: ["notEmpty", "nonLocalReturns"]
  37236. }),
  37237. $globals.MethodLexicalScope);
  37238. $core.addMethod(
  37239. $core.method({
  37240. selector: "iVars",
  37241. protocol: "accessing",
  37242. fn: function (){
  37243. var self=this,$self=this;
  37244. return $core.withContext(function($ctx1) {
  37245. var $1,$receiver;
  37246. $1=$self["@iVars"];
  37247. if(($receiver = $1) == null || $receiver.a$nil){
  37248. $self["@iVars"]=$recv($globals.Dictionary)._new();
  37249. return $self["@iVars"];
  37250. } else {
  37251. return $1;
  37252. }
  37253. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  37254. },
  37255. args: [],
  37256. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  37257. referencedClasses: ["Dictionary"],
  37258. messageSends: ["ifNil:", "new"]
  37259. }),
  37260. $globals.MethodLexicalScope);
  37261. $core.addMethod(
  37262. $core.method({
  37263. selector: "isMethodScope",
  37264. protocol: "testing",
  37265. fn: function (){
  37266. var self=this,$self=this;
  37267. return true;
  37268. },
  37269. args: [],
  37270. source: "isMethodScope\x0a\x09^ true",
  37271. referencedClasses: [],
  37272. messageSends: []
  37273. }),
  37274. $globals.MethodLexicalScope);
  37275. $core.addMethod(
  37276. $core.method({
  37277. selector: "localReturn",
  37278. protocol: "accessing",
  37279. fn: function (){
  37280. var self=this,$self=this;
  37281. return $core.withContext(function($ctx1) {
  37282. var $1,$receiver;
  37283. $1=$self["@localReturn"];
  37284. if(($receiver = $1) == null || $receiver.a$nil){
  37285. return false;
  37286. } else {
  37287. return $1;
  37288. }
  37289. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  37290. },
  37291. args: [],
  37292. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  37293. referencedClasses: [],
  37294. messageSends: ["ifNil:"]
  37295. }),
  37296. $globals.MethodLexicalScope);
  37297. $core.addMethod(
  37298. $core.method({
  37299. selector: "localReturn:",
  37300. protocol: "accessing",
  37301. fn: function (aBoolean){
  37302. var self=this,$self=this;
  37303. $self["@localReturn"]=aBoolean;
  37304. return self;
  37305. },
  37306. args: ["aBoolean"],
  37307. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  37308. referencedClasses: [],
  37309. messageSends: []
  37310. }),
  37311. $globals.MethodLexicalScope);
  37312. $core.addMethod(
  37313. $core.method({
  37314. selector: "methodScope",
  37315. protocol: "accessing",
  37316. fn: function (){
  37317. var self=this,$self=this;
  37318. return self;
  37319. },
  37320. args: [],
  37321. source: "methodScope\x0a\x09^ self",
  37322. referencedClasses: [],
  37323. messageSends: []
  37324. }),
  37325. $globals.MethodLexicalScope);
  37326. $core.addMethod(
  37327. $core.method({
  37328. selector: "nonLocalReturns",
  37329. protocol: "accessing",
  37330. fn: function (){
  37331. var self=this,$self=this;
  37332. return $core.withContext(function($ctx1) {
  37333. var $1,$receiver;
  37334. $1=$self["@nonLocalReturns"];
  37335. if(($receiver = $1) == null || $receiver.a$nil){
  37336. $self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  37337. return $self["@nonLocalReturns"];
  37338. } else {
  37339. return $1;
  37340. }
  37341. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  37342. },
  37343. args: [],
  37344. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  37345. referencedClasses: ["OrderedCollection"],
  37346. messageSends: ["ifNil:", "new"]
  37347. }),
  37348. $globals.MethodLexicalScope);
  37349. $core.addMethod(
  37350. $core.method({
  37351. selector: "pseudoVars",
  37352. protocol: "accessing",
  37353. fn: function (){
  37354. var self=this,$self=this;
  37355. return $core.withContext(function($ctx1) {
  37356. var $1,$2,$4,$3,$receiver;
  37357. $1=$self["@pseudoVars"];
  37358. if(($receiver = $1) == null || $receiver.a$nil){
  37359. $self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  37360. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  37361. return $core.withContext(function($ctx2) {
  37362. $2=$self["@pseudoVars"];
  37363. $4=$recv($globals.PseudoVar)._on_(each);
  37364. $recv($4)._scope_($self._methodScope());
  37365. $3=$recv($4)._yourself();
  37366. return $recv($2)._at_put_(each,$3);
  37367. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37368. }));
  37369. } else {
  37370. $1;
  37371. }
  37372. return $self["@pseudoVars"];
  37373. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  37374. },
  37375. args: [],
  37376. 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",
  37377. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  37378. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  37379. }),
  37380. $globals.MethodLexicalScope);
  37381. $core.addMethod(
  37382. $core.method({
  37383. selector: "removeNonLocalReturn:",
  37384. protocol: "adding",
  37385. fn: function (aScope){
  37386. var self=this,$self=this;
  37387. return $core.withContext(function($ctx1) {
  37388. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  37389. }));
  37390. return self;
  37391. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37392. },
  37393. args: ["aScope"],
  37394. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  37395. referencedClasses: [],
  37396. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  37397. }),
  37398. $globals.MethodLexicalScope);
  37399. $core.addMethod(
  37400. $core.method({
  37401. selector: "unknownVariables",
  37402. protocol: "accessing",
  37403. fn: function (){
  37404. var self=this,$self=this;
  37405. return $core.withContext(function($ctx1) {
  37406. var $1,$receiver;
  37407. $1=$self["@unknownVariables"];
  37408. if(($receiver = $1) == null || $receiver.a$nil){
  37409. $self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  37410. return $self["@unknownVariables"];
  37411. } else {
  37412. return $1;
  37413. }
  37414. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  37415. },
  37416. args: [],
  37417. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  37418. referencedClasses: ["OrderedCollection"],
  37419. messageSends: ["ifNil:", "new"]
  37420. }),
  37421. $globals.MethodLexicalScope);
  37422. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  37423. $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.";
  37424. $core.addMethod(
  37425. $core.method({
  37426. selector: "alias",
  37427. protocol: "accessing",
  37428. fn: function (){
  37429. var self=this,$self=this;
  37430. return $core.withContext(function($ctx1) {
  37431. return $recv($self._name())._asVariableName();
  37432. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  37433. },
  37434. args: [],
  37435. source: "alias\x0a\x09^ self name asVariableName",
  37436. referencedClasses: [],
  37437. messageSends: ["asVariableName", "name"]
  37438. }),
  37439. $globals.ScopeVar);
  37440. $core.addMethod(
  37441. $core.method({
  37442. selector: "isArgVar",
  37443. protocol: "testing",
  37444. fn: function (){
  37445. var self=this,$self=this;
  37446. return false;
  37447. },
  37448. args: [],
  37449. source: "isArgVar\x0a\x09^ false",
  37450. referencedClasses: [],
  37451. messageSends: []
  37452. }),
  37453. $globals.ScopeVar);
  37454. $core.addMethod(
  37455. $core.method({
  37456. selector: "isClassRefVar",
  37457. protocol: "testing",
  37458. fn: function (){
  37459. var self=this,$self=this;
  37460. return false;
  37461. },
  37462. args: [],
  37463. source: "isClassRefVar\x0a\x09^ false",
  37464. referencedClasses: [],
  37465. messageSends: []
  37466. }),
  37467. $globals.ScopeVar);
  37468. $core.addMethod(
  37469. $core.method({
  37470. selector: "isImmutable",
  37471. protocol: "testing",
  37472. fn: function (){
  37473. var self=this,$self=this;
  37474. return false;
  37475. },
  37476. args: [],
  37477. source: "isImmutable\x0a\x09^ false",
  37478. referencedClasses: [],
  37479. messageSends: []
  37480. }),
  37481. $globals.ScopeVar);
  37482. $core.addMethod(
  37483. $core.method({
  37484. selector: "isInstanceVar",
  37485. protocol: "testing",
  37486. fn: function (){
  37487. var self=this,$self=this;
  37488. return false;
  37489. },
  37490. args: [],
  37491. source: "isInstanceVar\x0a\x09^ false",
  37492. referencedClasses: [],
  37493. messageSends: []
  37494. }),
  37495. $globals.ScopeVar);
  37496. $core.addMethod(
  37497. $core.method({
  37498. selector: "isPseudoVar",
  37499. protocol: "testing",
  37500. fn: function (){
  37501. var self=this,$self=this;
  37502. return false;
  37503. },
  37504. args: [],
  37505. source: "isPseudoVar\x0a\x09^ false",
  37506. referencedClasses: [],
  37507. messageSends: []
  37508. }),
  37509. $globals.ScopeVar);
  37510. $core.addMethod(
  37511. $core.method({
  37512. selector: "isSelf",
  37513. protocol: "testing",
  37514. fn: function (){
  37515. var self=this,$self=this;
  37516. return false;
  37517. },
  37518. args: [],
  37519. source: "isSelf\x0a\x09^ false",
  37520. referencedClasses: [],
  37521. messageSends: []
  37522. }),
  37523. $globals.ScopeVar);
  37524. $core.addMethod(
  37525. $core.method({
  37526. selector: "isSuper",
  37527. protocol: "testing",
  37528. fn: function (){
  37529. var self=this,$self=this;
  37530. return false;
  37531. },
  37532. args: [],
  37533. source: "isSuper\x0a\x09^ false",
  37534. referencedClasses: [],
  37535. messageSends: []
  37536. }),
  37537. $globals.ScopeVar);
  37538. $core.addMethod(
  37539. $core.method({
  37540. selector: "isTempVar",
  37541. protocol: "testing",
  37542. fn: function (){
  37543. var self=this,$self=this;
  37544. return false;
  37545. },
  37546. args: [],
  37547. source: "isTempVar\x0a\x09^ false",
  37548. referencedClasses: [],
  37549. messageSends: []
  37550. }),
  37551. $globals.ScopeVar);
  37552. $core.addMethod(
  37553. $core.method({
  37554. selector: "isUnknownVar",
  37555. protocol: "testing",
  37556. fn: function (){
  37557. var self=this,$self=this;
  37558. return false;
  37559. },
  37560. args: [],
  37561. source: "isUnknownVar\x0a\x09^ false",
  37562. referencedClasses: [],
  37563. messageSends: []
  37564. }),
  37565. $globals.ScopeVar);
  37566. $core.addMethod(
  37567. $core.method({
  37568. selector: "name",
  37569. protocol: "accessing",
  37570. fn: function (){
  37571. var self=this,$self=this;
  37572. return $self["@name"];
  37573. },
  37574. args: [],
  37575. source: "name\x0a\x09^ name",
  37576. referencedClasses: [],
  37577. messageSends: []
  37578. }),
  37579. $globals.ScopeVar);
  37580. $core.addMethod(
  37581. $core.method({
  37582. selector: "name:",
  37583. protocol: "accessing",
  37584. fn: function (aString){
  37585. var self=this,$self=this;
  37586. $self["@name"]=aString;
  37587. return self;
  37588. },
  37589. args: ["aString"],
  37590. source: "name: aString\x0a\x09name := aString",
  37591. referencedClasses: [],
  37592. messageSends: []
  37593. }),
  37594. $globals.ScopeVar);
  37595. $core.addMethod(
  37596. $core.method({
  37597. selector: "scope",
  37598. protocol: "accessing",
  37599. fn: function (){
  37600. var self=this,$self=this;
  37601. return $self["@scope"];
  37602. },
  37603. args: [],
  37604. source: "scope\x0a\x09^ scope",
  37605. referencedClasses: [],
  37606. messageSends: []
  37607. }),
  37608. $globals.ScopeVar);
  37609. $core.addMethod(
  37610. $core.method({
  37611. selector: "scope:",
  37612. protocol: "accessing",
  37613. fn: function (aScope){
  37614. var self=this,$self=this;
  37615. $self["@scope"]=aScope;
  37616. return self;
  37617. },
  37618. args: ["aScope"],
  37619. source: "scope: aScope\x0a\x09scope := aScope",
  37620. referencedClasses: [],
  37621. messageSends: []
  37622. }),
  37623. $globals.ScopeVar);
  37624. $core.addMethod(
  37625. $core.method({
  37626. selector: "validateAssignment",
  37627. protocol: "testing",
  37628. fn: function (){
  37629. var self=this,$self=this;
  37630. return $core.withContext(function($ctx1) {
  37631. var $1,$2;
  37632. $1=$recv($self._isArgVar())._or_((function(){
  37633. return $core.withContext(function($ctx2) {
  37634. return $self._isPseudoVar();
  37635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37636. }));
  37637. if($core.assert($1)){
  37638. $2=$recv($globals.InvalidAssignmentError)._new();
  37639. $recv($2)._variableName_($self._name());
  37640. $recv($2)._signal();
  37641. }
  37642. return self;
  37643. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  37644. },
  37645. args: [],
  37646. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  37647. referencedClasses: ["InvalidAssignmentError"],
  37648. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  37649. }),
  37650. $globals.ScopeVar);
  37651. $core.addMethod(
  37652. $core.method({
  37653. selector: "on:",
  37654. protocol: "instance creation",
  37655. fn: function (aString){
  37656. var self=this,$self=this;
  37657. return $core.withContext(function($ctx1) {
  37658. var $1;
  37659. $1=$self._new();
  37660. $recv($1)._name_(aString);
  37661. return $recv($1)._yourself();
  37662. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.a$cls)});
  37663. },
  37664. args: ["aString"],
  37665. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  37666. referencedClasses: [],
  37667. messageSends: ["name:", "new", "yourself"]
  37668. }),
  37669. $globals.ScopeVar.a$cls);
  37670. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  37671. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  37672. $core.addMethod(
  37673. $core.method({
  37674. selector: "isImmutable",
  37675. protocol: "testing",
  37676. fn: function (){
  37677. var self=this,$self=this;
  37678. return true;
  37679. },
  37680. args: [],
  37681. source: "isImmutable\x0a\x09^ true",
  37682. referencedClasses: [],
  37683. messageSends: []
  37684. }),
  37685. $globals.AliasVar);
  37686. $core.addMethod(
  37687. $core.method({
  37688. selector: "node",
  37689. protocol: "accessing",
  37690. fn: function (){
  37691. var self=this,$self=this;
  37692. return $self["@node"];
  37693. },
  37694. args: [],
  37695. source: "node\x0a\x09^ node",
  37696. referencedClasses: [],
  37697. messageSends: []
  37698. }),
  37699. $globals.AliasVar);
  37700. $core.addMethod(
  37701. $core.method({
  37702. selector: "node:",
  37703. protocol: "accessing",
  37704. fn: function (aNode){
  37705. var self=this,$self=this;
  37706. $self["@node"]=aNode;
  37707. return self;
  37708. },
  37709. args: ["aNode"],
  37710. source: "node: aNode\x0a\x09node := aNode",
  37711. referencedClasses: [],
  37712. messageSends: []
  37713. }),
  37714. $globals.AliasVar);
  37715. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37716. $globals.ArgVar.comment="I am an argument of a method or block.";
  37717. $core.addMethod(
  37718. $core.method({
  37719. selector: "isArgVar",
  37720. protocol: "testing",
  37721. fn: function (){
  37722. var self=this,$self=this;
  37723. return true;
  37724. },
  37725. args: [],
  37726. source: "isArgVar\x0a\x09^ true",
  37727. referencedClasses: [],
  37728. messageSends: []
  37729. }),
  37730. $globals.ArgVar);
  37731. $core.addMethod(
  37732. $core.method({
  37733. selector: "isImmutable",
  37734. protocol: "testing",
  37735. fn: function (){
  37736. var self=this,$self=this;
  37737. return true;
  37738. },
  37739. args: [],
  37740. source: "isImmutable\x0a\x09^ true",
  37741. referencedClasses: [],
  37742. messageSends: []
  37743. }),
  37744. $globals.ArgVar);
  37745. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37746. $globals.ClassRefVar.comment="I am an class reference variable";
  37747. $core.addMethod(
  37748. $core.method({
  37749. selector: "alias",
  37750. protocol: "accessing",
  37751. fn: function (){
  37752. var self=this,$self=this;
  37753. return $core.withContext(function($ctx1) {
  37754. return "$globals.".__comma($self._name());
  37755. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  37756. },
  37757. args: [],
  37758. 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",
  37759. referencedClasses: [],
  37760. messageSends: [",", "name"]
  37761. }),
  37762. $globals.ClassRefVar);
  37763. $core.addMethod(
  37764. $core.method({
  37765. selector: "isClassRefVar",
  37766. protocol: "testing",
  37767. fn: function (){
  37768. var self=this,$self=this;
  37769. return true;
  37770. },
  37771. args: [],
  37772. source: "isClassRefVar\x0a\x09^ true",
  37773. referencedClasses: [],
  37774. messageSends: []
  37775. }),
  37776. $globals.ClassRefVar);
  37777. $core.addMethod(
  37778. $core.method({
  37779. selector: "isImmutable",
  37780. protocol: "testing",
  37781. fn: function (){
  37782. var self=this,$self=this;
  37783. return true;
  37784. },
  37785. args: [],
  37786. source: "isImmutable\x0a\x09^ true",
  37787. referencedClasses: [],
  37788. messageSends: []
  37789. }),
  37790. $globals.ClassRefVar);
  37791. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37792. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  37793. $core.addMethod(
  37794. $core.method({
  37795. selector: "alias",
  37796. protocol: "testing",
  37797. fn: function (){
  37798. var self=this,$self=this;
  37799. return $core.withContext(function($ctx1) {
  37800. var $1;
  37801. $1=$recv("$self[\x22@".__comma($self._name())).__comma("\x22]");
  37802. $ctx1.sendIdx[","]=1;
  37803. return $1;
  37804. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  37805. },
  37806. args: [],
  37807. source: "alias\x0a\x09^ '$self[\x22@', self name, '\x22]'",
  37808. referencedClasses: [],
  37809. messageSends: [",", "name"]
  37810. }),
  37811. $globals.InstanceVar);
  37812. $core.addMethod(
  37813. $core.method({
  37814. selector: "isInstanceVar",
  37815. protocol: "testing",
  37816. fn: function (){
  37817. var self=this,$self=this;
  37818. return true;
  37819. },
  37820. args: [],
  37821. source: "isInstanceVar\x0a\x09^ true",
  37822. referencedClasses: [],
  37823. messageSends: []
  37824. }),
  37825. $globals.InstanceVar);
  37826. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37827. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  37828. $core.addMethod(
  37829. $core.method({
  37830. selector: "alias",
  37831. protocol: "accessing",
  37832. fn: function (){
  37833. var self=this,$self=this;
  37834. return $core.withContext(function($ctx1) {
  37835. return $self._name();
  37836. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  37837. },
  37838. args: [],
  37839. source: "alias\x0a\x09^ self name",
  37840. referencedClasses: [],
  37841. messageSends: ["name"]
  37842. }),
  37843. $globals.PseudoVar);
  37844. $core.addMethod(
  37845. $core.method({
  37846. selector: "isImmutable",
  37847. protocol: "testing",
  37848. fn: function (){
  37849. var self=this,$self=this;
  37850. return true;
  37851. },
  37852. args: [],
  37853. source: "isImmutable\x0a\x09^ true",
  37854. referencedClasses: [],
  37855. messageSends: []
  37856. }),
  37857. $globals.PseudoVar);
  37858. $core.addMethod(
  37859. $core.method({
  37860. selector: "isPseudoVar",
  37861. protocol: "testing",
  37862. fn: function (){
  37863. var self=this,$self=this;
  37864. return true;
  37865. },
  37866. args: [],
  37867. source: "isPseudoVar\x0a\x09^ true",
  37868. referencedClasses: [],
  37869. messageSends: []
  37870. }),
  37871. $globals.PseudoVar);
  37872. $core.addMethod(
  37873. $core.method({
  37874. selector: "isSelf",
  37875. protocol: "testing",
  37876. fn: function (){
  37877. var self=this,$self=this;
  37878. return $core.withContext(function($ctx1) {
  37879. return $recv($self["@name"]).__eq("self");
  37880. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.PseudoVar)});
  37881. },
  37882. args: [],
  37883. source: "isSelf\x0a\x09^ name = 'self'",
  37884. referencedClasses: [],
  37885. messageSends: ["="]
  37886. }),
  37887. $globals.PseudoVar);
  37888. $core.addMethod(
  37889. $core.method({
  37890. selector: "isSuper",
  37891. protocol: "testing",
  37892. fn: function (){
  37893. var self=this,$self=this;
  37894. return $core.withContext(function($ctx1) {
  37895. return $recv($self["@name"]).__eq("super");
  37896. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.PseudoVar)});
  37897. },
  37898. args: [],
  37899. source: "isSuper\x0a\x09^ name = 'super'",
  37900. referencedClasses: [],
  37901. messageSends: ["="]
  37902. }),
  37903. $globals.PseudoVar);
  37904. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37905. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  37906. $core.addMethod(
  37907. $core.method({
  37908. selector: "isTempVar",
  37909. protocol: "testing",
  37910. fn: function (){
  37911. var self=this,$self=this;
  37912. return true;
  37913. },
  37914. args: [],
  37915. source: "isTempVar\x0a\x09^ true",
  37916. referencedClasses: [],
  37917. messageSends: []
  37918. }),
  37919. $globals.TempVar);
  37920. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37921. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  37922. $core.addMethod(
  37923. $core.method({
  37924. selector: "isUnknownVar",
  37925. protocol: "testing",
  37926. fn: function (){
  37927. var self=this,$self=this;
  37928. return true;
  37929. },
  37930. args: [],
  37931. source: "isUnknownVar\x0a\x09^ true",
  37932. referencedClasses: [],
  37933. messageSends: []
  37934. }),
  37935. $globals.UnknownVar);
  37936. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  37937. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  37938. $core.addMethod(
  37939. $core.method({
  37940. selector: "classReferences",
  37941. protocol: "accessing",
  37942. fn: function (){
  37943. var self=this,$self=this;
  37944. return $core.withContext(function($ctx1) {
  37945. var $1,$receiver;
  37946. $1=$self["@classReferences"];
  37947. if(($receiver = $1) == null || $receiver.a$nil){
  37948. $self["@classReferences"]=$recv($globals.Set)._new();
  37949. return $self["@classReferences"];
  37950. } else {
  37951. return $1;
  37952. }
  37953. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  37954. },
  37955. args: [],
  37956. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  37957. referencedClasses: ["Set"],
  37958. messageSends: ["ifNil:", "new"]
  37959. }),
  37960. $globals.SemanticAnalyzer);
  37961. $core.addMethod(
  37962. $core.method({
  37963. selector: "errorShadowingVariable:",
  37964. protocol: "error handling",
  37965. fn: function (aString){
  37966. var self=this,$self=this;
  37967. return $core.withContext(function($ctx1) {
  37968. var $1;
  37969. $1=$recv($globals.ShadowingVariableError)._new();
  37970. $recv($1)._variableName_(aString);
  37971. $recv($1)._signal();
  37972. return self;
  37973. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  37974. },
  37975. args: ["aString"],
  37976. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  37977. referencedClasses: ["ShadowingVariableError"],
  37978. messageSends: ["variableName:", "new", "signal"]
  37979. }),
  37980. $globals.SemanticAnalyzer);
  37981. $core.addMethod(
  37982. $core.method({
  37983. selector: "errorUnknownVariable:",
  37984. protocol: "error handling",
  37985. fn: function (aNode){
  37986. var self=this,$self=this;
  37987. var identifier;
  37988. return $core.withContext(function($ctx1) {
  37989. var $1,$2,$3;
  37990. identifier=$recv(aNode)._value();
  37991. $ctx1.sendIdx["value"]=1;
  37992. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  37993. return $core.withContext(function($ctx2) {
  37994. return $self._isVariableUndefined_inPackage_(identifier,$self._thePackage());
  37995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37996. }));
  37997. if($core.assert($1)){
  37998. $2=$recv($globals.UnknownVariableError)._new();
  37999. $3=$recv(aNode)._value();
  38000. $ctx1.sendIdx["value"]=2;
  38001. $recv($2)._variableName_($3);
  38002. $recv($2)._signal();
  38003. } else {
  38004. $recv($recv($recv($self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  38005. }
  38006. return self;
  38007. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  38008. },
  38009. args: ["aNode"],
  38010. 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 ]",
  38011. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  38012. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  38013. }),
  38014. $globals.SemanticAnalyzer);
  38015. $core.addMethod(
  38016. $core.method({
  38017. selector: "isVariableUndefined:inPackage:",
  38018. protocol: "testing",
  38019. fn: function (aString,aPackage){
  38020. var self=this,$self=this;
  38021. return $core.withContext(function($ctx1) {
  38022. var $1,$2,$receiver;
  38023. if(($receiver = aPackage) == null || $receiver.a$nil){
  38024. aPackage;
  38025. } else {
  38026. var packageKnownVars;
  38027. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  38028. $1=$recv(packageKnownVars)._includes_(aString);
  38029. if($core.assert($1)){
  38030. return false;
  38031. }
  38032. }
  38033. $2=$recv("typeof ".__comma(aString)).__comma(" === \x22undefined\x22");
  38034. $ctx1.sendIdx[","]=1;
  38035. return $recv($globals.Compiler)._eval_($2);
  38036. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  38037. },
  38038. args: ["aString", "aPackage"],
  38039. 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'",
  38040. referencedClasses: ["Compiler"],
  38041. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", ","]
  38042. }),
  38043. $globals.SemanticAnalyzer);
  38044. $core.addMethod(
  38045. $core.method({
  38046. selector: "messageSends",
  38047. protocol: "accessing",
  38048. fn: function (){
  38049. var self=this,$self=this;
  38050. return $core.withContext(function($ctx1) {
  38051. var $1,$receiver;
  38052. $1=$self["@messageSends"];
  38053. if(($receiver = $1) == null || $receiver.a$nil){
  38054. $self["@messageSends"]=$recv($globals.Dictionary)._new();
  38055. return $self["@messageSends"];
  38056. } else {
  38057. return $1;
  38058. }
  38059. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  38060. },
  38061. args: [],
  38062. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  38063. referencedClasses: ["Dictionary"],
  38064. messageSends: ["ifNil:", "new"]
  38065. }),
  38066. $globals.SemanticAnalyzer);
  38067. $core.addMethod(
  38068. $core.method({
  38069. selector: "newBlockScope",
  38070. protocol: "factory",
  38071. fn: function (){
  38072. var self=this,$self=this;
  38073. return $core.withContext(function($ctx1) {
  38074. return $self._newScopeOfClass_($globals.LexicalScope);
  38075. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  38076. },
  38077. args: [],
  38078. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  38079. referencedClasses: ["LexicalScope"],
  38080. messageSends: ["newScopeOfClass:"]
  38081. }),
  38082. $globals.SemanticAnalyzer);
  38083. $core.addMethod(
  38084. $core.method({
  38085. selector: "newMethodScope",
  38086. protocol: "factory",
  38087. fn: function (){
  38088. var self=this,$self=this;
  38089. return $core.withContext(function($ctx1) {
  38090. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  38091. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  38092. },
  38093. args: [],
  38094. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  38095. referencedClasses: ["MethodLexicalScope"],
  38096. messageSends: ["newScopeOfClass:"]
  38097. }),
  38098. $globals.SemanticAnalyzer);
  38099. $core.addMethod(
  38100. $core.method({
  38101. selector: "newScopeOfClass:",
  38102. protocol: "factory",
  38103. fn: function (aLexicalScopeClass){
  38104. var self=this,$self=this;
  38105. return $core.withContext(function($ctx1) {
  38106. var $1;
  38107. $1=$recv(aLexicalScopeClass)._new();
  38108. $recv($1)._outerScope_($self["@currentScope"]);
  38109. return $recv($1)._yourself();
  38110. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  38111. },
  38112. args: ["aLexicalScopeClass"],
  38113. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  38114. referencedClasses: [],
  38115. messageSends: ["outerScope:", "new", "yourself"]
  38116. }),
  38117. $globals.SemanticAnalyzer);
  38118. $core.addMethod(
  38119. $core.method({
  38120. selector: "nextBlockIndex",
  38121. protocol: "private",
  38122. fn: function (){
  38123. var self=this,$self=this;
  38124. return $core.withContext(function($ctx1) {
  38125. var $1,$receiver;
  38126. $1=$self["@blockIndex"];
  38127. if(($receiver = $1) == null || $receiver.a$nil){
  38128. $self["@blockIndex"]=(0);
  38129. $self["@blockIndex"];
  38130. } else {
  38131. $1;
  38132. }
  38133. $self["@blockIndex"]=$recv($self["@blockIndex"]).__plus((1));
  38134. return $self["@blockIndex"];
  38135. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  38136. },
  38137. args: [],
  38138. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  38139. referencedClasses: [],
  38140. messageSends: ["ifNil:", "+"]
  38141. }),
  38142. $globals.SemanticAnalyzer);
  38143. $core.addMethod(
  38144. $core.method({
  38145. selector: "popScope",
  38146. protocol: "scope",
  38147. fn: function (){
  38148. var self=this,$self=this;
  38149. return $core.withContext(function($ctx1) {
  38150. var $1,$receiver;
  38151. $1=$self["@currentScope"];
  38152. if(($receiver = $1) == null || $receiver.a$nil){
  38153. $1;
  38154. } else {
  38155. $self["@currentScope"]=$recv($self["@currentScope"])._outerScope();
  38156. $self["@currentScope"];
  38157. }
  38158. return self;
  38159. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  38160. },
  38161. args: [],
  38162. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  38163. referencedClasses: [],
  38164. messageSends: ["ifNotNil:", "outerScope"]
  38165. }),
  38166. $globals.SemanticAnalyzer);
  38167. $core.addMethod(
  38168. $core.method({
  38169. selector: "pushScope:",
  38170. protocol: "scope",
  38171. fn: function (aScope){
  38172. var self=this,$self=this;
  38173. return $core.withContext(function($ctx1) {
  38174. $recv(aScope)._outerScope_($self["@currentScope"]);
  38175. $self["@currentScope"]=aScope;
  38176. return self;
  38177. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  38178. },
  38179. args: ["aScope"],
  38180. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  38181. referencedClasses: [],
  38182. messageSends: ["outerScope:"]
  38183. }),
  38184. $globals.SemanticAnalyzer);
  38185. $core.addMethod(
  38186. $core.method({
  38187. selector: "theClass",
  38188. protocol: "accessing",
  38189. fn: function (){
  38190. var self=this,$self=this;
  38191. return $self["@theClass"];
  38192. },
  38193. args: [],
  38194. source: "theClass\x0a\x09^ theClass",
  38195. referencedClasses: [],
  38196. messageSends: []
  38197. }),
  38198. $globals.SemanticAnalyzer);
  38199. $core.addMethod(
  38200. $core.method({
  38201. selector: "theClass:",
  38202. protocol: "accessing",
  38203. fn: function (aClass){
  38204. var self=this,$self=this;
  38205. $self["@theClass"]=aClass;
  38206. return self;
  38207. },
  38208. args: ["aClass"],
  38209. source: "theClass: aClass\x0a\x09theClass := aClass",
  38210. referencedClasses: [],
  38211. messageSends: []
  38212. }),
  38213. $globals.SemanticAnalyzer);
  38214. $core.addMethod(
  38215. $core.method({
  38216. selector: "thePackage",
  38217. protocol: "accessing",
  38218. fn: function (){
  38219. var self=this,$self=this;
  38220. return $self["@thePackage"];
  38221. },
  38222. args: [],
  38223. source: "thePackage\x0a\x09^ thePackage",
  38224. referencedClasses: [],
  38225. messageSends: []
  38226. }),
  38227. $globals.SemanticAnalyzer);
  38228. $core.addMethod(
  38229. $core.method({
  38230. selector: "thePackage:",
  38231. protocol: "accessing",
  38232. fn: function (aPackage){
  38233. var self=this,$self=this;
  38234. $self["@thePackage"]=aPackage;
  38235. return self;
  38236. },
  38237. args: ["aPackage"],
  38238. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  38239. referencedClasses: [],
  38240. messageSends: []
  38241. }),
  38242. $globals.SemanticAnalyzer);
  38243. $core.addMethod(
  38244. $core.method({
  38245. selector: "validateVariableScope:",
  38246. protocol: "scope",
  38247. fn: function (aString){
  38248. var self=this,$self=this;
  38249. return $core.withContext(function($ctx1) {
  38250. var $1,$receiver;
  38251. $1=$recv($self["@currentScope"])._lookupVariable_(aString);
  38252. if(($receiver = $1) == null || $receiver.a$nil){
  38253. $1;
  38254. } else {
  38255. $self._errorShadowingVariable_(aString);
  38256. }
  38257. return self;
  38258. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  38259. },
  38260. args: ["aString"],
  38261. 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 ]",
  38262. referencedClasses: [],
  38263. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  38264. }),
  38265. $globals.SemanticAnalyzer);
  38266. $core.addMethod(
  38267. $core.method({
  38268. selector: "visitAssignmentNode:",
  38269. protocol: "visiting",
  38270. fn: function (aNode){
  38271. var self=this,$self=this;
  38272. return $core.withContext(function($ctx1) {
  38273. (
  38274. $ctx1.supercall = true,
  38275. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($self, [aNode]));
  38276. $ctx1.supercall = false;
  38277. $recv($recv(aNode)._left())._beAssigned();
  38278. return self;
  38279. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38280. },
  38281. args: ["aNode"],
  38282. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  38283. referencedClasses: [],
  38284. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  38285. }),
  38286. $globals.SemanticAnalyzer);
  38287. $core.addMethod(
  38288. $core.method({
  38289. selector: "visitBlockNode:",
  38290. protocol: "visiting",
  38291. fn: function (aNode){
  38292. var self=this,$self=this;
  38293. return $core.withContext(function($ctx1) {
  38294. $self._pushScope_($self._newBlockScope());
  38295. $recv(aNode)._scope_($self["@currentScope"]);
  38296. $recv($self["@currentScope"])._node_(aNode);
  38297. $recv($self["@currentScope"])._blockIndex_($self._nextBlockIndex());
  38298. $recv($recv(aNode)._parameters())._do_((function(each){
  38299. return $core.withContext(function($ctx2) {
  38300. $self._validateVariableScope_(each);
  38301. return $recv($self["@currentScope"])._addArg_(each);
  38302. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38303. }));
  38304. (
  38305. $ctx1.supercall = true,
  38306. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($self, [aNode]));
  38307. $ctx1.supercall = false;
  38308. $self._popScope();
  38309. return self;
  38310. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38311. },
  38312. args: ["aNode"],
  38313. 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",
  38314. referencedClasses: [],
  38315. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  38316. }),
  38317. $globals.SemanticAnalyzer);
  38318. $core.addMethod(
  38319. $core.method({
  38320. selector: "visitCascadeNode:",
  38321. protocol: "visiting",
  38322. fn: function (aNode){
  38323. var self=this,$self=this;
  38324. return $core.withContext(function($ctx1) {
  38325. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  38326. (
  38327. $ctx1.supercall = true,
  38328. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($self, [aNode]));
  38329. $ctx1.supercall = false;
  38330. return self;
  38331. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38332. },
  38333. args: ["aNode"],
  38334. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  38335. referencedClasses: [],
  38336. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  38337. }),
  38338. $globals.SemanticAnalyzer);
  38339. $core.addMethod(
  38340. $core.method({
  38341. selector: "visitMethodNode:",
  38342. protocol: "visiting",
  38343. fn: function (aNode){
  38344. var self=this,$self=this;
  38345. return $core.withContext(function($ctx1) {
  38346. $self._pushScope_($self._newMethodScope());
  38347. $recv(aNode)._scope_($self["@currentScope"]);
  38348. $recv($self["@currentScope"])._node_(aNode);
  38349. $recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  38350. return $core.withContext(function($ctx2) {
  38351. return $recv($self["@currentScope"])._addIVar_(each);
  38352. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38353. }));
  38354. $ctx1.sendIdx["do:"]=1;
  38355. $recv($recv(aNode)._arguments())._do_((function(each){
  38356. return $core.withContext(function($ctx2) {
  38357. $self._validateVariableScope_(each);
  38358. return $recv($self["@currentScope"])._addArg_(each);
  38359. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38360. }));
  38361. (
  38362. $ctx1.supercall = true,
  38363. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  38364. $ctx1.supercall = false;
  38365. $recv(aNode)._classReferences_($self._classReferences());
  38366. $recv(aNode)._sendIndexes_($self._messageSends());
  38367. $self._popScope();
  38368. return aNode;
  38369. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38370. },
  38371. args: ["aNode"],
  38372. 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",
  38373. referencedClasses: [],
  38374. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  38375. }),
  38376. $globals.SemanticAnalyzer);
  38377. $core.addMethod(
  38378. $core.method({
  38379. selector: "visitReturnNode:",
  38380. protocol: "visiting",
  38381. fn: function (aNode){
  38382. var self=this,$self=this;
  38383. return $core.withContext(function($ctx1) {
  38384. var $1;
  38385. $recv(aNode)._scope_($self["@currentScope"]);
  38386. $1=$recv($self["@currentScope"])._isMethodScope();
  38387. if($core.assert($1)){
  38388. $recv($self["@currentScope"])._localReturn_(true);
  38389. } else {
  38390. $recv($recv($self["@currentScope"])._methodScope())._addNonLocalReturn_($self["@currentScope"]);
  38391. }
  38392. (
  38393. $ctx1.supercall = true,
  38394. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($self, [aNode]));
  38395. $ctx1.supercall = false;
  38396. return self;
  38397. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38398. },
  38399. args: ["aNode"],
  38400. 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",
  38401. referencedClasses: [],
  38402. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  38403. }),
  38404. $globals.SemanticAnalyzer);
  38405. $core.addMethod(
  38406. $core.method({
  38407. selector: "visitSendNode:",
  38408. protocol: "visiting",
  38409. fn: function (aNode){
  38410. var self=this,$self=this;
  38411. var sends;
  38412. return $core.withContext(function($ctx1) {
  38413. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  38414. return $core.withContext(function($ctx2) {
  38415. return $recv($globals.OrderedCollection)._new();
  38416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38417. }));
  38418. $recv(sends)._add_(aNode);
  38419. $recv(aNode)._index_($recv(sends)._size());
  38420. (
  38421. $ctx1.supercall = true,
  38422. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  38423. $ctx1.supercall = false;
  38424. return self;
  38425. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  38426. },
  38427. args: ["aNode"],
  38428. 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",
  38429. referencedClasses: ["OrderedCollection"],
  38430. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  38431. }),
  38432. $globals.SemanticAnalyzer);
  38433. $core.addMethod(
  38434. $core.method({
  38435. selector: "visitSequenceNode:",
  38436. protocol: "visiting",
  38437. fn: function (aNode){
  38438. var self=this,$self=this;
  38439. return $core.withContext(function($ctx1) {
  38440. $recv($recv(aNode)._temps())._do_((function(each){
  38441. return $core.withContext(function($ctx2) {
  38442. $self._validateVariableScope_(each);
  38443. return $recv($self["@currentScope"])._addTemp_(each);
  38444. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38445. }));
  38446. (
  38447. $ctx1.supercall = true,
  38448. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  38449. $ctx1.supercall = false;
  38450. return self;
  38451. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38452. },
  38453. args: ["aNode"],
  38454. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  38455. referencedClasses: [],
  38456. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  38457. }),
  38458. $globals.SemanticAnalyzer);
  38459. $core.addMethod(
  38460. $core.method({
  38461. selector: "visitVariableNode:",
  38462. protocol: "visiting",
  38463. fn: function (aNode){
  38464. var self=this,$self=this;
  38465. var binding;
  38466. return $core.withContext(function($ctx1) {
  38467. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  38468. binding=$recv($self["@currentScope"])._lookupVariable_(aNode);
  38469. $1=binding;
  38470. if(($receiver = $1) == null || $receiver.a$nil){
  38471. $3=$recv(aNode)._value();
  38472. $ctx1.sendIdx["value"]=1;
  38473. $2=$recv($3)._isCapitalized();
  38474. if($core.assert($2)){
  38475. $4=$recv($globals.ClassRefVar)._new();
  38476. $ctx1.sendIdx["new"]=1;
  38477. $5=$recv(aNode)._value();
  38478. $ctx1.sendIdx["value"]=2;
  38479. $recv($4)._name_($5);
  38480. $ctx1.sendIdx["name:"]=1;
  38481. $6=$recv($4)._yourself();
  38482. $ctx1.sendIdx["yourself"]=1;
  38483. binding=$6;
  38484. $7=$self._classReferences();
  38485. $8=$recv(aNode)._value();
  38486. $ctx1.sendIdx["value"]=3;
  38487. $recv($7)._add_($8);
  38488. } else {
  38489. $self._errorUnknownVariable_(aNode);
  38490. $9=$recv($globals.UnknownVar)._new();
  38491. $recv($9)._name_($recv(aNode)._value());
  38492. binding=$recv($9)._yourself();
  38493. binding;
  38494. }
  38495. } else {
  38496. $1;
  38497. }
  38498. $recv(aNode)._binding_(binding);
  38499. return self;
  38500. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  38501. },
  38502. args: ["aNode"],
  38503. 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.",
  38504. referencedClasses: ["ClassRefVar", "UnknownVar"],
  38505. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  38506. }),
  38507. $globals.SemanticAnalyzer);
  38508. $core.addMethod(
  38509. $core.method({
  38510. selector: "on:",
  38511. protocol: "instance creation",
  38512. fn: function (aClass){
  38513. var self=this,$self=this;
  38514. return $core.withContext(function($ctx1) {
  38515. var $1;
  38516. $1=$self._new();
  38517. $recv($1)._theClass_(aClass);
  38518. return $recv($1)._yourself();
  38519. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.a$cls)});
  38520. },
  38521. args: ["aClass"],
  38522. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  38523. referencedClasses: [],
  38524. messageSends: ["theClass:", "new", "yourself"]
  38525. }),
  38526. $globals.SemanticAnalyzer.a$cls);
  38527. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  38528. $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";
  38529. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38530. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  38531. $core.addMethod(
  38532. $core.method({
  38533. selector: "messageText",
  38534. protocol: "accessing",
  38535. fn: function (){
  38536. var self=this,$self=this;
  38537. return $core.withContext(function($ctx1) {
  38538. return " Invalid assignment to variable: ".__comma($self._variableName());
  38539. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  38540. },
  38541. args: [],
  38542. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  38543. referencedClasses: [],
  38544. messageSends: [",", "variableName"]
  38545. }),
  38546. $globals.InvalidAssignmentError);
  38547. $core.addMethod(
  38548. $core.method({
  38549. selector: "variableName",
  38550. protocol: "accessing",
  38551. fn: function (){
  38552. var self=this,$self=this;
  38553. return $self["@variableName"];
  38554. },
  38555. args: [],
  38556. source: "variableName\x0a\x09^ variableName",
  38557. referencedClasses: [],
  38558. messageSends: []
  38559. }),
  38560. $globals.InvalidAssignmentError);
  38561. $core.addMethod(
  38562. $core.method({
  38563. selector: "variableName:",
  38564. protocol: "accessing",
  38565. fn: function (aString){
  38566. var self=this,$self=this;
  38567. $self["@variableName"]=aString;
  38568. return self;
  38569. },
  38570. args: ["aString"],
  38571. source: "variableName: aString\x0a\x09variableName := aString",
  38572. referencedClasses: [],
  38573. messageSends: []
  38574. }),
  38575. $globals.InvalidAssignmentError);
  38576. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38577. $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.";
  38578. $core.addMethod(
  38579. $core.method({
  38580. selector: "messageText",
  38581. protocol: "accessing",
  38582. fn: function (){
  38583. var self=this,$self=this;
  38584. return $core.withContext(function($ctx1) {
  38585. var $1;
  38586. $1=$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined");
  38587. $ctx1.sendIdx[","]=1;
  38588. return $1;
  38589. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  38590. },
  38591. args: [],
  38592. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  38593. referencedClasses: [],
  38594. messageSends: [",", "variableName"]
  38595. }),
  38596. $globals.ShadowingVariableError);
  38597. $core.addMethod(
  38598. $core.method({
  38599. selector: "variableName",
  38600. protocol: "accessing",
  38601. fn: function (){
  38602. var self=this,$self=this;
  38603. return $self["@variableName"];
  38604. },
  38605. args: [],
  38606. source: "variableName\x0a\x09^ variableName",
  38607. referencedClasses: [],
  38608. messageSends: []
  38609. }),
  38610. $globals.ShadowingVariableError);
  38611. $core.addMethod(
  38612. $core.method({
  38613. selector: "variableName:",
  38614. protocol: "accessing",
  38615. fn: function (aString){
  38616. var self=this,$self=this;
  38617. $self["@variableName"]=aString;
  38618. return self;
  38619. },
  38620. args: ["aString"],
  38621. source: "variableName: aString\x0a\x09variableName := aString",
  38622. referencedClasses: [],
  38623. messageSends: []
  38624. }),
  38625. $globals.ShadowingVariableError);
  38626. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38627. $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.";
  38628. $core.addMethod(
  38629. $core.method({
  38630. selector: "messageText",
  38631. protocol: "accessing",
  38632. fn: function (){
  38633. var self=this,$self=this;
  38634. return $core.withContext(function($ctx1) {
  38635. var $1;
  38636. $1=$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined");
  38637. $ctx1.sendIdx[","]=1;
  38638. return $1;
  38639. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  38640. },
  38641. args: [],
  38642. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  38643. referencedClasses: [],
  38644. messageSends: [",", "variableName"]
  38645. }),
  38646. $globals.UnknownVariableError);
  38647. $core.addMethod(
  38648. $core.method({
  38649. selector: "variableName",
  38650. protocol: "accessing",
  38651. fn: function (){
  38652. var self=this,$self=this;
  38653. return $self["@variableName"];
  38654. },
  38655. args: [],
  38656. source: "variableName\x0a\x09^ variableName",
  38657. referencedClasses: [],
  38658. messageSends: []
  38659. }),
  38660. $globals.UnknownVariableError);
  38661. $core.addMethod(
  38662. $core.method({
  38663. selector: "variableName:",
  38664. protocol: "accessing",
  38665. fn: function (aString){
  38666. var self=this,$self=this;
  38667. $self["@variableName"]=aString;
  38668. return self;
  38669. },
  38670. args: ["aString"],
  38671. source: "variableName: aString\x0a\x09variableName := aString",
  38672. referencedClasses: [],
  38673. messageSends: []
  38674. }),
  38675. $globals.UnknownVariableError);
  38676. $core.addMethod(
  38677. $core.method({
  38678. selector: "inlineJS:",
  38679. protocol: "*Compiler-Semantic",
  38680. fn: function (aString){
  38681. var self=this,$self=this;
  38682. return $core.withContext(function($ctx1) {
  38683. var $2,$1,$3,$5,$4;
  38684. $2=$self._sequenceNode();
  38685. $ctx1.sendIdx["sequenceNode"]=1;
  38686. $1=$recv($2)._dagChildren();
  38687. $recv($1)._ifNotEmpty_((function(){
  38688. return $core.withContext(function($ctx2) {
  38689. return $recv($globals.CompilerError)._signal_("inlineJS: does not allow smalltalk statements");
  38690. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38691. }));
  38692. $3=$self._sequenceNode();
  38693. $5=$recv($globals.JSStatementNode)._new();
  38694. $recv($5)._source_(aString);
  38695. $4=$recv($5)._yourself();
  38696. $recv($3)._addDagChild_($4);
  38697. return self;
  38698. }, function($ctx1) {$ctx1.fill(self,"inlineJS:",{aString:aString},$globals.EarlyPragmator)});
  38699. },
  38700. args: ["aString"],
  38701. source: "inlineJS: aString\x0a\x09self sequenceNode dagChildren ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'inlineJS: does not allow smalltalk statements' ].\x0a\x09self sequenceNode addDagChild: (\x0a\x09\x09JSStatementNode new\x0a\x09\x09\x09source: aString;\x0a\x09\x09\x09yourself)",
  38702. referencedClasses: ["CompilerError", "JSStatementNode"],
  38703. messageSends: ["ifNotEmpty:", "dagChildren", "sequenceNode", "signal:", "addDagChild:", "source:", "new", "yourself"]
  38704. }),
  38705. $globals.EarlyPragmator);
  38706. });
  38707. 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";
  38708. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  38709. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  38710. $core.addPackage("Compiler-IR");
  38711. ($core.packageDescriptors||$core.packages)["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  38712. ($core.packageDescriptors||$core.packages)["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  38713. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  38714. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  38715. $core.addMethod(
  38716. $core.method({
  38717. selector: "addToSequence:",
  38718. protocol: "visiting",
  38719. fn: function (anInstruction){
  38720. var self=this,$self=this;
  38721. return $core.withContext(function($ctx1) {
  38722. var $1,$receiver;
  38723. if(($receiver = anInstruction) == null || $receiver.a$nil){
  38724. anInstruction;
  38725. } else {
  38726. $1=$recv(anInstruction)._isVariable();
  38727. if(!$core.assert($1)){
  38728. $recv($self._sequence())._add_(anInstruction);
  38729. }
  38730. }
  38731. return anInstruction;
  38732. }, function($ctx1) {$ctx1.fill(self,"addToSequence:",{anInstruction:anInstruction},$globals.IRASTTranslator)});
  38733. },
  38734. args: ["anInstruction"],
  38735. source: "addToSequence: anInstruction\x0a\x09anInstruction ifNotNil: [\x0a\x09\x09anInstruction isVariable ifFalse: [\x0a\x09\x09\x09self sequence add: anInstruction ] ].\x0a\x09^ anInstruction",
  38736. referencedClasses: [],
  38737. messageSends: ["ifNotNil:", "ifFalse:", "isVariable", "add:", "sequence"]
  38738. }),
  38739. $globals.IRASTTranslator);
  38740. $core.addMethod(
  38741. $core.method({
  38742. selector: "alias:",
  38743. protocol: "visiting",
  38744. fn: function (aNode){
  38745. var self=this,$self=this;
  38746. var variable;
  38747. return $core.withContext(function($ctx1) {
  38748. var $1,$2,$3,$5,$4,$6,$8,$7;
  38749. $1=$recv(aNode)._isImmutable();
  38750. if($core.assert($1)){
  38751. $2=$self._visit_(aNode);
  38752. $ctx1.sendIdx["visit:"]=1;
  38753. return $2;
  38754. }
  38755. $3=$recv($globals.IRVariable)._new();
  38756. $ctx1.sendIdx["new"]=1;
  38757. $5=$recv($globals.AliasVar)._new();
  38758. $ctx1.sendIdx["new"]=2;
  38759. $4=$recv($5)._name_("$".__comma($self._nextAlias()));
  38760. $recv($3)._variable_($4);
  38761. $6=$recv($3)._yourself();
  38762. $ctx1.sendIdx["yourself"]=1;
  38763. variable=$6;
  38764. $8=$recv($globals.IRAssignment)._new();
  38765. $recv($8)._add_(variable);
  38766. $ctx1.sendIdx["add:"]=1;
  38767. $recv($8)._add_($self._visit_(aNode));
  38768. $ctx1.sendIdx["add:"]=2;
  38769. $7=$recv($8)._yourself();
  38770. $self._addToSequence_($7);
  38771. $recv($recv($self._method())._internalVariables())._add_(variable);
  38772. return variable;
  38773. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  38774. },
  38775. args: ["aNode"],
  38776. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self addToSequence: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  38777. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  38778. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "addToSequence:", "add:", "internalVariables", "method"]
  38779. }),
  38780. $globals.IRASTTranslator);
  38781. $core.addMethod(
  38782. $core.method({
  38783. selector: "aliasTemporally:",
  38784. protocol: "visiting",
  38785. fn: function (aCollection){
  38786. var self=this,$self=this;
  38787. var threshold,result;
  38788. return $core.withContext(function($ctx1) {
  38789. var $1,$2,$4,$3;
  38790. threshold=(0);
  38791. $recv(aCollection)._withIndexDo_((function(each,i){
  38792. return $core.withContext(function($ctx2) {
  38793. $1=$recv(each)._subtreeNeedsAliasing();
  38794. if($core.assert($1)){
  38795. threshold=i;
  38796. return threshold;
  38797. }
  38798. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  38799. }));
  38800. $ctx1.sendIdx["withIndexDo:"]=1;
  38801. result=$recv($globals.OrderedCollection)._new();
  38802. $recv(aCollection)._withIndexDo_((function(each,i){
  38803. return $core.withContext(function($ctx2) {
  38804. $2=result;
  38805. $4=$recv(i).__lt_eq(threshold);
  38806. if($core.assert($4)){
  38807. $3=$self._alias_(each);
  38808. } else {
  38809. $3=$self._visit_(each);
  38810. }
  38811. return $recv($2)._add_($3);
  38812. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  38813. }));
  38814. return result;
  38815. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  38816. },
  38817. args: ["aCollection"],
  38818. 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",
  38819. referencedClasses: ["OrderedCollection"],
  38820. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  38821. }),
  38822. $globals.IRASTTranslator);
  38823. $core.addMethod(
  38824. $core.method({
  38825. selector: "method",
  38826. protocol: "accessing",
  38827. fn: function (){
  38828. var self=this,$self=this;
  38829. return $self["@method"];
  38830. },
  38831. args: [],
  38832. source: "method\x0a\x09^ method",
  38833. referencedClasses: [],
  38834. messageSends: []
  38835. }),
  38836. $globals.IRASTTranslator);
  38837. $core.addMethod(
  38838. $core.method({
  38839. selector: "method:",
  38840. protocol: "accessing",
  38841. fn: function (anIRMethod){
  38842. var self=this,$self=this;
  38843. $self["@method"]=anIRMethod;
  38844. return self;
  38845. },
  38846. args: ["anIRMethod"],
  38847. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  38848. referencedClasses: [],
  38849. messageSends: []
  38850. }),
  38851. $globals.IRASTTranslator);
  38852. $core.addMethod(
  38853. $core.method({
  38854. selector: "nextAlias",
  38855. protocol: "accessing",
  38856. fn: function (){
  38857. var self=this,$self=this;
  38858. return $core.withContext(function($ctx1) {
  38859. var $1,$receiver;
  38860. $1=$self["@nextAlias"];
  38861. if(($receiver = $1) == null || $receiver.a$nil){
  38862. $self["@nextAlias"]=(0);
  38863. $self["@nextAlias"];
  38864. } else {
  38865. $1;
  38866. }
  38867. $self["@nextAlias"]=$recv($self["@nextAlias"]).__plus((1));
  38868. return $recv($self["@nextAlias"])._asString();
  38869. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  38870. },
  38871. args: [],
  38872. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  38873. referencedClasses: [],
  38874. messageSends: ["ifNil:", "+", "asString"]
  38875. }),
  38876. $globals.IRASTTranslator);
  38877. $core.addMethod(
  38878. $core.method({
  38879. selector: "sequence",
  38880. protocol: "accessing",
  38881. fn: function (){
  38882. var self=this,$self=this;
  38883. return $self["@sequence"];
  38884. },
  38885. args: [],
  38886. source: "sequence\x0a\x09^ sequence",
  38887. referencedClasses: [],
  38888. messageSends: []
  38889. }),
  38890. $globals.IRASTTranslator);
  38891. $core.addMethod(
  38892. $core.method({
  38893. selector: "sequence:",
  38894. protocol: "accessing",
  38895. fn: function (anIRSequence){
  38896. var self=this,$self=this;
  38897. $self["@sequence"]=anIRSequence;
  38898. return self;
  38899. },
  38900. args: ["anIRSequence"],
  38901. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  38902. referencedClasses: [],
  38903. messageSends: []
  38904. }),
  38905. $globals.IRASTTranslator);
  38906. $core.addMethod(
  38907. $core.method({
  38908. selector: "source",
  38909. protocol: "accessing",
  38910. fn: function (){
  38911. var self=this,$self=this;
  38912. return $self["@source"];
  38913. },
  38914. args: [],
  38915. source: "source\x0a\x09^ source",
  38916. referencedClasses: [],
  38917. messageSends: []
  38918. }),
  38919. $globals.IRASTTranslator);
  38920. $core.addMethod(
  38921. $core.method({
  38922. selector: "source:",
  38923. protocol: "accessing",
  38924. fn: function (aString){
  38925. var self=this,$self=this;
  38926. $self["@source"]=aString;
  38927. return self;
  38928. },
  38929. args: ["aString"],
  38930. source: "source: aString\x0a\x09source := aString",
  38931. referencedClasses: [],
  38932. messageSends: []
  38933. }),
  38934. $globals.IRASTTranslator);
  38935. $core.addMethod(
  38936. $core.method({
  38937. selector: "theClass",
  38938. protocol: "accessing",
  38939. fn: function (){
  38940. var self=this,$self=this;
  38941. return $self["@theClass"];
  38942. },
  38943. args: [],
  38944. source: "theClass\x0a\x09^ theClass",
  38945. referencedClasses: [],
  38946. messageSends: []
  38947. }),
  38948. $globals.IRASTTranslator);
  38949. $core.addMethod(
  38950. $core.method({
  38951. selector: "theClass:",
  38952. protocol: "accessing",
  38953. fn: function (aClass){
  38954. var self=this,$self=this;
  38955. $self["@theClass"]=aClass;
  38956. return self;
  38957. },
  38958. args: ["aClass"],
  38959. source: "theClass: aClass\x0a\x09theClass := aClass",
  38960. referencedClasses: [],
  38961. messageSends: []
  38962. }),
  38963. $globals.IRASTTranslator);
  38964. $core.addMethod(
  38965. $core.method({
  38966. selector: "visitAssignmentNode:",
  38967. protocol: "visiting",
  38968. fn: function (aNode){
  38969. var self=this,$self=this;
  38970. var left,right,assignment;
  38971. return $core.withContext(function($ctx1) {
  38972. var $2,$1;
  38973. right=$self._visit_($recv(aNode)._right());
  38974. $ctx1.sendIdx["visit:"]=1;
  38975. left=$self._visit_($recv(aNode)._left());
  38976. $2=$recv($globals.IRAssignment)._new();
  38977. $recv($2)._add_(left);
  38978. $ctx1.sendIdx["add:"]=1;
  38979. $recv($2)._add_(right);
  38980. $1=$recv($2)._yourself();
  38981. $self._addToSequence_($1);
  38982. return left;
  38983. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  38984. },
  38985. args: ["aNode"],
  38986. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self addToSequence: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  38987. referencedClasses: ["IRAssignment"],
  38988. messageSends: ["visit:", "right", "left", "addToSequence:", "add:", "new", "yourself"]
  38989. }),
  38990. $globals.IRASTTranslator);
  38991. $core.addMethod(
  38992. $core.method({
  38993. selector: "visitBlockNode:",
  38994. protocol: "visiting",
  38995. fn: function (aNode){
  38996. var self=this,$self=this;
  38997. var closure;
  38998. return $core.withContext(function($ctx1) {
  38999. var $1,$2,$3,$5,$4,$6,$8,$7;
  39000. $1=$recv($globals.IRClosure)._new();
  39001. $ctx1.sendIdx["new"]=1;
  39002. $recv($1)._arguments_($recv(aNode)._parameters());
  39003. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39004. $2=$recv(aNode)._scope();
  39005. $ctx1.sendIdx["scope"]=1;
  39006. $recv($1)._scope_($2);
  39007. $ctx1.sendIdx["scope:"]=1;
  39008. $3=$recv($1)._yourself();
  39009. $ctx1.sendIdx["yourself"]=1;
  39010. closure=$3;
  39011. $5=$recv(aNode)._scope();
  39012. $ctx1.sendIdx["scope"]=2;
  39013. $4=$recv($5)._temps();
  39014. $recv($4)._do_((function(each){
  39015. return $core.withContext(function($ctx2) {
  39016. $6=closure;
  39017. $8=$recv($globals.IRTempDeclaration)._new();
  39018. $recv($8)._name_($recv(each)._name());
  39019. $recv($8)._scope_($recv(aNode)._scope());
  39020. $7=$recv($8)._yourself();
  39021. return $recv($6)._add_($7);
  39022. $ctx2.sendIdx["add:"]=1;
  39023. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39024. }));
  39025. $ctx1.sendIdx["do:"]=1;
  39026. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39027. return $core.withContext(function($ctx2) {
  39028. return $recv(closure)._add_($self._visit_(each));
  39029. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39030. }));
  39031. return closure;
  39032. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  39033. },
  39034. args: ["aNode"],
  39035. 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",
  39036. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  39037. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  39038. }),
  39039. $globals.IRASTTranslator);
  39040. $core.addMethod(
  39041. $core.method({
  39042. selector: "visitBlockSequenceNode:",
  39043. protocol: "visiting",
  39044. fn: function (aNode){
  39045. var self=this,$self=this;
  39046. return $core.withContext(function($ctx1) {
  39047. var $1,$2,$4,$3,$5,$8,$7,$6,$10,$13,$12,$11,$9;
  39048. $1=$recv($globals.IRBlockSequence)._new();
  39049. $ctx1.sendIdx["new"]=1;
  39050. return $self._withSequence_do_($1,(function(){
  39051. return $core.withContext(function($ctx2) {
  39052. $2=$recv(aNode)._dagChildren();
  39053. $ctx2.sendIdx["dagChildren"]=1;
  39054. return $recv($2)._ifNotEmpty_((function(){
  39055. return $core.withContext(function($ctx3) {
  39056. $4=$recv(aNode)._dagChildren();
  39057. $ctx3.sendIdx["dagChildren"]=2;
  39058. $3=$recv($4)._allButLast();
  39059. $recv($3)._do_((function(each){
  39060. return $core.withContext(function($ctx4) {
  39061. $5=$self._visitOrAlias_(each);
  39062. $ctx4.sendIdx["visitOrAlias:"]=1;
  39063. return $self._addToSequence_($5);
  39064. $ctx4.sendIdx["addToSequence:"]=1;
  39065. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  39066. }));
  39067. $8=$recv(aNode)._dagChildren();
  39068. $ctx3.sendIdx["dagChildren"]=3;
  39069. $7=$recv($8)._last();
  39070. $ctx3.sendIdx["last"]=1;
  39071. $6=$recv($7)._isReturnNode();
  39072. if($core.assert($6)){
  39073. return $self._addToSequence_($self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  39074. } else {
  39075. $10=$recv($globals.IRBlockReturn)._new();
  39076. $13=$recv(aNode)._dagChildren();
  39077. $ctx3.sendIdx["dagChildren"]=4;
  39078. $12=$recv($13)._last();
  39079. $ctx3.sendIdx["last"]=2;
  39080. $11=$self._visitOrAlias_($12);
  39081. $ctx3.sendIdx["visitOrAlias:"]=2;
  39082. $recv($10)._add_($11);
  39083. $9=$recv($10)._yourself();
  39084. return $self._addToSequence_($9);
  39085. $ctx3.sendIdx["addToSequence:"]=2;
  39086. }
  39087. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39088. }));
  39089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39090. }));
  39091. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39092. },
  39093. args: ["aNode"],
  39094. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren ifNotEmpty: [\x0a\x09\x09\x09\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self addToSequence: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self addToSequence: (IRBlockReturn new add: (self visitOrAlias: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self addToSequence: (self visitOrAlias: aNode dagChildren last) ] ]]",
  39095. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  39096. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "addToSequence:", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "add:", "yourself"]
  39097. }),
  39098. $globals.IRASTTranslator);
  39099. $core.addMethod(
  39100. $core.method({
  39101. selector: "visitCascadeNode:",
  39102. protocol: "visiting",
  39103. fn: function (aNode){
  39104. var self=this,$self=this;
  39105. var receiver;
  39106. return $core.withContext(function($ctx1) {
  39107. var $1,$2,$4,$3;
  39108. receiver=$recv(aNode)._receiver();
  39109. $1=$recv(receiver)._isImmutable();
  39110. if(!$core.assert($1)){
  39111. var alias;
  39112. alias=$self._alias_(receiver);
  39113. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  39114. receiver;
  39115. }
  39116. $2=$recv(aNode)._dagChildren();
  39117. $ctx1.sendIdx["dagChildren"]=1;
  39118. $recv($2)._do_((function(each){
  39119. return $core.withContext(function($ctx2) {
  39120. return $recv(each)._receiver_(receiver);
  39121. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39122. }));
  39123. $ctx1.sendIdx["do:"]=1;
  39124. $4=$recv(aNode)._dagChildren();
  39125. $ctx1.sendIdx["dagChildren"]=2;
  39126. $3=$recv($4)._allButLast();
  39127. $recv($3)._do_((function(each){
  39128. return $core.withContext(function($ctx2) {
  39129. return $self._addToSequence_($self._visit_(each));
  39130. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39131. }));
  39132. return $self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  39133. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  39134. },
  39135. args: ["aNode"],
  39136. source: "visitCascadeNode: aNode\x0a\x09| receiver |\x0a\x09receiver := aNode receiver.\x0a\x09receiver isImmutable ifFalse: [\x0a\x09\x09| alias |\x0a\x09\x09alias := self alias: receiver.\x0a\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09aNode dagChildren do: [ :each | each receiver: receiver ].\x0a\x0a\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09self addToSequence: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode dagChildren last",
  39137. referencedClasses: ["VariableNode"],
  39138. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "addToSequence:", "visit:", "visitOrAlias:", "last"]
  39139. }),
  39140. $globals.IRASTTranslator);
  39141. $core.addMethod(
  39142. $core.method({
  39143. selector: "visitDynamicArrayNode:",
  39144. protocol: "visiting",
  39145. fn: function (aNode){
  39146. var self=this,$self=this;
  39147. var array;
  39148. return $core.withContext(function($ctx1) {
  39149. array=$recv($globals.IRDynamicArray)._new();
  39150. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39151. return $core.withContext(function($ctx2) {
  39152. return $recv(array)._add_(each);
  39153. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39154. }));
  39155. return array;
  39156. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  39157. },
  39158. args: ["aNode"],
  39159. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  39160. referencedClasses: ["IRDynamicArray"],
  39161. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39162. }),
  39163. $globals.IRASTTranslator);
  39164. $core.addMethod(
  39165. $core.method({
  39166. selector: "visitDynamicDictionaryNode:",
  39167. protocol: "visiting",
  39168. fn: function (aNode){
  39169. var self=this,$self=this;
  39170. var dictionary;
  39171. return $core.withContext(function($ctx1) {
  39172. dictionary=$recv($globals.IRDynamicDictionary)._new();
  39173. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39174. return $core.withContext(function($ctx2) {
  39175. return $recv(dictionary)._add_(each);
  39176. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39177. }));
  39178. return dictionary;
  39179. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  39180. },
  39181. args: ["aNode"],
  39182. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  39183. referencedClasses: ["IRDynamicDictionary"],
  39184. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39185. }),
  39186. $globals.IRASTTranslator);
  39187. $core.addMethod(
  39188. $core.method({
  39189. selector: "visitJSStatementNode:",
  39190. protocol: "visiting",
  39191. fn: function (aNode){
  39192. var self=this,$self=this;
  39193. return $core.withContext(function($ctx1) {
  39194. var $1;
  39195. $1=$recv($globals.IRVerbatim)._new();
  39196. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  39197. return $recv($1)._yourself();
  39198. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39199. },
  39200. args: ["aNode"],
  39201. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  39202. referencedClasses: ["IRVerbatim"],
  39203. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  39204. }),
  39205. $globals.IRASTTranslator);
  39206. $core.addMethod(
  39207. $core.method({
  39208. selector: "visitMethodNode:",
  39209. protocol: "visiting",
  39210. fn: function (aNode){
  39211. var self=this,$self=this;
  39212. return $core.withContext(function($ctx1) {
  39213. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  39214. $2=$recv($globals.IRMethod)._new();
  39215. $ctx1.sendIdx["new"]=1;
  39216. $recv($2)._source_($recv($self._source())._crlfSanitized());
  39217. $ctx1.sendIdx["source:"]=1;
  39218. $recv($2)._theClass_($self._theClass());
  39219. $recv($2)._arguments_($recv(aNode)._arguments());
  39220. $recv($2)._selector_($recv(aNode)._selector());
  39221. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  39222. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39223. $recv($2)._classReferences_($recv(aNode)._classReferences());
  39224. $3=$recv(aNode)._scope();
  39225. $ctx1.sendIdx["scope"]=1;
  39226. $recv($2)._scope_($3);
  39227. $ctx1.sendIdx["scope:"]=1;
  39228. $4=$recv($2)._yourself();
  39229. $ctx1.sendIdx["yourself"]=1;
  39230. $1=$4;
  39231. $self._method_($1);
  39232. $6=$recv(aNode)._scope();
  39233. $ctx1.sendIdx["scope"]=2;
  39234. $5=$recv($6)._temps();
  39235. $recv($5)._do_((function(each){
  39236. return $core.withContext(function($ctx2) {
  39237. $7=$self._method();
  39238. $ctx2.sendIdx["method"]=1;
  39239. $9=$recv($globals.IRTempDeclaration)._new();
  39240. $ctx2.sendIdx["new"]=2;
  39241. $recv($9)._name_($recv(each)._name());
  39242. $10=$recv(aNode)._scope();
  39243. $ctx2.sendIdx["scope"]=3;
  39244. $recv($9)._scope_($10);
  39245. $11=$recv($9)._yourself();
  39246. $ctx2.sendIdx["yourself"]=2;
  39247. $8=$11;
  39248. return $recv($7)._add_($8);
  39249. $ctx2.sendIdx["add:"]=1;
  39250. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39251. }));
  39252. $ctx1.sendIdx["do:"]=1;
  39253. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39254. return $core.withContext(function($ctx2) {
  39255. $12=$self._method();
  39256. $ctx2.sendIdx["method"]=2;
  39257. return $recv($12)._add_($self._visit_(each));
  39258. $ctx2.sendIdx["add:"]=2;
  39259. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39260. }));
  39261. $14=$recv(aNode)._scope();
  39262. $ctx1.sendIdx["scope"]=4;
  39263. $13=$recv($14)._hasLocalReturn();
  39264. if(!$core.assert($13)){
  39265. $15=$self._method();
  39266. $ctx1.sendIdx["method"]=3;
  39267. $17=$recv($globals.IRReturn)._new();
  39268. $ctx1.sendIdx["new"]=3;
  39269. $19=$recv($globals.IRVariable)._new();
  39270. $ctx1.sendIdx["new"]=4;
  39271. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  39272. $20=$recv($19)._yourself();
  39273. $ctx1.sendIdx["yourself"]=3;
  39274. $18=$20;
  39275. $recv($17)._add_($18);
  39276. $ctx1.sendIdx["add:"]=4;
  39277. $21=$recv($17)._yourself();
  39278. $ctx1.sendIdx["yourself"]=4;
  39279. $16=$21;
  39280. $recv($15)._add_($16);
  39281. $ctx1.sendIdx["add:"]=3;
  39282. $23=$recv($globals.IRVerbatim)._new();
  39283. $recv($23)._source_(";".__comma($recv($globals.String)._lf()));
  39284. $22=$recv($23)._yourself();
  39285. $recv($15)._add_($22);
  39286. }
  39287. return $self._method();
  39288. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39289. },
  39290. args: ["aNode"],
  39291. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ';', String lf; yourself) ].\x0a\x0a\x09^ self method",
  39292. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim", "String"],
  39293. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "dagChildren", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars", ",", "lf"]
  39294. }),
  39295. $globals.IRASTTranslator);
  39296. $core.addMethod(
  39297. $core.method({
  39298. selector: "visitOrAlias:",
  39299. protocol: "visiting",
  39300. fn: function (aNode){
  39301. var self=this,$self=this;
  39302. return $core.withContext(function($ctx1) {
  39303. var $1;
  39304. $1=$recv(aNode)._shouldBeAliased();
  39305. if($core.assert($1)){
  39306. return $self._alias_(aNode);
  39307. } else {
  39308. return $self._visit_(aNode);
  39309. }
  39310. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  39311. },
  39312. args: ["aNode"],
  39313. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  39314. referencedClasses: [],
  39315. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  39316. }),
  39317. $globals.IRASTTranslator);
  39318. $core.addMethod(
  39319. $core.method({
  39320. selector: "visitReturnNode:",
  39321. protocol: "visiting",
  39322. fn: function (aNode){
  39323. var self=this,$self=this;
  39324. var return_;
  39325. return $core.withContext(function($ctx1) {
  39326. var $1;
  39327. $1=$recv(aNode)._nonLocalReturn();
  39328. if($core.assert($1)){
  39329. return_=$recv($globals.IRNonLocalReturn)._new();
  39330. $ctx1.sendIdx["new"]=1;
  39331. } else {
  39332. return_=$recv($globals.IRReturn)._new();
  39333. }
  39334. $recv(return_)._scope_($recv(aNode)._scope());
  39335. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39336. return $core.withContext(function($ctx2) {
  39337. return $recv(return_)._add_($self._visitOrAlias_(each));
  39338. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39339. }));
  39340. return return_;
  39341. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  39342. },
  39343. args: ["aNode"],
  39344. 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",
  39345. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  39346. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  39347. }),
  39348. $globals.IRASTTranslator);
  39349. $core.addMethod(
  39350. $core.method({
  39351. selector: "visitSendNode:",
  39352. protocol: "visiting",
  39353. fn: function (aNode){
  39354. var self=this,$self=this;
  39355. var send;
  39356. return $core.withContext(function($ctx1) {
  39357. var $1;
  39358. send=$recv($globals.IRSend)._new();
  39359. $1=send;
  39360. $recv($1)._selector_($recv(aNode)._selector());
  39361. $recv($1)._index_($recv(aNode)._index());
  39362. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39363. return $core.withContext(function($ctx2) {
  39364. return $recv(send)._add_(each);
  39365. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39366. }));
  39367. return send;
  39368. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  39369. },
  39370. args: ["aNode"],
  39371. 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",
  39372. referencedClasses: ["IRSend"],
  39373. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39374. }),
  39375. $globals.IRASTTranslator);
  39376. $core.addMethod(
  39377. $core.method({
  39378. selector: "visitSequenceNode:",
  39379. protocol: "visiting",
  39380. fn: function (aNode){
  39381. var self=this,$self=this;
  39382. return $core.withContext(function($ctx1) {
  39383. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  39384. return $core.withContext(function($ctx2) {
  39385. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  39386. return $core.withContext(function($ctx3) {
  39387. return $self._addToSequence_($self._visitOrAlias_(each));
  39388. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39389. }));
  39390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39391. }));
  39392. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39393. },
  39394. args: ["aNode"],
  39395. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [ aNode dagChildren do: [ :each |\x0a\x09\x09\x09self addToSequence: (self visitOrAlias: each) ] ]",
  39396. referencedClasses: ["IRSequence"],
  39397. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "addToSequence:", "visitOrAlias:"]
  39398. }),
  39399. $globals.IRASTTranslator);
  39400. $core.addMethod(
  39401. $core.method({
  39402. selector: "visitValueNode:",
  39403. protocol: "visiting",
  39404. fn: function (aNode){
  39405. var self=this,$self=this;
  39406. return $core.withContext(function($ctx1) {
  39407. var $1;
  39408. $1=$recv($globals.IRValue)._new();
  39409. $recv($1)._value_($recv(aNode)._value());
  39410. return $recv($1)._yourself();
  39411. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39412. },
  39413. args: ["aNode"],
  39414. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  39415. referencedClasses: ["IRValue"],
  39416. messageSends: ["value:", "new", "value", "yourself"]
  39417. }),
  39418. $globals.IRASTTranslator);
  39419. $core.addMethod(
  39420. $core.method({
  39421. selector: "visitVariableNode:",
  39422. protocol: "visiting",
  39423. fn: function (aNode){
  39424. var self=this,$self=this;
  39425. return $core.withContext(function($ctx1) {
  39426. var $1;
  39427. $1=$recv($globals.IRVariable)._new();
  39428. $recv($1)._variable_($recv(aNode)._binding());
  39429. return $recv($1)._yourself();
  39430. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39431. },
  39432. args: ["aNode"],
  39433. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  39434. referencedClasses: ["IRVariable"],
  39435. messageSends: ["variable:", "new", "binding", "yourself"]
  39436. }),
  39437. $globals.IRASTTranslator);
  39438. $core.addMethod(
  39439. $core.method({
  39440. selector: "withSequence:do:",
  39441. protocol: "accessing",
  39442. fn: function (aSequence,aBlock){
  39443. var self=this,$self=this;
  39444. var outerSequence;
  39445. return $core.withContext(function($ctx1) {
  39446. outerSequence=$self._sequence();
  39447. $self._sequence_(aSequence);
  39448. $ctx1.sendIdx["sequence:"]=1;
  39449. $recv(aBlock)._value();
  39450. $self._sequence_(outerSequence);
  39451. return aSequence;
  39452. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  39453. },
  39454. args: ["aSequence", "aBlock"],
  39455. 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",
  39456. referencedClasses: [],
  39457. messageSends: ["sequence", "sequence:", "value"]
  39458. }),
  39459. $globals.IRASTTranslator);
  39460. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  39461. $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.";
  39462. $core.addMethod(
  39463. $core.method({
  39464. selector: "add:",
  39465. protocol: "building",
  39466. fn: function (anObject){
  39467. var self=this,$self=this;
  39468. return $core.withContext(function($ctx1) {
  39469. $recv(anObject)._parent_(self);
  39470. return $recv($self._dagChildren())._add_(anObject);
  39471. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  39472. },
  39473. args: ["anObject"],
  39474. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  39475. referencedClasses: [],
  39476. messageSends: ["parent:", "add:", "dagChildren"]
  39477. }),
  39478. $globals.IRInstruction);
  39479. $core.addMethod(
  39480. $core.method({
  39481. selector: "isClosure",
  39482. protocol: "testing",
  39483. fn: function (){
  39484. var self=this,$self=this;
  39485. return false;
  39486. },
  39487. args: [],
  39488. source: "isClosure\x0a\x09^ false",
  39489. referencedClasses: [],
  39490. messageSends: []
  39491. }),
  39492. $globals.IRInstruction);
  39493. $core.addMethod(
  39494. $core.method({
  39495. selector: "isInlined",
  39496. protocol: "testing",
  39497. fn: function (){
  39498. var self=this,$self=this;
  39499. return false;
  39500. },
  39501. args: [],
  39502. source: "isInlined\x0a\x09^ false",
  39503. referencedClasses: [],
  39504. messageSends: []
  39505. }),
  39506. $globals.IRInstruction);
  39507. $core.addMethod(
  39508. $core.method({
  39509. selector: "isMethod",
  39510. protocol: "testing",
  39511. fn: function (){
  39512. var self=this,$self=this;
  39513. return false;
  39514. },
  39515. args: [],
  39516. source: "isMethod\x0a\x09^ false",
  39517. referencedClasses: [],
  39518. messageSends: []
  39519. }),
  39520. $globals.IRInstruction);
  39521. $core.addMethod(
  39522. $core.method({
  39523. selector: "isSelf",
  39524. protocol: "testing",
  39525. fn: function (){
  39526. var self=this,$self=this;
  39527. return false;
  39528. },
  39529. args: [],
  39530. source: "isSelf\x0a\x09^ false",
  39531. referencedClasses: [],
  39532. messageSends: []
  39533. }),
  39534. $globals.IRInstruction);
  39535. $core.addMethod(
  39536. $core.method({
  39537. selector: "isSend",
  39538. protocol: "testing",
  39539. fn: function (){
  39540. var self=this,$self=this;
  39541. return false;
  39542. },
  39543. args: [],
  39544. source: "isSend\x0a\x09^ false",
  39545. referencedClasses: [],
  39546. messageSends: []
  39547. }),
  39548. $globals.IRInstruction);
  39549. $core.addMethod(
  39550. $core.method({
  39551. selector: "isSequence",
  39552. protocol: "testing",
  39553. fn: function (){
  39554. var self=this,$self=this;
  39555. return false;
  39556. },
  39557. args: [],
  39558. source: "isSequence\x0a\x09^ false",
  39559. referencedClasses: [],
  39560. messageSends: []
  39561. }),
  39562. $globals.IRInstruction);
  39563. $core.addMethod(
  39564. $core.method({
  39565. selector: "isSuper",
  39566. protocol: "testing",
  39567. fn: function (){
  39568. var self=this,$self=this;
  39569. return false;
  39570. },
  39571. args: [],
  39572. source: "isSuper\x0a\x09^ false",
  39573. referencedClasses: [],
  39574. messageSends: []
  39575. }),
  39576. $globals.IRInstruction);
  39577. $core.addMethod(
  39578. $core.method({
  39579. selector: "isTempDeclaration",
  39580. protocol: "testing",
  39581. fn: function (){
  39582. var self=this,$self=this;
  39583. return false;
  39584. },
  39585. args: [],
  39586. source: "isTempDeclaration\x0a\x09^ false",
  39587. referencedClasses: [],
  39588. messageSends: []
  39589. }),
  39590. $globals.IRInstruction);
  39591. $core.addMethod(
  39592. $core.method({
  39593. selector: "isVariable",
  39594. protocol: "testing",
  39595. fn: function (){
  39596. var self=this,$self=this;
  39597. return false;
  39598. },
  39599. args: [],
  39600. source: "isVariable\x0a\x09^ false",
  39601. referencedClasses: [],
  39602. messageSends: []
  39603. }),
  39604. $globals.IRInstruction);
  39605. $core.addMethod(
  39606. $core.method({
  39607. selector: "method",
  39608. protocol: "accessing",
  39609. fn: function (){
  39610. var self=this,$self=this;
  39611. return $core.withContext(function($ctx1) {
  39612. return $recv($self._parent())._method();
  39613. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  39614. },
  39615. args: [],
  39616. source: "method\x0a\x09^ self parent method",
  39617. referencedClasses: [],
  39618. messageSends: ["method", "parent"]
  39619. }),
  39620. $globals.IRInstruction);
  39621. $core.addMethod(
  39622. $core.method({
  39623. selector: "needsBoxingAsReceiver",
  39624. protocol: "testing",
  39625. fn: function (){
  39626. var self=this,$self=this;
  39627. return true;
  39628. },
  39629. args: [],
  39630. source: "needsBoxingAsReceiver\x0a\x09^ true",
  39631. referencedClasses: [],
  39632. messageSends: []
  39633. }),
  39634. $globals.IRInstruction);
  39635. $core.addMethod(
  39636. $core.method({
  39637. selector: "parent",
  39638. protocol: "accessing",
  39639. fn: function (){
  39640. var self=this,$self=this;
  39641. return $self["@parent"];
  39642. },
  39643. args: [],
  39644. source: "parent\x0a\x09^ parent",
  39645. referencedClasses: [],
  39646. messageSends: []
  39647. }),
  39648. $globals.IRInstruction);
  39649. $core.addMethod(
  39650. $core.method({
  39651. selector: "parent:",
  39652. protocol: "accessing",
  39653. fn: function (anIRInstruction){
  39654. var self=this,$self=this;
  39655. $self["@parent"]=anIRInstruction;
  39656. return self;
  39657. },
  39658. args: ["anIRInstruction"],
  39659. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  39660. referencedClasses: [],
  39661. messageSends: []
  39662. }),
  39663. $globals.IRInstruction);
  39664. $core.addMethod(
  39665. $core.method({
  39666. selector: "remove:",
  39667. protocol: "building",
  39668. fn: function (anIRInstruction){
  39669. var self=this,$self=this;
  39670. return $core.withContext(function($ctx1) {
  39671. $recv($self._dagChildren())._remove_(anIRInstruction);
  39672. return self;
  39673. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39674. },
  39675. args: ["anIRInstruction"],
  39676. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  39677. referencedClasses: [],
  39678. messageSends: ["remove:", "dagChildren"]
  39679. }),
  39680. $globals.IRInstruction);
  39681. $core.addMethod(
  39682. $core.method({
  39683. selector: "replace:with:",
  39684. protocol: "building",
  39685. fn: function (anIRInstruction,anotherIRInstruction){
  39686. var self=this,$self=this;
  39687. return $core.withContext(function($ctx1) {
  39688. var $1;
  39689. $recv(anotherIRInstruction)._parent_(self);
  39690. $1=$self._dagChildren();
  39691. $ctx1.sendIdx["dagChildren"]=1;
  39692. $recv($1)._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  39693. return self;
  39694. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  39695. },
  39696. args: ["anIRInstruction", "anotherIRInstruction"],
  39697. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  39698. referencedClasses: [],
  39699. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  39700. }),
  39701. $globals.IRInstruction);
  39702. $core.addMethod(
  39703. $core.method({
  39704. selector: "replaceWith:",
  39705. protocol: "building",
  39706. fn: function (anIRInstruction){
  39707. var self=this,$self=this;
  39708. return $core.withContext(function($ctx1) {
  39709. $recv($self._parent())._replace_with_(self,anIRInstruction);
  39710. return self;
  39711. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39712. },
  39713. args: ["anIRInstruction"],
  39714. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  39715. referencedClasses: [],
  39716. messageSends: ["replace:with:", "parent"]
  39717. }),
  39718. $globals.IRInstruction);
  39719. $core.addMethod(
  39720. $core.method({
  39721. selector: "scope",
  39722. protocol: "accessing",
  39723. fn: function (){
  39724. var self=this,$self=this;
  39725. return $core.withContext(function($ctx1) {
  39726. var $1,$receiver;
  39727. $1=$self._parent();
  39728. if(($receiver = $1) == null || $receiver.a$nil){
  39729. return $1;
  39730. } else {
  39731. var node;
  39732. node=$receiver;
  39733. return $recv(node)._scope();
  39734. }
  39735. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  39736. },
  39737. args: [],
  39738. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  39739. referencedClasses: [],
  39740. messageSends: ["ifNotNil:", "parent", "scope"]
  39741. }),
  39742. $globals.IRInstruction);
  39743. $core.addMethod(
  39744. $core.method({
  39745. selector: "yieldsValue",
  39746. protocol: "testing",
  39747. fn: function (){
  39748. var self=this,$self=this;
  39749. return true;
  39750. },
  39751. args: [],
  39752. source: "yieldsValue\x0a\x09^ true",
  39753. referencedClasses: [],
  39754. messageSends: []
  39755. }),
  39756. $globals.IRInstruction);
  39757. $core.addMethod(
  39758. $core.method({
  39759. selector: "on:",
  39760. protocol: "instance creation",
  39761. fn: function (aBuilder){
  39762. var self=this,$self=this;
  39763. return $core.withContext(function($ctx1) {
  39764. var $1;
  39765. $1=$self._new();
  39766. $recv($1)._builder_(aBuilder);
  39767. return $recv($1)._yourself();
  39768. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.a$cls)});
  39769. },
  39770. args: ["aBuilder"],
  39771. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  39772. referencedClasses: [],
  39773. messageSends: ["builder:", "new", "yourself"]
  39774. }),
  39775. $globals.IRInstruction.a$cls);
  39776. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  39777. $core.addMethod(
  39778. $core.method({
  39779. selector: "acceptDagVisitor:",
  39780. protocol: "visiting",
  39781. fn: function (aVisitor){
  39782. var self=this,$self=this;
  39783. return $core.withContext(function($ctx1) {
  39784. return $recv(aVisitor)._visitIRAssignment_(self);
  39785. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  39786. },
  39787. args: ["aVisitor"],
  39788. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  39789. referencedClasses: [],
  39790. messageSends: ["visitIRAssignment:"]
  39791. }),
  39792. $globals.IRAssignment);
  39793. $core.addMethod(
  39794. $core.method({
  39795. selector: "left",
  39796. protocol: "accessing",
  39797. fn: function (){
  39798. var self=this,$self=this;
  39799. return $core.withContext(function($ctx1) {
  39800. return $recv($self._dagChildren())._first();
  39801. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  39802. },
  39803. args: [],
  39804. source: "left\x0a\x09^ self dagChildren first",
  39805. referencedClasses: [],
  39806. messageSends: ["first", "dagChildren"]
  39807. }),
  39808. $globals.IRAssignment);
  39809. $core.addMethod(
  39810. $core.method({
  39811. selector: "right",
  39812. protocol: "accessing",
  39813. fn: function (){
  39814. var self=this,$self=this;
  39815. return $core.withContext(function($ctx1) {
  39816. return $recv($self._dagChildren())._last();
  39817. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  39818. },
  39819. args: [],
  39820. source: "right\x0a\x09^ self dagChildren last",
  39821. referencedClasses: [],
  39822. messageSends: ["last", "dagChildren"]
  39823. }),
  39824. $globals.IRAssignment);
  39825. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  39826. $core.addMethod(
  39827. $core.method({
  39828. selector: "acceptDagVisitor:",
  39829. protocol: "visiting",
  39830. fn: function (aVisitor){
  39831. var self=this,$self=this;
  39832. return $core.withContext(function($ctx1) {
  39833. return $recv(aVisitor)._visitIRDynamicArray_(self);
  39834. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  39835. },
  39836. args: ["aVisitor"],
  39837. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  39838. referencedClasses: [],
  39839. messageSends: ["visitIRDynamicArray:"]
  39840. }),
  39841. $globals.IRDynamicArray);
  39842. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  39843. $core.addMethod(
  39844. $core.method({
  39845. selector: "acceptDagVisitor:",
  39846. protocol: "visiting",
  39847. fn: function (aVisitor){
  39848. var self=this,$self=this;
  39849. return $core.withContext(function($ctx1) {
  39850. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  39851. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  39852. },
  39853. args: ["aVisitor"],
  39854. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  39855. referencedClasses: [],
  39856. messageSends: ["visitIRDynamicDictionary:"]
  39857. }),
  39858. $globals.IRDynamicDictionary);
  39859. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  39860. $core.addMethod(
  39861. $core.method({
  39862. selector: "scope",
  39863. protocol: "accessing",
  39864. fn: function (){
  39865. var self=this,$self=this;
  39866. return $self["@scope"];
  39867. },
  39868. args: [],
  39869. source: "scope\x0a\x09^ scope",
  39870. referencedClasses: [],
  39871. messageSends: []
  39872. }),
  39873. $globals.IRScopedInstruction);
  39874. $core.addMethod(
  39875. $core.method({
  39876. selector: "scope:",
  39877. protocol: "accessing",
  39878. fn: function (aScope){
  39879. var self=this,$self=this;
  39880. $self["@scope"]=aScope;
  39881. return self;
  39882. },
  39883. args: ["aScope"],
  39884. source: "scope: aScope\x0a\x09scope := aScope",
  39885. referencedClasses: [],
  39886. messageSends: []
  39887. }),
  39888. $globals.IRScopedInstruction);
  39889. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  39890. $core.addMethod(
  39891. $core.method({
  39892. selector: "arguments",
  39893. protocol: "accessing",
  39894. fn: function (){
  39895. var self=this,$self=this;
  39896. return $core.withContext(function($ctx1) {
  39897. var $1,$receiver;
  39898. $1=$self["@arguments"];
  39899. if(($receiver = $1) == null || $receiver.a$nil){
  39900. return [];
  39901. } else {
  39902. return $1;
  39903. }
  39904. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  39905. },
  39906. args: [],
  39907. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  39908. referencedClasses: [],
  39909. messageSends: ["ifNil:"]
  39910. }),
  39911. $globals.IRClosureInstruction);
  39912. $core.addMethod(
  39913. $core.method({
  39914. selector: "arguments:",
  39915. protocol: "accessing",
  39916. fn: function (aCollection){
  39917. var self=this,$self=this;
  39918. $self["@arguments"]=aCollection;
  39919. return self;
  39920. },
  39921. args: ["aCollection"],
  39922. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  39923. referencedClasses: [],
  39924. messageSends: []
  39925. }),
  39926. $globals.IRClosureInstruction);
  39927. $core.addMethod(
  39928. $core.method({
  39929. selector: "locals",
  39930. protocol: "accessing",
  39931. fn: function (){
  39932. var self=this,$self=this;
  39933. return $core.withContext(function($ctx1) {
  39934. var $1;
  39935. $1=$recv($self._arguments())._copy();
  39936. $recv($1)._addAll_($recv($self._tempDeclarations())._collect_((function(each){
  39937. return $core.withContext(function($ctx2) {
  39938. return $recv(each)._name();
  39939. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39940. })));
  39941. return $recv($1)._yourself();
  39942. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  39943. },
  39944. args: [],
  39945. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  39946. referencedClasses: [],
  39947. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  39948. }),
  39949. $globals.IRClosureInstruction);
  39950. $core.addMethod(
  39951. $core.method({
  39952. selector: "requiresSmalltalkContext",
  39953. protocol: "accessing",
  39954. fn: function (){
  39955. var self=this,$self=this;
  39956. return $core.withContext(function($ctx1) {
  39957. var $1,$receiver;
  39958. $1=$self["@requiresSmalltalkContext"];
  39959. if(($receiver = $1) == null || $receiver.a$nil){
  39960. return false;
  39961. } else {
  39962. return $1;
  39963. }
  39964. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  39965. },
  39966. args: [],
  39967. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  39968. referencedClasses: [],
  39969. messageSends: ["ifNil:"]
  39970. }),
  39971. $globals.IRClosureInstruction);
  39972. $core.addMethod(
  39973. $core.method({
  39974. selector: "requiresSmalltalkContext:",
  39975. protocol: "accessing",
  39976. fn: function (anObject){
  39977. var self=this,$self=this;
  39978. $self["@requiresSmalltalkContext"]=anObject;
  39979. return self;
  39980. },
  39981. args: ["anObject"],
  39982. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  39983. referencedClasses: [],
  39984. messageSends: []
  39985. }),
  39986. $globals.IRClosureInstruction);
  39987. $core.addMethod(
  39988. $core.method({
  39989. selector: "scope:",
  39990. protocol: "accessing",
  39991. fn: function (aScope){
  39992. var self=this,$self=this;
  39993. return $core.withContext(function($ctx1) {
  39994. (
  39995. $ctx1.supercall = true,
  39996. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($self, [aScope]));
  39997. $ctx1.supercall = false;
  39998. $recv(aScope)._instruction_(self);
  39999. return self;
  40000. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  40001. },
  40002. args: ["aScope"],
  40003. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  40004. referencedClasses: [],
  40005. messageSends: ["scope:", "instruction:"]
  40006. }),
  40007. $globals.IRClosureInstruction);
  40008. $core.addMethod(
  40009. $core.method({
  40010. selector: "tempDeclarations",
  40011. protocol: "accessing",
  40012. fn: function (){
  40013. var self=this,$self=this;
  40014. return $core.withContext(function($ctx1) {
  40015. return $recv($self._dagChildren())._select_((function(each){
  40016. return $core.withContext(function($ctx2) {
  40017. return $recv(each)._isTempDeclaration();
  40018. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40019. }));
  40020. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  40021. },
  40022. args: [],
  40023. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  40024. referencedClasses: [],
  40025. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  40026. }),
  40027. $globals.IRClosureInstruction);
  40028. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  40029. $core.addMethod(
  40030. $core.method({
  40031. selector: "acceptDagVisitor:",
  40032. protocol: "visiting",
  40033. fn: function (aVisitor){
  40034. var self=this,$self=this;
  40035. return $core.withContext(function($ctx1) {
  40036. return $recv(aVisitor)._visitIRClosure_(self);
  40037. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  40038. },
  40039. args: ["aVisitor"],
  40040. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  40041. referencedClasses: [],
  40042. messageSends: ["visitIRClosure:"]
  40043. }),
  40044. $globals.IRClosure);
  40045. $core.addMethod(
  40046. $core.method({
  40047. selector: "isClosure",
  40048. protocol: "testing",
  40049. fn: function (){
  40050. var self=this,$self=this;
  40051. return true;
  40052. },
  40053. args: [],
  40054. source: "isClosure\x0a\x09^ true",
  40055. referencedClasses: [],
  40056. messageSends: []
  40057. }),
  40058. $globals.IRClosure);
  40059. $core.addMethod(
  40060. $core.method({
  40061. selector: "sequence",
  40062. protocol: "accessing",
  40063. fn: function (){
  40064. var self=this,$self=this;
  40065. return $core.withContext(function($ctx1) {
  40066. return $recv($self._dagChildren())._last();
  40067. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  40068. },
  40069. args: [],
  40070. source: "sequence\x0a\x09^ self dagChildren last",
  40071. referencedClasses: [],
  40072. messageSends: ["last", "dagChildren"]
  40073. }),
  40074. $globals.IRClosure);
  40075. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  40076. $globals.IRMethod.comment="I am a method instruction";
  40077. $core.addMethod(
  40078. $core.method({
  40079. selector: "acceptDagVisitor:",
  40080. protocol: "visiting",
  40081. fn: function (aVisitor){
  40082. var self=this,$self=this;
  40083. return $core.withContext(function($ctx1) {
  40084. return $recv(aVisitor)._visitIRMethod_(self);
  40085. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  40086. },
  40087. args: ["aVisitor"],
  40088. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  40089. referencedClasses: [],
  40090. messageSends: ["visitIRMethod:"]
  40091. }),
  40092. $globals.IRMethod);
  40093. $core.addMethod(
  40094. $core.method({
  40095. selector: "classReferences",
  40096. protocol: "accessing",
  40097. fn: function (){
  40098. var self=this,$self=this;
  40099. return $self["@classReferences"];
  40100. },
  40101. args: [],
  40102. source: "classReferences\x0a\x09^ classReferences",
  40103. referencedClasses: [],
  40104. messageSends: []
  40105. }),
  40106. $globals.IRMethod);
  40107. $core.addMethod(
  40108. $core.method({
  40109. selector: "classReferences:",
  40110. protocol: "accessing",
  40111. fn: function (aCollection){
  40112. var self=this,$self=this;
  40113. $self["@classReferences"]=aCollection;
  40114. return self;
  40115. },
  40116. args: ["aCollection"],
  40117. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  40118. referencedClasses: [],
  40119. messageSends: []
  40120. }),
  40121. $globals.IRMethod);
  40122. $core.addMethod(
  40123. $core.method({
  40124. selector: "internalVariables",
  40125. protocol: "accessing",
  40126. fn: function (){
  40127. var self=this,$self=this;
  40128. return $core.withContext(function($ctx1) {
  40129. var $1,$receiver;
  40130. $1=$self["@internalVariables"];
  40131. if(($receiver = $1) == null || $receiver.a$nil){
  40132. $self["@internalVariables"]=$recv($globals.Set)._new();
  40133. return $self["@internalVariables"];
  40134. } else {
  40135. return $1;
  40136. }
  40137. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  40138. },
  40139. args: [],
  40140. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  40141. referencedClasses: ["Set"],
  40142. messageSends: ["ifNil:", "new"]
  40143. }),
  40144. $globals.IRMethod);
  40145. $core.addMethod(
  40146. $core.method({
  40147. selector: "isMethod",
  40148. protocol: "testing",
  40149. fn: function (){
  40150. var self=this,$self=this;
  40151. return true;
  40152. },
  40153. args: [],
  40154. source: "isMethod\x0a\x09^ true",
  40155. referencedClasses: [],
  40156. messageSends: []
  40157. }),
  40158. $globals.IRMethod);
  40159. $core.addMethod(
  40160. $core.method({
  40161. selector: "messageSends",
  40162. protocol: "accessing",
  40163. fn: function (){
  40164. var self=this,$self=this;
  40165. return $core.withContext(function($ctx1) {
  40166. return $recv($self._sendIndexes())._keys();
  40167. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  40168. },
  40169. args: [],
  40170. source: "messageSends\x0a\x09^ self sendIndexes keys",
  40171. referencedClasses: [],
  40172. messageSends: ["keys", "sendIndexes"]
  40173. }),
  40174. $globals.IRMethod);
  40175. $core.addMethod(
  40176. $core.method({
  40177. selector: "method",
  40178. protocol: "accessing",
  40179. fn: function (){
  40180. var self=this,$self=this;
  40181. return self;
  40182. },
  40183. args: [],
  40184. source: "method\x0a\x09^ self",
  40185. referencedClasses: [],
  40186. messageSends: []
  40187. }),
  40188. $globals.IRMethod);
  40189. $core.addMethod(
  40190. $core.method({
  40191. selector: "selector",
  40192. protocol: "accessing",
  40193. fn: function (){
  40194. var self=this,$self=this;
  40195. return $self["@selector"];
  40196. },
  40197. args: [],
  40198. source: "selector\x0a\x09^ selector",
  40199. referencedClasses: [],
  40200. messageSends: []
  40201. }),
  40202. $globals.IRMethod);
  40203. $core.addMethod(
  40204. $core.method({
  40205. selector: "selector:",
  40206. protocol: "accessing",
  40207. fn: function (aString){
  40208. var self=this,$self=this;
  40209. $self["@selector"]=aString;
  40210. return self;
  40211. },
  40212. args: ["aString"],
  40213. source: "selector: aString\x0a\x09selector := aString",
  40214. referencedClasses: [],
  40215. messageSends: []
  40216. }),
  40217. $globals.IRMethod);
  40218. $core.addMethod(
  40219. $core.method({
  40220. selector: "sendIndexes",
  40221. protocol: "accessing",
  40222. fn: function (){
  40223. var self=this,$self=this;
  40224. return $self["@sendIndexes"];
  40225. },
  40226. args: [],
  40227. source: "sendIndexes\x0a\x09^ sendIndexes",
  40228. referencedClasses: [],
  40229. messageSends: []
  40230. }),
  40231. $globals.IRMethod);
  40232. $core.addMethod(
  40233. $core.method({
  40234. selector: "sendIndexes:",
  40235. protocol: "accessing",
  40236. fn: function (aDictionary){
  40237. var self=this,$self=this;
  40238. $self["@sendIndexes"]=aDictionary;
  40239. return self;
  40240. },
  40241. args: ["aDictionary"],
  40242. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  40243. referencedClasses: [],
  40244. messageSends: []
  40245. }),
  40246. $globals.IRMethod);
  40247. $core.addMethod(
  40248. $core.method({
  40249. selector: "source",
  40250. protocol: "accessing",
  40251. fn: function (){
  40252. var self=this,$self=this;
  40253. return $self["@source"];
  40254. },
  40255. args: [],
  40256. source: "source\x0a\x09^ source",
  40257. referencedClasses: [],
  40258. messageSends: []
  40259. }),
  40260. $globals.IRMethod);
  40261. $core.addMethod(
  40262. $core.method({
  40263. selector: "source:",
  40264. protocol: "accessing",
  40265. fn: function (aString){
  40266. var self=this,$self=this;
  40267. $self["@source"]=aString;
  40268. return self;
  40269. },
  40270. args: ["aString"],
  40271. source: "source: aString\x0a\x09source := aString",
  40272. referencedClasses: [],
  40273. messageSends: []
  40274. }),
  40275. $globals.IRMethod);
  40276. $core.addMethod(
  40277. $core.method({
  40278. selector: "theClass",
  40279. protocol: "accessing",
  40280. fn: function (){
  40281. var self=this,$self=this;
  40282. return $self["@theClass"];
  40283. },
  40284. args: [],
  40285. source: "theClass\x0a\x09^ theClass",
  40286. referencedClasses: [],
  40287. messageSends: []
  40288. }),
  40289. $globals.IRMethod);
  40290. $core.addMethod(
  40291. $core.method({
  40292. selector: "theClass:",
  40293. protocol: "accessing",
  40294. fn: function (aClass){
  40295. var self=this,$self=this;
  40296. $self["@theClass"]=aClass;
  40297. return self;
  40298. },
  40299. args: ["aClass"],
  40300. source: "theClass: aClass\x0a\x09theClass := aClass",
  40301. referencedClasses: [],
  40302. messageSends: []
  40303. }),
  40304. $globals.IRMethod);
  40305. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  40306. $globals.IRReturn.comment="I am a local return instruction.";
  40307. $core.addMethod(
  40308. $core.method({
  40309. selector: "acceptDagVisitor:",
  40310. protocol: "visiting",
  40311. fn: function (aVisitor){
  40312. var self=this,$self=this;
  40313. return $core.withContext(function($ctx1) {
  40314. return $recv(aVisitor)._visitIRReturn_(self);
  40315. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  40316. },
  40317. args: ["aVisitor"],
  40318. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  40319. referencedClasses: [],
  40320. messageSends: ["visitIRReturn:"]
  40321. }),
  40322. $globals.IRReturn);
  40323. $core.addMethod(
  40324. $core.method({
  40325. selector: "expression",
  40326. protocol: "accessing",
  40327. fn: function (){
  40328. var self=this,$self=this;
  40329. return $core.withContext(function($ctx1) {
  40330. return $recv($self._dagChildren())._single();
  40331. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  40332. },
  40333. args: [],
  40334. source: "expression\x0a\x09^ self dagChildren single",
  40335. referencedClasses: [],
  40336. messageSends: ["single", "dagChildren"]
  40337. }),
  40338. $globals.IRReturn);
  40339. $core.addMethod(
  40340. $core.method({
  40341. selector: "scope",
  40342. protocol: "accessing",
  40343. fn: function (){
  40344. var self=this,$self=this;
  40345. return $core.withContext(function($ctx1) {
  40346. var $1,$receiver;
  40347. $1=$self["@scope"];
  40348. if(($receiver = $1) == null || $receiver.a$nil){
  40349. return $recv($self._parent())._scope();
  40350. } else {
  40351. return $1;
  40352. }
  40353. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  40354. },
  40355. args: [],
  40356. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  40357. referencedClasses: [],
  40358. messageSends: ["ifNil:", "scope", "parent"]
  40359. }),
  40360. $globals.IRReturn);
  40361. $core.addMethod(
  40362. $core.method({
  40363. selector: "yieldsValue",
  40364. protocol: "testing",
  40365. fn: function (){
  40366. var self=this,$self=this;
  40367. return false;
  40368. },
  40369. args: [],
  40370. source: "yieldsValue\x0a\x09^ false",
  40371. referencedClasses: [],
  40372. messageSends: []
  40373. }),
  40374. $globals.IRReturn);
  40375. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  40376. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  40377. $core.addMethod(
  40378. $core.method({
  40379. selector: "acceptDagVisitor:",
  40380. protocol: "visiting",
  40381. fn: function (aVisitor){
  40382. var self=this,$self=this;
  40383. return $core.withContext(function($ctx1) {
  40384. return $recv(aVisitor)._visitIRBlockReturn_(self);
  40385. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  40386. },
  40387. args: ["aVisitor"],
  40388. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  40389. referencedClasses: [],
  40390. messageSends: ["visitIRBlockReturn:"]
  40391. }),
  40392. $globals.IRBlockReturn);
  40393. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  40394. $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.";
  40395. $core.addMethod(
  40396. $core.method({
  40397. selector: "acceptDagVisitor:",
  40398. protocol: "visiting",
  40399. fn: function (aVisitor){
  40400. var self=this,$self=this;
  40401. return $core.withContext(function($ctx1) {
  40402. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  40403. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  40404. },
  40405. args: ["aVisitor"],
  40406. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  40407. referencedClasses: [],
  40408. messageSends: ["visitIRNonLocalReturn:"]
  40409. }),
  40410. $globals.IRNonLocalReturn);
  40411. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  40412. $core.addMethod(
  40413. $core.method({
  40414. selector: "acceptDagVisitor:",
  40415. protocol: "visiting",
  40416. fn: function (aVisitor){
  40417. var self=this,$self=this;
  40418. return $core.withContext(function($ctx1) {
  40419. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  40420. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  40421. },
  40422. args: ["aVisitor"],
  40423. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  40424. referencedClasses: [],
  40425. messageSends: ["visitIRTempDeclaration:"]
  40426. }),
  40427. $globals.IRTempDeclaration);
  40428. $core.addMethod(
  40429. $core.method({
  40430. selector: "isTempDeclaration",
  40431. protocol: "testing",
  40432. fn: function (){
  40433. var self=this,$self=this;
  40434. return true;
  40435. },
  40436. args: [],
  40437. source: "isTempDeclaration\x0a\x09^ true",
  40438. referencedClasses: [],
  40439. messageSends: []
  40440. }),
  40441. $globals.IRTempDeclaration);
  40442. $core.addMethod(
  40443. $core.method({
  40444. selector: "name",
  40445. protocol: "accessing",
  40446. fn: function (){
  40447. var self=this,$self=this;
  40448. return $self["@name"];
  40449. },
  40450. args: [],
  40451. source: "name\x0a\x09^ name",
  40452. referencedClasses: [],
  40453. messageSends: []
  40454. }),
  40455. $globals.IRTempDeclaration);
  40456. $core.addMethod(
  40457. $core.method({
  40458. selector: "name:",
  40459. protocol: "accessing",
  40460. fn: function (aString){
  40461. var self=this,$self=this;
  40462. $self["@name"]=aString;
  40463. return self;
  40464. },
  40465. args: ["aString"],
  40466. source: "name: aString\x0a\x09name := aString",
  40467. referencedClasses: [],
  40468. messageSends: []
  40469. }),
  40470. $globals.IRTempDeclaration);
  40471. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "index"], "Compiler-IR");
  40472. $globals.IRSend.comment="I am a message send instruction.";
  40473. $core.addMethod(
  40474. $core.method({
  40475. selector: "acceptDagVisitor:",
  40476. protocol: "visiting",
  40477. fn: function (aVisitor){
  40478. var self=this,$self=this;
  40479. return $core.withContext(function($ctx1) {
  40480. return $recv(aVisitor)._visitIRSend_(self);
  40481. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  40482. },
  40483. args: ["aVisitor"],
  40484. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  40485. referencedClasses: [],
  40486. messageSends: ["visitIRSend:"]
  40487. }),
  40488. $globals.IRSend);
  40489. $core.addMethod(
  40490. $core.method({
  40491. selector: "arguments",
  40492. protocol: "accessing",
  40493. fn: function (){
  40494. var self=this,$self=this;
  40495. return $core.withContext(function($ctx1) {
  40496. return $recv($self._dagChildren())._allButFirst();
  40497. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  40498. },
  40499. args: [],
  40500. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  40501. referencedClasses: [],
  40502. messageSends: ["allButFirst", "dagChildren"]
  40503. }),
  40504. $globals.IRSend);
  40505. $core.addMethod(
  40506. $core.method({
  40507. selector: "index",
  40508. protocol: "accessing",
  40509. fn: function (){
  40510. var self=this,$self=this;
  40511. return $self["@index"];
  40512. },
  40513. args: [],
  40514. source: "index\x0a\x09^ index",
  40515. referencedClasses: [],
  40516. messageSends: []
  40517. }),
  40518. $globals.IRSend);
  40519. $core.addMethod(
  40520. $core.method({
  40521. selector: "index:",
  40522. protocol: "accessing",
  40523. fn: function (anInteger){
  40524. var self=this,$self=this;
  40525. $self["@index"]=anInteger;
  40526. return self;
  40527. },
  40528. args: ["anInteger"],
  40529. source: "index: anInteger\x0a\x09index := anInteger",
  40530. referencedClasses: [],
  40531. messageSends: []
  40532. }),
  40533. $globals.IRSend);
  40534. $core.addMethod(
  40535. $core.method({
  40536. selector: "isSend",
  40537. protocol: "testing",
  40538. fn: function (){
  40539. var self=this,$self=this;
  40540. return true;
  40541. },
  40542. args: [],
  40543. source: "isSend\x0a\x09^ true",
  40544. referencedClasses: [],
  40545. messageSends: []
  40546. }),
  40547. $globals.IRSend);
  40548. $core.addMethod(
  40549. $core.method({
  40550. selector: "receiver",
  40551. protocol: "accessing",
  40552. fn: function (){
  40553. var self=this,$self=this;
  40554. return $core.withContext(function($ctx1) {
  40555. return $recv($self._dagChildren())._first();
  40556. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  40557. },
  40558. args: [],
  40559. source: "receiver\x0a\x09^ self dagChildren first",
  40560. referencedClasses: [],
  40561. messageSends: ["first", "dagChildren"]
  40562. }),
  40563. $globals.IRSend);
  40564. $core.addMethod(
  40565. $core.method({
  40566. selector: "selector",
  40567. protocol: "accessing",
  40568. fn: function (){
  40569. var self=this,$self=this;
  40570. return $self["@selector"];
  40571. },
  40572. args: [],
  40573. source: "selector\x0a\x09^ selector",
  40574. referencedClasses: [],
  40575. messageSends: []
  40576. }),
  40577. $globals.IRSend);
  40578. $core.addMethod(
  40579. $core.method({
  40580. selector: "selector:",
  40581. protocol: "accessing",
  40582. fn: function (aString){
  40583. var self=this,$self=this;
  40584. $self["@selector"]=aString;
  40585. return self;
  40586. },
  40587. args: ["aString"],
  40588. source: "selector: aString\x0a\x09selector := aString",
  40589. referencedClasses: [],
  40590. messageSends: []
  40591. }),
  40592. $globals.IRSend);
  40593. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  40594. $core.addMethod(
  40595. $core.method({
  40596. selector: "acceptDagVisitor:",
  40597. protocol: "visiting",
  40598. fn: function (aVisitor){
  40599. var self=this,$self=this;
  40600. return $core.withContext(function($ctx1) {
  40601. return $recv(aVisitor)._visitIRSequence_(self);
  40602. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  40603. },
  40604. args: ["aVisitor"],
  40605. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  40606. referencedClasses: [],
  40607. messageSends: ["visitIRSequence:"]
  40608. }),
  40609. $globals.IRSequence);
  40610. $core.addMethod(
  40611. $core.method({
  40612. selector: "isSequence",
  40613. protocol: "testing",
  40614. fn: function (){
  40615. var self=this,$self=this;
  40616. return true;
  40617. },
  40618. args: [],
  40619. source: "isSequence\x0a\x09^ true",
  40620. referencedClasses: [],
  40621. messageSends: []
  40622. }),
  40623. $globals.IRSequence);
  40624. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  40625. $core.addMethod(
  40626. $core.method({
  40627. selector: "acceptDagVisitor:",
  40628. protocol: "visiting",
  40629. fn: function (aVisitor){
  40630. var self=this,$self=this;
  40631. return $core.withContext(function($ctx1) {
  40632. return $recv(aVisitor)._visitIRBlockSequence_(self);
  40633. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  40634. },
  40635. args: ["aVisitor"],
  40636. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  40637. referencedClasses: [],
  40638. messageSends: ["visitIRBlockSequence:"]
  40639. }),
  40640. $globals.IRBlockSequence);
  40641. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  40642. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  40643. $core.addMethod(
  40644. $core.method({
  40645. selector: "acceptDagVisitor:",
  40646. protocol: "visiting",
  40647. fn: function (aVisitor){
  40648. var self=this,$self=this;
  40649. return $core.withContext(function($ctx1) {
  40650. return $recv(aVisitor)._visitIRValue_(self);
  40651. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  40652. },
  40653. args: ["aVisitor"],
  40654. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  40655. referencedClasses: [],
  40656. messageSends: ["visitIRValue:"]
  40657. }),
  40658. $globals.IRValue);
  40659. $core.addMethod(
  40660. $core.method({
  40661. selector: "needsBoxingAsReceiver",
  40662. protocol: "testing",
  40663. fn: function (){
  40664. var self=this,$self=this;
  40665. return false;
  40666. },
  40667. args: [],
  40668. source: "needsBoxingAsReceiver\x0a\x09^ false",
  40669. referencedClasses: [],
  40670. messageSends: []
  40671. }),
  40672. $globals.IRValue);
  40673. $core.addMethod(
  40674. $core.method({
  40675. selector: "value",
  40676. protocol: "accessing",
  40677. fn: function (){
  40678. var self=this,$self=this;
  40679. return $self["@value"];
  40680. },
  40681. args: [],
  40682. source: "value\x0a\x09^ value",
  40683. referencedClasses: [],
  40684. messageSends: []
  40685. }),
  40686. $globals.IRValue);
  40687. $core.addMethod(
  40688. $core.method({
  40689. selector: "value:",
  40690. protocol: "accessing",
  40691. fn: function (aString){
  40692. var self=this,$self=this;
  40693. $self["@value"]=aString;
  40694. return self;
  40695. },
  40696. args: ["aString"],
  40697. source: "value: aString\x0a\x09value := aString",
  40698. referencedClasses: [],
  40699. messageSends: []
  40700. }),
  40701. $globals.IRValue);
  40702. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  40703. $globals.IRVariable.comment="I am a variable instruction.";
  40704. $core.addMethod(
  40705. $core.method({
  40706. selector: "acceptDagVisitor:",
  40707. protocol: "visiting",
  40708. fn: function (aVisitor){
  40709. var self=this,$self=this;
  40710. return $core.withContext(function($ctx1) {
  40711. return $recv(aVisitor)._visitIRVariable_(self);
  40712. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  40713. },
  40714. args: ["aVisitor"],
  40715. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  40716. referencedClasses: [],
  40717. messageSends: ["visitIRVariable:"]
  40718. }),
  40719. $globals.IRVariable);
  40720. $core.addMethod(
  40721. $core.method({
  40722. selector: "isSelf",
  40723. protocol: "testing",
  40724. fn: function (){
  40725. var self=this,$self=this;
  40726. return $core.withContext(function($ctx1) {
  40727. return $recv($self._variable())._isSelf();
  40728. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.IRVariable)});
  40729. },
  40730. args: [],
  40731. source: "isSelf\x0a\x09^ self variable isSelf",
  40732. referencedClasses: [],
  40733. messageSends: ["isSelf", "variable"]
  40734. }),
  40735. $globals.IRVariable);
  40736. $core.addMethod(
  40737. $core.method({
  40738. selector: "isSuper",
  40739. protocol: "testing",
  40740. fn: function (){
  40741. var self=this,$self=this;
  40742. return $core.withContext(function($ctx1) {
  40743. return $recv($self._variable())._isSuper();
  40744. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.IRVariable)});
  40745. },
  40746. args: [],
  40747. source: "isSuper\x0a\x09^ self variable isSuper",
  40748. referencedClasses: [],
  40749. messageSends: ["isSuper", "variable"]
  40750. }),
  40751. $globals.IRVariable);
  40752. $core.addMethod(
  40753. $core.method({
  40754. selector: "isVariable",
  40755. protocol: "testing",
  40756. fn: function (){
  40757. var self=this,$self=this;
  40758. return true;
  40759. },
  40760. args: [],
  40761. source: "isVariable\x0a\x09^ true",
  40762. referencedClasses: [],
  40763. messageSends: []
  40764. }),
  40765. $globals.IRVariable);
  40766. $core.addMethod(
  40767. $core.method({
  40768. selector: "needsBoxingAsReceiver",
  40769. protocol: "testing",
  40770. fn: function (){
  40771. var self=this,$self=this;
  40772. return $core.withContext(function($ctx1) {
  40773. return $recv($recv($self._variable())._isPseudoVar())._not();
  40774. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  40775. },
  40776. args: [],
  40777. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  40778. referencedClasses: [],
  40779. messageSends: ["not", "isPseudoVar", "variable"]
  40780. }),
  40781. $globals.IRVariable);
  40782. $core.addMethod(
  40783. $core.method({
  40784. selector: "variable",
  40785. protocol: "accessing",
  40786. fn: function (){
  40787. var self=this,$self=this;
  40788. return $self["@variable"];
  40789. },
  40790. args: [],
  40791. source: "variable\x0a\x09^ variable",
  40792. referencedClasses: [],
  40793. messageSends: []
  40794. }),
  40795. $globals.IRVariable);
  40796. $core.addMethod(
  40797. $core.method({
  40798. selector: "variable:",
  40799. protocol: "accessing",
  40800. fn: function (aScopeVariable){
  40801. var self=this,$self=this;
  40802. $self["@variable"]=aScopeVariable;
  40803. return self;
  40804. },
  40805. args: ["aScopeVariable"],
  40806. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  40807. referencedClasses: [],
  40808. messageSends: []
  40809. }),
  40810. $globals.IRVariable);
  40811. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  40812. $core.addMethod(
  40813. $core.method({
  40814. selector: "acceptDagVisitor:",
  40815. protocol: "visiting",
  40816. fn: function (aVisitor){
  40817. var self=this,$self=this;
  40818. return $core.withContext(function($ctx1) {
  40819. return $recv(aVisitor)._visitIRVerbatim_(self);
  40820. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  40821. },
  40822. args: ["aVisitor"],
  40823. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  40824. referencedClasses: [],
  40825. messageSends: ["visitIRVerbatim:"]
  40826. }),
  40827. $globals.IRVerbatim);
  40828. $core.addMethod(
  40829. $core.method({
  40830. selector: "source",
  40831. protocol: "accessing",
  40832. fn: function (){
  40833. var self=this,$self=this;
  40834. return $self["@source"];
  40835. },
  40836. args: [],
  40837. source: "source\x0a\x09^ source",
  40838. referencedClasses: [],
  40839. messageSends: []
  40840. }),
  40841. $globals.IRVerbatim);
  40842. $core.addMethod(
  40843. $core.method({
  40844. selector: "source:",
  40845. protocol: "accessing",
  40846. fn: function (aString){
  40847. var self=this,$self=this;
  40848. $self["@source"]=aString;
  40849. return self;
  40850. },
  40851. args: ["aString"],
  40852. source: "source: aString\x0a\x09source := aString",
  40853. referencedClasses: [],
  40854. messageSends: []
  40855. }),
  40856. $globals.IRVerbatim);
  40857. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  40858. $core.addMethod(
  40859. $core.method({
  40860. selector: "visitDagNode:",
  40861. protocol: "visiting",
  40862. fn: function (aNode){
  40863. var self=this,$self=this;
  40864. return $core.withContext(function($ctx1) {
  40865. return $self._visitDagNodeVariantSimple_(aNode);
  40866. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  40867. },
  40868. args: ["aNode"],
  40869. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  40870. referencedClasses: [],
  40871. messageSends: ["visitDagNodeVariantSimple:"]
  40872. }),
  40873. $globals.IRVisitor);
  40874. $core.addMethod(
  40875. $core.method({
  40876. selector: "visitIRAssignment:",
  40877. protocol: "visiting",
  40878. fn: function (anIRAssignment){
  40879. var self=this,$self=this;
  40880. return $core.withContext(function($ctx1) {
  40881. return $self._visitDagNode_(anIRAssignment);
  40882. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  40883. },
  40884. args: ["anIRAssignment"],
  40885. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  40886. referencedClasses: [],
  40887. messageSends: ["visitDagNode:"]
  40888. }),
  40889. $globals.IRVisitor);
  40890. $core.addMethod(
  40891. $core.method({
  40892. selector: "visitIRBlockReturn:",
  40893. protocol: "visiting",
  40894. fn: function (anIRBlockReturn){
  40895. var self=this,$self=this;
  40896. return $core.withContext(function($ctx1) {
  40897. return $self._visitIRReturn_(anIRBlockReturn);
  40898. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  40899. },
  40900. args: ["anIRBlockReturn"],
  40901. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  40902. referencedClasses: [],
  40903. messageSends: ["visitIRReturn:"]
  40904. }),
  40905. $globals.IRVisitor);
  40906. $core.addMethod(
  40907. $core.method({
  40908. selector: "visitIRBlockSequence:",
  40909. protocol: "visiting",
  40910. fn: function (anIRBlockSequence){
  40911. var self=this,$self=this;
  40912. return $core.withContext(function($ctx1) {
  40913. return $self._visitIRSequence_(anIRBlockSequence);
  40914. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  40915. },
  40916. args: ["anIRBlockSequence"],
  40917. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  40918. referencedClasses: [],
  40919. messageSends: ["visitIRSequence:"]
  40920. }),
  40921. $globals.IRVisitor);
  40922. $core.addMethod(
  40923. $core.method({
  40924. selector: "visitIRClosure:",
  40925. protocol: "visiting",
  40926. fn: function (anIRClosure){
  40927. var self=this,$self=this;
  40928. return $core.withContext(function($ctx1) {
  40929. return $self._visitDagNode_(anIRClosure);
  40930. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  40931. },
  40932. args: ["anIRClosure"],
  40933. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  40934. referencedClasses: [],
  40935. messageSends: ["visitDagNode:"]
  40936. }),
  40937. $globals.IRVisitor);
  40938. $core.addMethod(
  40939. $core.method({
  40940. selector: "visitIRDynamicArray:",
  40941. protocol: "visiting",
  40942. fn: function (anIRDynamicArray){
  40943. var self=this,$self=this;
  40944. return $core.withContext(function($ctx1) {
  40945. return $self._visitDagNode_(anIRDynamicArray);
  40946. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  40947. },
  40948. args: ["anIRDynamicArray"],
  40949. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  40950. referencedClasses: [],
  40951. messageSends: ["visitDagNode:"]
  40952. }),
  40953. $globals.IRVisitor);
  40954. $core.addMethod(
  40955. $core.method({
  40956. selector: "visitIRDynamicDictionary:",
  40957. protocol: "visiting",
  40958. fn: function (anIRDynamicDictionary){
  40959. var self=this,$self=this;
  40960. return $core.withContext(function($ctx1) {
  40961. return $self._visitDagNode_(anIRDynamicDictionary);
  40962. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  40963. },
  40964. args: ["anIRDynamicDictionary"],
  40965. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  40966. referencedClasses: [],
  40967. messageSends: ["visitDagNode:"]
  40968. }),
  40969. $globals.IRVisitor);
  40970. $core.addMethod(
  40971. $core.method({
  40972. selector: "visitIRInlinedClosure:",
  40973. protocol: "visiting",
  40974. fn: function (anIRInlinedClosure){
  40975. var self=this,$self=this;
  40976. return $core.withContext(function($ctx1) {
  40977. return $self._visitIRClosure_(anIRInlinedClosure);
  40978. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  40979. },
  40980. args: ["anIRInlinedClosure"],
  40981. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  40982. referencedClasses: [],
  40983. messageSends: ["visitIRClosure:"]
  40984. }),
  40985. $globals.IRVisitor);
  40986. $core.addMethod(
  40987. $core.method({
  40988. selector: "visitIRInlinedSequence:",
  40989. protocol: "visiting",
  40990. fn: function (anIRInlinedSequence){
  40991. var self=this,$self=this;
  40992. return $core.withContext(function($ctx1) {
  40993. return $self._visitIRSequence_(anIRInlinedSequence);
  40994. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  40995. },
  40996. args: ["anIRInlinedSequence"],
  40997. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  40998. referencedClasses: [],
  40999. messageSends: ["visitIRSequence:"]
  41000. }),
  41001. $globals.IRVisitor);
  41002. $core.addMethod(
  41003. $core.method({
  41004. selector: "visitIRMethod:",
  41005. protocol: "visiting",
  41006. fn: function (anIRMethod){
  41007. var self=this,$self=this;
  41008. return $core.withContext(function($ctx1) {
  41009. return $self._visitDagNode_(anIRMethod);
  41010. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  41011. },
  41012. args: ["anIRMethod"],
  41013. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  41014. referencedClasses: [],
  41015. messageSends: ["visitDagNode:"]
  41016. }),
  41017. $globals.IRVisitor);
  41018. $core.addMethod(
  41019. $core.method({
  41020. selector: "visitIRNonLocalReturn:",
  41021. protocol: "visiting",
  41022. fn: function (anIRNonLocalReturn){
  41023. var self=this,$self=this;
  41024. return $core.withContext(function($ctx1) {
  41025. return $self._visitDagNode_(anIRNonLocalReturn);
  41026. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  41027. },
  41028. args: ["anIRNonLocalReturn"],
  41029. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  41030. referencedClasses: [],
  41031. messageSends: ["visitDagNode:"]
  41032. }),
  41033. $globals.IRVisitor);
  41034. $core.addMethod(
  41035. $core.method({
  41036. selector: "visitIRNonLocalReturnHandling:",
  41037. protocol: "visiting",
  41038. fn: function (anIRNonLocalReturnHandling){
  41039. var self=this,$self=this;
  41040. return $core.withContext(function($ctx1) {
  41041. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  41042. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  41043. },
  41044. args: ["anIRNonLocalReturnHandling"],
  41045. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  41046. referencedClasses: [],
  41047. messageSends: ["visitDagNode:"]
  41048. }),
  41049. $globals.IRVisitor);
  41050. $core.addMethod(
  41051. $core.method({
  41052. selector: "visitIRReturn:",
  41053. protocol: "visiting",
  41054. fn: function (anIRReturn){
  41055. var self=this,$self=this;
  41056. return $core.withContext(function($ctx1) {
  41057. return $self._visitDagNode_(anIRReturn);
  41058. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  41059. },
  41060. args: ["anIRReturn"],
  41061. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  41062. referencedClasses: [],
  41063. messageSends: ["visitDagNode:"]
  41064. }),
  41065. $globals.IRVisitor);
  41066. $core.addMethod(
  41067. $core.method({
  41068. selector: "visitIRSend:",
  41069. protocol: "visiting",
  41070. fn: function (anIRSend){
  41071. var self=this,$self=this;
  41072. return $core.withContext(function($ctx1) {
  41073. return $self._visitDagNode_(anIRSend);
  41074. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  41075. },
  41076. args: ["anIRSend"],
  41077. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  41078. referencedClasses: [],
  41079. messageSends: ["visitDagNode:"]
  41080. }),
  41081. $globals.IRVisitor);
  41082. $core.addMethod(
  41083. $core.method({
  41084. selector: "visitIRSequence:",
  41085. protocol: "visiting",
  41086. fn: function (anIRSequence){
  41087. var self=this,$self=this;
  41088. return $core.withContext(function($ctx1) {
  41089. return $self._visitDagNode_(anIRSequence);
  41090. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  41091. },
  41092. args: ["anIRSequence"],
  41093. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  41094. referencedClasses: [],
  41095. messageSends: ["visitDagNode:"]
  41096. }),
  41097. $globals.IRVisitor);
  41098. $core.addMethod(
  41099. $core.method({
  41100. selector: "visitIRTempDeclaration:",
  41101. protocol: "visiting",
  41102. fn: function (anIRTempDeclaration){
  41103. var self=this,$self=this;
  41104. return $core.withContext(function($ctx1) {
  41105. return $self._visitDagNode_(anIRTempDeclaration);
  41106. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  41107. },
  41108. args: ["anIRTempDeclaration"],
  41109. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  41110. referencedClasses: [],
  41111. messageSends: ["visitDagNode:"]
  41112. }),
  41113. $globals.IRVisitor);
  41114. $core.addMethod(
  41115. $core.method({
  41116. selector: "visitIRValue:",
  41117. protocol: "visiting",
  41118. fn: function (anIRValue){
  41119. var self=this,$self=this;
  41120. return $core.withContext(function($ctx1) {
  41121. return $self._visitDagNode_(anIRValue);
  41122. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  41123. },
  41124. args: ["anIRValue"],
  41125. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  41126. referencedClasses: [],
  41127. messageSends: ["visitDagNode:"]
  41128. }),
  41129. $globals.IRVisitor);
  41130. $core.addMethod(
  41131. $core.method({
  41132. selector: "visitIRVariable:",
  41133. protocol: "visiting",
  41134. fn: function (anIRVariable){
  41135. var self=this,$self=this;
  41136. return $core.withContext(function($ctx1) {
  41137. return $self._visitDagNode_(anIRVariable);
  41138. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  41139. },
  41140. args: ["anIRVariable"],
  41141. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  41142. referencedClasses: [],
  41143. messageSends: ["visitDagNode:"]
  41144. }),
  41145. $globals.IRVisitor);
  41146. $core.addMethod(
  41147. $core.method({
  41148. selector: "visitIRVerbatim:",
  41149. protocol: "visiting",
  41150. fn: function (anIRVerbatim){
  41151. var self=this,$self=this;
  41152. return $core.withContext(function($ctx1) {
  41153. return $self._visitDagNode_(anIRVerbatim);
  41154. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  41155. },
  41156. args: ["anIRVerbatim"],
  41157. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  41158. referencedClasses: [],
  41159. messageSends: ["visitDagNode:"]
  41160. }),
  41161. $globals.IRVisitor);
  41162. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  41163. $core.addMethod(
  41164. $core.method({
  41165. selector: "contents",
  41166. protocol: "accessing",
  41167. fn: function (){
  41168. var self=this,$self=this;
  41169. return $core.withContext(function($ctx1) {
  41170. return $recv($self._stream())._contents();
  41171. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  41172. },
  41173. args: [],
  41174. source: "contents\x0a\x09^ self stream contents",
  41175. referencedClasses: [],
  41176. messageSends: ["contents", "stream"]
  41177. }),
  41178. $globals.IRJSTranslator);
  41179. $core.addMethod(
  41180. $core.method({
  41181. selector: "currentClass",
  41182. protocol: "accessing",
  41183. fn: function (){
  41184. var self=this,$self=this;
  41185. return $self["@currentClass"];
  41186. },
  41187. args: [],
  41188. source: "currentClass\x0a\x09^ currentClass",
  41189. referencedClasses: [],
  41190. messageSends: []
  41191. }),
  41192. $globals.IRJSTranslator);
  41193. $core.addMethod(
  41194. $core.method({
  41195. selector: "currentClass:",
  41196. protocol: "accessing",
  41197. fn: function (aClass){
  41198. var self=this,$self=this;
  41199. $self["@currentClass"]=aClass;
  41200. return self;
  41201. },
  41202. args: ["aClass"],
  41203. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  41204. referencedClasses: [],
  41205. messageSends: []
  41206. }),
  41207. $globals.IRJSTranslator);
  41208. $core.addMethod(
  41209. $core.method({
  41210. selector: "initialize",
  41211. protocol: "initialization",
  41212. fn: function (){
  41213. var self=this,$self=this;
  41214. return $core.withContext(function($ctx1) {
  41215. (
  41216. $ctx1.supercall = true,
  41217. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41218. $ctx1.supercall = false;
  41219. $self["@stream"]=$recv($globals.JSStream)._new();
  41220. return self;
  41221. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  41222. },
  41223. args: [],
  41224. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  41225. referencedClasses: ["JSStream"],
  41226. messageSends: ["initialize", "new"]
  41227. }),
  41228. $globals.IRJSTranslator);
  41229. $core.addMethod(
  41230. $core.method({
  41231. selector: "stream",
  41232. protocol: "accessing",
  41233. fn: function (){
  41234. var self=this,$self=this;
  41235. return $self["@stream"];
  41236. },
  41237. args: [],
  41238. source: "stream\x0a\x09^ stream",
  41239. referencedClasses: [],
  41240. messageSends: []
  41241. }),
  41242. $globals.IRJSTranslator);
  41243. $core.addMethod(
  41244. $core.method({
  41245. selector: "stream:",
  41246. protocol: "accessing",
  41247. fn: function (aStream){
  41248. var self=this,$self=this;
  41249. $self["@stream"]=aStream;
  41250. return self;
  41251. },
  41252. args: ["aStream"],
  41253. source: "stream: aStream\x0a\x09stream := aStream",
  41254. referencedClasses: [],
  41255. messageSends: []
  41256. }),
  41257. $globals.IRJSTranslator);
  41258. $core.addMethod(
  41259. $core.method({
  41260. selector: "visitIRAssignment:",
  41261. protocol: "visiting",
  41262. fn: function (anIRAssignment){
  41263. var self=this,$self=this;
  41264. return $core.withContext(function($ctx1) {
  41265. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  41266. return $core.withContext(function($ctx2) {
  41267. return $self._visit_($recv(anIRAssignment)._left());
  41268. $ctx2.sendIdx["visit:"]=1;
  41269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41270. }),(function(){
  41271. return $core.withContext(function($ctx2) {
  41272. return $self._visit_($recv(anIRAssignment)._right());
  41273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41274. }));
  41275. return self;
  41276. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  41277. },
  41278. args: ["anIRAssignment"],
  41279. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  41280. referencedClasses: [],
  41281. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  41282. }),
  41283. $globals.IRJSTranslator);
  41284. $core.addMethod(
  41285. $core.method({
  41286. selector: "visitIRClosure:",
  41287. protocol: "visiting",
  41288. fn: function (anIRClosure){
  41289. var self=this,$self=this;
  41290. return $core.withContext(function($ctx1) {
  41291. var $1,$2;
  41292. $1=$self._stream();
  41293. $ctx1.sendIdx["stream"]=1;
  41294. $recv($1)._nextPutClosureWith_arguments_((function(){
  41295. return $core.withContext(function($ctx2) {
  41296. $2=$self._stream();
  41297. $ctx2.sendIdx["stream"]=2;
  41298. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  41299. return $core.withContext(function($ctx3) {
  41300. return $recv($recv(each)._name())._asVariableName();
  41301. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  41302. })));
  41303. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  41304. return $core.withContext(function($ctx3) {
  41305. return (
  41306. $ctx3.supercall = true,
  41307. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($self, [anIRClosure]));
  41308. $ctx3.supercall = false;
  41309. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  41310. }));
  41311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41312. }),$recv(anIRClosure)._arguments());
  41313. return self;
  41314. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  41315. },
  41316. args: ["anIRClosure"],
  41317. 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",
  41318. referencedClasses: [],
  41319. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  41320. }),
  41321. $globals.IRJSTranslator);
  41322. $core.addMethod(
  41323. $core.method({
  41324. selector: "visitIRDynamicArray:",
  41325. protocol: "visiting",
  41326. fn: function (anIRDynamicArray){
  41327. var self=this,$self=this;
  41328. return $core.withContext(function($ctx1) {
  41329. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  41330. return self;
  41331. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  41332. },
  41333. args: ["anIRDynamicArray"],
  41334. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  41335. referencedClasses: [],
  41336. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41337. }),
  41338. $globals.IRJSTranslator);
  41339. $core.addMethod(
  41340. $core.method({
  41341. selector: "visitIRDynamicDictionary:",
  41342. protocol: "visiting",
  41343. fn: function (anIRDynamicDictionary){
  41344. var self=this,$self=this;
  41345. return $core.withContext(function($ctx1) {
  41346. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  41347. return self;
  41348. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  41349. },
  41350. args: ["anIRDynamicDictionary"],
  41351. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  41352. referencedClasses: [],
  41353. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41354. }),
  41355. $globals.IRJSTranslator);
  41356. $core.addMethod(
  41357. $core.method({
  41358. selector: "visitIRMethod:",
  41359. protocol: "visiting",
  41360. fn: function (anIRMethod){
  41361. var self=this,$self=this;
  41362. return $core.withContext(function($ctx1) {
  41363. var $1,$2,$3,$4,$5,$6,$7;
  41364. $1=$self._stream();
  41365. $ctx1.sendIdx["stream"]=1;
  41366. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  41367. return $core.withContext(function($ctx2) {
  41368. $2=$self._stream();
  41369. $ctx2.sendIdx["stream"]=2;
  41370. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  41371. return $core.withContext(function($ctx3) {
  41372. $3=$self._stream();
  41373. $ctx3.sendIdx["stream"]=3;
  41374. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  41375. return $core.withContext(function($ctx4) {
  41376. return $recv($recv(each)._name())._asVariableName();
  41377. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  41378. }));
  41379. $ctx3.sendIdx["collect:"]=1;
  41380. $recv($3)._nextPutVars_($4);
  41381. $ctx3.sendIdx["nextPutVars:"]=1;
  41382. $5=$self._stream();
  41383. $ctx3.sendIdx["stream"]=4;
  41384. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  41385. return $core.withContext(function($ctx4) {
  41386. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  41387. return $core.withContext(function($ctx5) {
  41388. $6=$self._stream();
  41389. $ctx5.sendIdx["stream"]=5;
  41390. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  41391. return $core.withContext(function($ctx6) {
  41392. return $recv($recv(each)._variable())._alias();
  41393. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  41394. })));
  41395. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  41396. }));
  41397. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  41398. if($core.assert($7)){
  41399. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  41400. return $core.withContext(function($ctx5) {
  41401. return (
  41402. $ctx5.supercall = true,
  41403. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41404. $ctx5.supercall = false;
  41405. $ctx5.sendIdx["visitIRMethod:"]=1;
  41406. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  41407. }));
  41408. } else {
  41409. return (
  41410. $ctx4.supercall = true,
  41411. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41412. $ctx4.supercall = false;
  41413. }
  41414. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  41415. }));
  41416. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41417. }),$recv(anIRMethod)._arguments());
  41418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41419. }));
  41420. return $self._contents();
  41421. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  41422. },
  41423. args: ["anIRMethod"],
  41424. 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",
  41425. referencedClasses: [],
  41426. 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"]
  41427. }),
  41428. $globals.IRJSTranslator);
  41429. $core.addMethod(
  41430. $core.method({
  41431. selector: "visitIRNonLocalReturn:",
  41432. protocol: "visiting",
  41433. fn: function (anIRNonLocalReturn){
  41434. var self=this,$self=this;
  41435. return $core.withContext(function($ctx1) {
  41436. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  41437. return $core.withContext(function($ctx2) {
  41438. return (
  41439. $ctx2.supercall = true,
  41440. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  41441. $ctx2.supercall = false;
  41442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41443. }));
  41444. return self;
  41445. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  41446. },
  41447. args: ["anIRNonLocalReturn"],
  41448. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  41449. referencedClasses: [],
  41450. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  41451. }),
  41452. $globals.IRJSTranslator);
  41453. $core.addMethod(
  41454. $core.method({
  41455. selector: "visitIRReturn:",
  41456. protocol: "visiting",
  41457. fn: function (anIRReturn){
  41458. var self=this,$self=this;
  41459. return $core.withContext(function($ctx1) {
  41460. $recv($self._stream())._nextPutReturnWith_((function(){
  41461. return $core.withContext(function($ctx2) {
  41462. return (
  41463. $ctx2.supercall = true,
  41464. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  41465. $ctx2.supercall = false;
  41466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41467. }));
  41468. return self;
  41469. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  41470. },
  41471. args: ["anIRReturn"],
  41472. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  41473. referencedClasses: [],
  41474. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  41475. }),
  41476. $globals.IRJSTranslator);
  41477. $core.addMethod(
  41478. $core.method({
  41479. selector: "visitIRSend:",
  41480. protocol: "visiting",
  41481. fn: function (anIRSend){
  41482. var self=this,$self=this;
  41483. var sends,superclass;
  41484. return $core.withContext(function($ctx1) {
  41485. var $1,$2;
  41486. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  41487. $1=$recv($recv(anIRSend)._receiver())._isSuper();
  41488. if($core.assert($1)){
  41489. $self._visitSuperSend_(anIRSend);
  41490. } else {
  41491. $self._visitSend_(anIRSend);
  41492. }
  41493. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  41494. if($core.assert($2)){
  41495. $recv($self._stream())._nextPutSendIndexFor_(anIRSend);
  41496. }
  41497. return self;
  41498. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  41499. },
  41500. args: ["anIRSend"],
  41501. 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 ]",
  41502. referencedClasses: [],
  41503. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuper", "receiver", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  41504. }),
  41505. $globals.IRJSTranslator);
  41506. $core.addMethod(
  41507. $core.method({
  41508. selector: "visitIRSequence:",
  41509. protocol: "visiting",
  41510. fn: function (anIRSequence){
  41511. var self=this,$self=this;
  41512. return $core.withContext(function($ctx1) {
  41513. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  41514. return $core.withContext(function($ctx2) {
  41515. return $recv($self._stream())._nextPutStatementWith_((function(){
  41516. return $core.withContext(function($ctx3) {
  41517. return $self._visit_(each);
  41518. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41519. }));
  41520. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41521. }));
  41522. return self;
  41523. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  41524. },
  41525. args: ["anIRSequence"],
  41526. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  41527. referencedClasses: [],
  41528. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  41529. }),
  41530. $globals.IRJSTranslator);
  41531. $core.addMethod(
  41532. $core.method({
  41533. selector: "visitIRTempDeclaration:",
  41534. protocol: "visiting",
  41535. fn: function (anIRTempDeclaration){
  41536. var self=this,$self=this;
  41537. return self;
  41538. },
  41539. args: ["anIRTempDeclaration"],
  41540. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  41541. referencedClasses: [],
  41542. messageSends: []
  41543. }),
  41544. $globals.IRJSTranslator);
  41545. $core.addMethod(
  41546. $core.method({
  41547. selector: "visitIRValue:",
  41548. protocol: "visiting",
  41549. fn: function (anIRValue){
  41550. var self=this,$self=this;
  41551. return $core.withContext(function($ctx1) {
  41552. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  41553. return self;
  41554. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  41555. },
  41556. args: ["anIRValue"],
  41557. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  41558. referencedClasses: [],
  41559. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  41560. }),
  41561. $globals.IRJSTranslator);
  41562. $core.addMethod(
  41563. $core.method({
  41564. selector: "visitIRVariable:",
  41565. protocol: "visiting",
  41566. fn: function (anIRVariable){
  41567. var self=this,$self=this;
  41568. return $core.withContext(function($ctx1) {
  41569. var $3,$2,$1,$4;
  41570. $3=$recv(anIRVariable)._variable();
  41571. $ctx1.sendIdx["variable"]=1;
  41572. $2=$recv($3)._name();
  41573. $1=$recv($2).__eq("thisContext");
  41574. if($core.assert($1)){
  41575. $4=$self._stream();
  41576. $ctx1.sendIdx["stream"]=1;
  41577. $recv($4)._nextPutAll_("$core.getThisContext()");
  41578. $ctx1.sendIdx["nextPutAll:"]=1;
  41579. } else {
  41580. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  41581. }
  41582. return self;
  41583. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  41584. },
  41585. args: ["anIRVariable"],
  41586. 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 ]",
  41587. referencedClasses: [],
  41588. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  41589. }),
  41590. $globals.IRJSTranslator);
  41591. $core.addMethod(
  41592. $core.method({
  41593. selector: "visitIRVerbatim:",
  41594. protocol: "visiting",
  41595. fn: function (anIRVerbatim){
  41596. var self=this,$self=this;
  41597. return $core.withContext(function($ctx1) {
  41598. $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  41599. return self;
  41600. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  41601. },
  41602. args: ["anIRVerbatim"],
  41603. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutAll: anIRVerbatim source",
  41604. referencedClasses: [],
  41605. messageSends: ["nextPutAll:", "stream", "source"]
  41606. }),
  41607. $globals.IRJSTranslator);
  41608. $core.addMethod(
  41609. $core.method({
  41610. selector: "visitInstructionList:enclosedBetween:and:",
  41611. protocol: "visiting",
  41612. fn: function (anArray,aString,anotherString){
  41613. var self=this,$self=this;
  41614. return $core.withContext(function($ctx1) {
  41615. var $1;
  41616. $1=$self._stream();
  41617. $ctx1.sendIdx["stream"]=1;
  41618. $recv($1)._nextPutAll_(aString);
  41619. $ctx1.sendIdx["nextPutAll:"]=1;
  41620. $recv(anArray)._do_separatedBy_((function(each){
  41621. return $core.withContext(function($ctx2) {
  41622. return $self._visit_(each);
  41623. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41624. }),(function(){
  41625. return $core.withContext(function($ctx2) {
  41626. return $recv($self._stream())._nextPutAll_(",");
  41627. $ctx2.sendIdx["nextPutAll:"]=2;
  41628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41629. }));
  41630. $recv($self["@stream"])._nextPutAll_(anotherString);
  41631. return self;
  41632. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  41633. },
  41634. args: ["anArray", "aString", "anotherString"],
  41635. 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",
  41636. referencedClasses: [],
  41637. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  41638. }),
  41639. $globals.IRJSTranslator);
  41640. $core.addMethod(
  41641. $core.method({
  41642. selector: "visitReceiver:",
  41643. protocol: "visiting",
  41644. fn: function (anIRInstruction){
  41645. var self=this,$self=this;
  41646. var instr;
  41647. return $core.withContext(function($ctx1) {
  41648. var $1,$2,$4,$5,$3,$6,$7,$8;
  41649. $1=$recv(anIRInstruction)._isSelf();
  41650. if($core.assert($1)){
  41651. $2=$recv(anIRInstruction)._copy();
  41652. $ctx1.sendIdx["copy"]=1;
  41653. $4=$recv($recv(anIRInstruction)._variable())._copy();
  41654. $recv($4)._name_("$self");
  41655. $5=$recv($4)._yourself();
  41656. $ctx1.sendIdx["yourself"]=1;
  41657. $3=$5;
  41658. $recv($2)._variable_($3);
  41659. instr=$recv($2)._yourself();
  41660. instr;
  41661. } else {
  41662. instr=anIRInstruction;
  41663. instr;
  41664. }
  41665. $6=$recv(instr)._needsBoxingAsReceiver();
  41666. if(!$core.assert($6)){
  41667. $7=$self._visit_(instr);
  41668. $ctx1.sendIdx["visit:"]=1;
  41669. return $7;
  41670. }
  41671. $8=$self._stream();
  41672. $ctx1.sendIdx["stream"]=1;
  41673. $recv($8)._nextPutAll_("$recv(");
  41674. $ctx1.sendIdx["nextPutAll:"]=1;
  41675. $self._visit_(instr);
  41676. $recv($self._stream())._nextPutAll_(")");
  41677. return self;
  41678. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction,instr:instr},$globals.IRJSTranslator)});
  41679. },
  41680. args: ["anIRInstruction"],
  41681. 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: ')'",
  41682. referencedClasses: [],
  41683. messageSends: ["ifTrue:ifFalse:", "isSelf", "variable:", "copy", "name:", "variable", "yourself", "ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  41684. }),
  41685. $globals.IRJSTranslator);
  41686. $core.addMethod(
  41687. $core.method({
  41688. selector: "visitSend:",
  41689. protocol: "visiting",
  41690. fn: function (anIRSend){
  41691. var self=this,$self=this;
  41692. return $core.withContext(function($ctx1) {
  41693. $self._visitReceiver_($recv(anIRSend)._receiver());
  41694. $recv($self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  41695. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  41696. return self;
  41697. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41698. },
  41699. args: ["anIRSend"],
  41700. 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: ')'",
  41701. referencedClasses: [],
  41702. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41703. }),
  41704. $globals.IRJSTranslator);
  41705. $core.addMethod(
  41706. $core.method({
  41707. selector: "visitSuperSend:",
  41708. protocol: "visiting",
  41709. fn: function (anIRSend){
  41710. var self=this,$self=this;
  41711. return $core.withContext(function($ctx1) {
  41712. var $1,$4,$3,$2,$5,$6,$7,$8;
  41713. $1=$self._stream();
  41714. $ctx1.sendIdx["stream"]=1;
  41715. $recv($1)._nextPutAll_("(");
  41716. $ctx1.sendIdx["nextPutAll:"]=1;
  41717. $recv($1)._lf();
  41718. $ctx1.sendIdx["lf"]=1;
  41719. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41720. $ctx1.sendIdx["nextPutAll:"]=2;
  41721. $recv($1)._lf();
  41722. $ctx1.sendIdx["lf"]=2;
  41723. $4=$recv(anIRSend)._scope();
  41724. $ctx1.sendIdx["scope"]=1;
  41725. $3=$recv($4)._alias();
  41726. $ctx1.sendIdx["alias"]=1;
  41727. $2=$recv($3).__comma(".supercall = true,");
  41728. $ctx1.sendIdx[","]=1;
  41729. $recv($1)._nextPutAll_($2);
  41730. $ctx1.sendIdx["nextPutAll:"]=3;
  41731. $recv($1)._lf();
  41732. $ctx1.sendIdx["lf"]=3;
  41733. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41734. $ctx1.sendIdx["nextPutAll:"]=4;
  41735. $recv($1)._lf();
  41736. $ctx1.sendIdx["lf"]=4;
  41737. $5="(".__comma($recv($self._currentClass())._asJavaScriptSource());
  41738. $ctx1.sendIdx[","]=2;
  41739. $recv($1)._nextPutAll_($5);
  41740. $ctx1.sendIdx["nextPutAll:"]=5;
  41741. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  41742. $ctx1.sendIdx["nextPutAll:"]=6;
  41743. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  41744. $ctx1.sendIdx[","]=3;
  41745. $recv($1)._nextPutAll_($6);
  41746. $ctx1.sendIdx["nextPutAll:"]=7;
  41747. $7=$recv($1)._nextPutAll_("$self, ");
  41748. $ctx1.sendIdx["nextPutAll:"]=8;
  41749. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  41750. $8=$self._stream();
  41751. $recv($8)._nextPutAll_("));");
  41752. $ctx1.sendIdx["nextPutAll:"]=9;
  41753. $recv($8)._lf();
  41754. $ctx1.sendIdx["lf"]=5;
  41755. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41756. $ctx1.sendIdx["nextPutAll:"]=10;
  41757. $recv($8)._lf();
  41758. $ctx1.sendIdx["lf"]=6;
  41759. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  41760. $ctx1.sendIdx["nextPutAll:"]=11;
  41761. $recv($8)._lf();
  41762. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41763. return self;
  41764. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41765. },
  41766. args: ["anIRSend"],
  41767. 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);'",
  41768. referencedClasses: [],
  41769. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41770. }),
  41771. $globals.IRJSTranslator);
  41772. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  41773. $core.addMethod(
  41774. $core.method({
  41775. selector: "contents",
  41776. protocol: "accessing",
  41777. fn: function (){
  41778. var self=this,$self=this;
  41779. return $core.withContext(function($ctx1) {
  41780. return $recv($self["@stream"])._contents();
  41781. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  41782. },
  41783. args: [],
  41784. source: "contents\x0a\x09^ stream contents",
  41785. referencedClasses: [],
  41786. messageSends: ["contents"]
  41787. }),
  41788. $globals.JSStream);
  41789. $core.addMethod(
  41790. $core.method({
  41791. selector: "initialize",
  41792. protocol: "initialization",
  41793. fn: function (){
  41794. var self=this,$self=this;
  41795. return $core.withContext(function($ctx1) {
  41796. (
  41797. $ctx1.supercall = true,
  41798. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41799. $ctx1.supercall = false;
  41800. $self["@stream"]=""._writeStream();
  41801. return self;
  41802. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  41803. },
  41804. args: [],
  41805. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  41806. referencedClasses: [],
  41807. messageSends: ["initialize", "writeStream"]
  41808. }),
  41809. $globals.JSStream);
  41810. $core.addMethod(
  41811. $core.method({
  41812. selector: "lf",
  41813. protocol: "streaming",
  41814. fn: function (){
  41815. var self=this,$self=this;
  41816. return $core.withContext(function($ctx1) {
  41817. $recv($self["@stream"])._lf();
  41818. return self;
  41819. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  41820. },
  41821. args: [],
  41822. source: "lf\x0a\x09stream lf",
  41823. referencedClasses: [],
  41824. messageSends: ["lf"]
  41825. }),
  41826. $globals.JSStream);
  41827. $core.addMethod(
  41828. $core.method({
  41829. selector: "nextPut:",
  41830. protocol: "streaming",
  41831. fn: function (aString){
  41832. var self=this,$self=this;
  41833. return $core.withContext(function($ctx1) {
  41834. $recv($self["@stream"])._nextPut_(aString);
  41835. return self;
  41836. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  41837. },
  41838. args: ["aString"],
  41839. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  41840. referencedClasses: [],
  41841. messageSends: ["nextPut:"]
  41842. }),
  41843. $globals.JSStream);
  41844. $core.addMethod(
  41845. $core.method({
  41846. selector: "nextPutAll:",
  41847. protocol: "streaming",
  41848. fn: function (aString){
  41849. var self=this,$self=this;
  41850. return $core.withContext(function($ctx1) {
  41851. $recv($self["@stream"])._nextPutAll_(aString);
  41852. return self;
  41853. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  41854. },
  41855. args: ["aString"],
  41856. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  41857. referencedClasses: [],
  41858. messageSends: ["nextPutAll:"]
  41859. }),
  41860. $globals.JSStream);
  41861. $core.addMethod(
  41862. $core.method({
  41863. selector: "nextPutAssignLhs:rhs:",
  41864. protocol: "streaming",
  41865. fn: function (aBlock,anotherBlock){
  41866. var self=this,$self=this;
  41867. return $core.withContext(function($ctx1) {
  41868. $recv(aBlock)._value();
  41869. $ctx1.sendIdx["value"]=1;
  41870. $recv($self["@stream"])._nextPutAll_("=");
  41871. $recv(anotherBlock)._value();
  41872. return self;
  41873. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  41874. },
  41875. args: ["aBlock", "anotherBlock"],
  41876. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  41877. referencedClasses: [],
  41878. messageSends: ["value", "nextPutAll:"]
  41879. }),
  41880. $globals.JSStream);
  41881. $core.addMethod(
  41882. $core.method({
  41883. selector: "nextPutBlockContextFor:during:",
  41884. protocol: "streaming",
  41885. fn: function (anIRClosure,aBlock){
  41886. var self=this,$self=this;
  41887. return $core.withContext(function($ctx1) {
  41888. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  41889. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  41890. if(!$core.assert($1)){
  41891. $2=$recv(aBlock)._value();
  41892. $ctx1.sendIdx["value"]=1;
  41893. return $2;
  41894. }
  41895. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41896. $ctx1.sendIdx["nextPutAll:"]=1;
  41897. $self._lf();
  41898. $ctx1.sendIdx["lf"]=1;
  41899. $6=$recv(anIRClosure)._scope();
  41900. $ctx1.sendIdx["scope"]=1;
  41901. $5=$recv($6)._alias();
  41902. $ctx1.sendIdx["alias"]=1;
  41903. $4="return $core.withContext(function(".__comma($5);
  41904. $ctx1.sendIdx[","]=2;
  41905. $3=$recv($4).__comma(") {");
  41906. $ctx1.sendIdx[","]=1;
  41907. $self._nextPutAll_($3);
  41908. $ctx1.sendIdx["nextPutAll:"]=2;
  41909. $self._lf();
  41910. $ctx1.sendIdx["lf"]=2;
  41911. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41912. $ctx1.sendIdx["nextPutAll:"]=3;
  41913. $7=$self._lf();
  41914. $ctx1.sendIdx["lf"]=3;
  41915. $recv(aBlock)._value();
  41916. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41917. $ctx1.sendIdx["nextPutAll:"]=4;
  41918. $self._lf();
  41919. $ctx1.sendIdx["lf"]=4;
  41920. $11=$recv(anIRClosure)._scope();
  41921. $ctx1.sendIdx["scope"]=2;
  41922. $10=$recv($11)._alias();
  41923. $ctx1.sendIdx["alias"]=2;
  41924. $9="}, function(".__comma($10);
  41925. $ctx1.sendIdx[","]=4;
  41926. $8=$recv($9).__comma(") {");
  41927. $ctx1.sendIdx[","]=3;
  41928. $self._nextPutAll_($8);
  41929. $ctx1.sendIdx["nextPutAll:"]=5;
  41930. $15=$recv(anIRClosure)._scope();
  41931. $ctx1.sendIdx["scope"]=3;
  41932. $14=$recv($15)._alias();
  41933. $ctx1.sendIdx["alias"]=3;
  41934. $13=$recv($14).__comma(".fillBlock({");
  41935. $ctx1.sendIdx[","]=5;
  41936. $12=$self._nextPutAll_($13);
  41937. $ctx1.sendIdx["nextPutAll:"]=6;
  41938. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  41939. return $core.withContext(function($ctx2) {
  41940. $16=$recv(each)._asVariableName();
  41941. $ctx2.sendIdx["asVariableName"]=1;
  41942. $self._nextPutAll_($16);
  41943. $ctx2.sendIdx["nextPutAll:"]=7;
  41944. $self._nextPutAll_(":");
  41945. $ctx2.sendIdx["nextPutAll:"]=8;
  41946. $17=$self._nextPutAll_($recv(each)._asVariableName());
  41947. $ctx2.sendIdx["nextPutAll:"]=9;
  41948. return $17;
  41949. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41950. }),(function(){
  41951. return $core.withContext(function($ctx2) {
  41952. return $self._nextPutAll_(",");
  41953. $ctx2.sendIdx["nextPutAll:"]=10;
  41954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41955. }));
  41956. $self._nextPutAll_("},");
  41957. $ctx1.sendIdx["nextPutAll:"]=11;
  41958. $23=$recv(anIRClosure)._scope();
  41959. $ctx1.sendIdx["scope"]=4;
  41960. $22=$recv($23)._outerScope();
  41961. $21=$recv($22)._alias();
  41962. $20=$recv($21).__comma(",");
  41963. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  41964. $ctx1.sendIdx[","]=7;
  41965. $18=$recv($19).__comma(")});");
  41966. $ctx1.sendIdx[","]=6;
  41967. $self._nextPutAll_($18);
  41968. $ctx1.sendIdx["nextPutAll:"]=12;
  41969. $self._lf();
  41970. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41971. return self;
  41972. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  41973. },
  41974. args: ["anIRClosure", "aBlock"],
  41975. 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);'",
  41976. referencedClasses: [],
  41977. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  41978. }),
  41979. $globals.JSStream);
  41980. $core.addMethod(
  41981. $core.method({
  41982. selector: "nextPutClosureWith:arguments:",
  41983. protocol: "streaming",
  41984. fn: function (aBlock,anArray){
  41985. var self=this,$self=this;
  41986. return $core.withContext(function($ctx1) {
  41987. var $1,$2,$3;
  41988. $recv($self["@stream"])._nextPutAll_("(function(");
  41989. $ctx1.sendIdx["nextPutAll:"]=1;
  41990. $recv(anArray)._do_separatedBy_((function(each){
  41991. return $core.withContext(function($ctx2) {
  41992. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  41993. $ctx2.sendIdx["nextPutAll:"]=2;
  41994. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41995. }),(function(){
  41996. return $core.withContext(function($ctx2) {
  41997. return $recv($self["@stream"])._nextPut_(",");
  41998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41999. }));
  42000. $1=$self["@stream"];
  42001. $recv($1)._nextPutAll_("){");
  42002. $ctx1.sendIdx["nextPutAll:"]=3;
  42003. $2=$recv($1)._lf();
  42004. $ctx1.sendIdx["lf"]=1;
  42005. $recv(aBlock)._value();
  42006. $3=$self["@stream"];
  42007. $recv($3)._lf();
  42008. $recv($3)._nextPutAll_("})");
  42009. return self;
  42010. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42011. },
  42012. args: ["aBlock", "anArray"],
  42013. 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: '})'",
  42014. referencedClasses: [],
  42015. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42016. }),
  42017. $globals.JSStream);
  42018. $core.addMethod(
  42019. $core.method({
  42020. selector: "nextPutContextFor:during:",
  42021. protocol: "streaming",
  42022. fn: function (aMethod,aBlock){
  42023. var self=this,$self=this;
  42024. return $core.withContext(function($ctx1) {
  42025. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  42026. $1=$recv(aMethod)._requiresSmalltalkContext();
  42027. if(!$core.assert($1)){
  42028. $2=$recv(aBlock)._value();
  42029. $ctx1.sendIdx["value"]=1;
  42030. return $2;
  42031. }
  42032. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42033. $ctx1.sendIdx["nextPutAll:"]=1;
  42034. $self._lf();
  42035. $ctx1.sendIdx["lf"]=1;
  42036. $6=$recv(aMethod)._scope();
  42037. $ctx1.sendIdx["scope"]=1;
  42038. $5=$recv($6)._alias();
  42039. $ctx1.sendIdx["alias"]=1;
  42040. $4="return $core.withContext(function(".__comma($5);
  42041. $ctx1.sendIdx[","]=2;
  42042. $3=$recv($4).__comma(") {");
  42043. $ctx1.sendIdx[","]=1;
  42044. $self._nextPutAll_($3);
  42045. $ctx1.sendIdx["nextPutAll:"]=2;
  42046. $self._lf();
  42047. $ctx1.sendIdx["lf"]=2;
  42048. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42049. $ctx1.sendIdx["nextPutAll:"]=3;
  42050. $7=$self._lf();
  42051. $ctx1.sendIdx["lf"]=3;
  42052. $recv(aBlock)._value();
  42053. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42054. $ctx1.sendIdx["nextPutAll:"]=4;
  42055. $self._lf();
  42056. $ctx1.sendIdx["lf"]=4;
  42057. $12=$recv(aMethod)._scope();
  42058. $ctx1.sendIdx["scope"]=2;
  42059. $11=$recv($12)._alias();
  42060. $ctx1.sendIdx["alias"]=2;
  42061. $10="}, function(".__comma($11);
  42062. $ctx1.sendIdx[","]=5;
  42063. $9=$recv($10).__comma(") {");
  42064. $ctx1.sendIdx[","]=4;
  42065. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  42066. $ctx1.sendIdx[","]=3;
  42067. $self._nextPutAll_($8);
  42068. $ctx1.sendIdx["nextPutAll:"]=5;
  42069. $16=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42070. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42071. $15=".fill(self,".__comma($16);
  42072. $14=$recv($15).__comma(",{");
  42073. $ctx1.sendIdx[","]=6;
  42074. $13=$self._nextPutAll_($14);
  42075. $ctx1.sendIdx["nextPutAll:"]=6;
  42076. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  42077. return $core.withContext(function($ctx2) {
  42078. $17=$recv(each)._asVariableName();
  42079. $ctx2.sendIdx["asVariableName"]=1;
  42080. $self._nextPutAll_($17);
  42081. $ctx2.sendIdx["nextPutAll:"]=7;
  42082. $self._nextPutAll_(":");
  42083. $ctx2.sendIdx["nextPutAll:"]=8;
  42084. $18=$self._nextPutAll_($recv(each)._asVariableName());
  42085. $ctx2.sendIdx["nextPutAll:"]=9;
  42086. return $18;
  42087. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42088. }),(function(){
  42089. return $core.withContext(function($ctx2) {
  42090. return $self._nextPutAll_(",");
  42091. $ctx2.sendIdx["nextPutAll:"]=10;
  42092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42093. }));
  42094. $self._nextPutAll_("},");
  42095. $ctx1.sendIdx["nextPutAll:"]=11;
  42096. $self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavaScriptSource());
  42097. $ctx1.sendIdx["nextPutAll:"]=12;
  42098. $self._nextPutAll_(")});");
  42099. $ctx1.sendIdx["nextPutAll:"]=13;
  42100. $self._lf();
  42101. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42102. return self;
  42103. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42104. },
  42105. args: ["aMethod", "aBlock"],
  42106. 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);'",
  42107. referencedClasses: [],
  42108. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  42109. }),
  42110. $globals.JSStream);
  42111. $core.addMethod(
  42112. $core.method({
  42113. selector: "nextPutFunctionWith:arguments:",
  42114. protocol: "streaming",
  42115. fn: function (aBlock,anArray){
  42116. var self=this,$self=this;
  42117. return $core.withContext(function($ctx1) {
  42118. var $1,$2,$3,$4,$5;
  42119. $recv($self["@stream"])._nextPutAll_("fn: function (");
  42120. $ctx1.sendIdx["nextPutAll:"]=1;
  42121. $recv(anArray)._do_separatedBy_((function(each){
  42122. return $core.withContext(function($ctx2) {
  42123. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  42124. $ctx2.sendIdx["nextPutAll:"]=2;
  42125. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42126. }),(function(){
  42127. return $core.withContext(function($ctx2) {
  42128. return $recv($self["@stream"])._nextPut_(",");
  42129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42130. }));
  42131. $1=$self["@stream"];
  42132. $recv($1)._nextPutAll_("){");
  42133. $ctx1.sendIdx["nextPutAll:"]=3;
  42134. $2=$recv($1)._lf();
  42135. $ctx1.sendIdx["lf"]=1;
  42136. $3=$self["@stream"];
  42137. $recv($3)._nextPutAll_("var self=this,$self=this;");
  42138. $ctx1.sendIdx["nextPutAll:"]=4;
  42139. $4=$recv($3)._lf();
  42140. $ctx1.sendIdx["lf"]=2;
  42141. $recv(aBlock)._value();
  42142. $5=$self["@stream"];
  42143. $recv($5)._lf();
  42144. $recv($5)._nextPutAll_("}");
  42145. return self;
  42146. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42147. },
  42148. args: ["aBlock", "anArray"],
  42149. 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: '}'",
  42150. referencedClasses: [],
  42151. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42152. }),
  42153. $globals.JSStream);
  42154. $core.addMethod(
  42155. $core.method({
  42156. selector: "nextPutIf:then:",
  42157. protocol: "streaming",
  42158. fn: function (aBlock,anotherBlock){
  42159. var self=this,$self=this;
  42160. return $core.withContext(function($ctx1) {
  42161. var $1;
  42162. $recv($self["@stream"])._nextPutAll_("if(");
  42163. $ctx1.sendIdx["nextPutAll:"]=1;
  42164. $recv(aBlock)._value();
  42165. $ctx1.sendIdx["value"]=1;
  42166. $1=$self["@stream"];
  42167. $recv($1)._nextPutAll_("){");
  42168. $ctx1.sendIdx["nextPutAll:"]=2;
  42169. $recv($1)._lf();
  42170. $recv(anotherBlock)._value();
  42171. $recv($self["@stream"])._nextPutAll_("}");
  42172. $self._omitSemicolon_(true);
  42173. return self;
  42174. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  42175. },
  42176. args: ["aBlock", "anotherBlock"],
  42177. 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",
  42178. referencedClasses: [],
  42179. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42180. }),
  42181. $globals.JSStream);
  42182. $core.addMethod(
  42183. $core.method({
  42184. selector: "nextPutIf:then:else:",
  42185. protocol: "streaming",
  42186. fn: function (aBlock,ifBlock,elseBlock){
  42187. var self=this,$self=this;
  42188. return $core.withContext(function($ctx1) {
  42189. var $1,$2,$3;
  42190. $recv($self["@stream"])._nextPutAll_("if(");
  42191. $ctx1.sendIdx["nextPutAll:"]=1;
  42192. $recv(aBlock)._value();
  42193. $ctx1.sendIdx["value"]=1;
  42194. $1=$self["@stream"];
  42195. $recv($1)._nextPutAll_("){");
  42196. $ctx1.sendIdx["nextPutAll:"]=2;
  42197. $2=$recv($1)._lf();
  42198. $ctx1.sendIdx["lf"]=1;
  42199. $recv(ifBlock)._value();
  42200. $ctx1.sendIdx["value"]=2;
  42201. $3=$self["@stream"];
  42202. $recv($3)._nextPutAll_("} else {");
  42203. $ctx1.sendIdx["nextPutAll:"]=3;
  42204. $recv($3)._lf();
  42205. $recv(elseBlock)._value();
  42206. $recv($self["@stream"])._nextPutAll_("}");
  42207. $self._omitSemicolon_(true);
  42208. return self;
  42209. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  42210. },
  42211. args: ["aBlock", "ifBlock", "elseBlock"],
  42212. 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",
  42213. referencedClasses: [],
  42214. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42215. }),
  42216. $globals.JSStream);
  42217. $core.addMethod(
  42218. $core.method({
  42219. selector: "nextPutMethodDeclaration:with:",
  42220. protocol: "streaming",
  42221. fn: function (aMethod,aBlock){
  42222. var self=this,$self=this;
  42223. return $core.withContext(function($ctx1) {
  42224. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  42225. $1=$self["@stream"];
  42226. $recv($1)._nextPutAll_("$core.method({");
  42227. $ctx1.sendIdx["nextPutAll:"]=1;
  42228. $recv($1)._lf();
  42229. $ctx1.sendIdx["lf"]=1;
  42230. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42231. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42232. $3="selector: ".__comma($4);
  42233. $ctx1.sendIdx[","]=2;
  42234. $2=$recv($3).__comma(",");
  42235. $ctx1.sendIdx[","]=1;
  42236. $recv($1)._nextPutAll_($2);
  42237. $ctx1.sendIdx["nextPutAll:"]=2;
  42238. $recv($1)._lf();
  42239. $ctx1.sendIdx["lf"]=2;
  42240. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  42241. $ctx1.sendIdx["asJavaScriptSource"]=2;
  42242. $6="source: ".__comma($7);
  42243. $ctx1.sendIdx[","]=4;
  42244. $5=$recv($6).__comma(",");
  42245. $ctx1.sendIdx[","]=3;
  42246. $recv($1)._nextPutAll_($5);
  42247. $ctx1.sendIdx["nextPutAll:"]=3;
  42248. $8=$recv($1)._lf();
  42249. $ctx1.sendIdx["lf"]=3;
  42250. $recv(aBlock)._value();
  42251. $ctx1.sendIdx["value"]=1;
  42252. $9=$self["@stream"];
  42253. $12=$recv($globals.String)._lf();
  42254. $ctx1.sendIdx["lf"]=4;
  42255. $11=",".__comma($12);
  42256. $ctx1.sendIdx[","]=6;
  42257. $10=$recv($11).__comma("messageSends: ");
  42258. $ctx1.sendIdx[","]=5;
  42259. $recv($9)._nextPutAll_($10);
  42260. $ctx1.sendIdx["nextPutAll:"]=4;
  42261. $15=$recv($recv(aMethod)._messageSends())._asArray();
  42262. $ctx1.sendIdx["asArray"]=1;
  42263. $14=$recv($15)._asJavaScriptSource();
  42264. $ctx1.sendIdx["asJavaScriptSource"]=3;
  42265. $13=$recv($14).__comma(",");
  42266. $ctx1.sendIdx[","]=7;
  42267. $recv($9)._nextPutAll_($13);
  42268. $ctx1.sendIdx["nextPutAll:"]=5;
  42269. $recv($9)._lf();
  42270. $ctx1.sendIdx["lf"]=5;
  42271. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  42272. return $core.withContext(function($ctx2) {
  42273. return $recv(each)._value();
  42274. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42275. })))._asArray())._asJavaScriptSource();
  42276. $ctx1.sendIdx["asJavaScriptSource"]=4;
  42277. $17="args: ".__comma($18);
  42278. $16=$recv($17).__comma(",");
  42279. $ctx1.sendIdx[","]=8;
  42280. $recv($9)._nextPutAll_($16);
  42281. $ctx1.sendIdx["nextPutAll:"]=6;
  42282. $recv($9)._lf();
  42283. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  42284. $ctx1.sendIdx["nextPutAll:"]=7;
  42285. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  42286. return $core.withContext(function($ctx2) {
  42287. return $recv($self["@stream"])._nextPutAll_($recv(each)._asJavaScriptSource());
  42288. $ctx2.sendIdx["nextPutAll:"]=8;
  42289. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42290. }),(function(){
  42291. return $core.withContext(function($ctx2) {
  42292. return $recv($self["@stream"])._nextPutAll_(",");
  42293. $ctx2.sendIdx["nextPutAll:"]=9;
  42294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42295. }));
  42296. $20=$self["@stream"];
  42297. $recv($20)._nextPutAll_("]");
  42298. $ctx1.sendIdx["nextPutAll:"]=10;
  42299. $recv($20)._nextPutAll_("})");
  42300. return self;
  42301. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42302. },
  42303. args: ["aMethod", "aBlock"],
  42304. 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: '})'",
  42305. referencedClasses: ["String"],
  42306. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  42307. }),
  42308. $globals.JSStream);
  42309. $core.addMethod(
  42310. $core.method({
  42311. selector: "nextPutNonLocalReturnHandlingWith:",
  42312. protocol: "streaming",
  42313. fn: function (aBlock){
  42314. var self=this,$self=this;
  42315. return $core.withContext(function($ctx1) {
  42316. var $1,$2,$3;
  42317. $1=$self["@stream"];
  42318. $recv($1)._nextPutAll_("var $early={};");
  42319. $ctx1.sendIdx["nextPutAll:"]=1;
  42320. $recv($1)._lf();
  42321. $ctx1.sendIdx["lf"]=1;
  42322. $recv($1)._nextPutAll_("try {");
  42323. $ctx1.sendIdx["nextPutAll:"]=2;
  42324. $2=$recv($1)._lf();
  42325. $ctx1.sendIdx["lf"]=2;
  42326. $recv(aBlock)._value();
  42327. $3=$self["@stream"];
  42328. $recv($3)._nextPutAll_("}");
  42329. $ctx1.sendIdx["nextPutAll:"]=3;
  42330. $recv($3)._lf();
  42331. $ctx1.sendIdx["lf"]=3;
  42332. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  42333. $recv($3)._lf();
  42334. return self;
  42335. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  42336. },
  42337. args: ["aBlock"],
  42338. 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",
  42339. referencedClasses: [],
  42340. messageSends: ["nextPutAll:", "lf", "value"]
  42341. }),
  42342. $globals.JSStream);
  42343. $core.addMethod(
  42344. $core.method({
  42345. selector: "nextPutNonLocalReturnWith:",
  42346. protocol: "streaming",
  42347. fn: function (aBlock){
  42348. var self=this,$self=this;
  42349. return $core.withContext(function($ctx1) {
  42350. $recv($self["@stream"])._nextPutAll_("throw $early=[");
  42351. $ctx1.sendIdx["nextPutAll:"]=1;
  42352. $recv(aBlock)._value();
  42353. $recv($self["@stream"])._nextPutAll_("]");
  42354. return self;
  42355. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42356. },
  42357. args: ["aBlock"],
  42358. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  42359. referencedClasses: [],
  42360. messageSends: ["nextPutAll:", "value"]
  42361. }),
  42362. $globals.JSStream);
  42363. $core.addMethod(
  42364. $core.method({
  42365. selector: "nextPutReturnWith:",
  42366. protocol: "streaming",
  42367. fn: function (aBlock){
  42368. var self=this,$self=this;
  42369. return $core.withContext(function($ctx1) {
  42370. $recv($self["@stream"])._nextPutAll_("return ");
  42371. $recv(aBlock)._value();
  42372. return self;
  42373. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42374. },
  42375. args: ["aBlock"],
  42376. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  42377. referencedClasses: [],
  42378. messageSends: ["nextPutAll:", "value"]
  42379. }),
  42380. $globals.JSStream);
  42381. $core.addMethod(
  42382. $core.method({
  42383. selector: "nextPutSendIndexFor:",
  42384. protocol: "streaming",
  42385. fn: function (anIRSend){
  42386. var self=this,$self=this;
  42387. return $core.withContext(function($ctx1) {
  42388. $self._nextPutAll_(";");
  42389. $ctx1.sendIdx["nextPutAll:"]=1;
  42390. $self._lf();
  42391. $ctx1.sendIdx["lf"]=1;
  42392. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42393. $ctx1.sendIdx["nextPutAll:"]=2;
  42394. $self._lf();
  42395. $ctx1.sendIdx["lf"]=2;
  42396. $self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  42397. $ctx1.sendIdx["nextPutAll:"]=3;
  42398. $self._nextPutAll_(".sendIdx[");
  42399. $ctx1.sendIdx["nextPutAll:"]=4;
  42400. $self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  42401. $ctx1.sendIdx["nextPutAll:"]=5;
  42402. $self._nextPutAll_("]=");
  42403. $ctx1.sendIdx["nextPutAll:"]=6;
  42404. $self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  42405. $ctx1.sendIdx["nextPutAll:"]=7;
  42406. $self._nextPutAll_(";");
  42407. $ctx1.sendIdx["nextPutAll:"]=8;
  42408. $self._lf();
  42409. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  42410. return self;
  42411. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  42412. },
  42413. args: ["anIRSend"],
  42414. 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)'",
  42415. referencedClasses: [],
  42416. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  42417. }),
  42418. $globals.JSStream);
  42419. $core.addMethod(
  42420. $core.method({
  42421. selector: "nextPutStatementWith:",
  42422. protocol: "streaming",
  42423. fn: function (aBlock){
  42424. var self=this,$self=this;
  42425. return $core.withContext(function($ctx1) {
  42426. var $1;
  42427. $self._omitSemicolon_(false);
  42428. $ctx1.sendIdx["omitSemicolon:"]=1;
  42429. $recv(aBlock)._value();
  42430. $1=$self._omitSemicolon();
  42431. if(!$core.assert($1)){
  42432. $recv($self["@stream"])._nextPutAll_(";");
  42433. }
  42434. $self._omitSemicolon_(false);
  42435. $recv($self["@stream"])._lf();
  42436. return self;
  42437. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  42438. },
  42439. args: ["aBlock"],
  42440. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  42441. referencedClasses: [],
  42442. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  42443. }),
  42444. $globals.JSStream);
  42445. $core.addMethod(
  42446. $core.method({
  42447. selector: "nextPutVars:",
  42448. protocol: "streaming",
  42449. fn: function (aCollection){
  42450. var self=this,$self=this;
  42451. return $core.withContext(function($ctx1) {
  42452. var $1;
  42453. $recv(aCollection)._ifNotEmpty_((function(){
  42454. return $core.withContext(function($ctx2) {
  42455. $recv($self["@stream"])._nextPutAll_("var ");
  42456. $ctx2.sendIdx["nextPutAll:"]=1;
  42457. $recv(aCollection)._do_separatedBy_((function(each){
  42458. return $core.withContext(function($ctx3) {
  42459. return $recv($self["@stream"])._nextPutAll_(each);
  42460. $ctx3.sendIdx["nextPutAll:"]=2;
  42461. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42462. }),(function(){
  42463. return $core.withContext(function($ctx3) {
  42464. return $recv($self["@stream"])._nextPutAll_(",");
  42465. $ctx3.sendIdx["nextPutAll:"]=3;
  42466. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42467. }));
  42468. $1=$self["@stream"];
  42469. $recv($1)._nextPutAll_(";");
  42470. return $recv($1)._lf();
  42471. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42472. }));
  42473. return self;
  42474. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  42475. },
  42476. args: ["aCollection"],
  42477. 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 ]",
  42478. referencedClasses: [],
  42479. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  42480. }),
  42481. $globals.JSStream);
  42482. $core.addMethod(
  42483. $core.method({
  42484. selector: "omitSemicolon",
  42485. protocol: "accessing",
  42486. fn: function (){
  42487. var self=this,$self=this;
  42488. return $self["@omitSemicolon"];
  42489. },
  42490. args: [],
  42491. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  42492. referencedClasses: [],
  42493. messageSends: []
  42494. }),
  42495. $globals.JSStream);
  42496. $core.addMethod(
  42497. $core.method({
  42498. selector: "omitSemicolon:",
  42499. protocol: "accessing",
  42500. fn: function (aBoolean){
  42501. var self=this,$self=this;
  42502. $self["@omitSemicolon"]=aBoolean;
  42503. return self;
  42504. },
  42505. args: ["aBoolean"],
  42506. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  42507. referencedClasses: [],
  42508. messageSends: []
  42509. }),
  42510. $globals.JSStream);
  42511. $core.addMethod(
  42512. $core.method({
  42513. selector: "isReferenced",
  42514. protocol: "*Compiler-IR",
  42515. fn: function (){
  42516. var self=this,$self=this;
  42517. return $core.withContext(function($ctx1) {
  42518. var $3,$2,$1;
  42519. $3=$self._parent();
  42520. $ctx1.sendIdx["parent"]=1;
  42521. $2=$recv($3)._isSequenceNode();
  42522. $1=$recv($2)._or_((function(){
  42523. return $core.withContext(function($ctx2) {
  42524. return $recv($self._parent())._isAssignmentNode();
  42525. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42526. }));
  42527. return $recv($1)._not();
  42528. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  42529. },
  42530. args: [],
  42531. 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",
  42532. referencedClasses: [],
  42533. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  42534. }),
  42535. $globals.ASTNode);
  42536. $core.addMethod(
  42537. $core.method({
  42538. selector: "subtreeNeedsAliasing",
  42539. protocol: "*Compiler-IR",
  42540. fn: function (){
  42541. var self=this,$self=this;
  42542. return $core.withContext(function($ctx1) {
  42543. return $recv($self._shouldBeAliased())._or_((function(){
  42544. return $core.withContext(function($ctx2) {
  42545. return $recv($self._dagChildren())._anySatisfy_((function(each){
  42546. return $core.withContext(function($ctx3) {
  42547. return $recv(each)._subtreeNeedsAliasing();
  42548. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42549. }));
  42550. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42551. }));
  42552. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  42553. },
  42554. args: [],
  42555. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  42556. referencedClasses: [],
  42557. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  42558. }),
  42559. $globals.ASTNode);
  42560. $core.addMethod(
  42561. $core.method({
  42562. selector: "shouldBeAliased",
  42563. protocol: "*Compiler-IR",
  42564. fn: function (){
  42565. var self=this,$self=this;
  42566. return $core.withContext(function($ctx1) {
  42567. var $1;
  42568. $1=(
  42569. $ctx1.supercall = true,
  42570. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42571. $ctx1.supercall = false;
  42572. return $recv($1)._or_((function(){
  42573. return $core.withContext(function($ctx2) {
  42574. return $self._isReferenced();
  42575. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42576. }));
  42577. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  42578. },
  42579. args: [],
  42580. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  42581. referencedClasses: [],
  42582. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  42583. }),
  42584. $globals.AssignmentNode);
  42585. $core.addMethod(
  42586. $core.method({
  42587. selector: "appendToInstruction:",
  42588. protocol: "*Compiler-IR",
  42589. fn: function (anIRInstruction){
  42590. var self=this,$self=this;
  42591. return $core.withContext(function($ctx1) {
  42592. $recv(anIRInstruction)._appendBlock_(self);
  42593. return self;
  42594. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  42595. },
  42596. args: ["anIRInstruction"],
  42597. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  42598. referencedClasses: [],
  42599. messageSends: ["appendBlock:"]
  42600. }),
  42601. $globals.BlockClosure);
  42602. $core.addMethod(
  42603. $core.method({
  42604. selector: "subtreeNeedsAliasing",
  42605. protocol: "*Compiler-IR",
  42606. fn: function (){
  42607. var self=this,$self=this;
  42608. return $core.withContext(function($ctx1) {
  42609. return $self._shouldBeAliased();
  42610. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  42611. },
  42612. args: [],
  42613. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  42614. referencedClasses: [],
  42615. messageSends: ["shouldBeAliased"]
  42616. }),
  42617. $globals.BlockNode);
  42618. $core.addMethod(
  42619. $core.method({
  42620. selector: "subtreeNeedsAliasing",
  42621. protocol: "*Compiler-IR",
  42622. fn: function (){
  42623. var self=this,$self=this;
  42624. return $core.withContext(function($ctx1) {
  42625. return $recv($recv($self._parent())._isSequenceNode())._not();
  42626. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  42627. },
  42628. args: [],
  42629. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  42630. referencedClasses: [],
  42631. messageSends: ["not", "isSequenceNode", "parent"]
  42632. }),
  42633. $globals.CascadeNode);
  42634. $core.addMethod(
  42635. $core.method({
  42636. selector: "shouldBeAliased",
  42637. protocol: "*Compiler-IR",
  42638. fn: function (){
  42639. var self=this,$self=this;
  42640. var sends;
  42641. return $core.withContext(function($ctx1) {
  42642. var $2,$1;
  42643. sends=$recv($recv($recv($self._method())._sendIndexes())._at_($self._selector()))._size();
  42644. $2=(
  42645. $ctx1.supercall = true,
  42646. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42647. $ctx1.supercall = false;
  42648. $1=$recv($2)._or_((function(){
  42649. return $core.withContext(function($ctx2) {
  42650. return $recv($self._isReferenced())._and_((function(){
  42651. return $core.withContext(function($ctx3) {
  42652. return $recv($recv($self._index()).__lt(sends))._or_((function(){
  42653. return $core.withContext(function($ctx4) {
  42654. return $self._superSend();
  42655. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  42656. }));
  42657. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42658. }));
  42659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42660. }));
  42661. $ctx1.sendIdx["or:"]=1;
  42662. return $1;
  42663. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  42664. },
  42665. args: [],
  42666. 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 ] ] ])",
  42667. referencedClasses: [],
  42668. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  42669. }),
  42670. $globals.SendNode);
  42671. $core.addMethod(
  42672. $core.method({
  42673. selector: "subtreeNeedsAliasing",
  42674. protocol: "*Compiler-IR",
  42675. fn: function (){
  42676. var self=this,$self=this;
  42677. return $core.withContext(function($ctx1) {
  42678. return $recv($self._shouldBeInlined())._or_((function(){
  42679. return $core.withContext(function($ctx2) {
  42680. return (
  42681. $ctx2.supercall = true,
  42682. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($self, []));
  42683. $ctx2.supercall = false;
  42684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42685. }));
  42686. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  42687. },
  42688. args: [],
  42689. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  42690. referencedClasses: [],
  42691. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  42692. }),
  42693. $globals.SendNode);
  42694. });
  42695. 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";
  42696. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  42697. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  42698. $core.addPackage("Compiler-Inlining");
  42699. ($core.packageDescriptors||$core.packages)["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  42700. ($core.packageDescriptors||$core.packages)["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  42701. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  42702. $core.addMethod(
  42703. $core.method({
  42704. selector: "visitSendNode:",
  42705. protocol: "visiting",
  42706. fn: function (aNode){
  42707. var self=this,$self=this;
  42708. return $core.withContext(function($ctx1) {
  42709. var $1,$2,$3,$4,$receiver;
  42710. $1=$recv(aNode)._superSend();
  42711. if(!$core.assert($1)){
  42712. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  42713. if($core.assert($2)){
  42714. $recv(aNode)._shouldBeInlined_(true);
  42715. $3=$recv(aNode)._receiver();
  42716. if(($receiver = $3) == null || $receiver.a$nil){
  42717. $3;
  42718. } else {
  42719. var receiver;
  42720. receiver=$receiver;
  42721. $recv(receiver)._shouldBeAliased_(true);
  42722. }
  42723. }
  42724. }
  42725. $4=(
  42726. $ctx1.supercall = true,
  42727. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  42728. $ctx1.supercall = false;
  42729. return $4;
  42730. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  42731. },
  42732. args: ["aNode"],
  42733. 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",
  42734. referencedClasses: ["IRSendInliner"],
  42735. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  42736. }),
  42737. $globals.ASTPreInliner);
  42738. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  42739. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  42740. $core.addMethod(
  42741. $core.method({
  42742. selector: "acceptDagVisitor:",
  42743. protocol: "visiting",
  42744. fn: function (aVisitor){
  42745. var self=this,$self=this;
  42746. return $core.withContext(function($ctx1) {
  42747. $recv(aVisitor)._visitIRInlinedClosure_(self);
  42748. return self;
  42749. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  42750. },
  42751. args: ["aVisitor"],
  42752. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  42753. referencedClasses: [],
  42754. messageSends: ["visitIRInlinedClosure:"]
  42755. }),
  42756. $globals.IRInlinedClosure);
  42757. $core.addMethod(
  42758. $core.method({
  42759. selector: "isInlined",
  42760. protocol: "testing",
  42761. fn: function (){
  42762. var self=this,$self=this;
  42763. return true;
  42764. },
  42765. args: [],
  42766. source: "isInlined\x0a\x09^ true",
  42767. referencedClasses: [],
  42768. messageSends: []
  42769. }),
  42770. $globals.IRInlinedClosure);
  42771. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  42772. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  42773. $core.addMethod(
  42774. $core.method({
  42775. selector: "acceptDagVisitor:",
  42776. protocol: "visiting",
  42777. fn: function (aVisitor){
  42778. var self=this,$self=this;
  42779. return $core.withContext(function($ctx1) {
  42780. $recv(aVisitor)._visitInlinedSend_(self);
  42781. return self;
  42782. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  42783. },
  42784. args: ["aVisitor"],
  42785. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  42786. referencedClasses: [],
  42787. messageSends: ["visitInlinedSend:"]
  42788. }),
  42789. $globals.IRInlinedSend);
  42790. $core.addMethod(
  42791. $core.method({
  42792. selector: "internalVariables",
  42793. protocol: "accessing",
  42794. fn: function (){
  42795. var self=this,$self=this;
  42796. return [];
  42797. },
  42798. args: [],
  42799. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  42800. referencedClasses: [],
  42801. messageSends: []
  42802. }),
  42803. $globals.IRInlinedSend);
  42804. $core.addMethod(
  42805. $core.method({
  42806. selector: "isInlined",
  42807. protocol: "testing",
  42808. fn: function (){
  42809. var self=this,$self=this;
  42810. return true;
  42811. },
  42812. args: [],
  42813. source: "isInlined\x0a\x09^ true",
  42814. referencedClasses: [],
  42815. messageSends: []
  42816. }),
  42817. $globals.IRInlinedSend);
  42818. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42819. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  42820. $core.addMethod(
  42821. $core.method({
  42822. selector: "acceptDagVisitor:",
  42823. protocol: "visiting",
  42824. fn: function (aVisitor){
  42825. var self=this,$self=this;
  42826. return $core.withContext(function($ctx1) {
  42827. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  42828. return self;
  42829. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  42830. },
  42831. args: ["aVisitor"],
  42832. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  42833. referencedClasses: [],
  42834. messageSends: ["visitIRInlinedIfFalse:"]
  42835. }),
  42836. $globals.IRInlinedIfFalse);
  42837. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42838. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  42839. $core.addMethod(
  42840. $core.method({
  42841. selector: "acceptDagVisitor:",
  42842. protocol: "visiting",
  42843. fn: function (aVisitor){
  42844. var self=this,$self=this;
  42845. return $core.withContext(function($ctx1) {
  42846. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  42847. return self;
  42848. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  42849. },
  42850. args: ["aVisitor"],
  42851. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  42852. referencedClasses: [],
  42853. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  42854. }),
  42855. $globals.IRInlinedIfNilIfNotNil);
  42856. $core.addMethod(
  42857. $core.method({
  42858. selector: "internalVariables",
  42859. protocol: "accessing",
  42860. fn: function (){
  42861. var self=this,$self=this;
  42862. return $core.withContext(function($ctx1) {
  42863. return $recv($globals.Array)._with_($self._receiverInternalVariable());
  42864. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  42865. },
  42866. args: [],
  42867. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  42868. referencedClasses: ["Array"],
  42869. messageSends: ["with:", "receiverInternalVariable"]
  42870. }),
  42871. $globals.IRInlinedIfNilIfNotNil);
  42872. $core.addMethod(
  42873. $core.method({
  42874. selector: "receiverInternalVariable",
  42875. protocol: "accessing",
  42876. fn: function (){
  42877. var self=this,$self=this;
  42878. return $core.withContext(function($ctx1) {
  42879. var $1;
  42880. $1=$recv($globals.IRVariable)._new();
  42881. $ctx1.sendIdx["new"]=1;
  42882. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_($self._receiverInternalVariableName()));
  42883. return $recv($1)._yourself();
  42884. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  42885. },
  42886. args: [],
  42887. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  42888. referencedClasses: ["IRVariable", "AliasVar"],
  42889. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  42890. }),
  42891. $globals.IRInlinedIfNilIfNotNil);
  42892. $core.addMethod(
  42893. $core.method({
  42894. selector: "receiverInternalVariableName",
  42895. protocol: "accessing",
  42896. fn: function (){
  42897. var self=this,$self=this;
  42898. return "$receiver";
  42899. },
  42900. args: [],
  42901. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  42902. referencedClasses: [],
  42903. messageSends: []
  42904. }),
  42905. $globals.IRInlinedIfNilIfNotNil);
  42906. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42907. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  42908. $core.addMethod(
  42909. $core.method({
  42910. selector: "acceptDagVisitor:",
  42911. protocol: "visiting",
  42912. fn: function (aVisitor){
  42913. var self=this,$self=this;
  42914. return $core.withContext(function($ctx1) {
  42915. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  42916. return self;
  42917. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  42918. },
  42919. args: ["aVisitor"],
  42920. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  42921. referencedClasses: [],
  42922. messageSends: ["visitIRInlinedIfTrue:"]
  42923. }),
  42924. $globals.IRInlinedIfTrue);
  42925. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42926. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  42927. $core.addMethod(
  42928. $core.method({
  42929. selector: "acceptDagVisitor:",
  42930. protocol: "visiting",
  42931. fn: function (aVisitor){
  42932. var self=this,$self=this;
  42933. return $core.withContext(function($ctx1) {
  42934. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  42935. return self;
  42936. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  42937. },
  42938. args: ["aVisitor"],
  42939. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  42940. referencedClasses: [],
  42941. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  42942. }),
  42943. $globals.IRInlinedIfTrueIfFalse);
  42944. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  42945. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  42946. $core.addMethod(
  42947. $core.method({
  42948. selector: "acceptDagVisitor:",
  42949. protocol: "visiting",
  42950. fn: function (aVisitor){
  42951. var self=this,$self=this;
  42952. return $core.withContext(function($ctx1) {
  42953. $recv(aVisitor)._visitIRInlinedSequence_(self);
  42954. return self;
  42955. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  42956. },
  42957. args: ["aVisitor"],
  42958. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  42959. referencedClasses: [],
  42960. messageSends: ["visitIRInlinedSequence:"]
  42961. }),
  42962. $globals.IRInlinedSequence);
  42963. $core.addMethod(
  42964. $core.method({
  42965. selector: "isInlined",
  42966. protocol: "testing",
  42967. fn: function (){
  42968. var self=this,$self=this;
  42969. return true;
  42970. },
  42971. args: [],
  42972. source: "isInlined\x0a\x09^ true",
  42973. referencedClasses: [],
  42974. messageSends: []
  42975. }),
  42976. $globals.IRInlinedSequence);
  42977. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  42978. $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`";
  42979. $core.addMethod(
  42980. $core.method({
  42981. selector: "assignmentInliner",
  42982. protocol: "factory",
  42983. fn: function (){
  42984. var self=this,$self=this;
  42985. return $core.withContext(function($ctx1) {
  42986. var $1;
  42987. $1=$recv($globals.IRAssignmentInliner)._new();
  42988. $recv($1)._translator_(self);
  42989. return $recv($1)._yourself();
  42990. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  42991. },
  42992. args: [],
  42993. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  42994. referencedClasses: ["IRAssignmentInliner"],
  42995. messageSends: ["translator:", "new", "yourself"]
  42996. }),
  42997. $globals.IRInliner);
  42998. $core.addMethod(
  42999. $core.method({
  43000. selector: "returnInliner",
  43001. protocol: "factory",
  43002. fn: function (){
  43003. var self=this,$self=this;
  43004. return $core.withContext(function($ctx1) {
  43005. var $1;
  43006. $1=$recv($globals.IRReturnInliner)._new();
  43007. $recv($1)._translator_(self);
  43008. return $recv($1)._yourself();
  43009. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  43010. },
  43011. args: [],
  43012. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43013. referencedClasses: ["IRReturnInliner"],
  43014. messageSends: ["translator:", "new", "yourself"]
  43015. }),
  43016. $globals.IRInliner);
  43017. $core.addMethod(
  43018. $core.method({
  43019. selector: "sendInliner",
  43020. protocol: "factory",
  43021. fn: function (){
  43022. var self=this,$self=this;
  43023. return $core.withContext(function($ctx1) {
  43024. var $1;
  43025. $1=$recv($globals.IRSendInliner)._new();
  43026. $recv($1)._translator_(self);
  43027. return $recv($1)._yourself();
  43028. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  43029. },
  43030. args: [],
  43031. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43032. referencedClasses: ["IRSendInliner"],
  43033. messageSends: ["translator:", "new", "yourself"]
  43034. }),
  43035. $globals.IRInliner);
  43036. $core.addMethod(
  43037. $core.method({
  43038. selector: "shouldInlineAssignment:",
  43039. protocol: "testing",
  43040. fn: function (anIRAssignment){
  43041. var self=this,$self=this;
  43042. return $core.withContext(function($ctx1) {
  43043. var $3,$2,$1;
  43044. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  43045. return $core.withContext(function($ctx2) {
  43046. $3=$recv(anIRAssignment)._right();
  43047. $ctx2.sendIdx["right"]=1;
  43048. $2=$recv($3)._isSend();
  43049. return $recv($2)._and_((function(){
  43050. return $core.withContext(function($ctx3) {
  43051. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  43052. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43053. }));
  43054. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43055. }));
  43056. $ctx1.sendIdx["and:"]=1;
  43057. return $1;
  43058. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43059. },
  43060. args: ["anIRAssignment"],
  43061. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  43062. referencedClasses: [],
  43063. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  43064. }),
  43065. $globals.IRInliner);
  43066. $core.addMethod(
  43067. $core.method({
  43068. selector: "shouldInlineReturn:",
  43069. protocol: "testing",
  43070. fn: function (anIRReturn){
  43071. var self=this,$self=this;
  43072. return $core.withContext(function($ctx1) {
  43073. var $3,$2,$1;
  43074. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  43075. return $core.withContext(function($ctx2) {
  43076. $3=$recv(anIRReturn)._expression();
  43077. $ctx2.sendIdx["expression"]=1;
  43078. $2=$recv($3)._isSend();
  43079. return $recv($2)._and_((function(){
  43080. return $core.withContext(function($ctx3) {
  43081. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  43082. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43083. }));
  43084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43085. }));
  43086. $ctx1.sendIdx["and:"]=1;
  43087. return $1;
  43088. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43089. },
  43090. args: ["anIRReturn"],
  43091. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  43092. referencedClasses: [],
  43093. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  43094. }),
  43095. $globals.IRInliner);
  43096. $core.addMethod(
  43097. $core.method({
  43098. selector: "shouldInlineSend:",
  43099. protocol: "testing",
  43100. fn: function (anIRSend){
  43101. var self=this,$self=this;
  43102. return $core.withContext(function($ctx1) {
  43103. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  43104. return $core.withContext(function($ctx2) {
  43105. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  43106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43107. }));
  43108. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43109. },
  43110. args: ["anIRSend"],
  43111. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  43112. referencedClasses: ["IRSendInliner"],
  43113. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  43114. }),
  43115. $globals.IRInliner);
  43116. $core.addMethod(
  43117. $core.method({
  43118. selector: "visitIRAssignment:",
  43119. protocol: "visiting",
  43120. fn: function (anIRAssignment){
  43121. var self=this,$self=this;
  43122. return $core.withContext(function($ctx1) {
  43123. var $1;
  43124. $1=$self._shouldInlineAssignment_(anIRAssignment);
  43125. if($core.assert($1)){
  43126. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  43127. } else {
  43128. return (
  43129. $ctx1.supercall = true,
  43130. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($self, [anIRAssignment]));
  43131. $ctx1.supercall = false;
  43132. }
  43133. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43134. },
  43135. args: ["anIRAssignment"],
  43136. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  43137. referencedClasses: [],
  43138. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  43139. }),
  43140. $globals.IRInliner);
  43141. $core.addMethod(
  43142. $core.method({
  43143. selector: "visitIRNonLocalReturn:",
  43144. protocol: "visiting",
  43145. fn: function (anIRNonLocalReturn){
  43146. var self=this,$self=this;
  43147. var localReturn;
  43148. return $core.withContext(function($ctx1) {
  43149. var $2,$1,$4,$3,$5,$6,$7;
  43150. $2=$recv(anIRNonLocalReturn)._scope();
  43151. $ctx1.sendIdx["scope"]=1;
  43152. $1=$recv($2)._canInlineNonLocalReturns();
  43153. if($core.assert($1)){
  43154. $4=$recv(anIRNonLocalReturn)._scope();
  43155. $ctx1.sendIdx["scope"]=2;
  43156. $3=$recv($4)._methodScope();
  43157. $5=$recv(anIRNonLocalReturn)._scope();
  43158. $ctx1.sendIdx["scope"]=3;
  43159. $recv($3)._removeNonLocalReturn_($5);
  43160. $6=$recv($globals.IRReturn)._new();
  43161. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  43162. localReturn=$recv($6)._yourself();
  43163. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  43164. return $core.withContext(function($ctx2) {
  43165. return $recv(localReturn)._add_(each);
  43166. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43167. }));
  43168. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  43169. return $self._visitIRReturn_(localReturn);
  43170. }
  43171. $7=(
  43172. $ctx1.supercall = true,
  43173. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  43174. $ctx1.supercall = false;
  43175. return $7;
  43176. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  43177. },
  43178. args: ["anIRNonLocalReturn"],
  43179. 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",
  43180. referencedClasses: ["IRReturn"],
  43181. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  43182. }),
  43183. $globals.IRInliner);
  43184. $core.addMethod(
  43185. $core.method({
  43186. selector: "visitIRReturn:",
  43187. protocol: "visiting",
  43188. fn: function (anIRReturn){
  43189. var self=this,$self=this;
  43190. return $core.withContext(function($ctx1) {
  43191. var $1;
  43192. $1=$self._shouldInlineReturn_(anIRReturn);
  43193. if($core.assert($1)){
  43194. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  43195. } else {
  43196. return (
  43197. $ctx1.supercall = true,
  43198. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  43199. $ctx1.supercall = false;
  43200. }
  43201. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43202. },
  43203. args: ["anIRReturn"],
  43204. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  43205. referencedClasses: [],
  43206. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  43207. }),
  43208. $globals.IRInliner);
  43209. $core.addMethod(
  43210. $core.method({
  43211. selector: "visitIRSend:",
  43212. protocol: "visiting",
  43213. fn: function (anIRSend){
  43214. var self=this,$self=this;
  43215. return $core.withContext(function($ctx1) {
  43216. var $1;
  43217. $1=$self._shouldInlineSend_(anIRSend);
  43218. if($core.assert($1)){
  43219. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  43220. } else {
  43221. return (
  43222. $ctx1.supercall = true,
  43223. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($self, [anIRSend]));
  43224. $ctx1.supercall = false;
  43225. }
  43226. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43227. },
  43228. args: ["anIRSend"],
  43229. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  43230. referencedClasses: [],
  43231. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  43232. }),
  43233. $globals.IRInliner);
  43234. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  43235. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  43236. $core.addMethod(
  43237. $core.method({
  43238. selector: "visitIRInlinedClosure:",
  43239. protocol: "visiting",
  43240. fn: function (anIRInlinedClosure){
  43241. var self=this,$self=this;
  43242. return $core.withContext(function($ctx1) {
  43243. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  43244. return $core.withContext(function($ctx2) {
  43245. return $recv($recv(each)._name())._asVariableName();
  43246. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43247. })));
  43248. $self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  43249. return self;
  43250. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  43251. },
  43252. args: ["anIRInlinedClosure"],
  43253. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  43254. referencedClasses: [],
  43255. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  43256. }),
  43257. $globals.IRInliningJSTranslator);
  43258. $core.addMethod(
  43259. $core.method({
  43260. selector: "visitIRInlinedIfFalse:",
  43261. protocol: "visiting",
  43262. fn: function (anIRInlinedIfFalse){
  43263. var self=this,$self=this;
  43264. return $core.withContext(function($ctx1) {
  43265. var $1,$2,$4,$3;
  43266. $1=$self._stream();
  43267. $ctx1.sendIdx["stream"]=1;
  43268. $recv($1)._nextPutIf_then_((function(){
  43269. return $core.withContext(function($ctx2) {
  43270. $2=$self._stream();
  43271. $ctx2.sendIdx["stream"]=2;
  43272. $recv($2)._nextPutAll_("!$core.assert(");
  43273. $ctx2.sendIdx["nextPutAll:"]=1;
  43274. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  43275. $ctx2.sendIdx["dagChildren"]=1;
  43276. $3=$recv($4)._first();
  43277. $self._visit_($3);
  43278. $ctx2.sendIdx["visit:"]=1;
  43279. return $recv($self._stream())._nextPutAll_(")");
  43280. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43281. }),(function(){
  43282. return $core.withContext(function($ctx2) {
  43283. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  43284. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43285. }));
  43286. return self;
  43287. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  43288. },
  43289. args: ["anIRInlinedIfFalse"],
  43290. 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 ]",
  43291. referencedClasses: [],
  43292. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43293. }),
  43294. $globals.IRInliningJSTranslator);
  43295. $core.addMethod(
  43296. $core.method({
  43297. selector: "visitIRInlinedIfNilIfNotNil:",
  43298. protocol: "visiting",
  43299. fn: function (anIRInlinedIfNilIfNotNil){
  43300. var self=this,$self=this;
  43301. return $core.withContext(function($ctx1) {
  43302. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  43303. $1=$self._stream();
  43304. $ctx1.sendIdx["stream"]=1;
  43305. $recv($1)._nextPutIf_then_else_((function(){
  43306. var recvVarName;
  43307. return $core.withContext(function($ctx2) {
  43308. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  43309. $2=$self._stream();
  43310. $ctx2.sendIdx["stream"]=2;
  43311. $4="(".__comma(recvVarName);
  43312. $ctx2.sendIdx[","]=2;
  43313. $3=$recv($4).__comma(" = ");
  43314. $ctx2.sendIdx[","]=1;
  43315. $recv($2)._nextPutAll_($3);
  43316. $ctx2.sendIdx["nextPutAll:"]=1;
  43317. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43318. $ctx2.sendIdx["dagChildren"]=1;
  43319. $5=$recv($6)._first();
  43320. $self._visit_($5);
  43321. $ctx2.sendIdx["visit:"]=1;
  43322. $7=$self._stream();
  43323. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".a$nil");
  43324. $ctx2.sendIdx[","]=3;
  43325. return $recv($7)._nextPutAll_($8);
  43326. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  43327. }),(function(){
  43328. return $core.withContext(function($ctx2) {
  43329. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43330. $ctx2.sendIdx["dagChildren"]=2;
  43331. $9=$recv($10)._second();
  43332. return $self._visit_($9);
  43333. $ctx2.sendIdx["visit:"]=2;
  43334. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43335. }),(function(){
  43336. return $core.withContext(function($ctx2) {
  43337. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  43338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43339. }));
  43340. return self;
  43341. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  43342. },
  43343. args: ["anIRInlinedIfNilIfNotNil"],
  43344. 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 ]",
  43345. referencedClasses: [],
  43346. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  43347. }),
  43348. $globals.IRInliningJSTranslator);
  43349. $core.addMethod(
  43350. $core.method({
  43351. selector: "visitIRInlinedIfTrue:",
  43352. protocol: "visiting",
  43353. fn: function (anIRInlinedIfTrue){
  43354. var self=this,$self=this;
  43355. return $core.withContext(function($ctx1) {
  43356. var $1,$2,$4,$3;
  43357. $1=$self._stream();
  43358. $ctx1.sendIdx["stream"]=1;
  43359. $recv($1)._nextPutIf_then_((function(){
  43360. return $core.withContext(function($ctx2) {
  43361. $2=$self._stream();
  43362. $ctx2.sendIdx["stream"]=2;
  43363. $recv($2)._nextPutAll_("$core.assert(");
  43364. $ctx2.sendIdx["nextPutAll:"]=1;
  43365. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  43366. $ctx2.sendIdx["dagChildren"]=1;
  43367. $3=$recv($4)._first();
  43368. $self._visit_($3);
  43369. $ctx2.sendIdx["visit:"]=1;
  43370. return $recv($self._stream())._nextPutAll_(")");
  43371. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43372. }),(function(){
  43373. return $core.withContext(function($ctx2) {
  43374. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  43375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43376. }));
  43377. return self;
  43378. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  43379. },
  43380. args: ["anIRInlinedIfTrue"],
  43381. 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 ]",
  43382. referencedClasses: [],
  43383. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43384. }),
  43385. $globals.IRInliningJSTranslator);
  43386. $core.addMethod(
  43387. $core.method({
  43388. selector: "visitIRInlinedIfTrueIfFalse:",
  43389. protocol: "visiting",
  43390. fn: function (anIRInlinedIfTrueIfFalse){
  43391. var self=this,$self=this;
  43392. return $core.withContext(function($ctx1) {
  43393. var $1,$2,$4,$3,$6,$5;
  43394. $1=$self._stream();
  43395. $ctx1.sendIdx["stream"]=1;
  43396. $recv($1)._nextPutIf_then_else_((function(){
  43397. return $core.withContext(function($ctx2) {
  43398. $2=$self._stream();
  43399. $ctx2.sendIdx["stream"]=2;
  43400. $recv($2)._nextPutAll_("$core.assert(");
  43401. $ctx2.sendIdx["nextPutAll:"]=1;
  43402. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43403. $ctx2.sendIdx["dagChildren"]=1;
  43404. $3=$recv($4)._first();
  43405. $self._visit_($3);
  43406. $ctx2.sendIdx["visit:"]=1;
  43407. return $recv($self._stream())._nextPutAll_(")");
  43408. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43409. }),(function(){
  43410. return $core.withContext(function($ctx2) {
  43411. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43412. $ctx2.sendIdx["dagChildren"]=2;
  43413. $5=$recv($6)._second();
  43414. return $self._visit_($5);
  43415. $ctx2.sendIdx["visit:"]=2;
  43416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43417. }),(function(){
  43418. return $core.withContext(function($ctx2) {
  43419. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  43420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43421. }));
  43422. return self;
  43423. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  43424. },
  43425. args: ["anIRInlinedIfTrueIfFalse"],
  43426. 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 ]",
  43427. referencedClasses: [],
  43428. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  43429. }),
  43430. $globals.IRInliningJSTranslator);
  43431. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  43432. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  43433. $core.addMethod(
  43434. $core.method({
  43435. selector: "ifFalse:",
  43436. protocol: "inlining",
  43437. fn: function (anIRInstruction){
  43438. var self=this,$self=this;
  43439. return $core.withContext(function($ctx1) {
  43440. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  43441. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43442. },
  43443. args: ["anIRInstruction"],
  43444. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  43445. referencedClasses: ["IRInlinedIfFalse"],
  43446. messageSends: ["inlinedSend:withBlock:", "new"]
  43447. }),
  43448. $globals.IRSendInliner);
  43449. $core.addMethod(
  43450. $core.method({
  43451. selector: "ifFalse:ifTrue:",
  43452. protocol: "inlining",
  43453. fn: function (anIRInstruction,anotherIRInstruction){
  43454. var self=this,$self=this;
  43455. return $core.withContext(function($ctx1) {
  43456. return $self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  43457. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43458. },
  43459. args: ["anIRInstruction", "anotherIRInstruction"],
  43460. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  43461. referencedClasses: [],
  43462. messageSends: ["perform:withArguments:"]
  43463. }),
  43464. $globals.IRSendInliner);
  43465. $core.addMethod(
  43466. $core.method({
  43467. selector: "ifNil:",
  43468. protocol: "inlining",
  43469. fn: function (anIRInstruction){
  43470. var self=this,$self=this;
  43471. return $core.withContext(function($ctx1) {
  43472. var $1,$3,$5,$6,$4,$2;
  43473. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43474. $ctx1.sendIdx["new"]=1;
  43475. $3=$recv($globals.IRClosure)._new();
  43476. $ctx1.sendIdx["new"]=2;
  43477. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43478. $5=$recv($globals.IRBlockSequence)._new();
  43479. $recv($5)._add_($recv($self._send())._receiver());
  43480. $6=$recv($5)._yourself();
  43481. $ctx1.sendIdx["yourself"]=1;
  43482. $4=$6;
  43483. $recv($3)._add_($4);
  43484. $ctx1.sendIdx["add:"]=1;
  43485. $2=$recv($3)._yourself();
  43486. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  43487. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43488. },
  43489. args: ["anIRInstruction"],
  43490. 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)",
  43491. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43492. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43493. }),
  43494. $globals.IRSendInliner);
  43495. $core.addMethod(
  43496. $core.method({
  43497. selector: "ifNil:ifNotNil:",
  43498. protocol: "inlining",
  43499. fn: function (anIRInstruction,anotherIRInstruction){
  43500. var self=this,$self=this;
  43501. return $core.withContext(function($ctx1) {
  43502. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  43503. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43504. },
  43505. args: ["anIRInstruction", "anotherIRInstruction"],
  43506. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43507. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43508. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43509. }),
  43510. $globals.IRSendInliner);
  43511. $core.addMethod(
  43512. $core.method({
  43513. selector: "ifNotNil:",
  43514. protocol: "inlining",
  43515. fn: function (anIRInstruction){
  43516. var self=this,$self=this;
  43517. return $core.withContext(function($ctx1) {
  43518. var $1,$3,$5,$6,$4,$2;
  43519. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43520. $ctx1.sendIdx["new"]=1;
  43521. $3=$recv($globals.IRClosure)._new();
  43522. $ctx1.sendIdx["new"]=2;
  43523. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43524. $5=$recv($globals.IRBlockSequence)._new();
  43525. $recv($5)._add_($recv($self._send())._receiver());
  43526. $6=$recv($5)._yourself();
  43527. $ctx1.sendIdx["yourself"]=1;
  43528. $4=$6;
  43529. $recv($3)._add_($4);
  43530. $ctx1.sendIdx["add:"]=1;
  43531. $2=$recv($3)._yourself();
  43532. return $self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  43533. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43534. },
  43535. args: ["anIRInstruction"],
  43536. 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",
  43537. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43538. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43539. }),
  43540. $globals.IRSendInliner);
  43541. $core.addMethod(
  43542. $core.method({
  43543. selector: "ifNotNil:ifNil:",
  43544. protocol: "inlining",
  43545. fn: function (anIRInstruction,anotherIRInstruction){
  43546. var self=this,$self=this;
  43547. return $core.withContext(function($ctx1) {
  43548. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  43549. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43550. },
  43551. args: ["anIRInstruction", "anotherIRInstruction"],
  43552. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  43553. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43554. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43555. }),
  43556. $globals.IRSendInliner);
  43557. $core.addMethod(
  43558. $core.method({
  43559. selector: "ifTrue:",
  43560. protocol: "inlining",
  43561. fn: function (anIRInstruction){
  43562. var self=this,$self=this;
  43563. return $core.withContext(function($ctx1) {
  43564. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  43565. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43566. },
  43567. args: ["anIRInstruction"],
  43568. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  43569. referencedClasses: ["IRInlinedIfTrue"],
  43570. messageSends: ["inlinedSend:withBlock:", "new"]
  43571. }),
  43572. $globals.IRSendInliner);
  43573. $core.addMethod(
  43574. $core.method({
  43575. selector: "ifTrue:ifFalse:",
  43576. protocol: "inlining",
  43577. fn: function (anIRInstruction,anotherIRInstruction){
  43578. var self=this,$self=this;
  43579. return $core.withContext(function($ctx1) {
  43580. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  43581. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43582. },
  43583. args: ["anIRInstruction", "anotherIRInstruction"],
  43584. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43585. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  43586. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43587. }),
  43588. $globals.IRSendInliner);
  43589. $core.addMethod(
  43590. $core.method({
  43591. selector: "inlineClosure:",
  43592. protocol: "inlining",
  43593. fn: function (anIRClosure){
  43594. var self=this,$self=this;
  43595. var inlinedClosure,sequence,statements;
  43596. return $core.withContext(function($ctx1) {
  43597. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  43598. inlinedClosure=$self._inlinedClosure();
  43599. $1=inlinedClosure;
  43600. $2=$recv(anIRClosure)._scope();
  43601. $ctx1.sendIdx["scope"]=1;
  43602. $recv($1)._scope_($2);
  43603. $ctx1.sendIdx["scope:"]=1;
  43604. $recv($1)._parent_($recv(anIRClosure)._parent());
  43605. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  43606. return $core.withContext(function($ctx2) {
  43607. return $recv(inlinedClosure)._add_(each);
  43608. $ctx2.sendIdx["add:"]=1;
  43609. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43610. }));
  43611. $ctx1.sendIdx["do:"]=1;
  43612. sequence=$self._inlinedSequence();
  43613. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  43614. return $core.withContext(function($ctx2) {
  43615. $3=inlinedClosure;
  43616. $5=$recv($globals.IRTempDeclaration)._new();
  43617. $ctx2.sendIdx["new"]=1;
  43618. $recv($5)._name_(each);
  43619. $ctx2.sendIdx["name:"]=1;
  43620. $6=$recv($5)._yourself();
  43621. $ctx2.sendIdx["yourself"]=1;
  43622. $4=$6;
  43623. $recv($3)._add_($4);
  43624. $ctx2.sendIdx["add:"]=2;
  43625. $7=sequence;
  43626. $9=$recv($globals.IRAssignment)._new();
  43627. $ctx2.sendIdx["new"]=2;
  43628. $11=$recv($globals.IRVariable)._new();
  43629. $ctx2.sendIdx["new"]=3;
  43630. $13=$recv($globals.AliasVar)._new();
  43631. $ctx2.sendIdx["new"]=4;
  43632. $14=$recv(inlinedClosure)._scope();
  43633. $ctx2.sendIdx["scope"]=2;
  43634. $recv($13)._scope_($14);
  43635. $ctx2.sendIdx["scope:"]=2;
  43636. $recv($13)._name_(each);
  43637. $ctx2.sendIdx["name:"]=2;
  43638. $15=$recv($13)._yourself();
  43639. $ctx2.sendIdx["yourself"]=2;
  43640. $12=$15;
  43641. $10=$recv($11)._variable_($12);
  43642. $ctx2.sendIdx["variable:"]=1;
  43643. $recv($9)._add_($10);
  43644. $ctx2.sendIdx["add:"]=4;
  43645. $17=$recv($globals.IRVariable)._new();
  43646. $ctx2.sendIdx["new"]=5;
  43647. $19=$recv($globals.AliasVar)._new();
  43648. $recv($19)._scope_($recv(inlinedClosure)._scope());
  43649. $recv($19)._name_("$receiver");
  43650. $20=$recv($19)._yourself();
  43651. $ctx2.sendIdx["yourself"]=3;
  43652. $18=$20;
  43653. $16=$recv($17)._variable_($18);
  43654. $recv($9)._add_($16);
  43655. $ctx2.sendIdx["add:"]=5;
  43656. $8=$recv($9)._yourself();
  43657. return $recv($7)._add_($8);
  43658. $ctx2.sendIdx["add:"]=3;
  43659. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43660. }));
  43661. $ctx1.sendIdx["do:"]=2;
  43662. $recv(inlinedClosure)._add_(sequence);
  43663. $ctx1.sendIdx["add:"]=6;
  43664. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  43665. $recv(statements)._ifNotEmpty_((function(){
  43666. return $core.withContext(function($ctx2) {
  43667. $recv($recv(statements)._allButLast())._do_((function(each){
  43668. return $core.withContext(function($ctx3) {
  43669. return $recv(sequence)._add_(each);
  43670. $ctx3.sendIdx["add:"]=7;
  43671. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  43672. }));
  43673. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  43674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43675. }));
  43676. return inlinedClosure;
  43677. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  43678. },
  43679. args: ["anIRClosure"],
  43680. 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",
  43681. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  43682. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  43683. }),
  43684. $globals.IRSendInliner);
  43685. $core.addMethod(
  43686. $core.method({
  43687. selector: "inlineSend:",
  43688. protocol: "inlining",
  43689. fn: function (anIRSend){
  43690. var self=this,$self=this;
  43691. return $core.withContext(function($ctx1) {
  43692. var $2,$1;
  43693. $self._send_(anIRSend);
  43694. $2=$self._send();
  43695. $ctx1.sendIdx["send"]=1;
  43696. $1=$recv($2)._selector();
  43697. return $self._perform_withArguments_($1,$recv($self._send())._arguments());
  43698. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  43699. },
  43700. args: ["anIRSend"],
  43701. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  43702. referencedClasses: [],
  43703. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  43704. }),
  43705. $globals.IRSendInliner);
  43706. $core.addMethod(
  43707. $core.method({
  43708. selector: "inlineSend:andReplace:",
  43709. protocol: "private",
  43710. fn: function (anIRSend,anIRInstruction){
  43711. var self=this,$self=this;
  43712. return $core.withContext(function($ctx1) {
  43713. $recv(anIRInstruction)._replaceWith_(anIRSend);
  43714. return $self._inlineSend_(anIRSend);
  43715. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43716. },
  43717. args: ["anIRSend", "anIRInstruction"],
  43718. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  43719. referencedClasses: [],
  43720. messageSends: ["replaceWith:", "inlineSend:"]
  43721. }),
  43722. $globals.IRSendInliner);
  43723. $core.addMethod(
  43724. $core.method({
  43725. selector: "inlinedClosure",
  43726. protocol: "factory",
  43727. fn: function (){
  43728. var self=this,$self=this;
  43729. return $core.withContext(function($ctx1) {
  43730. return $recv($globals.IRInlinedClosure)._new();
  43731. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  43732. },
  43733. args: [],
  43734. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  43735. referencedClasses: ["IRInlinedClosure"],
  43736. messageSends: ["new"]
  43737. }),
  43738. $globals.IRSendInliner);
  43739. $core.addMethod(
  43740. $core.method({
  43741. selector: "inlinedSend:withBlock:",
  43742. protocol: "private",
  43743. fn: function (inlinedSend,anIRInstruction){
  43744. var self=this,$self=this;
  43745. var inlinedClosure;
  43746. return $core.withContext(function($ctx1) {
  43747. var $1,$2,$4,$3,$5;
  43748. $1=$recv(anIRInstruction)._isClosure();
  43749. if(!$core.assert($1)){
  43750. $self._inliningError_("Message argument should be a block");
  43751. $ctx1.sendIdx["inliningError:"]=1;
  43752. }
  43753. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  43754. if(!$core.assert($2)){
  43755. $self._inliningError_("Inlined block should have zero argument");
  43756. }
  43757. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  43758. $4=$self._send();
  43759. $ctx1.sendIdx["send"]=1;
  43760. $3=$recv($4)._receiver();
  43761. $recv(inlinedSend)._add_($3);
  43762. $ctx1.sendIdx["add:"]=1;
  43763. $recv(inlinedSend)._add_(inlinedClosure);
  43764. $recv($self._send())._replaceWith_(inlinedSend);
  43765. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  43766. $ctx1.sendIdx["internalVariables"]=1;
  43767. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  43768. return inlinedSend;
  43769. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  43770. },
  43771. args: ["inlinedSend", "anIRInstruction"],
  43772. 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",
  43773. referencedClasses: [],
  43774. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43775. }),
  43776. $globals.IRSendInliner);
  43777. $core.addMethod(
  43778. $core.method({
  43779. selector: "inlinedSend:withBlock:withBlock:",
  43780. protocol: "private",
  43781. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  43782. var self=this,$self=this;
  43783. var inlinedClosure1,inlinedClosure2;
  43784. return $core.withContext(function($ctx1) {
  43785. var $1,$2,$3,$4,$6,$5,$7;
  43786. $1=$recv(anIRInstruction)._isClosure();
  43787. $ctx1.sendIdx["isClosure"]=1;
  43788. if(!$core.assert($1)){
  43789. $self._inliningError_("Message argument should be a block");
  43790. $ctx1.sendIdx["inliningError:"]=1;
  43791. }
  43792. $2=$recv(anotherIRInstruction)._isClosure();
  43793. if(!$core.assert($2)){
  43794. $self._inliningError_("Message argument should be a block");
  43795. }
  43796. $3=$self._translator();
  43797. $ctx1.sendIdx["translator"]=1;
  43798. $4=$self._inlineClosure_(anIRInstruction);
  43799. $ctx1.sendIdx["inlineClosure:"]=1;
  43800. inlinedClosure1=$recv($3)._visit_($4);
  43801. $ctx1.sendIdx["visit:"]=1;
  43802. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  43803. $6=$self._send();
  43804. $ctx1.sendIdx["send"]=1;
  43805. $5=$recv($6)._receiver();
  43806. $recv(inlinedSend)._add_($5);
  43807. $ctx1.sendIdx["add:"]=1;
  43808. $recv(inlinedSend)._add_(inlinedClosure1);
  43809. $ctx1.sendIdx["add:"]=2;
  43810. $recv(inlinedSend)._add_(inlinedClosure2);
  43811. $recv($self._send())._replaceWith_(inlinedSend);
  43812. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  43813. $ctx1.sendIdx["internalVariables"]=1;
  43814. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  43815. return inlinedSend;
  43816. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  43817. },
  43818. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  43819. 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",
  43820. referencedClasses: [],
  43821. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43822. }),
  43823. $globals.IRSendInliner);
  43824. $core.addMethod(
  43825. $core.method({
  43826. selector: "inlinedSequence",
  43827. protocol: "factory",
  43828. fn: function (){
  43829. var self=this,$self=this;
  43830. return $core.withContext(function($ctx1) {
  43831. return $recv($globals.IRInlinedSequence)._new();
  43832. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  43833. },
  43834. args: [],
  43835. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  43836. referencedClasses: ["IRInlinedSequence"],
  43837. messageSends: ["new"]
  43838. }),
  43839. $globals.IRSendInliner);
  43840. $core.addMethod(
  43841. $core.method({
  43842. selector: "inliningError:",
  43843. protocol: "error handling",
  43844. fn: function (aString){
  43845. var self=this,$self=this;
  43846. return $core.withContext(function($ctx1) {
  43847. $recv($globals.InliningError)._signal_(aString);
  43848. return self;
  43849. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  43850. },
  43851. args: ["aString"],
  43852. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  43853. referencedClasses: ["InliningError"],
  43854. messageSends: ["signal:"]
  43855. }),
  43856. $globals.IRSendInliner);
  43857. $core.addMethod(
  43858. $core.method({
  43859. selector: "send",
  43860. protocol: "accessing",
  43861. fn: function (){
  43862. var self=this,$self=this;
  43863. return $self["@send"];
  43864. },
  43865. args: [],
  43866. source: "send\x0a\x09^ send",
  43867. referencedClasses: [],
  43868. messageSends: []
  43869. }),
  43870. $globals.IRSendInliner);
  43871. $core.addMethod(
  43872. $core.method({
  43873. selector: "send:",
  43874. protocol: "accessing",
  43875. fn: function (anIRSend){
  43876. var self=this,$self=this;
  43877. $self["@send"]=anIRSend;
  43878. return self;
  43879. },
  43880. args: ["anIRSend"],
  43881. source: "send: anIRSend\x0a\x09send := anIRSend",
  43882. referencedClasses: [],
  43883. messageSends: []
  43884. }),
  43885. $globals.IRSendInliner);
  43886. $core.addMethod(
  43887. $core.method({
  43888. selector: "translator",
  43889. protocol: "accessing",
  43890. fn: function (){
  43891. var self=this,$self=this;
  43892. return $self["@translator"];
  43893. },
  43894. args: [],
  43895. source: "translator\x0a\x09^ translator",
  43896. referencedClasses: [],
  43897. messageSends: []
  43898. }),
  43899. $globals.IRSendInliner);
  43900. $core.addMethod(
  43901. $core.method({
  43902. selector: "translator:",
  43903. protocol: "accessing",
  43904. fn: function (anASTTranslator){
  43905. var self=this,$self=this;
  43906. $self["@translator"]=anASTTranslator;
  43907. return self;
  43908. },
  43909. args: ["anASTTranslator"],
  43910. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  43911. referencedClasses: [],
  43912. messageSends: []
  43913. }),
  43914. $globals.IRSendInliner);
  43915. $core.addMethod(
  43916. $core.method({
  43917. selector: "inlinedSelectors",
  43918. protocol: "accessing",
  43919. fn: function (){
  43920. var self=this,$self=this;
  43921. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  43922. },
  43923. args: [],
  43924. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  43925. referencedClasses: [],
  43926. messageSends: []
  43927. }),
  43928. $globals.IRSendInliner.a$cls);
  43929. $core.addMethod(
  43930. $core.method({
  43931. selector: "shouldInline:",
  43932. protocol: "accessing",
  43933. fn: function (anIRSend){
  43934. var self=this,$self=this;
  43935. return $core.withContext(function($ctx1) {
  43936. var $1;
  43937. $1=$recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  43938. if(!$core.assert($1)){
  43939. return false;
  43940. }
  43941. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  43942. return $core.withContext(function($ctx2) {
  43943. return $recv(each)._isClosure();
  43944. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43945. }));
  43946. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.a$cls)});
  43947. },
  43948. args: ["anIRSend"],
  43949. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  43950. referencedClasses: [],
  43951. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  43952. }),
  43953. $globals.IRSendInliner.a$cls);
  43954. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  43955. $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};";
  43956. $core.addMethod(
  43957. $core.method({
  43958. selector: "inlineAssignment:",
  43959. protocol: "inlining",
  43960. fn: function (anIRAssignment){
  43961. var self=this,$self=this;
  43962. return $core.withContext(function($ctx1) {
  43963. $self._target_($recv(anIRAssignment)._left());
  43964. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  43965. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  43966. },
  43967. args: ["anIRAssignment"],
  43968. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  43969. referencedClasses: [],
  43970. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  43971. }),
  43972. $globals.IRAssignmentInliner);
  43973. $core.addMethod(
  43974. $core.method({
  43975. selector: "inlineClosure:",
  43976. protocol: "inlining",
  43977. fn: function (anIRClosure){
  43978. var self=this,$self=this;
  43979. var closure,sequence,statements;
  43980. return $core.withContext(function($ctx1) {
  43981. var $1,$2,$3,$5,$4;
  43982. closure=(
  43983. $ctx1.supercall = true,
  43984. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  43985. $ctx1.supercall = false;
  43986. sequence=$recv(closure)._sequence();
  43987. statements=$recv(sequence)._dagChildren();
  43988. $recv(statements)._ifNotEmpty_((function(){
  43989. var final;
  43990. return $core.withContext(function($ctx2) {
  43991. final=$recv(statements)._last();
  43992. $1=$recv(final)._yieldsValue();
  43993. if($core.assert($1)){
  43994. $2=sequence;
  43995. $3=final;
  43996. $5=$recv($globals.IRAssignment)._new();
  43997. $recv($5)._add_($self._target());
  43998. $ctx2.sendIdx["add:"]=1;
  43999. $recv($5)._add_($recv(final)._copy());
  44000. $4=$recv($5)._yourself();
  44001. return $recv($2)._replace_with_($3,$4);
  44002. }
  44003. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44004. }));
  44005. return closure;
  44006. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  44007. },
  44008. args: ["anIRClosure"],
  44009. 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",
  44010. referencedClasses: ["IRAssignment"],
  44011. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  44012. }),
  44013. $globals.IRAssignmentInliner);
  44014. $core.addMethod(
  44015. $core.method({
  44016. selector: "target",
  44017. protocol: "accessing",
  44018. fn: function (){
  44019. var self=this,$self=this;
  44020. return $self["@target"];
  44021. },
  44022. args: [],
  44023. source: "target\x0a\x09^ target",
  44024. referencedClasses: [],
  44025. messageSends: []
  44026. }),
  44027. $globals.IRAssignmentInliner);
  44028. $core.addMethod(
  44029. $core.method({
  44030. selector: "target:",
  44031. protocol: "accessing",
  44032. fn: function (anObject){
  44033. var self=this,$self=this;
  44034. $self["@target"]=anObject;
  44035. return self;
  44036. },
  44037. args: ["anObject"],
  44038. source: "target: anObject\x0a\x09target := anObject",
  44039. referencedClasses: [],
  44040. messageSends: []
  44041. }),
  44042. $globals.IRAssignmentInliner);
  44043. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  44044. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  44045. $core.addMethod(
  44046. $core.method({
  44047. selector: "inlineClosure:",
  44048. protocol: "inlining",
  44049. fn: function (anIRClosure){
  44050. var self=this,$self=this;
  44051. var closure,sequence,statements;
  44052. return $core.withContext(function($ctx1) {
  44053. var $1,$2,$3,$5,$4;
  44054. closure=(
  44055. $ctx1.supercall = true,
  44056. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  44057. $ctx1.supercall = false;
  44058. sequence=$recv(closure)._sequence();
  44059. statements=$recv(sequence)._dagChildren();
  44060. $recv(statements)._ifNotEmpty_((function(){
  44061. var final;
  44062. return $core.withContext(function($ctx2) {
  44063. final=$recv(statements)._last();
  44064. $1=$recv(final)._yieldsValue();
  44065. if($core.assert($1)){
  44066. $2=sequence;
  44067. $3=final;
  44068. $5=$recv($globals.IRReturn)._new();
  44069. $recv($5)._add_($recv(final)._copy());
  44070. $4=$recv($5)._yourself();
  44071. return $recv($2)._replace_with_($3,$4);
  44072. }
  44073. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44074. }));
  44075. return closure;
  44076. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  44077. },
  44078. args: ["anIRClosure"],
  44079. 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",
  44080. referencedClasses: ["IRReturn"],
  44081. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  44082. }),
  44083. $globals.IRReturnInliner);
  44084. $core.addMethod(
  44085. $core.method({
  44086. selector: "inlineReturn:",
  44087. protocol: "inlining",
  44088. fn: function (anIRReturn){
  44089. var self=this,$self=this;
  44090. return $core.withContext(function($ctx1) {
  44091. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  44092. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  44093. },
  44094. args: ["anIRReturn"],
  44095. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  44096. referencedClasses: [],
  44097. messageSends: ["inlineSend:andReplace:", "expression"]
  44098. }),
  44099. $globals.IRReturnInliner);
  44100. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  44101. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  44102. $core.addMethod(
  44103. $core.method({
  44104. selector: "inliner",
  44105. protocol: "compiling",
  44106. fn: function (){
  44107. var self=this,$self=this;
  44108. return $core.withContext(function($ctx1) {
  44109. return $recv($globals.IRInliner)._new();
  44110. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  44111. },
  44112. args: [],
  44113. source: "inliner\x0a\x09^ IRInliner new",
  44114. referencedClasses: ["IRInliner"],
  44115. messageSends: ["new"]
  44116. }),
  44117. $globals.InliningCodeGenerator);
  44118. $core.addMethod(
  44119. $core.method({
  44120. selector: "irTranslatorClass",
  44121. protocol: "compiling",
  44122. fn: function (){
  44123. var self=this,$self=this;
  44124. return $globals.IRInliningJSTranslator;
  44125. },
  44126. args: [],
  44127. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  44128. referencedClasses: ["IRInliningJSTranslator"],
  44129. messageSends: []
  44130. }),
  44131. $globals.InliningCodeGenerator);
  44132. $core.addMethod(
  44133. $core.method({
  44134. selector: "preInliner",
  44135. protocol: "compiling",
  44136. fn: function (){
  44137. var self=this,$self=this;
  44138. return $core.withContext(function($ctx1) {
  44139. return $recv($globals.ASTPreInliner)._new();
  44140. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  44141. },
  44142. args: [],
  44143. source: "preInliner\x0a\x09^ ASTPreInliner new",
  44144. referencedClasses: ["ASTPreInliner"],
  44145. messageSends: ["new"]
  44146. }),
  44147. $globals.InliningCodeGenerator);
  44148. $core.addMethod(
  44149. $core.method({
  44150. selector: "transformersDictionary",
  44151. protocol: "compiling",
  44152. fn: function (){
  44153. var self=this,$self=this;
  44154. return $core.withContext(function($ctx1) {
  44155. var $1,$2,$receiver;
  44156. $1=$self["@transformersDictionary"];
  44157. if(($receiver = $1) == null || $receiver.a$nil){
  44158. $2=(
  44159. $ctx1.supercall = true,
  44160. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($self, []));
  44161. $ctx1.supercall = false;
  44162. $recv($2)._at_put_("3000-inlinerTagging",$self._preInliner());
  44163. $ctx1.sendIdx["at:put:"]=1;
  44164. $recv($2)._at_put_("6000-inliner",$self._inliner());
  44165. $ctx1.sendIdx["at:put:"]=2;
  44166. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  44167. $self["@transformersDictionary"]=$recv($2)._yourself();
  44168. return $self["@transformersDictionary"];
  44169. } else {
  44170. return $1;
  44171. }
  44172. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  44173. },
  44174. args: [],
  44175. 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 ]",
  44176. referencedClasses: [],
  44177. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  44178. }),
  44179. $globals.InliningCodeGenerator);
  44180. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  44181. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  44182. $core.addClass("InliningSemanticAnalyzer", $globals.SemanticAnalyzer, [], "Compiler-Inlining");
  44183. $core.addMethod(
  44184. $core.method({
  44185. selector: "visitSendNode:",
  44186. protocol: "visiting",
  44187. fn: function (aNode){
  44188. var self=this,$self=this;
  44189. return $core.withContext(function($ctx1) {
  44190. var $1,$2,$3,$receiver;
  44191. $1=$recv(aNode)._superSend();
  44192. if(!$core.assert($1)){
  44193. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  44194. if($core.assert($2)){
  44195. $recv(aNode)._shouldBeInlined_(true);
  44196. $3=$recv(aNode)._receiver();
  44197. if(($receiver = $3) == null || $receiver.a$nil){
  44198. $3;
  44199. } else {
  44200. var receiver;
  44201. receiver=$receiver;
  44202. $recv(receiver)._shouldBeAliased_(true);
  44203. }
  44204. }
  44205. }
  44206. (
  44207. $ctx1.supercall = true,
  44208. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  44209. $ctx1.supercall = false;
  44210. return self;
  44211. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  44212. },
  44213. args: ["aNode"],
  44214. 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",
  44215. referencedClasses: ["IRSendInliner"],
  44216. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  44217. }),
  44218. $globals.InliningSemanticAnalyzer);
  44219. $core.addMethod(
  44220. $core.method({
  44221. selector: "asInlinedBlockResult",
  44222. protocol: "*Compiler-Inlining",
  44223. fn: function (){
  44224. var self=this,$self=this;
  44225. return $core.withContext(function($ctx1) {
  44226. return $self._expression();
  44227. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  44228. },
  44229. args: [],
  44230. source: "asInlinedBlockResult\x0a\x09^ self expression",
  44231. referencedClasses: [],
  44232. messageSends: ["expression"]
  44233. }),
  44234. $globals.IRBlockReturn);
  44235. $core.addMethod(
  44236. $core.method({
  44237. selector: "asInlinedBlockResult",
  44238. protocol: "*Compiler-Inlining",
  44239. fn: function (){
  44240. var self=this,$self=this;
  44241. return self;
  44242. },
  44243. args: [],
  44244. source: "asInlinedBlockResult\x0a\x09^ self",
  44245. referencedClasses: [],
  44246. messageSends: []
  44247. }),
  44248. $globals.IRInstruction);
  44249. });
  44250. 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";
  44251. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  44252. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  44253. $core.addPackage("Compiler-Interpreter");
  44254. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  44255. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  44256. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  44257. $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`).";
  44258. $core.addMethod(
  44259. $core.method({
  44260. selector: "applyTo:arguments:",
  44261. protocol: "evaluating",
  44262. fn: function (anObject,aCollection){
  44263. var self=this,$self=this;
  44264. return $core.withContext(function($ctx1) {
  44265. $self._interpreterError();
  44266. return self;
  44267. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  44268. },
  44269. args: ["anObject", "aCollection"],
  44270. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  44271. referencedClasses: [],
  44272. messageSends: ["interpreterError"]
  44273. }),
  44274. $globals.AIBlockClosure);
  44275. $core.addMethod(
  44276. $core.method({
  44277. selector: "compiledSource",
  44278. protocol: "accessing",
  44279. fn: function (){
  44280. var self=this,$self=this;
  44281. return "[ AST Block closure ]";
  44282. },
  44283. args: [],
  44284. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  44285. referencedClasses: [],
  44286. messageSends: []
  44287. }),
  44288. $globals.AIBlockClosure);
  44289. $core.addMethod(
  44290. $core.method({
  44291. selector: "currySelf",
  44292. protocol: "converting",
  44293. fn: function (){
  44294. var self=this,$self=this;
  44295. return $core.withContext(function($ctx1) {
  44296. $self._interpreterError();
  44297. return self;
  44298. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  44299. },
  44300. args: [],
  44301. source: "currySelf\x0a\x09self interpreterError",
  44302. referencedClasses: [],
  44303. messageSends: ["interpreterError"]
  44304. }),
  44305. $globals.AIBlockClosure);
  44306. $core.addMethod(
  44307. $core.method({
  44308. selector: "initializeWithContext:node:",
  44309. protocol: "initialization",
  44310. fn: function (aContext,aNode){
  44311. var self=this,$self=this;
  44312. $self["@node"]=aNode;
  44313. $self["@outerContext"]=aContext;
  44314. return self;
  44315. },
  44316. args: ["aContext", "aNode"],
  44317. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  44318. referencedClasses: [],
  44319. messageSends: []
  44320. }),
  44321. $globals.AIBlockClosure);
  44322. $core.addMethod(
  44323. $core.method({
  44324. selector: "interpreterError",
  44325. protocol: "error handling",
  44326. fn: function (){
  44327. var self=this,$self=this;
  44328. return $core.withContext(function($ctx1) {
  44329. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  44330. return self;
  44331. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  44332. },
  44333. args: [],
  44334. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  44335. referencedClasses: ["ASTInterpreterError"],
  44336. messageSends: ["signal:"]
  44337. }),
  44338. $globals.AIBlockClosure);
  44339. $core.addMethod(
  44340. $core.method({
  44341. selector: "numArgs",
  44342. protocol: "accessing",
  44343. fn: function (){
  44344. var self=this,$self=this;
  44345. return $core.withContext(function($ctx1) {
  44346. return $recv($recv($self["@node"])._temps())._size();
  44347. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  44348. },
  44349. args: [],
  44350. source: "numArgs\x0a\x09^ node temps size",
  44351. referencedClasses: [],
  44352. messageSends: ["size", "temps"]
  44353. }),
  44354. $globals.AIBlockClosure);
  44355. $core.addMethod(
  44356. $core.method({
  44357. selector: "value",
  44358. protocol: "evaluating",
  44359. fn: function (){
  44360. var self=this,$self=this;
  44361. return $core.withContext(function($ctx1) {
  44362. return $self._valueWithPossibleArguments_([]);
  44363. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  44364. },
  44365. args: [],
  44366. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  44367. referencedClasses: [],
  44368. messageSends: ["valueWithPossibleArguments:"]
  44369. }),
  44370. $globals.AIBlockClosure);
  44371. $core.addMethod(
  44372. $core.method({
  44373. selector: "value:",
  44374. protocol: "evaluating",
  44375. fn: function (anArgument){
  44376. var self=this,$self=this;
  44377. return $core.withContext(function($ctx1) {
  44378. return $self._valueWithPossibleArguments_([anArgument]);
  44379. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  44380. },
  44381. args: ["anArgument"],
  44382. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  44383. referencedClasses: [],
  44384. messageSends: ["valueWithPossibleArguments:"]
  44385. }),
  44386. $globals.AIBlockClosure);
  44387. $core.addMethod(
  44388. $core.method({
  44389. selector: "value:value:",
  44390. protocol: "evaluating",
  44391. fn: function (firstArgument,secondArgument){
  44392. var self=this,$self=this;
  44393. return $core.withContext(function($ctx1) {
  44394. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  44395. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  44396. },
  44397. args: ["firstArgument", "secondArgument"],
  44398. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  44399. referencedClasses: [],
  44400. messageSends: ["valueWithPossibleArguments:"]
  44401. }),
  44402. $globals.AIBlockClosure);
  44403. $core.addMethod(
  44404. $core.method({
  44405. selector: "value:value:value:",
  44406. protocol: "evaluating",
  44407. fn: function (firstArgument,secondArgument,thirdArgument){
  44408. var self=this,$self=this;
  44409. return $core.withContext(function($ctx1) {
  44410. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  44411. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  44412. },
  44413. args: ["firstArgument", "secondArgument", "thirdArgument"],
  44414. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  44415. referencedClasses: [],
  44416. messageSends: ["valueWithPossibleArguments:"]
  44417. }),
  44418. $globals.AIBlockClosure);
  44419. $core.addMethod(
  44420. $core.method({
  44421. selector: "valueWithPossibleArguments:",
  44422. protocol: "evaluating",
  44423. fn: function (aCollection){
  44424. var self=this,$self=this;
  44425. var context,sequenceNode;
  44426. return $core.withContext(function($ctx1) {
  44427. var $1,$2,$3;
  44428. context=$recv($self["@outerContext"])._newInnerContext();
  44429. $1=$recv($recv($recv($self["@node"])._dagChildren())._first())._copy();
  44430. $recv($1)._parent_(nil);
  44431. sequenceNode=$recv($1)._yourself();
  44432. $recv($recv(sequenceNode)._temps())._do_((function(each){
  44433. return $core.withContext(function($ctx2) {
  44434. return $recv(context)._defineLocal_(each);
  44435. $ctx2.sendIdx["defineLocal:"]=1;
  44436. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44437. }));
  44438. $recv($recv($self["@node"])._parameters())._withIndexDo_((function(each,index){
  44439. return $core.withContext(function($ctx2) {
  44440. $recv(context)._defineLocal_(each);
  44441. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  44442. return nil;
  44443. })));
  44444. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  44445. }));
  44446. $2=$recv(context)._interpreter();
  44447. $ctx1.sendIdx["interpreter"]=1;
  44448. $recv($2)._node_(sequenceNode);
  44449. $recv($2)._enterNode();
  44450. $recv($2)._proceed();
  44451. $3=$recv($self["@outerContext"])._interpreter();
  44452. $ctx1.sendIdx["interpreter"]=2;
  44453. $recv($3)._setNonLocalReturnFromContext_(context);
  44454. return $recv($recv(context)._interpreter())._pop();
  44455. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  44456. },
  44457. args: ["aCollection"],
  44458. 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",
  44459. referencedClasses: [],
  44460. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  44461. }),
  44462. $globals.AIBlockClosure);
  44463. $core.addMethod(
  44464. $core.method({
  44465. selector: "forContext:node:",
  44466. protocol: "instance creation",
  44467. fn: function (aContext,aNode){
  44468. var self=this,$self=this;
  44469. return $core.withContext(function($ctx1) {
  44470. var $1;
  44471. $1=$self._new();
  44472. $recv($1)._initializeWithContext_node_(aContext,aNode);
  44473. return $recv($1)._yourself();
  44474. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.a$cls)});
  44475. },
  44476. args: ["aContext", "aNode"],
  44477. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  44478. referencedClasses: [],
  44479. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  44480. }),
  44481. $globals.AIBlockClosure.a$cls);
  44482. $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  44483. $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)";
  44484. $core.addMethod(
  44485. $core.method({
  44486. selector: "arguments",
  44487. protocol: "interpreting",
  44488. fn: function (){
  44489. var self=this,$self=this;
  44490. return $core.withContext(function($ctx1) {
  44491. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  44492. return $core.withContext(function($ctx2) {
  44493. return $self._localAt_ifAbsent_(each,(function(){
  44494. return $core.withContext(function($ctx3) {
  44495. return $self._error_("Argument not in context");
  44496. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44497. }));
  44498. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44499. }));
  44500. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  44501. },
  44502. args: [],
  44503. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  44504. referencedClasses: [],
  44505. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  44506. }),
  44507. $globals.AIContext);
  44508. $core.addMethod(
  44509. $core.method({
  44510. selector: "ast",
  44511. protocol: "interpreting",
  44512. fn: function (){
  44513. var self=this,$self=this;
  44514. return $core.withContext(function($ctx1) {
  44515. var $1,$2,$3,$receiver;
  44516. $1=$self._isBlockContext();
  44517. if($core.assert($1)){
  44518. $2=$self._outerContext();
  44519. if(($receiver = $2) == null || $receiver.a$nil){
  44520. return $2;
  44521. } else {
  44522. var context;
  44523. context=$receiver;
  44524. return $recv(context)._ast();
  44525. }
  44526. }
  44527. $3=$self["@ast"];
  44528. if(($receiver = $3) == null || $receiver.a$nil){
  44529. $self._initializeAST();
  44530. } else {
  44531. $3;
  44532. }
  44533. return $self["@ast"];
  44534. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  44535. },
  44536. args: [],
  44537. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  44538. referencedClasses: [],
  44539. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  44540. }),
  44541. $globals.AIContext);
  44542. $core.addMethod(
  44543. $core.method({
  44544. selector: "basicLocalAt:",
  44545. protocol: "private",
  44546. fn: function (aString){
  44547. var self=this,$self=this;
  44548. return $core.withContext(function($ctx1) {
  44549. return $recv($self._locals())._at_(aString);
  44550. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  44551. },
  44552. args: ["aString"],
  44553. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  44554. referencedClasses: [],
  44555. messageSends: ["at:", "locals"]
  44556. }),
  44557. $globals.AIContext);
  44558. $core.addMethod(
  44559. $core.method({
  44560. selector: "basicLocalAt:put:",
  44561. protocol: "private",
  44562. fn: function (aString,anObject){
  44563. var self=this,$self=this;
  44564. return $core.withContext(function($ctx1) {
  44565. $recv($self._locals())._at_put_(aString,anObject);
  44566. return self;
  44567. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  44568. },
  44569. args: ["aString", "anObject"],
  44570. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  44571. referencedClasses: [],
  44572. messageSends: ["at:put:", "locals"]
  44573. }),
  44574. $globals.AIContext);
  44575. $core.addMethod(
  44576. $core.method({
  44577. selector: "basicReceiver",
  44578. protocol: "interpreting",
  44579. fn: function (){
  44580. var self=this,$self=this;
  44581. return $core.withContext(function($ctx1) {
  44582. return $self._localAt_("self");
  44583. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  44584. },
  44585. args: [],
  44586. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  44587. referencedClasses: [],
  44588. messageSends: ["localAt:"]
  44589. }),
  44590. $globals.AIContext);
  44591. $core.addMethod(
  44592. $core.method({
  44593. selector: "defineLocal:",
  44594. protocol: "accessing",
  44595. fn: function (aString){
  44596. var self=this,$self=this;
  44597. return $core.withContext(function($ctx1) {
  44598. $recv($self._locals())._at_put_(aString,nil);
  44599. return self;
  44600. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  44601. },
  44602. args: ["aString"],
  44603. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  44604. referencedClasses: [],
  44605. messageSends: ["at:put:", "locals"]
  44606. }),
  44607. $globals.AIContext);
  44608. $core.addMethod(
  44609. $core.method({
  44610. selector: "evaluate:on:",
  44611. protocol: "evaluating",
  44612. fn: function (aString,anEvaluator){
  44613. var self=this,$self=this;
  44614. return $core.withContext(function($ctx1) {
  44615. return $recv(anEvaluator)._evaluate_context_(aString,self);
  44616. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  44617. },
  44618. args: ["aString", "anEvaluator"],
  44619. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  44620. referencedClasses: [],
  44621. messageSends: ["evaluate:context:"]
  44622. }),
  44623. $globals.AIContext);
  44624. $core.addMethod(
  44625. $core.method({
  44626. selector: "evaluateNode:",
  44627. protocol: "evaluating",
  44628. fn: function (aNode){
  44629. var self=this,$self=this;
  44630. return $core.withContext(function($ctx1) {
  44631. var $1;
  44632. $1=$recv($globals.ASTInterpreter)._new();
  44633. $recv($1)._context_(self);
  44634. $recv($1)._node_(aNode);
  44635. $recv($1)._enterNode();
  44636. $recv($1)._proceed();
  44637. return $recv($1)._result();
  44638. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  44639. },
  44640. args: ["aNode"],
  44641. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  44642. referencedClasses: ["ASTInterpreter"],
  44643. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  44644. }),
  44645. $globals.AIContext);
  44646. $core.addMethod(
  44647. $core.method({
  44648. selector: "evaluatedSelector",
  44649. protocol: "accessing",
  44650. fn: function (){
  44651. var self=this,$self=this;
  44652. return $self["@evaluatedSelector"];
  44653. },
  44654. args: [],
  44655. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  44656. referencedClasses: [],
  44657. messageSends: []
  44658. }),
  44659. $globals.AIContext);
  44660. $core.addMethod(
  44661. $core.method({
  44662. selector: "evaluatedSelector:",
  44663. protocol: "accessing",
  44664. fn: function (aString){
  44665. var self=this,$self=this;
  44666. $self["@evaluatedSelector"]=aString;
  44667. return self;
  44668. },
  44669. args: ["aString"],
  44670. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  44671. referencedClasses: [],
  44672. messageSends: []
  44673. }),
  44674. $globals.AIContext);
  44675. $core.addMethod(
  44676. $core.method({
  44677. selector: "index",
  44678. protocol: "accessing",
  44679. fn: function (){
  44680. var self=this,$self=this;
  44681. return $core.withContext(function($ctx1) {
  44682. var $1,$receiver;
  44683. $1=$self["@index"];
  44684. if(($receiver = $1) == null || $receiver.a$nil){
  44685. return (0);
  44686. } else {
  44687. return $1;
  44688. }
  44689. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  44690. },
  44691. args: [],
  44692. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  44693. referencedClasses: [],
  44694. messageSends: ["ifNil:"]
  44695. }),
  44696. $globals.AIContext);
  44697. $core.addMethod(
  44698. $core.method({
  44699. selector: "index:",
  44700. protocol: "accessing",
  44701. fn: function (anInteger){
  44702. var self=this,$self=this;
  44703. $self["@index"]=anInteger;
  44704. return self;
  44705. },
  44706. args: ["anInteger"],
  44707. source: "index: anInteger\x0a\x09index := anInteger",
  44708. referencedClasses: [],
  44709. messageSends: []
  44710. }),
  44711. $globals.AIContext);
  44712. $core.addMethod(
  44713. $core.method({
  44714. selector: "initializeAST",
  44715. protocol: "initialization",
  44716. fn: function (){
  44717. var self=this,$self=this;
  44718. return $core.withContext(function($ctx1) {
  44719. var $1;
  44720. $1=$self._method();
  44721. $ctx1.sendIdx["method"]=1;
  44722. $self["@ast"]=$recv($1)._ast();
  44723. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._methodClass()))._visit_($self["@ast"]);
  44724. return self;
  44725. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  44726. },
  44727. args: [],
  44728. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  44729. referencedClasses: ["SemanticAnalyzer"],
  44730. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  44731. }),
  44732. $globals.AIContext);
  44733. $core.addMethod(
  44734. $core.method({
  44735. selector: "initializeFromMethodContext:",
  44736. protocol: "initialization",
  44737. fn: function (aMethodContext){
  44738. var self=this,$self=this;
  44739. return $core.withContext(function($ctx1) {
  44740. var $1,$2,$3,$receiver;
  44741. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  44742. $self._index_($recv(aMethodContext)._index());
  44743. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  44744. $self._receiver_($recv(aMethodContext)._receiver());
  44745. $self._supercall_($recv(aMethodContext)._supercall());
  44746. $self._selector_($recv(aMethodContext)._selector());
  44747. $1=$recv(aMethodContext)._outerContext();
  44748. $ctx1.sendIdx["outerContext"]=1;
  44749. if(($receiver = $1) == null || $receiver.a$nil){
  44750. $1;
  44751. } else {
  44752. var outer;
  44753. outer=$receiver;
  44754. $2=$recv(outer)._methodContext();
  44755. if(($receiver = $2) == null || $receiver.a$nil){
  44756. $2;
  44757. } else {
  44758. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  44759. }
  44760. $3=$recv(aMethodContext)._locals();
  44761. $ctx1.sendIdx["locals"]=1;
  44762. $recv($3)._keysAndValuesDo_((function(key,value){
  44763. return $core.withContext(function($ctx2) {
  44764. return $recv($self._locals())._at_put_(key,value);
  44765. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  44766. }));
  44767. }
  44768. return self;
  44769. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  44770. },
  44771. args: ["aMethodContext"],
  44772. 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 ] ]",
  44773. referencedClasses: [],
  44774. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  44775. }),
  44776. $globals.AIContext);
  44777. $core.addMethod(
  44778. $core.method({
  44779. selector: "initializeInterpreter",
  44780. protocol: "initialization",
  44781. fn: function (){
  44782. var self=this,$self=this;
  44783. return $core.withContext(function($ctx1) {
  44784. var $1,$2,$receiver;
  44785. $1=$recv($globals.ASTInterpreter)._new();
  44786. $recv($1)._context_(self);
  44787. $self["@interpreter"]=$recv($1)._yourself();
  44788. $2=$self._innerContext();
  44789. if(($receiver = $2) == null || $receiver.a$nil){
  44790. $2;
  44791. } else {
  44792. $self._setupInterpreter_($self["@interpreter"]);
  44793. }
  44794. return self;
  44795. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  44796. },
  44797. args: [],
  44798. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  44799. referencedClasses: ["ASTInterpreter"],
  44800. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  44801. }),
  44802. $globals.AIContext);
  44803. $core.addMethod(
  44804. $core.method({
  44805. selector: "initializeLocals",
  44806. protocol: "initialization",
  44807. fn: function (){
  44808. var self=this,$self=this;
  44809. return $core.withContext(function($ctx1) {
  44810. $self["@locals"]=$recv($globals.Dictionary)._new();
  44811. $recv($self["@locals"])._at_put_("thisContext",self);
  44812. return self;
  44813. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  44814. },
  44815. args: [],
  44816. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  44817. referencedClasses: ["Dictionary"],
  44818. messageSends: ["new", "at:put:"]
  44819. }),
  44820. $globals.AIContext);
  44821. $core.addMethod(
  44822. $core.method({
  44823. selector: "innerContext",
  44824. protocol: "accessing",
  44825. fn: function (){
  44826. var self=this,$self=this;
  44827. return $self["@innerContext"];
  44828. },
  44829. args: [],
  44830. source: "innerContext\x0a\x09^ innerContext",
  44831. referencedClasses: [],
  44832. messageSends: []
  44833. }),
  44834. $globals.AIContext);
  44835. $core.addMethod(
  44836. $core.method({
  44837. selector: "innerContext:",
  44838. protocol: "accessing",
  44839. fn: function (anAIContext){
  44840. var self=this,$self=this;
  44841. $self["@innerContext"]=anAIContext;
  44842. return self;
  44843. },
  44844. args: ["anAIContext"],
  44845. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  44846. referencedClasses: [],
  44847. messageSends: []
  44848. }),
  44849. $globals.AIContext);
  44850. $core.addMethod(
  44851. $core.method({
  44852. selector: "interpreter",
  44853. protocol: "interpreting",
  44854. fn: function (){
  44855. var self=this,$self=this;
  44856. return $core.withContext(function($ctx1) {
  44857. var $1,$receiver;
  44858. $1=$self["@interpreter"];
  44859. if(($receiver = $1) == null || $receiver.a$nil){
  44860. $self._initializeInterpreter();
  44861. } else {
  44862. $1;
  44863. }
  44864. return $self["@interpreter"];
  44865. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  44866. },
  44867. args: [],
  44868. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  44869. referencedClasses: [],
  44870. messageSends: ["ifNil:", "initializeInterpreter"]
  44871. }),
  44872. $globals.AIContext);
  44873. $core.addMethod(
  44874. $core.method({
  44875. selector: "interpreter:",
  44876. protocol: "interpreting",
  44877. fn: function (anInterpreter){
  44878. var self=this,$self=this;
  44879. $self["@interpreter"]=anInterpreter;
  44880. return self;
  44881. },
  44882. args: ["anInterpreter"],
  44883. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  44884. referencedClasses: [],
  44885. messageSends: []
  44886. }),
  44887. $globals.AIContext);
  44888. $core.addMethod(
  44889. $core.method({
  44890. selector: "isTopContext",
  44891. protocol: "testing",
  44892. fn: function (){
  44893. var self=this,$self=this;
  44894. return $core.withContext(function($ctx1) {
  44895. return $recv($self._innerContext())._isNil();
  44896. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  44897. },
  44898. args: [],
  44899. source: "isTopContext\x0a\x09^ self innerContext isNil",
  44900. referencedClasses: [],
  44901. messageSends: ["isNil", "innerContext"]
  44902. }),
  44903. $globals.AIContext);
  44904. $core.addMethod(
  44905. $core.method({
  44906. selector: "localAt:",
  44907. protocol: "accessing",
  44908. fn: function (aString){
  44909. var self=this,$self=this;
  44910. var context;
  44911. return $core.withContext(function($ctx1) {
  44912. context=$self._lookupContextForLocal_(aString);
  44913. return $recv(context)._basicLocalAt_(aString);
  44914. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  44915. },
  44916. args: ["aString"],
  44917. 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",
  44918. referencedClasses: [],
  44919. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  44920. }),
  44921. $globals.AIContext);
  44922. $core.addMethod(
  44923. $core.method({
  44924. selector: "localAt:ifAbsent:",
  44925. protocol: "accessing",
  44926. fn: function (aString,aBlock){
  44927. var self=this,$self=this;
  44928. var context;
  44929. return $core.withContext(function($ctx1) {
  44930. var $early={};
  44931. try {
  44932. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  44933. return $core.withContext(function($ctx2) {
  44934. throw $early=[$recv(aBlock)._value()];
  44935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44936. }));
  44937. return $recv(context)._basicLocalAt_(aString);
  44938. }
  44939. catch(e) {if(e===$early)return e[0]; throw e}
  44940. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  44941. },
  44942. args: ["aString", "aBlock"],
  44943. 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",
  44944. referencedClasses: [],
  44945. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  44946. }),
  44947. $globals.AIContext);
  44948. $core.addMethod(
  44949. $core.method({
  44950. selector: "localAt:put:",
  44951. protocol: "accessing",
  44952. fn: function (aString,anObject){
  44953. var self=this,$self=this;
  44954. var context;
  44955. return $core.withContext(function($ctx1) {
  44956. context=$self._lookupContextForLocal_(aString);
  44957. $recv(context)._basicLocalAt_put_(aString,anObject);
  44958. return self;
  44959. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  44960. },
  44961. args: ["aString", "anObject"],
  44962. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  44963. referencedClasses: [],
  44964. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  44965. }),
  44966. $globals.AIContext);
  44967. $core.addMethod(
  44968. $core.method({
  44969. selector: "locals",
  44970. protocol: "accessing",
  44971. fn: function (){
  44972. var self=this,$self=this;
  44973. return $core.withContext(function($ctx1) {
  44974. var $1,$receiver;
  44975. $1=$self["@locals"];
  44976. if(($receiver = $1) == null || $receiver.a$nil){
  44977. $self._initializeLocals();
  44978. } else {
  44979. $1;
  44980. }
  44981. return $self["@locals"];
  44982. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  44983. },
  44984. args: [],
  44985. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  44986. referencedClasses: [],
  44987. messageSends: ["ifNil:", "initializeLocals"]
  44988. }),
  44989. $globals.AIContext);
  44990. $core.addMethod(
  44991. $core.method({
  44992. selector: "lookupContextForLocal:",
  44993. protocol: "private",
  44994. fn: function (aString){
  44995. var self=this,$self=this;
  44996. return $core.withContext(function($ctx1) {
  44997. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  44998. return $core.withContext(function($ctx2) {
  44999. return $self._variableNotFound();
  45000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45001. }));
  45002. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  45003. },
  45004. args: ["aString"],
  45005. 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 ]",
  45006. referencedClasses: [],
  45007. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  45008. }),
  45009. $globals.AIContext);
  45010. $core.addMethod(
  45011. $core.method({
  45012. selector: "lookupContextForLocal:ifNone:",
  45013. protocol: "private",
  45014. fn: function (aString,aBlock){
  45015. var self=this,$self=this;
  45016. return $core.withContext(function($ctx1) {
  45017. var $1;
  45018. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  45019. return self;
  45020. }),(function(){
  45021. return $core.withContext(function($ctx2) {
  45022. $1=$self._outerContext();
  45023. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  45024. return $core.withContext(function($ctx3) {
  45025. return $recv(context)._lookupContextForLocal_(aString);
  45026. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  45027. }));
  45028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45029. }));
  45030. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  45031. },
  45032. args: ["aString", "aBlock"],
  45033. 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 ] ]",
  45034. referencedClasses: [],
  45035. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  45036. }),
  45037. $globals.AIContext);
  45038. $core.addMethod(
  45039. $core.method({
  45040. selector: "newInnerContext",
  45041. protocol: "factory",
  45042. fn: function (){
  45043. var self=this,$self=this;
  45044. return $core.withContext(function($ctx1) {
  45045. var $1;
  45046. $1=$recv($self._class())._new();
  45047. $recv($1)._outerContext_(self);
  45048. return $recv($1)._yourself();
  45049. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  45050. },
  45051. args: [],
  45052. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  45053. referencedClasses: [],
  45054. messageSends: ["outerContext:", "new", "class", "yourself"]
  45055. }),
  45056. $globals.AIContext);
  45057. $core.addMethod(
  45058. $core.method({
  45059. selector: "outerContext",
  45060. protocol: "accessing",
  45061. fn: function (){
  45062. var self=this,$self=this;
  45063. return $self["@outerContext"];
  45064. },
  45065. args: [],
  45066. source: "outerContext\x0a\x09^ outerContext",
  45067. referencedClasses: [],
  45068. messageSends: []
  45069. }),
  45070. $globals.AIContext);
  45071. $core.addMethod(
  45072. $core.method({
  45073. selector: "outerContext:",
  45074. protocol: "accessing",
  45075. fn: function (anAIContext){
  45076. var self=this,$self=this;
  45077. return $core.withContext(function($ctx1) {
  45078. var $1,$receiver;
  45079. $self["@outerContext"]=anAIContext;
  45080. $1=$self["@outerContext"];
  45081. if(($receiver = $1) == null || $receiver.a$nil){
  45082. $1;
  45083. } else {
  45084. var context;
  45085. context=$receiver;
  45086. $recv(context)._innerContext_(self);
  45087. }
  45088. return self;
  45089. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  45090. },
  45091. args: ["anAIContext"],
  45092. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  45093. referencedClasses: [],
  45094. messageSends: ["ifNotNil:", "innerContext:"]
  45095. }),
  45096. $globals.AIContext);
  45097. $core.addMethod(
  45098. $core.method({
  45099. selector: "receiver:",
  45100. protocol: "interpreting",
  45101. fn: function (anObject){
  45102. var self=this,$self=this;
  45103. return $core.withContext(function($ctx1) {
  45104. $recv($self._locals())._at_put_("self",anObject);
  45105. return self;
  45106. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  45107. },
  45108. args: ["anObject"],
  45109. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  45110. referencedClasses: [],
  45111. messageSends: ["at:put:", "locals"]
  45112. }),
  45113. $globals.AIContext);
  45114. $core.addMethod(
  45115. $core.method({
  45116. selector: "selector",
  45117. protocol: "accessing",
  45118. fn: function (){
  45119. var self=this,$self=this;
  45120. return $self["@selector"];
  45121. },
  45122. args: [],
  45123. source: "selector\x0a\x09^ selector",
  45124. referencedClasses: [],
  45125. messageSends: []
  45126. }),
  45127. $globals.AIContext);
  45128. $core.addMethod(
  45129. $core.method({
  45130. selector: "selector:",
  45131. protocol: "accessing",
  45132. fn: function (aString){
  45133. var self=this,$self=this;
  45134. $self["@selector"]=aString;
  45135. return self;
  45136. },
  45137. args: ["aString"],
  45138. source: "selector: aString\x0a\x09selector := aString",
  45139. referencedClasses: [],
  45140. messageSends: []
  45141. }),
  45142. $globals.AIContext);
  45143. $core.addMethod(
  45144. $core.method({
  45145. selector: "sendIndexAt:",
  45146. protocol: "accessing",
  45147. fn: function (aString){
  45148. var self=this,$self=this;
  45149. return $core.withContext(function($ctx1) {
  45150. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  45151. return (0);
  45152. }));
  45153. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  45154. },
  45155. args: ["aString"],
  45156. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  45157. referencedClasses: [],
  45158. messageSends: ["at:ifAbsent:", "sendIndexes"]
  45159. }),
  45160. $globals.AIContext);
  45161. $core.addMethod(
  45162. $core.method({
  45163. selector: "sendIndexes",
  45164. protocol: "accessing",
  45165. fn: function (){
  45166. var self=this,$self=this;
  45167. return $core.withContext(function($ctx1) {
  45168. var $1,$receiver;
  45169. $1=$self["@sendIndexes"];
  45170. if(($receiver = $1) == null || $receiver.a$nil){
  45171. return $recv($globals.Dictionary)._new();
  45172. } else {
  45173. return $1;
  45174. }
  45175. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  45176. },
  45177. args: [],
  45178. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  45179. referencedClasses: ["Dictionary"],
  45180. messageSends: ["ifNil:", "new"]
  45181. }),
  45182. $globals.AIContext);
  45183. $core.addMethod(
  45184. $core.method({
  45185. selector: "sendIndexes:",
  45186. protocol: "accessing",
  45187. fn: function (aDictionary){
  45188. var self=this,$self=this;
  45189. $self["@sendIndexes"]=aDictionary;
  45190. return self;
  45191. },
  45192. args: ["aDictionary"],
  45193. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  45194. referencedClasses: [],
  45195. messageSends: []
  45196. }),
  45197. $globals.AIContext);
  45198. $core.addMethod(
  45199. $core.method({
  45200. selector: "setupInterpreter:",
  45201. protocol: "interpreting",
  45202. fn: function (anInterpreter){
  45203. var self=this,$self=this;
  45204. var currentNode;
  45205. return $core.withContext(function($ctx1) {
  45206. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  45207. $1=$recv($globals.ASTPCNodeVisitor)._new();
  45208. $2=$self._evaluatedSelector();
  45209. $ctx1.sendIdx["evaluatedSelector"]=1;
  45210. $recv($1)._selector_($2);
  45211. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  45212. $3=$self._ast();
  45213. $ctx1.sendIdx["ast"]=1;
  45214. $recv($1)._visit_($3);
  45215. currentNode=$recv($1)._currentNode();
  45216. $4=$recv($self._ast())._sequenceNode();
  45217. if(($receiver = $4) == null || $receiver.a$nil){
  45218. $4;
  45219. } else {
  45220. var sequence;
  45221. sequence=$receiver;
  45222. $recv($recv(sequence)._temps())._do_((function(each){
  45223. return $core.withContext(function($ctx2) {
  45224. return $self._defineLocal_(each);
  45225. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45226. }));
  45227. $ctx1.sendIdx["do:"]=1;
  45228. }
  45229. $recv(anInterpreter)._node_(currentNode);
  45230. $7=$self._innerContext();
  45231. $ctx1.sendIdx["innerContext"]=1;
  45232. $6=$recv($7)._arguments();
  45233. $5=$recv($6)._reversed();
  45234. $recv($5)._do_((function(each){
  45235. return $core.withContext(function($ctx2) {
  45236. return $recv(anInterpreter)._push_(each);
  45237. $ctx2.sendIdx["push:"]=1;
  45238. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  45239. }));
  45240. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  45241. return self;
  45242. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  45243. },
  45244. args: ["anInterpreter"],
  45245. 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)",
  45246. referencedClasses: ["ASTPCNodeVisitor"],
  45247. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  45248. }),
  45249. $globals.AIContext);
  45250. $core.addMethod(
  45251. $core.method({
  45252. selector: "supercall",
  45253. protocol: "interpreting",
  45254. fn: function (){
  45255. var self=this,$self=this;
  45256. return $core.withContext(function($ctx1) {
  45257. var $1,$receiver;
  45258. $1=$self["@supercall"];
  45259. if(($receiver = $1) == null || $receiver.a$nil){
  45260. return false;
  45261. } else {
  45262. return $1;
  45263. }
  45264. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  45265. },
  45266. args: [],
  45267. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  45268. referencedClasses: [],
  45269. messageSends: ["ifNil:"]
  45270. }),
  45271. $globals.AIContext);
  45272. $core.addMethod(
  45273. $core.method({
  45274. selector: "supercall:",
  45275. protocol: "interpreting",
  45276. fn: function (aBoolean){
  45277. var self=this,$self=this;
  45278. $self["@supercall"]=aBoolean;
  45279. return self;
  45280. },
  45281. args: ["aBoolean"],
  45282. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  45283. referencedClasses: [],
  45284. messageSends: []
  45285. }),
  45286. $globals.AIContext);
  45287. $core.addMethod(
  45288. $core.method({
  45289. selector: "variableNotFound",
  45290. protocol: "error handling",
  45291. fn: function (){
  45292. var self=this,$self=this;
  45293. return $core.withContext(function($ctx1) {
  45294. $self._error_("Variable missing");
  45295. return self;
  45296. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  45297. },
  45298. args: [],
  45299. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  45300. referencedClasses: [],
  45301. messageSends: ["error:"]
  45302. }),
  45303. $globals.AIContext);
  45304. $core.addMethod(
  45305. $core.method({
  45306. selector: "fromMethodContext:",
  45307. protocol: "instance creation",
  45308. fn: function (aMethodContext){
  45309. var self=this,$self=this;
  45310. return $core.withContext(function($ctx1) {
  45311. var $1;
  45312. $1=$self._new();
  45313. $recv($1)._initializeFromMethodContext_(aMethodContext);
  45314. return $recv($1)._yourself();
  45315. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.a$cls)});
  45316. },
  45317. args: ["aMethodContext"],
  45318. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  45319. referencedClasses: [],
  45320. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  45321. }),
  45322. $globals.AIContext.a$cls);
  45323. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  45324. $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.";
  45325. $core.addMethod(
  45326. $core.method({
  45327. selector: "context",
  45328. protocol: "accessing",
  45329. fn: function (){
  45330. var self=this,$self=this;
  45331. return $self["@context"];
  45332. },
  45333. args: [],
  45334. source: "context\x0a\x09^ context",
  45335. referencedClasses: [],
  45336. messageSends: []
  45337. }),
  45338. $globals.AISemanticAnalyzer);
  45339. $core.addMethod(
  45340. $core.method({
  45341. selector: "context:",
  45342. protocol: "accessing",
  45343. fn: function (anAIContext){
  45344. var self=this,$self=this;
  45345. $self["@context"]=anAIContext;
  45346. return self;
  45347. },
  45348. args: ["anAIContext"],
  45349. source: "context: anAIContext\x0a\x09context := anAIContext",
  45350. referencedClasses: [],
  45351. messageSends: []
  45352. }),
  45353. $globals.AISemanticAnalyzer);
  45354. $core.addMethod(
  45355. $core.method({
  45356. selector: "visitVariableNode:",
  45357. protocol: "visiting",
  45358. fn: function (aNode){
  45359. var self=this,$self=this;
  45360. return $core.withContext(function($ctx1) {
  45361. var $1;
  45362. var $early={};
  45363. try {
  45364. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  45365. return $core.withContext(function($ctx2) {
  45366. $1=(
  45367. $ctx2.supercall = true,
  45368. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  45369. $ctx2.supercall = false;
  45370. throw $early=[$1];
  45371. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45372. }));
  45373. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  45374. return self;
  45375. }
  45376. catch(e) {if(e===$early)return e[0]; throw e}
  45377. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  45378. },
  45379. args: ["aNode"],
  45380. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  45381. referencedClasses: ["ASTContextVar"],
  45382. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  45383. }),
  45384. $globals.AISemanticAnalyzer);
  45385. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  45386. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  45387. $core.addMethod(
  45388. $core.method({
  45389. selector: "context",
  45390. protocol: "accessing",
  45391. fn: function (){
  45392. var self=this,$self=this;
  45393. return $self["@context"];
  45394. },
  45395. args: [],
  45396. source: "context\x0a\x09^ context",
  45397. referencedClasses: [],
  45398. messageSends: []
  45399. }),
  45400. $globals.ASTContextVar);
  45401. $core.addMethod(
  45402. $core.method({
  45403. selector: "context:",
  45404. protocol: "accessing",
  45405. fn: function (anObject){
  45406. var self=this,$self=this;
  45407. $self["@context"]=anObject;
  45408. return self;
  45409. },
  45410. args: ["anObject"],
  45411. source: "context: anObject\x0a\x09context := anObject",
  45412. referencedClasses: [],
  45413. messageSends: []
  45414. }),
  45415. $globals.ASTContextVar);
  45416. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  45417. $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.";
  45418. $core.addMethod(
  45419. $core.method({
  45420. selector: "atEnd",
  45421. protocol: "testing",
  45422. fn: function (){
  45423. var self=this,$self=this;
  45424. return $core.withContext(function($ctx1) {
  45425. var $1,$receiver;
  45426. $1=$self._context();
  45427. $ctx1.sendIdx["context"]=1;
  45428. if(($receiver = $1) == null || $receiver.a$nil){
  45429. return true;
  45430. } else {
  45431. $1;
  45432. }
  45433. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  45434. return $core.withContext(function($ctx2) {
  45435. return $recv($self._context())._isTopContext();
  45436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45437. }));
  45438. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  45439. },
  45440. args: [],
  45441. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  45442. referencedClasses: [],
  45443. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  45444. }),
  45445. $globals.ASTDebugger);
  45446. $core.addMethod(
  45447. $core.method({
  45448. selector: "context",
  45449. protocol: "accessing",
  45450. fn: function (){
  45451. var self=this,$self=this;
  45452. return $self["@context"];
  45453. },
  45454. args: [],
  45455. source: "context\x0a\x09^ context",
  45456. referencedClasses: [],
  45457. messageSends: []
  45458. }),
  45459. $globals.ASTDebugger);
  45460. $core.addMethod(
  45461. $core.method({
  45462. selector: "context:",
  45463. protocol: "accessing",
  45464. fn: function (aContext){
  45465. var self=this,$self=this;
  45466. $self["@context"]=aContext;
  45467. return self;
  45468. },
  45469. args: ["aContext"],
  45470. source: "context: aContext\x0a\x09context := aContext",
  45471. referencedClasses: [],
  45472. messageSends: []
  45473. }),
  45474. $globals.ASTDebugger);
  45475. $core.addMethod(
  45476. $core.method({
  45477. selector: "flushInnerContexts",
  45478. protocol: "actions",
  45479. fn: function (){
  45480. var self=this,$self=this;
  45481. return $core.withContext(function($ctx1) {
  45482. var $1,$receiver;
  45483. $1=$self._context();
  45484. if(($receiver = $1) == null || $receiver.a$nil){
  45485. $1;
  45486. } else {
  45487. var cxt;
  45488. cxt=$receiver;
  45489. $recv(cxt)._innerContext_(nil);
  45490. }
  45491. return self;
  45492. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  45493. },
  45494. args: [],
  45495. 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 ]",
  45496. referencedClasses: [],
  45497. messageSends: ["ifNotNil:", "context", "innerContext:"]
  45498. }),
  45499. $globals.ASTDebugger);
  45500. $core.addMethod(
  45501. $core.method({
  45502. selector: "interpreter",
  45503. protocol: "accessing",
  45504. fn: function (){
  45505. var self=this,$self=this;
  45506. return $core.withContext(function($ctx1) {
  45507. var $1,$receiver;
  45508. $1=$self._context();
  45509. if(($receiver = $1) == null || $receiver.a$nil){
  45510. return $1;
  45511. } else {
  45512. var ctx;
  45513. ctx=$receiver;
  45514. return $recv(ctx)._interpreter();
  45515. }
  45516. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  45517. },
  45518. args: [],
  45519. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  45520. referencedClasses: [],
  45521. messageSends: ["ifNotNil:", "context", "interpreter"]
  45522. }),
  45523. $globals.ASTDebugger);
  45524. $core.addMethod(
  45525. $core.method({
  45526. selector: "method",
  45527. protocol: "accessing",
  45528. fn: function (){
  45529. var self=this,$self=this;
  45530. return $core.withContext(function($ctx1) {
  45531. return $recv($self._context())._method();
  45532. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  45533. },
  45534. args: [],
  45535. source: "method\x0a\x09^ self context method",
  45536. referencedClasses: [],
  45537. messageSends: ["method", "context"]
  45538. }),
  45539. $globals.ASTDebugger);
  45540. $core.addMethod(
  45541. $core.method({
  45542. selector: "node",
  45543. protocol: "accessing",
  45544. fn: function (){
  45545. var self=this,$self=this;
  45546. return $core.withContext(function($ctx1) {
  45547. var $1,$receiver;
  45548. $1=$self._interpreter();
  45549. $ctx1.sendIdx["interpreter"]=1;
  45550. if(($receiver = $1) == null || $receiver.a$nil){
  45551. return $1;
  45552. } else {
  45553. return $recv($self._interpreter())._node();
  45554. }
  45555. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  45556. },
  45557. args: [],
  45558. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  45559. referencedClasses: [],
  45560. messageSends: ["ifNotNil:", "interpreter", "node"]
  45561. }),
  45562. $globals.ASTDebugger);
  45563. $core.addMethod(
  45564. $core.method({
  45565. selector: "onStep",
  45566. protocol: "private",
  45567. fn: function (){
  45568. var self=this,$self=this;
  45569. return $core.withContext(function($ctx1) {
  45570. var $1,$3,$2,$4,$6,$5,$receiver;
  45571. $1=$self._interpreter();
  45572. $ctx1.sendIdx["interpreter"]=1;
  45573. $self["@result"]=$recv($1)._result();
  45574. $3=$self._interpreter();
  45575. $ctx1.sendIdx["interpreter"]=2;
  45576. $2=$recv($3)._atEnd();
  45577. $ctx1.sendIdx["atEnd"]=1;
  45578. if($core.assert($2)){
  45579. $4=$recv($self._context())._outerContext();
  45580. if(($receiver = $4) == null || $receiver.a$nil){
  45581. $4;
  45582. } else {
  45583. var outerContext;
  45584. outerContext=$receiver;
  45585. $self._context_(outerContext);
  45586. }
  45587. $6=$self._interpreter();
  45588. $ctx1.sendIdx["interpreter"]=3;
  45589. $5=$recv($6)._atEnd();
  45590. if(!$core.assert($5)){
  45591. $recv($self._interpreter())._skip();
  45592. }
  45593. }
  45594. $self._flushInnerContexts();
  45595. return self;
  45596. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  45597. },
  45598. args: [],
  45599. 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",
  45600. referencedClasses: [],
  45601. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  45602. }),
  45603. $globals.ASTDebugger);
  45604. $core.addMethod(
  45605. $core.method({
  45606. selector: "proceed",
  45607. protocol: "stepping",
  45608. fn: function (){
  45609. var self=this,$self=this;
  45610. return $core.withContext(function($ctx1) {
  45611. $recv((function(){
  45612. return $core.withContext(function($ctx2) {
  45613. return $self._atEnd();
  45614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45615. }))._whileFalse_((function(){
  45616. return $core.withContext(function($ctx2) {
  45617. return $self._stepOver();
  45618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45619. }));
  45620. return self;
  45621. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  45622. },
  45623. args: [],
  45624. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  45625. referencedClasses: [],
  45626. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  45627. }),
  45628. $globals.ASTDebugger);
  45629. $core.addMethod(
  45630. $core.method({
  45631. selector: "restart",
  45632. protocol: "stepping",
  45633. fn: function (){
  45634. var self=this,$self=this;
  45635. return $core.withContext(function($ctx1) {
  45636. $recv($self._interpreter())._restart();
  45637. $self._flushInnerContexts();
  45638. return self;
  45639. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  45640. },
  45641. args: [],
  45642. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  45643. referencedClasses: [],
  45644. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  45645. }),
  45646. $globals.ASTDebugger);
  45647. $core.addMethod(
  45648. $core.method({
  45649. selector: "result",
  45650. protocol: "accessing",
  45651. fn: function (){
  45652. var self=this,$self=this;
  45653. return $self["@result"];
  45654. },
  45655. args: [],
  45656. source: "result\x0a\x09^ result",
  45657. referencedClasses: [],
  45658. messageSends: []
  45659. }),
  45660. $globals.ASTDebugger);
  45661. $core.addMethod(
  45662. $core.method({
  45663. selector: "stepInto",
  45664. protocol: "stepping",
  45665. fn: function (){
  45666. var self=this,$self=this;
  45667. return $core.withContext(function($ctx1) {
  45668. $self._shouldBeImplemented();
  45669. return self;
  45670. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  45671. },
  45672. args: [],
  45673. source: "stepInto\x0a\x09self shouldBeImplemented",
  45674. referencedClasses: [],
  45675. messageSends: ["shouldBeImplemented"]
  45676. }),
  45677. $globals.ASTDebugger);
  45678. $core.addMethod(
  45679. $core.method({
  45680. selector: "stepOver",
  45681. protocol: "stepping",
  45682. fn: function (){
  45683. var self=this,$self=this;
  45684. return $core.withContext(function($ctx1) {
  45685. var $1,$2;
  45686. $1=$recv($self._context())._isTopContext();
  45687. if($core.assert($1)){
  45688. $recv($self._interpreter())._stepOver();
  45689. } else {
  45690. $2=$self._interpreter();
  45691. $ctx1.sendIdx["interpreter"]=1;
  45692. $recv($2)._skip();
  45693. }
  45694. $self._onStep();
  45695. return self;
  45696. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  45697. },
  45698. args: [],
  45699. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  45700. referencedClasses: [],
  45701. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  45702. }),
  45703. $globals.ASTDebugger);
  45704. $core.addMethod(
  45705. $core.method({
  45706. selector: "context:",
  45707. protocol: "instance creation",
  45708. fn: function (aContext){
  45709. var self=this,$self=this;
  45710. return $core.withContext(function($ctx1) {
  45711. var $1;
  45712. $1=$self._new();
  45713. $recv($1)._context_(aContext);
  45714. return $recv($1)._yourself();
  45715. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.a$cls)});
  45716. },
  45717. args: ["aContext"],
  45718. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  45719. referencedClasses: [],
  45720. messageSends: ["context:", "new", "yourself"]
  45721. }),
  45722. $globals.ASTDebugger.a$cls);
  45723. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  45724. $core.addMethod(
  45725. $core.method({
  45726. selector: "interpreter",
  45727. protocol: "accessing",
  45728. fn: function (){
  45729. var self=this,$self=this;
  45730. return $self["@interpreter"];
  45731. },
  45732. args: [],
  45733. source: "interpreter\x0a\x09^ interpreter",
  45734. referencedClasses: [],
  45735. messageSends: []
  45736. }),
  45737. $globals.ASTEnterNode);
  45738. $core.addMethod(
  45739. $core.method({
  45740. selector: "interpreter:",
  45741. protocol: "accessing",
  45742. fn: function (anObject){
  45743. var self=this,$self=this;
  45744. $self["@interpreter"]=anObject;
  45745. return self;
  45746. },
  45747. args: ["anObject"],
  45748. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  45749. referencedClasses: [],
  45750. messageSends: []
  45751. }),
  45752. $globals.ASTEnterNode);
  45753. $core.addMethod(
  45754. $core.method({
  45755. selector: "visitBlockNode:",
  45756. protocol: "visiting",
  45757. fn: function (aNode){
  45758. var self=this,$self=this;
  45759. return aNode;
  45760. },
  45761. args: ["aNode"],
  45762. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  45763. referencedClasses: [],
  45764. messageSends: []
  45765. }),
  45766. $globals.ASTEnterNode);
  45767. $core.addMethod(
  45768. $core.method({
  45769. selector: "visitDagNode:",
  45770. protocol: "visiting",
  45771. fn: function (aNode){
  45772. var self=this,$self=this;
  45773. return $core.withContext(function($ctx1) {
  45774. var $early={};
  45775. try {
  45776. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  45777. throw $early=[aNode];
  45778. }),(function(nodes){
  45779. return $core.withContext(function($ctx2) {
  45780. throw $early=[$self._visit_($recv(nodes)._first())];
  45781. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  45782. }));
  45783. return self;
  45784. }
  45785. catch(e) {if(e===$early)return e[0]; throw e}
  45786. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45787. },
  45788. args: ["aNode"],
  45789. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  45790. referencedClasses: [],
  45791. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  45792. }),
  45793. $globals.ASTEnterNode);
  45794. $core.addMethod(
  45795. $core.method({
  45796. selector: "visitSequenceNode:",
  45797. protocol: "visiting",
  45798. fn: function (aNode){
  45799. var self=this,$self=this;
  45800. return $core.withContext(function($ctx1) {
  45801. var $1;
  45802. $recv($recv(aNode)._temps())._do_((function(each){
  45803. return $core.withContext(function($ctx2) {
  45804. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  45805. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45806. }));
  45807. $1=(
  45808. $ctx1.supercall = true,
  45809. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  45810. $ctx1.supercall = false;
  45811. return $1;
  45812. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45813. },
  45814. args: ["aNode"],
  45815. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  45816. referencedClasses: [],
  45817. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  45818. }),
  45819. $globals.ASTEnterNode);
  45820. $core.addMethod(
  45821. $core.method({
  45822. selector: "on:",
  45823. protocol: "instance creation",
  45824. fn: function (anInterpreter){
  45825. var self=this,$self=this;
  45826. return $core.withContext(function($ctx1) {
  45827. var $1;
  45828. $1=$self._new();
  45829. $recv($1)._interpreter_(anInterpreter);
  45830. return $recv($1)._yourself();
  45831. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.a$cls)});
  45832. },
  45833. args: ["anInterpreter"],
  45834. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  45835. referencedClasses: [],
  45836. messageSends: ["interpreter:", "new", "yourself"]
  45837. }),
  45838. $globals.ASTEnterNode.a$cls);
  45839. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  45840. $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";
  45841. $core.addMethod(
  45842. $core.method({
  45843. selector: "assign:to:",
  45844. protocol: "private",
  45845. fn: function (aNode,anObject){
  45846. var self=this,$self=this;
  45847. return $core.withContext(function($ctx1) {
  45848. var $1,$3,$2,$4;
  45849. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  45850. if($core.assert($1)){
  45851. $3=$self._context();
  45852. $ctx1.sendIdx["context"]=1;
  45853. $2=$recv($3)._receiver();
  45854. $4=$recv(aNode)._value();
  45855. $ctx1.sendIdx["value"]=1;
  45856. $recv($2)._instVarAt_put_($4,anObject);
  45857. } else {
  45858. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  45859. }
  45860. return self;
  45861. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  45862. },
  45863. args: ["aNode", "anObject"],
  45864. 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 ]",
  45865. referencedClasses: [],
  45866. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  45867. }),
  45868. $globals.ASTInterpreter);
  45869. $core.addMethod(
  45870. $core.method({
  45871. selector: "atEnd",
  45872. protocol: "testing",
  45873. fn: function (){
  45874. var self=this,$self=this;
  45875. return $core.withContext(function($ctx1) {
  45876. var $1;
  45877. $1=$self["@forceAtEnd"];
  45878. if($core.assert($1)){
  45879. return true;
  45880. }
  45881. return $recv($self._hasReturned())._or_((function(){
  45882. return $core.withContext(function($ctx2) {
  45883. return $recv($self._node())._isNil();
  45884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45885. }));
  45886. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  45887. },
  45888. args: [],
  45889. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  45890. referencedClasses: [],
  45891. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  45892. }),
  45893. $globals.ASTInterpreter);
  45894. $core.addMethod(
  45895. $core.method({
  45896. selector: "context",
  45897. protocol: "accessing",
  45898. fn: function (){
  45899. var self=this,$self=this;
  45900. return $self["@context"];
  45901. },
  45902. args: [],
  45903. source: "context\x0a\x09^ context",
  45904. referencedClasses: [],
  45905. messageSends: []
  45906. }),
  45907. $globals.ASTInterpreter);
  45908. $core.addMethod(
  45909. $core.method({
  45910. selector: "context:",
  45911. protocol: "accessing",
  45912. fn: function (aContext){
  45913. var self=this,$self=this;
  45914. $self["@context"]=aContext;
  45915. return self;
  45916. },
  45917. args: ["aContext"],
  45918. source: "context: aContext\x0a\x09context := aContext",
  45919. referencedClasses: [],
  45920. messageSends: []
  45921. }),
  45922. $globals.ASTInterpreter);
  45923. $core.addMethod(
  45924. $core.method({
  45925. selector: "enterNode",
  45926. protocol: "interpreting",
  45927. fn: function (){
  45928. var self=this,$self=this;
  45929. return $core.withContext(function($ctx1) {
  45930. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  45931. return self;
  45932. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  45933. },
  45934. args: [],
  45935. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  45936. referencedClasses: ["ASTEnterNode"],
  45937. messageSends: ["node:", "visit:", "on:", "node"]
  45938. }),
  45939. $globals.ASTInterpreter);
  45940. $core.addMethod(
  45941. $core.method({
  45942. selector: "eval:",
  45943. protocol: "private",
  45944. fn: function (aString){
  45945. var self=this,$self=this;
  45946. var source,function_;
  45947. return $core.withContext(function($ctx1) {
  45948. var $3,$2,$1;
  45949. source=$recv($globals.String)._streamContents_((function(str){
  45950. return $core.withContext(function($ctx2) {
  45951. $recv(str)._nextPutAll_("0,(function(");
  45952. $ctx2.sendIdx["nextPutAll:"]=1;
  45953. $3=$self._context();
  45954. $ctx2.sendIdx["context"]=1;
  45955. $2=$recv($3)._locals();
  45956. $ctx2.sendIdx["locals"]=1;
  45957. $1=$recv($2)._keys();
  45958. $recv($1)._do_separatedBy_((function(each){
  45959. return $core.withContext(function($ctx3) {
  45960. return $recv(str)._nextPutAll_(each);
  45961. $ctx3.sendIdx["nextPutAll:"]=2;
  45962. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  45963. }),(function(){
  45964. return $core.withContext(function($ctx3) {
  45965. return $recv(str)._nextPutAll_(",");
  45966. $ctx3.sendIdx["nextPutAll:"]=3;
  45967. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  45968. }));
  45969. $recv(str)._nextPutAll_("){ return (function() {");
  45970. $ctx2.sendIdx["nextPutAll:"]=4;
  45971. $recv(str)._nextPutAll_(aString);
  45972. $ctx2.sendIdx["nextPutAll:"]=5;
  45973. return $recv(str)._nextPutAll_("})()})");
  45974. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  45975. }));
  45976. function_=$recv($globals.Compiler)._eval_(source);
  45977. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  45978. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  45979. },
  45980. args: ["aString"],
  45981. 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",
  45982. referencedClasses: ["String", "Compiler"],
  45983. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  45984. }),
  45985. $globals.ASTInterpreter);
  45986. $core.addMethod(
  45987. $core.method({
  45988. selector: "hasReturned",
  45989. protocol: "testing",
  45990. fn: function (){
  45991. var self=this,$self=this;
  45992. return $core.withContext(function($ctx1) {
  45993. var $1,$receiver;
  45994. $1=$self["@returned"];
  45995. if(($receiver = $1) == null || $receiver.a$nil){
  45996. return false;
  45997. } else {
  45998. return $1;
  45999. }
  46000. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  46001. },
  46002. args: [],
  46003. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  46004. referencedClasses: [],
  46005. messageSends: ["ifNil:"]
  46006. }),
  46007. $globals.ASTInterpreter);
  46008. $core.addMethod(
  46009. $core.method({
  46010. selector: "initialize",
  46011. protocol: "initialization",
  46012. fn: function (){
  46013. var self=this,$self=this;
  46014. return $core.withContext(function($ctx1) {
  46015. (
  46016. $ctx1.supercall = true,
  46017. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  46018. $ctx1.supercall = false;
  46019. $self["@forceAtEnd"]=false;
  46020. return self;
  46021. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  46022. },
  46023. args: [],
  46024. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  46025. referencedClasses: [],
  46026. messageSends: ["initialize"]
  46027. }),
  46028. $globals.ASTInterpreter);
  46029. $core.addMethod(
  46030. $core.method({
  46031. selector: "interpret",
  46032. protocol: "interpreting",
  46033. fn: function (){
  46034. var self=this,$self=this;
  46035. return $core.withContext(function($ctx1) {
  46036. $self._visit_($self._node());
  46037. return self;
  46038. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  46039. },
  46040. args: [],
  46041. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  46042. referencedClasses: [],
  46043. messageSends: ["visit:", "node"]
  46044. }),
  46045. $globals.ASTInterpreter);
  46046. $core.addMethod(
  46047. $core.method({
  46048. selector: "messageFromSendNode:arguments:",
  46049. protocol: "private",
  46050. fn: function (aSendNode,aCollection){
  46051. var self=this,$self=this;
  46052. return $core.withContext(function($ctx1) {
  46053. var $1;
  46054. $1=$recv($globals.Message)._new();
  46055. $recv($1)._selector_($recv(aSendNode)._selector());
  46056. $recv($1)._arguments_(aCollection);
  46057. return $recv($1)._yourself();
  46058. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  46059. },
  46060. args: ["aSendNode", "aCollection"],
  46061. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  46062. referencedClasses: ["Message"],
  46063. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  46064. }),
  46065. $globals.ASTInterpreter);
  46066. $core.addMethod(
  46067. $core.method({
  46068. selector: "messageNotUnderstood:receiver:",
  46069. protocol: "private",
  46070. fn: function (aMessage,anObject){
  46071. var self=this,$self=this;
  46072. return $core.withContext(function($ctx1) {
  46073. var $1;
  46074. $1=$recv($globals.MessageNotUnderstood)._new();
  46075. $recv($1)._message_(aMessage);
  46076. $recv($1)._receiver_(anObject);
  46077. $recv($1)._signal();
  46078. return self;
  46079. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  46080. },
  46081. args: ["aMessage", "anObject"],
  46082. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  46083. referencedClasses: ["MessageNotUnderstood"],
  46084. messageSends: ["message:", "new", "receiver:", "signal"]
  46085. }),
  46086. $globals.ASTInterpreter);
  46087. $core.addMethod(
  46088. $core.method({
  46089. selector: "next",
  46090. protocol: "interpreting",
  46091. fn: function (){
  46092. var self=this,$self=this;
  46093. var nd,nextNode;
  46094. return $core.withContext(function($ctx1) {
  46095. var $1,$2,$receiver;
  46096. nd=$self._node();
  46097. $1=$recv(nd)._parent();
  46098. if(($receiver = $1) == null || $receiver.a$nil){
  46099. nextNode=$1;
  46100. } else {
  46101. var parent;
  46102. parent=$receiver;
  46103. $2=$recv(parent)._nextSiblingNode_(nd);
  46104. if(($receiver = $2) == null || $receiver.a$nil){
  46105. nextNode=parent;
  46106. } else {
  46107. var sibling;
  46108. sibling=$receiver;
  46109. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  46110. }
  46111. }
  46112. $self._node_(nextNode);
  46113. return self;
  46114. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  46115. },
  46116. args: [],
  46117. 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",
  46118. referencedClasses: ["ASTEnterNode"],
  46119. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  46120. }),
  46121. $globals.ASTInterpreter);
  46122. $core.addMethod(
  46123. $core.method({
  46124. selector: "node",
  46125. protocol: "accessing",
  46126. fn: function (){
  46127. var self=this,$self=this;
  46128. return $self["@node"];
  46129. },
  46130. args: [],
  46131. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  46132. referencedClasses: [],
  46133. messageSends: []
  46134. }),
  46135. $globals.ASTInterpreter);
  46136. $core.addMethod(
  46137. $core.method({
  46138. selector: "node:",
  46139. protocol: "accessing",
  46140. fn: function (aNode){
  46141. var self=this,$self=this;
  46142. $self["@node"]=aNode;
  46143. return self;
  46144. },
  46145. args: ["aNode"],
  46146. source: "node: aNode\x0a\x09node := aNode",
  46147. referencedClasses: [],
  46148. messageSends: []
  46149. }),
  46150. $globals.ASTInterpreter);
  46151. $core.addMethod(
  46152. $core.method({
  46153. selector: "peek",
  46154. protocol: "stack",
  46155. fn: function (){
  46156. var self=this,$self=this;
  46157. return $core.withContext(function($ctx1) {
  46158. var $1;
  46159. var $early={};
  46160. try {
  46161. $1=$self._stack();
  46162. $ctx1.sendIdx["stack"]=1;
  46163. $recv($1)._ifEmpty_((function(){
  46164. throw $early=[nil];
  46165. }));
  46166. return $recv($self._stack())._last();
  46167. }
  46168. catch(e) {if(e===$early)return e[0]; throw e}
  46169. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  46170. },
  46171. args: [],
  46172. 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",
  46173. referencedClasses: [],
  46174. messageSends: ["ifEmpty:", "stack", "last"]
  46175. }),
  46176. $globals.ASTInterpreter);
  46177. $core.addMethod(
  46178. $core.method({
  46179. selector: "pop",
  46180. protocol: "stack",
  46181. fn: function (){
  46182. var self=this,$self=this;
  46183. var peekedValue;
  46184. return $core.withContext(function($ctx1) {
  46185. peekedValue=$self._peek();
  46186. $recv($self._stack())._removeLast();
  46187. return peekedValue;
  46188. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  46189. },
  46190. args: [],
  46191. 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",
  46192. referencedClasses: [],
  46193. messageSends: ["peek", "removeLast", "stack"]
  46194. }),
  46195. $globals.ASTInterpreter);
  46196. $core.addMethod(
  46197. $core.method({
  46198. selector: "proceed",
  46199. protocol: "interpreting",
  46200. fn: function (){
  46201. var self=this,$self=this;
  46202. return $core.withContext(function($ctx1) {
  46203. $recv((function(){
  46204. return $core.withContext(function($ctx2) {
  46205. return $self._atEnd();
  46206. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46207. }))._whileFalse_((function(){
  46208. return $core.withContext(function($ctx2) {
  46209. return $self._step();
  46210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46211. }));
  46212. return self;
  46213. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  46214. },
  46215. args: [],
  46216. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  46217. referencedClasses: [],
  46218. messageSends: ["whileFalse:", "atEnd", "step"]
  46219. }),
  46220. $globals.ASTInterpreter);
  46221. $core.addMethod(
  46222. $core.method({
  46223. selector: "push:",
  46224. protocol: "stack",
  46225. fn: function (anObject){
  46226. var self=this,$self=this;
  46227. return $core.withContext(function($ctx1) {
  46228. return $recv($self._stack())._add_(anObject);
  46229. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  46230. },
  46231. args: ["anObject"],
  46232. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  46233. referencedClasses: [],
  46234. messageSends: ["add:", "stack"]
  46235. }),
  46236. $globals.ASTInterpreter);
  46237. $core.addMethod(
  46238. $core.method({
  46239. selector: "restart",
  46240. protocol: "interpreting",
  46241. fn: function (){
  46242. var self=this,$self=this;
  46243. return $core.withContext(function($ctx1) {
  46244. $self._node_($recv($self._context())._ast());
  46245. $self._enterNode();
  46246. return self;
  46247. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  46248. },
  46249. args: [],
  46250. source: "restart\x0a\x09self node: self context ast; enterNode",
  46251. referencedClasses: [],
  46252. messageSends: ["node:", "ast", "context", "enterNode"]
  46253. }),
  46254. $globals.ASTInterpreter);
  46255. $core.addMethod(
  46256. $core.method({
  46257. selector: "result",
  46258. protocol: "accessing",
  46259. fn: function (){
  46260. var self=this,$self=this;
  46261. return $core.withContext(function($ctx1) {
  46262. var $1;
  46263. $1=$self._hasReturned();
  46264. if($core.assert($1)){
  46265. return $self._returnValue();
  46266. } else {
  46267. return $recv($self._context())._receiver();
  46268. }
  46269. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  46270. },
  46271. args: [],
  46272. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  46273. referencedClasses: [],
  46274. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  46275. }),
  46276. $globals.ASTInterpreter);
  46277. $core.addMethod(
  46278. $core.method({
  46279. selector: "returnValue",
  46280. protocol: "accessing",
  46281. fn: function (){
  46282. var self=this,$self=this;
  46283. return $self["@returnValue"];
  46284. },
  46285. args: [],
  46286. source: "returnValue\x0a\x09^ returnValue",
  46287. referencedClasses: [],
  46288. messageSends: []
  46289. }),
  46290. $globals.ASTInterpreter);
  46291. $core.addMethod(
  46292. $core.method({
  46293. selector: "returnValue:",
  46294. protocol: "accessing",
  46295. fn: function (anObject){
  46296. var self=this,$self=this;
  46297. $self["@returnValue"]=anObject;
  46298. return self;
  46299. },
  46300. args: ["anObject"],
  46301. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  46302. referencedClasses: [],
  46303. messageSends: []
  46304. }),
  46305. $globals.ASTInterpreter);
  46306. $core.addMethod(
  46307. $core.method({
  46308. selector: "sendMessage:to:superSend:",
  46309. protocol: "private",
  46310. fn: function (aMessage,anObject,aBoolean){
  46311. var self=this,$self=this;
  46312. var method;
  46313. return $core.withContext(function($ctx1) {
  46314. var $2,$1,$3,$receiver;
  46315. var $early={};
  46316. try {
  46317. if(!$core.assert(aBoolean)){
  46318. return $recv(aMessage)._sendTo_(anObject);
  46319. }
  46320. $2=$recv(anObject)._class();
  46321. $ctx1.sendIdx["class"]=1;
  46322. $1=$recv($2)._superclass();
  46323. $ctx1.sendIdx["superclass"]=1;
  46324. if(($receiver = $1) == null || $receiver.a$nil){
  46325. $3=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  46326. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  46327. return $3;
  46328. } else {
  46329. $1;
  46330. }
  46331. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  46332. return $core.withContext(function($ctx2) {
  46333. throw $early=[$self._messageNotUnderstood_receiver_(aMessage,anObject)];
  46334. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46335. }));
  46336. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  46337. }
  46338. catch(e) {if(e===$early)return e[0]; throw e}
  46339. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  46340. },
  46341. args: ["aMessage", "anObject", "aBoolean"],
  46342. 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",
  46343. referencedClasses: [],
  46344. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  46345. }),
  46346. $globals.ASTInterpreter);
  46347. $core.addMethod(
  46348. $core.method({
  46349. selector: "setNonLocalReturnFromContext:",
  46350. protocol: "interpreting",
  46351. fn: function (aContext){
  46352. var self=this,$self=this;
  46353. return $core.withContext(function($ctx1) {
  46354. var $2,$1;
  46355. $2=$recv(aContext)._interpreter();
  46356. $ctx1.sendIdx["interpreter"]=1;
  46357. $1=$recv($2)._hasReturned();
  46358. if($core.assert($1)){
  46359. $self["@returned"]=true;
  46360. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  46361. }
  46362. return self;
  46363. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  46364. },
  46365. args: ["aContext"],
  46366. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  46367. referencedClasses: [],
  46368. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  46369. }),
  46370. $globals.ASTInterpreter);
  46371. $core.addMethod(
  46372. $core.method({
  46373. selector: "skip",
  46374. protocol: "interpreting",
  46375. fn: function (){
  46376. var self=this,$self=this;
  46377. return $core.withContext(function($ctx1) {
  46378. $self._next();
  46379. return self;
  46380. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  46381. },
  46382. args: [],
  46383. source: "skip\x0a\x09self next",
  46384. referencedClasses: [],
  46385. messageSends: ["next"]
  46386. }),
  46387. $globals.ASTInterpreter);
  46388. $core.addMethod(
  46389. $core.method({
  46390. selector: "stack",
  46391. protocol: "accessing",
  46392. fn: function (){
  46393. var self=this,$self=this;
  46394. return $core.withContext(function($ctx1) {
  46395. var $1,$receiver;
  46396. $1=$self["@stack"];
  46397. if(($receiver = $1) == null || $receiver.a$nil){
  46398. $self["@stack"]=$recv($globals.OrderedCollection)._new();
  46399. return $self["@stack"];
  46400. } else {
  46401. return $1;
  46402. }
  46403. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  46404. },
  46405. args: [],
  46406. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  46407. referencedClasses: ["OrderedCollection"],
  46408. messageSends: ["ifNil:", "new"]
  46409. }),
  46410. $globals.ASTInterpreter);
  46411. $core.addMethod(
  46412. $core.method({
  46413. selector: "step",
  46414. protocol: "interpreting",
  46415. fn: function (){
  46416. var self=this,$self=this;
  46417. return $core.withContext(function($ctx1) {
  46418. $self._interpret();
  46419. $self._next();
  46420. return self;
  46421. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  46422. },
  46423. args: [],
  46424. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  46425. referencedClasses: [],
  46426. messageSends: ["interpret", "next"]
  46427. }),
  46428. $globals.ASTInterpreter);
  46429. $core.addMethod(
  46430. $core.method({
  46431. selector: "stepOver",
  46432. protocol: "interpreting",
  46433. fn: function (){
  46434. var self=this,$self=this;
  46435. return $core.withContext(function($ctx1) {
  46436. var $2,$1;
  46437. $self._step();
  46438. $ctx1.sendIdx["step"]=1;
  46439. $recv((function(){
  46440. return $core.withContext(function($ctx2) {
  46441. $2=$self._node();
  46442. $ctx2.sendIdx["node"]=1;
  46443. $1=$recv($2)._isNil();
  46444. return $recv($1)._or_((function(){
  46445. return $core.withContext(function($ctx3) {
  46446. return $recv($self._node())._isSteppingNode();
  46447. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46448. }));
  46449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46450. }))._whileFalse_((function(){
  46451. return $core.withContext(function($ctx2) {
  46452. return $self._step();
  46453. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46454. }));
  46455. return self;
  46456. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  46457. },
  46458. args: [],
  46459. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  46460. referencedClasses: [],
  46461. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  46462. }),
  46463. $globals.ASTInterpreter);
  46464. $core.addMethod(
  46465. $core.method({
  46466. selector: "visit:",
  46467. protocol: "visiting",
  46468. fn: function (aNode){
  46469. var self=this,$self=this;
  46470. return $core.withContext(function($ctx1) {
  46471. var $1;
  46472. $1=$self._hasReturned();
  46473. if(!$core.assert($1)){
  46474. (
  46475. $ctx1.supercall = true,
  46476. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  46477. $ctx1.supercall = false;
  46478. }
  46479. return self;
  46480. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  46481. },
  46482. args: ["aNode"],
  46483. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  46484. referencedClasses: [],
  46485. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  46486. }),
  46487. $globals.ASTInterpreter);
  46488. $core.addMethod(
  46489. $core.method({
  46490. selector: "visitAssignmentNode:",
  46491. protocol: "visiting",
  46492. fn: function (aNode){
  46493. var self=this,$self=this;
  46494. var poppedValue;
  46495. return $core.withContext(function($ctx1) {
  46496. poppedValue=$self._pop();
  46497. $ctx1.sendIdx["pop"]=1;
  46498. $self._pop();
  46499. $self._push_(poppedValue);
  46500. $self._assign_to_($recv(aNode)._left(),poppedValue);
  46501. return self;
  46502. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  46503. },
  46504. args: ["aNode"],
  46505. 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",
  46506. referencedClasses: [],
  46507. messageSends: ["pop", "push:", "assign:to:", "left"]
  46508. }),
  46509. $globals.ASTInterpreter);
  46510. $core.addMethod(
  46511. $core.method({
  46512. selector: "visitBlockNode:",
  46513. protocol: "visiting",
  46514. fn: function (aNode){
  46515. var self=this,$self=this;
  46516. var block;
  46517. return $core.withContext(function($ctx1) {
  46518. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  46519. $self._push_(block);
  46520. return self;
  46521. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  46522. },
  46523. args: ["aNode"],
  46524. 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",
  46525. referencedClasses: ["AIBlockClosure"],
  46526. messageSends: ["forContext:node:", "context", "push:"]
  46527. }),
  46528. $globals.ASTInterpreter);
  46529. $core.addMethod(
  46530. $core.method({
  46531. selector: "visitBlockSequenceNode:",
  46532. protocol: "visiting",
  46533. fn: function (aNode){
  46534. var self=this,$self=this;
  46535. return $core.withContext(function($ctx1) {
  46536. (
  46537. $ctx1.supercall = true,
  46538. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  46539. $ctx1.supercall = false;
  46540. $self["@forceAtEnd"]=true;
  46541. return self;
  46542. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46543. },
  46544. args: ["aNode"],
  46545. 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",
  46546. referencedClasses: [],
  46547. messageSends: ["visitBlockSequenceNode:"]
  46548. }),
  46549. $globals.ASTInterpreter);
  46550. $core.addMethod(
  46551. $core.method({
  46552. selector: "visitDagNode:",
  46553. protocol: "visiting",
  46554. fn: function (aNode){
  46555. var self=this,$self=this;
  46556. return self;
  46557. },
  46558. args: ["aNode"],
  46559. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  46560. referencedClasses: [],
  46561. messageSends: []
  46562. }),
  46563. $globals.ASTInterpreter);
  46564. $core.addMethod(
  46565. $core.method({
  46566. selector: "visitDynamicArrayNode:",
  46567. protocol: "visiting",
  46568. fn: function (aNode){
  46569. var self=this,$self=this;
  46570. var array;
  46571. return $core.withContext(function($ctx1) {
  46572. array=[];
  46573. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46574. return $core.withContext(function($ctx2) {
  46575. return $recv(array)._addFirst_($self._pop());
  46576. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46577. }));
  46578. $self._push_(array);
  46579. return self;
  46580. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  46581. },
  46582. args: ["aNode"],
  46583. 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",
  46584. referencedClasses: [],
  46585. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  46586. }),
  46587. $globals.ASTInterpreter);
  46588. $core.addMethod(
  46589. $core.method({
  46590. selector: "visitDynamicDictionaryNode:",
  46591. protocol: "visiting",
  46592. fn: function (aNode){
  46593. var self=this,$self=this;
  46594. var keyValueList;
  46595. return $core.withContext(function($ctx1) {
  46596. keyValueList=$recv($globals.OrderedCollection)._new();
  46597. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46598. return $core.withContext(function($ctx2) {
  46599. return $recv(keyValueList)._add_($self._pop());
  46600. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46601. }));
  46602. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  46603. return self;
  46604. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  46605. },
  46606. args: ["aNode"],
  46607. 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)",
  46608. referencedClasses: ["OrderedCollection", "HashedCollection"],
  46609. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  46610. }),
  46611. $globals.ASTInterpreter);
  46612. $core.addMethod(
  46613. $core.method({
  46614. selector: "visitJSStatementNode:",
  46615. protocol: "visiting",
  46616. fn: function (aNode){
  46617. var self=this,$self=this;
  46618. return $core.withContext(function($ctx1) {
  46619. $self["@returned"]=true;
  46620. $self._returnValue_($self._eval_($recv(aNode)._source()));
  46621. return self;
  46622. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46623. },
  46624. args: ["aNode"],
  46625. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  46626. referencedClasses: [],
  46627. messageSends: ["returnValue:", "eval:", "source"]
  46628. }),
  46629. $globals.ASTInterpreter);
  46630. $core.addMethod(
  46631. $core.method({
  46632. selector: "visitReturnNode:",
  46633. protocol: "visiting",
  46634. fn: function (aNode){
  46635. var self=this,$self=this;
  46636. return $core.withContext(function($ctx1) {
  46637. $self["@returned"]=true;
  46638. $self._returnValue_($self._pop());
  46639. return self;
  46640. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46641. },
  46642. args: ["aNode"],
  46643. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  46644. referencedClasses: [],
  46645. messageSends: ["returnValue:", "pop"]
  46646. }),
  46647. $globals.ASTInterpreter);
  46648. $core.addMethod(
  46649. $core.method({
  46650. selector: "visitSendNode:",
  46651. protocol: "visiting",
  46652. fn: function (aNode){
  46653. var self=this,$self=this;
  46654. var receiver,args,message,result;
  46655. return $core.withContext(function($ctx1) {
  46656. var $1;
  46657. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  46658. return $core.withContext(function($ctx2) {
  46659. return $self._pop();
  46660. $ctx2.sendIdx["pop"]=1;
  46661. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46662. }));
  46663. receiver=$self._peek();
  46664. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  46665. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  46666. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  46667. return $core.withContext(function($ctx2) {
  46668. return $recv($recv(aNode)._isLastChild())._not();
  46669. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46670. }));
  46671. if(!$core.assert($1)){
  46672. $self._pop();
  46673. $self._push_(result);
  46674. }
  46675. return self;
  46676. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  46677. },
  46678. args: ["aNode"],
  46679. 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 ]",
  46680. referencedClasses: [],
  46681. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  46682. }),
  46683. $globals.ASTInterpreter);
  46684. $core.addMethod(
  46685. $core.method({
  46686. selector: "visitValueNode:",
  46687. protocol: "visiting",
  46688. fn: function (aNode){
  46689. var self=this,$self=this;
  46690. return $core.withContext(function($ctx1) {
  46691. $self._push_($recv(aNode)._value());
  46692. return self;
  46693. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46694. },
  46695. args: ["aNode"],
  46696. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  46697. referencedClasses: [],
  46698. messageSends: ["push:", "value"]
  46699. }),
  46700. $globals.ASTInterpreter);
  46701. $core.addMethod(
  46702. $core.method({
  46703. selector: "visitVariableNode:",
  46704. protocol: "visiting",
  46705. fn: function (aNode){
  46706. var self=this,$self=this;
  46707. return $core.withContext(function($ctx1) {
  46708. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  46709. $2=$recv(aNode)._binding();
  46710. $ctx1.sendIdx["binding"]=1;
  46711. $1=$recv($2)._isUnknownVar();
  46712. if($core.assert($1)){
  46713. $5=$recv($globals.Platform)._globals();
  46714. $ctx1.sendIdx["globals"]=1;
  46715. $6=$recv(aNode)._value();
  46716. $ctx1.sendIdx["value"]=1;
  46717. $4=$recv($5)._at_ifAbsent_($6,(function(){
  46718. return $core.withContext(function($ctx2) {
  46719. return $self._error_("Unknown variable");
  46720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46721. }));
  46722. $ctx1.sendIdx["at:ifAbsent:"]=1;
  46723. $3=$self._push_($4);
  46724. $ctx1.sendIdx["push:"]=1;
  46725. return $3;
  46726. }
  46727. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  46728. if($core.assert($8)){
  46729. $10=$self._context();
  46730. $ctx1.sendIdx["context"]=1;
  46731. $9=$recv($10)._receiver();
  46732. $11=$recv(aNode)._value();
  46733. $ctx1.sendIdx["value"]=2;
  46734. $7=$recv($9)._instVarAt_($11);
  46735. } else {
  46736. $12=$self._context();
  46737. $13=$recv(aNode)._value();
  46738. $ctx1.sendIdx["value"]=3;
  46739. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  46740. return $core.withContext(function($ctx2) {
  46741. $15=$recv(aNode)._value();
  46742. $ctx2.sendIdx["value"]=4;
  46743. $14=$recv($15)._isCapitalized();
  46744. if($core.assert($14)){
  46745. $16=$recv($globals.Smalltalk)._globals();
  46746. $ctx2.sendIdx["globals"]=2;
  46747. $17=$recv(aNode)._value();
  46748. $ctx2.sendIdx["value"]=5;
  46749. return $recv($16)._at_ifAbsent_($17,(function(){
  46750. return $core.withContext(function($ctx3) {
  46751. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  46752. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  46753. }));
  46754. }
  46755. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  46756. }));
  46757. }
  46758. $self._push_($7);
  46759. return self;
  46760. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46761. },
  46762. args: ["aNode"],
  46763. 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 ] ] ] ])",
  46764. referencedClasses: ["Platform", "Smalltalk"],
  46765. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  46766. }),
  46767. $globals.ASTInterpreter);
  46768. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  46769. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  46770. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  46771. $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`";
  46772. $core.addMethod(
  46773. $core.method({
  46774. selector: "currentNode",
  46775. protocol: "accessing",
  46776. fn: function (){
  46777. var self=this,$self=this;
  46778. return $self["@currentNode"];
  46779. },
  46780. args: [],
  46781. source: "currentNode\x0a\x09^ currentNode",
  46782. referencedClasses: [],
  46783. messageSends: []
  46784. }),
  46785. $globals.ASTPCNodeVisitor);
  46786. $core.addMethod(
  46787. $core.method({
  46788. selector: "increaseTrackedIndex",
  46789. protocol: "accessing",
  46790. fn: function (){
  46791. var self=this,$self=this;
  46792. return $core.withContext(function($ctx1) {
  46793. $self["@trackedIndex"]=$recv($self._trackedIndex()).__plus((1));
  46794. return self;
  46795. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  46796. },
  46797. args: [],
  46798. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  46799. referencedClasses: [],
  46800. messageSends: ["+", "trackedIndex"]
  46801. }),
  46802. $globals.ASTPCNodeVisitor);
  46803. $core.addMethod(
  46804. $core.method({
  46805. selector: "index",
  46806. protocol: "accessing",
  46807. fn: function (){
  46808. var self=this,$self=this;
  46809. return $self["@index"];
  46810. },
  46811. args: [],
  46812. source: "index\x0a\x09^ index",
  46813. referencedClasses: [],
  46814. messageSends: []
  46815. }),
  46816. $globals.ASTPCNodeVisitor);
  46817. $core.addMethod(
  46818. $core.method({
  46819. selector: "index:",
  46820. protocol: "accessing",
  46821. fn: function (aNumber){
  46822. var self=this,$self=this;
  46823. $self["@index"]=aNumber;
  46824. return self;
  46825. },
  46826. args: ["aNumber"],
  46827. source: "index: aNumber\x0a\x09index := aNumber",
  46828. referencedClasses: [],
  46829. messageSends: []
  46830. }),
  46831. $globals.ASTPCNodeVisitor);
  46832. $core.addMethod(
  46833. $core.method({
  46834. selector: "selector",
  46835. protocol: "accessing",
  46836. fn: function (){
  46837. var self=this,$self=this;
  46838. return $self["@selector"];
  46839. },
  46840. args: [],
  46841. source: "selector\x0a\x09^ selector",
  46842. referencedClasses: [],
  46843. messageSends: []
  46844. }),
  46845. $globals.ASTPCNodeVisitor);
  46846. $core.addMethod(
  46847. $core.method({
  46848. selector: "selector:",
  46849. protocol: "accessing",
  46850. fn: function (aString){
  46851. var self=this,$self=this;
  46852. $self["@selector"]=aString;
  46853. return self;
  46854. },
  46855. args: ["aString"],
  46856. source: "selector: aString\x0a\x09selector := aString",
  46857. referencedClasses: [],
  46858. messageSends: []
  46859. }),
  46860. $globals.ASTPCNodeVisitor);
  46861. $core.addMethod(
  46862. $core.method({
  46863. selector: "trackedIndex",
  46864. protocol: "accessing",
  46865. fn: function (){
  46866. var self=this,$self=this;
  46867. return $core.withContext(function($ctx1) {
  46868. var $1,$receiver;
  46869. $1=$self["@trackedIndex"];
  46870. if(($receiver = $1) == null || $receiver.a$nil){
  46871. $self["@trackedIndex"]=(0);
  46872. return $self["@trackedIndex"];
  46873. } else {
  46874. return $1;
  46875. }
  46876. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  46877. },
  46878. args: [],
  46879. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  46880. referencedClasses: [],
  46881. messageSends: ["ifNil:"]
  46882. }),
  46883. $globals.ASTPCNodeVisitor);
  46884. $core.addMethod(
  46885. $core.method({
  46886. selector: "visitJSStatementNode:",
  46887. protocol: "visiting",
  46888. fn: function (aNode){
  46889. var self=this,$self=this;
  46890. $self["@currentNode"]=aNode;
  46891. return self;
  46892. },
  46893. args: ["aNode"],
  46894. 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",
  46895. referencedClasses: [],
  46896. messageSends: []
  46897. }),
  46898. $globals.ASTPCNodeVisitor);
  46899. $core.addMethod(
  46900. $core.method({
  46901. selector: "visitSendNode:",
  46902. protocol: "visiting",
  46903. fn: function (aNode){
  46904. var self=this,$self=this;
  46905. return $core.withContext(function($ctx1) {
  46906. var $2,$1,$3;
  46907. (
  46908. $ctx1.supercall = true,
  46909. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  46910. $ctx1.supercall = false;
  46911. $2=$self._selector();
  46912. $ctx1.sendIdx["selector"]=1;
  46913. $1=$recv($2).__eq($recv(aNode)._selector());
  46914. $ctx1.sendIdx["="]=1;
  46915. if($core.assert($1)){
  46916. $3=$recv($self._trackedIndex()).__eq($self._index());
  46917. if($core.assert($3)){
  46918. $self["@currentNode"]=aNode;
  46919. $self["@currentNode"];
  46920. }
  46921. $self._increaseTrackedIndex();
  46922. }
  46923. return self;
  46924. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  46925. },
  46926. args: ["aNode"],
  46927. 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 ]",
  46928. referencedClasses: [],
  46929. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  46930. }),
  46931. $globals.ASTPCNodeVisitor);
  46932. $core.addMethod(
  46933. $core.method({
  46934. selector: "isLastChild",
  46935. protocol: "*Compiler-Interpreter",
  46936. fn: function (){
  46937. var self=this,$self=this;
  46938. return $core.withContext(function($ctx1) {
  46939. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  46940. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  46941. },
  46942. args: [],
  46943. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  46944. referencedClasses: [],
  46945. messageSends: ["=", "last", "dagChildren", "parent"]
  46946. }),
  46947. $globals.ASTNode);
  46948. $core.addMethod(
  46949. $core.method({
  46950. selector: "isSteppingNode",
  46951. protocol: "*Compiler-Interpreter",
  46952. fn: function (){
  46953. var self=this,$self=this;
  46954. return false;
  46955. },
  46956. args: [],
  46957. source: "isSteppingNode\x0a\x09^ false",
  46958. referencedClasses: [],
  46959. messageSends: []
  46960. }),
  46961. $globals.ASTNode);
  46962. $core.addMethod(
  46963. $core.method({
  46964. selector: "nextSiblingNode:",
  46965. protocol: "*Compiler-Interpreter",
  46966. fn: function (aNode){
  46967. var self=this,$self=this;
  46968. return $core.withContext(function($ctx1) {
  46969. var $1;
  46970. var $early={};
  46971. try {
  46972. $1=$self._dagChildren();
  46973. $ctx1.sendIdx["dagChildren"]=1;
  46974. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  46975. throw $early=[nil];
  46976. }));
  46977. }
  46978. catch(e) {if(e===$early)return e[0]; throw e}
  46979. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  46980. },
  46981. args: ["aNode"],
  46982. 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 ]",
  46983. referencedClasses: [],
  46984. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  46985. }),
  46986. $globals.ASTNode);
  46987. $core.addMethod(
  46988. $core.method({
  46989. selector: "isSteppingNode",
  46990. protocol: "*Compiler-Interpreter",
  46991. fn: function (){
  46992. var self=this,$self=this;
  46993. return true;
  46994. },
  46995. args: [],
  46996. source: "isSteppingNode\x0a\x09^ true",
  46997. referencedClasses: [],
  46998. messageSends: []
  46999. }),
  47000. $globals.AssignmentNode);
  47001. $core.addMethod(
  47002. $core.method({
  47003. selector: "isSteppingNode",
  47004. protocol: "*Compiler-Interpreter",
  47005. fn: function (){
  47006. var self=this,$self=this;
  47007. return true;
  47008. },
  47009. args: [],
  47010. source: "isSteppingNode\x0a\x09^ true",
  47011. referencedClasses: [],
  47012. messageSends: []
  47013. }),
  47014. $globals.BlockNode);
  47015. $core.addMethod(
  47016. $core.method({
  47017. selector: "nextSiblingNode:",
  47018. protocol: "*Compiler-Interpreter",
  47019. fn: function (aNode){
  47020. var self=this,$self=this;
  47021. return nil;
  47022. },
  47023. args: ["aNode"],
  47024. 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",
  47025. referencedClasses: [],
  47026. messageSends: []
  47027. }),
  47028. $globals.BlockNode);
  47029. $core.addMethod(
  47030. $core.method({
  47031. selector: "isSteppingNode",
  47032. protocol: "*Compiler-Interpreter",
  47033. fn: function (){
  47034. var self=this,$self=this;
  47035. return true;
  47036. },
  47037. args: [],
  47038. source: "isSteppingNode\x0a\x09^ true",
  47039. referencedClasses: [],
  47040. messageSends: []
  47041. }),
  47042. $globals.DynamicArrayNode);
  47043. $core.addMethod(
  47044. $core.method({
  47045. selector: "isSteppingNode",
  47046. protocol: "*Compiler-Interpreter",
  47047. fn: function (){
  47048. var self=this,$self=this;
  47049. return true;
  47050. },
  47051. args: [],
  47052. source: "isSteppingNode\x0a\x09^ true",
  47053. referencedClasses: [],
  47054. messageSends: []
  47055. }),
  47056. $globals.DynamicDictionaryNode);
  47057. $core.addMethod(
  47058. $core.method({
  47059. selector: "isSteppingNode",
  47060. protocol: "*Compiler-Interpreter",
  47061. fn: function (){
  47062. var self=this,$self=this;
  47063. return true;
  47064. },
  47065. args: [],
  47066. source: "isSteppingNode\x0a\x09^ true",
  47067. referencedClasses: [],
  47068. messageSends: []
  47069. }),
  47070. $globals.JSStatementNode);
  47071. $core.addMethod(
  47072. $core.method({
  47073. selector: "isCascadeSendNode",
  47074. protocol: "*Compiler-Interpreter",
  47075. fn: function (){
  47076. var self=this,$self=this;
  47077. return $core.withContext(function($ctx1) {
  47078. return $recv($self._parent())._isCascadeNode();
  47079. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  47080. },
  47081. args: [],
  47082. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  47083. referencedClasses: [],
  47084. messageSends: ["isCascadeNode", "parent"]
  47085. }),
  47086. $globals.SendNode);
  47087. $core.addMethod(
  47088. $core.method({
  47089. selector: "isSteppingNode",
  47090. protocol: "*Compiler-Interpreter",
  47091. fn: function (){
  47092. var self=this,$self=this;
  47093. return true;
  47094. },
  47095. args: [],
  47096. source: "isSteppingNode\x0a\x09^ true",
  47097. referencedClasses: [],
  47098. messageSends: []
  47099. }),
  47100. $globals.SendNode);
  47101. });
  47102. define('amber/lang',[
  47103. './deploy',
  47104. './boot', // pre-fetch, dep of ./helpers
  47105. './helpers', // pre-fetch, dep of ./deploy
  47106. './parser',
  47107. // --- packages for the Amber reflection begin here ---
  47108. 'amber_core/Platform-ImportExport',
  47109. 'amber_core/Compiler-Core',
  47110. 'amber_core/Compiler-AST',
  47111. 'amber_core/Compiler-Semantic',
  47112. 'amber_core/Compiler-IR',
  47113. 'amber_core/Compiler-Inlining',
  47114. 'amber_core/Compiler-Interpreter'
  47115. // --- packages for the Amber reflection end here ---
  47116. ], function (amber) {
  47117. return amber;
  47118. });
  47119. define('amber_core/Platform-DOM',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  47120. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  47121. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47122. $core.addPackage("Platform-DOM");
  47123. ($core.packageDescriptors||$core.packages)["Platform-DOM"].innerEval = function (expr) { return eval(expr); };
  47124. ($core.packageDescriptors||$core.packages)["Platform-DOM"].transport = {"type":"amd","amdNamespace":"amber_core"};
  47125. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  47126. $core.addMethod(
  47127. $core.method({
  47128. selector: "isDomNode:",
  47129. protocol: "testing",
  47130. fn: function (anObject){
  47131. var self=this,$self=this;
  47132. return $core.withContext(function($ctx1) {
  47133. return anObject.nodeType > 0 &&
  47134. Object.prototype.toString.call(anObject) !== "[object Object]";
  47135. return self;
  47136. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.a$cls)});
  47137. },
  47138. args: ["anObject"],
  47139. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  47140. referencedClasses: [],
  47141. messageSends: []
  47142. }),
  47143. $globals.PlatformDom.a$cls);
  47144. $core.addMethod(
  47145. $core.method({
  47146. selector: "isFeasible",
  47147. protocol: "testing",
  47148. fn: function (){
  47149. var self=this,$self=this;
  47150. return $core.withContext(function($ctx1) {
  47151. if (typeof document === "undefined") return false;
  47152. try {
  47153. var d = document.createElement("div"),
  47154. f = document.createDocumentFragment(),
  47155. t = document.createTextNode("Hello, Amber!");
  47156. f.appendChild(t);
  47157. d.insertBefore(f, null);
  47158. return d.innerHTML === "Hello, Amber!";
  47159. } catch (e) {
  47160. return false;
  47161. };
  47162. return self;
  47163. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.a$cls)});
  47164. },
  47165. args: [],
  47166. 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'>",
  47167. referencedClasses: [],
  47168. messageSends: []
  47169. }),
  47170. $globals.PlatformDom.a$cls);
  47171. $core.addMethod(
  47172. $core.method({
  47173. selector: "newCustomEvent:detail:",
  47174. protocol: "creation",
  47175. fn: function (aString,anObject){
  47176. var self=this,$self=this;
  47177. return $core.withContext(function($ctx1) {
  47178. return new CustomEvent(aString, {detail: anObject});
  47179. return self;
  47180. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.a$cls)});
  47181. },
  47182. args: ["aString", "anObject"],
  47183. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  47184. referencedClasses: [],
  47185. messageSends: []
  47186. }),
  47187. $globals.PlatformDom.a$cls);
  47188. $core.addMethod(
  47189. $core.method({
  47190. selector: "toArray:",
  47191. protocol: "converting",
  47192. fn: function (aDomList){
  47193. var self=this,$self=this;
  47194. return $core.withContext(function($ctx1) {
  47195. return Array.prototype.slice.call(aDomList);
  47196. return self;
  47197. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.a$cls)});
  47198. },
  47199. args: ["aDomList"],
  47200. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  47201. referencedClasses: [],
  47202. messageSends: []
  47203. }),
  47204. $globals.PlatformDom.a$cls);
  47205. $core.addMethod(
  47206. $core.method({
  47207. selector: "asDomNode",
  47208. protocol: "*Platform-DOM",
  47209. fn: function (){
  47210. var self=this,$self=this;
  47211. var fragment;
  47212. return $core.withContext(function($ctx1) {
  47213. fragment=$recv(document)._createDocumentFragment();
  47214. $self._do_((function(each){
  47215. return $core.withContext(function($ctx2) {
  47216. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  47217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47218. }));
  47219. return fragment;
  47220. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  47221. },
  47222. args: [],
  47223. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  47224. referencedClasses: [],
  47225. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  47226. }),
  47227. $globals.Collection);
  47228. $core.addMethod(
  47229. $core.method({
  47230. selector: "asDomNode",
  47231. protocol: "*Platform-DOM",
  47232. fn: function (){
  47233. var self=this,$self=this;
  47234. return $core.withContext(function($ctx1) {
  47235. var $1,$2;
  47236. $1=$recv($globals.PlatformDom)._isDomNode_($self["@jsObject"]);
  47237. if($core.assert($1)){
  47238. return $self["@jsObject"];
  47239. } else {
  47240. $2=(
  47241. $ctx1.supercall = true,
  47242. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, []));
  47243. $ctx1.supercall = false;
  47244. return $2;
  47245. }
  47246. return self;
  47247. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  47248. },
  47249. args: [],
  47250. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  47251. referencedClasses: ["PlatformDom"],
  47252. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  47253. }),
  47254. $globals.JSObjectProxy);
  47255. $core.addMethod(
  47256. $core.method({
  47257. selector: "asDomNode",
  47258. protocol: "*Platform-DOM",
  47259. fn: function (){
  47260. var self=this,$self=this;
  47261. return $core.withContext(function($ctx1) {
  47262. return $recv(document)._createTextNode_($self._asString());
  47263. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.String)});
  47264. },
  47265. args: [],
  47266. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  47267. referencedClasses: [],
  47268. messageSends: ["createTextNode:", "asString"]
  47269. }),
  47270. $globals.String);
  47271. $core.addMethod(
  47272. $core.method({
  47273. selector: "htmlTextContent",
  47274. protocol: "*Platform-DOM",
  47275. fn: function (){
  47276. var self=this,$self=this;
  47277. return $core.withContext(function($ctx1) {
  47278. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  47279. return self;
  47280. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  47281. },
  47282. args: [],
  47283. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  47284. referencedClasses: [],
  47285. messageSends: []
  47286. }),
  47287. $globals.String);
  47288. });
  47289. 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";
  47290. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  47291. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47292. $core.addPackage("SUnit");
  47293. ($core.packageDescriptors||$core.packages)["SUnit"].innerEval = function (expr) { return eval(expr); };
  47294. ($core.packageDescriptors||$core.packages)["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  47295. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  47296. $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.";
  47297. $core.addMethod(
  47298. $core.method({
  47299. selector: "result",
  47300. protocol: "accessing",
  47301. fn: function (){
  47302. var self=this,$self=this;
  47303. return $self["@result"];
  47304. },
  47305. args: [],
  47306. source: "result\x0a\x09^ result",
  47307. referencedClasses: [],
  47308. messageSends: []
  47309. }),
  47310. $globals.ResultAnnouncement);
  47311. $core.addMethod(
  47312. $core.method({
  47313. selector: "result:",
  47314. protocol: "accessing",
  47315. fn: function (aTestResult){
  47316. var self=this,$self=this;
  47317. $self["@result"]=aTestResult;
  47318. return self;
  47319. },
  47320. args: ["aTestResult"],
  47321. source: "result: aTestResult\x0a\x09result := aTestResult",
  47322. referencedClasses: [],
  47323. messageSends: []
  47324. }),
  47325. $globals.ResultAnnouncement);
  47326. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  47327. $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.";
  47328. $core.addMethod(
  47329. $core.method({
  47330. selector: "assert:",
  47331. protocol: "testing",
  47332. fn: function (aBoolean){
  47333. var self=this,$self=this;
  47334. return $core.withContext(function($ctx1) {
  47335. $self._assert_description_(aBoolean,"Assertion failed");
  47336. return self;
  47337. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  47338. },
  47339. args: ["aBoolean"],
  47340. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  47341. referencedClasses: [],
  47342. messageSends: ["assert:description:"]
  47343. }),
  47344. $globals.TestCase);
  47345. $core.addMethod(
  47346. $core.method({
  47347. selector: "assert:description:",
  47348. protocol: "testing",
  47349. fn: function (aBoolean,aString){
  47350. var self=this,$self=this;
  47351. return $core.withContext(function($ctx1) {
  47352. if(!$core.assert(aBoolean)){
  47353. $self._signalFailure_(aString);
  47354. }
  47355. return self;
  47356. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  47357. },
  47358. args: ["aBoolean", "aString"],
  47359. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  47360. referencedClasses: [],
  47361. messageSends: ["ifFalse:", "signalFailure:"]
  47362. }),
  47363. $globals.TestCase);
  47364. $core.addMethod(
  47365. $core.method({
  47366. selector: "assert:equals:",
  47367. protocol: "testing",
  47368. fn: function (actual,expected){
  47369. var self=this,$self=this;
  47370. return $core.withContext(function($ctx1) {
  47371. var $1,$5,$4,$3,$2;
  47372. $1=$recv(actual).__eq(expected);
  47373. $5=$recv(expected)._printString();
  47374. $ctx1.sendIdx["printString"]=1;
  47375. $4="Expected: ".__comma($5);
  47376. $3=$recv($4).__comma(" but was: ");
  47377. $ctx1.sendIdx[","]=2;
  47378. $2=$recv($3).__comma($recv(actual)._printString());
  47379. $ctx1.sendIdx[","]=1;
  47380. return $self._assert_description_($1,$2);
  47381. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  47382. },
  47383. args: ["actual", "expected"],
  47384. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  47385. referencedClasses: [],
  47386. messageSends: ["assert:description:", "=", ",", "printString"]
  47387. }),
  47388. $globals.TestCase);
  47389. $core.addMethod(
  47390. $core.method({
  47391. selector: "async:",
  47392. protocol: "async",
  47393. fn: function (aBlock){
  47394. var self=this,$self=this;
  47395. var c;
  47396. return $core.withContext(function($ctx1) {
  47397. var $1;
  47398. $self._errorIfNotAsync_("#async");
  47399. c=$self["@context"];
  47400. return (function(){
  47401. return $core.withContext(function($ctx2) {
  47402. $1=$self._isAsync();
  47403. if($core.assert($1)){
  47404. return $recv(c)._execute_(aBlock);
  47405. }
  47406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47407. });
  47408. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  47409. },
  47410. args: ["aBlock"],
  47411. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  47412. referencedClasses: [],
  47413. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  47414. }),
  47415. $globals.TestCase);
  47416. $core.addMethod(
  47417. $core.method({
  47418. selector: "context:",
  47419. protocol: "accessing",
  47420. fn: function (aRunningTestContext){
  47421. var self=this,$self=this;
  47422. $self["@context"]=aRunningTestContext;
  47423. return self;
  47424. },
  47425. args: ["aRunningTestContext"],
  47426. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  47427. referencedClasses: [],
  47428. messageSends: []
  47429. }),
  47430. $globals.TestCase);
  47431. $core.addMethod(
  47432. $core.method({
  47433. selector: "deny:",
  47434. protocol: "testing",
  47435. fn: function (aBoolean){
  47436. var self=this,$self=this;
  47437. return $core.withContext(function($ctx1) {
  47438. $self._assert_($recv(aBoolean)._not());
  47439. return self;
  47440. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  47441. },
  47442. args: ["aBoolean"],
  47443. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  47444. referencedClasses: [],
  47445. messageSends: ["assert:", "not"]
  47446. }),
  47447. $globals.TestCase);
  47448. $core.addMethod(
  47449. $core.method({
  47450. selector: "errorIfNotAsync:",
  47451. protocol: "error handling",
  47452. fn: function (aString){
  47453. var self=this,$self=this;
  47454. return $core.withContext(function($ctx1) {
  47455. var $1;
  47456. $1=$self._isAsync();
  47457. if(!$core.assert($1)){
  47458. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  47459. }
  47460. return self;
  47461. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  47462. },
  47463. args: ["aString"],
  47464. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  47465. referencedClasses: [],
  47466. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  47467. }),
  47468. $globals.TestCase);
  47469. $core.addMethod(
  47470. $core.method({
  47471. selector: "finished",
  47472. protocol: "async",
  47473. fn: function (){
  47474. var self=this,$self=this;
  47475. return $core.withContext(function($ctx1) {
  47476. $self._errorIfNotAsync_("#finished");
  47477. $self["@asyncTimeout"]=nil;
  47478. return self;
  47479. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  47480. },
  47481. args: [],
  47482. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  47483. referencedClasses: [],
  47484. messageSends: ["errorIfNotAsync:"]
  47485. }),
  47486. $globals.TestCase);
  47487. $core.addMethod(
  47488. $core.method({
  47489. selector: "isAsync",
  47490. protocol: "testing",
  47491. fn: function (){
  47492. var self=this,$self=this;
  47493. return $core.withContext(function($ctx1) {
  47494. return $recv($self["@asyncTimeout"])._notNil();
  47495. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  47496. },
  47497. args: [],
  47498. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  47499. referencedClasses: [],
  47500. messageSends: ["notNil"]
  47501. }),
  47502. $globals.TestCase);
  47503. $core.addMethod(
  47504. $core.method({
  47505. selector: "performTest",
  47506. protocol: "running",
  47507. fn: function (){
  47508. var self=this,$self=this;
  47509. return $core.withContext(function($ctx1) {
  47510. $self["@asyncTimeout"]=nil;
  47511. $self._perform_($self._selector());
  47512. return self;
  47513. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  47514. },
  47515. args: [],
  47516. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  47517. referencedClasses: [],
  47518. messageSends: ["perform:", "selector"]
  47519. }),
  47520. $globals.TestCase);
  47521. $core.addMethod(
  47522. $core.method({
  47523. selector: "runCase",
  47524. protocol: "running",
  47525. fn: function (){
  47526. var self=this,$self=this;
  47527. return $core.withContext(function($ctx1) {
  47528. $recv($recv($globals.TestContext)._testCase_(self))._start();
  47529. return self;
  47530. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  47531. },
  47532. args: [],
  47533. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  47534. referencedClasses: ["TestContext"],
  47535. messageSends: ["start", "testCase:"]
  47536. }),
  47537. $globals.TestCase);
  47538. $core.addMethod(
  47539. $core.method({
  47540. selector: "selector",
  47541. protocol: "accessing",
  47542. fn: function (){
  47543. var self=this,$self=this;
  47544. return $self["@testSelector"];
  47545. },
  47546. args: [],
  47547. source: "selector\x0a\x09^ testSelector",
  47548. referencedClasses: [],
  47549. messageSends: []
  47550. }),
  47551. $globals.TestCase);
  47552. $core.addMethod(
  47553. $core.method({
  47554. selector: "setTestSelector:",
  47555. protocol: "accessing",
  47556. fn: function (aSelector){
  47557. var self=this,$self=this;
  47558. $self["@testSelector"]=aSelector;
  47559. return self;
  47560. },
  47561. args: ["aSelector"],
  47562. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  47563. referencedClasses: [],
  47564. messageSends: []
  47565. }),
  47566. $globals.TestCase);
  47567. $core.addMethod(
  47568. $core.method({
  47569. selector: "setUp",
  47570. protocol: "running",
  47571. fn: function (){
  47572. var self=this,$self=this;
  47573. return self;
  47574. },
  47575. args: [],
  47576. source: "setUp",
  47577. referencedClasses: [],
  47578. messageSends: []
  47579. }),
  47580. $globals.TestCase);
  47581. $core.addMethod(
  47582. $core.method({
  47583. selector: "should:",
  47584. protocol: "testing",
  47585. fn: function (aBlock){
  47586. var self=this,$self=this;
  47587. return $core.withContext(function($ctx1) {
  47588. $self._assert_($recv(aBlock)._value());
  47589. return self;
  47590. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  47591. },
  47592. args: ["aBlock"],
  47593. source: "should: aBlock\x0a\x09self assert: aBlock value",
  47594. referencedClasses: [],
  47595. messageSends: ["assert:", "value"]
  47596. }),
  47597. $globals.TestCase);
  47598. $core.addMethod(
  47599. $core.method({
  47600. selector: "should:raise:",
  47601. protocol: "testing",
  47602. fn: function (aBlock,anExceptionClass){
  47603. var self=this,$self=this;
  47604. return $core.withContext(function($ctx1) {
  47605. $self._assert_($recv((function(){
  47606. return $core.withContext(function($ctx2) {
  47607. $recv(aBlock)._value();
  47608. return false;
  47609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47610. }))._on_do_(anExceptionClass,(function(ex){
  47611. return true;
  47612. })));
  47613. return self;
  47614. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47615. },
  47616. args: ["aBlock", "anExceptionClass"],
  47617. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  47618. referencedClasses: [],
  47619. messageSends: ["assert:", "on:do:", "value"]
  47620. }),
  47621. $globals.TestCase);
  47622. $core.addMethod(
  47623. $core.method({
  47624. selector: "shouldnt:raise:",
  47625. protocol: "testing",
  47626. fn: function (aBlock,anExceptionClass){
  47627. var self=this,$self=this;
  47628. return $core.withContext(function($ctx1) {
  47629. $self._assert_($recv((function(){
  47630. return $core.withContext(function($ctx2) {
  47631. $recv(aBlock)._value();
  47632. return true;
  47633. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47634. }))._on_do_(anExceptionClass,(function(ex){
  47635. return false;
  47636. })));
  47637. return self;
  47638. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47639. },
  47640. args: ["aBlock", "anExceptionClass"],
  47641. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  47642. referencedClasses: [],
  47643. messageSends: ["assert:", "on:do:", "value"]
  47644. }),
  47645. $globals.TestCase);
  47646. $core.addMethod(
  47647. $core.method({
  47648. selector: "signalFailure:",
  47649. protocol: "private",
  47650. fn: function (aString){
  47651. var self=this,$self=this;
  47652. return $core.withContext(function($ctx1) {
  47653. var $1;
  47654. $1=$recv($globals.TestFailure)._new();
  47655. $recv($1)._messageText_(aString);
  47656. $recv($1)._signal();
  47657. return self;
  47658. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  47659. },
  47660. args: ["aString"],
  47661. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  47662. referencedClasses: ["TestFailure"],
  47663. messageSends: ["messageText:", "new", "signal"]
  47664. }),
  47665. $globals.TestCase);
  47666. $core.addMethod(
  47667. $core.method({
  47668. selector: "tearDown",
  47669. protocol: "running",
  47670. fn: function (){
  47671. var self=this,$self=this;
  47672. return self;
  47673. },
  47674. args: [],
  47675. source: "tearDown",
  47676. referencedClasses: [],
  47677. messageSends: []
  47678. }),
  47679. $globals.TestCase);
  47680. $core.addMethod(
  47681. $core.method({
  47682. selector: "timeout:",
  47683. protocol: "async",
  47684. fn: function (aNumber){
  47685. var self=this,$self=this;
  47686. return $core.withContext(function($ctx1) {
  47687. var $1,$receiver;
  47688. $1=$self["@asyncTimeout"];
  47689. if(($receiver = $1) == null || $receiver.a$nil){
  47690. $1;
  47691. } else {
  47692. $recv($self["@asyncTimeout"])._clearTimeout();
  47693. }
  47694. $self["@asyncTimeout"]=(0);
  47695. $self["@asyncTimeout"]=$recv($self._async_((function(){
  47696. return $core.withContext(function($ctx2) {
  47697. return $self._assert_description_(false,"SUnit grace time exhausted");
  47698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47699. })))._valueWithTimeout_(aNumber);
  47700. return self;
  47701. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  47702. },
  47703. args: ["aNumber"],
  47704. 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",
  47705. referencedClasses: [],
  47706. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  47707. }),
  47708. $globals.TestCase);
  47709. $core.addMethod(
  47710. $core.method({
  47711. selector: "allTestSelectors",
  47712. protocol: "accessing",
  47713. fn: function (){
  47714. var self=this,$self=this;
  47715. var selectors;
  47716. return $core.withContext(function($ctx1) {
  47717. var $1;
  47718. selectors=$self._testSelectors();
  47719. $1=$self._shouldInheritSelectors();
  47720. if($core.assert($1)){
  47721. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  47722. }
  47723. return selectors;
  47724. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.a$cls)});
  47725. },
  47726. args: [],
  47727. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  47728. referencedClasses: [],
  47729. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  47730. }),
  47731. $globals.TestCase.a$cls);
  47732. $core.addMethod(
  47733. $core.method({
  47734. selector: "buildSuite",
  47735. protocol: "accessing",
  47736. fn: function (){
  47737. var self=this,$self=this;
  47738. return $core.withContext(function($ctx1) {
  47739. return $recv($self._allTestSelectors())._collect_((function(each){
  47740. return $core.withContext(function($ctx2) {
  47741. return $self._selector_(each);
  47742. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47743. }));
  47744. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.a$cls)});
  47745. },
  47746. args: [],
  47747. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  47748. referencedClasses: [],
  47749. messageSends: ["collect:", "allTestSelectors", "selector:"]
  47750. }),
  47751. $globals.TestCase.a$cls);
  47752. $core.addMethod(
  47753. $core.method({
  47754. selector: "classTag",
  47755. protocol: "accessing",
  47756. fn: function (){
  47757. var self=this,$self=this;
  47758. return "test";
  47759. },
  47760. args: [],
  47761. 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'",
  47762. referencedClasses: [],
  47763. messageSends: []
  47764. }),
  47765. $globals.TestCase.a$cls);
  47766. $core.addMethod(
  47767. $core.method({
  47768. selector: "isAbstract",
  47769. protocol: "testing",
  47770. fn: function (){
  47771. var self=this,$self=this;
  47772. return $core.withContext(function($ctx1) {
  47773. return $recv($self._name()).__eq("TestCase");
  47774. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.a$cls)});
  47775. },
  47776. args: [],
  47777. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  47778. referencedClasses: [],
  47779. messageSends: ["=", "name"]
  47780. }),
  47781. $globals.TestCase.a$cls);
  47782. $core.addMethod(
  47783. $core.method({
  47784. selector: "isTestClass",
  47785. protocol: "testing",
  47786. fn: function (){
  47787. var self=this,$self=this;
  47788. return $core.withContext(function($ctx1) {
  47789. return $recv($self._isAbstract())._not();
  47790. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.a$cls)});
  47791. },
  47792. args: [],
  47793. source: "isTestClass\x0a\x09^ self isAbstract not",
  47794. referencedClasses: [],
  47795. messageSends: ["not", "isAbstract"]
  47796. }),
  47797. $globals.TestCase.a$cls);
  47798. $core.addMethod(
  47799. $core.method({
  47800. selector: "lookupHierarchyRoot",
  47801. protocol: "accessing",
  47802. fn: function (){
  47803. var self=this,$self=this;
  47804. return $globals.TestCase;
  47805. },
  47806. args: [],
  47807. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  47808. referencedClasses: ["TestCase"],
  47809. messageSends: []
  47810. }),
  47811. $globals.TestCase.a$cls);
  47812. $core.addMethod(
  47813. $core.method({
  47814. selector: "selector:",
  47815. protocol: "accessing",
  47816. fn: function (aSelector){
  47817. var self=this,$self=this;
  47818. return $core.withContext(function($ctx1) {
  47819. var $1;
  47820. $1=$self._new();
  47821. $recv($1)._setTestSelector_(aSelector);
  47822. return $recv($1)._yourself();
  47823. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.a$cls)});
  47824. },
  47825. args: ["aSelector"],
  47826. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  47827. referencedClasses: [],
  47828. messageSends: ["setTestSelector:", "new", "yourself"]
  47829. }),
  47830. $globals.TestCase.a$cls);
  47831. $core.addMethod(
  47832. $core.method({
  47833. selector: "shouldInheritSelectors",
  47834. protocol: "testing",
  47835. fn: function (){
  47836. var self=this,$self=this;
  47837. return $core.withContext(function($ctx1) {
  47838. return $self.__tild_eq($self._lookupHierarchyRoot());
  47839. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.a$cls)});
  47840. },
  47841. args: [],
  47842. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  47843. referencedClasses: [],
  47844. messageSends: ["~=", "lookupHierarchyRoot"]
  47845. }),
  47846. $globals.TestCase.a$cls);
  47847. $core.addMethod(
  47848. $core.method({
  47849. selector: "testSelectors",
  47850. protocol: "accessing",
  47851. fn: function (){
  47852. var self=this,$self=this;
  47853. return $core.withContext(function($ctx1) {
  47854. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  47855. return $core.withContext(function($ctx2) {
  47856. return $recv(each)._match_("^test");
  47857. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47858. }));
  47859. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.a$cls)});
  47860. },
  47861. args: [],
  47862. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  47863. referencedClasses: [],
  47864. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  47865. }),
  47866. $globals.TestCase.a$cls);
  47867. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  47868. $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).";
  47869. $core.addMethod(
  47870. $core.method({
  47871. selector: "execute:",
  47872. protocol: "running",
  47873. fn: function (aBlock){
  47874. var self=this,$self=this;
  47875. var failed;
  47876. return $core.withContext(function($ctx1) {
  47877. var $1,$2;
  47878. $recv($self["@testCase"])._context_(self);
  47879. $ctx1.sendIdx["context:"]=1;
  47880. $recv((function(){
  47881. return $core.withContext(function($ctx2) {
  47882. failed=true;
  47883. $recv(aBlock)._value();
  47884. failed=false;
  47885. return failed;
  47886. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47887. }))._ensure_((function(){
  47888. return $core.withContext(function($ctx2) {
  47889. $recv($self["@testCase"])._context_(nil);
  47890. $1=$recv(failed)._and_((function(){
  47891. return $core.withContext(function($ctx3) {
  47892. return $recv($self["@testCase"])._isAsync();
  47893. $ctx3.sendIdx["isAsync"]=1;
  47894. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  47895. }));
  47896. if($core.assert($1)){
  47897. $recv($self["@testCase"])._finished();
  47898. }
  47899. $2=$recv($self["@testCase"])._isAsync();
  47900. if(!$core.assert($2)){
  47901. return $recv($self["@testCase"])._tearDown();
  47902. }
  47903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47904. }));
  47905. return self;
  47906. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  47907. },
  47908. args: ["aBlock"],
  47909. 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 ] ]",
  47910. referencedClasses: [],
  47911. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  47912. }),
  47913. $globals.TestContext);
  47914. $core.addMethod(
  47915. $core.method({
  47916. selector: "start",
  47917. protocol: "running",
  47918. fn: function (){
  47919. var self=this,$self=this;
  47920. return $core.withContext(function($ctx1) {
  47921. $self._execute_((function(){
  47922. return $core.withContext(function($ctx2) {
  47923. $recv($self["@testCase"])._setUp();
  47924. return $recv($self["@testCase"])._performTest();
  47925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47926. }));
  47927. return self;
  47928. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  47929. },
  47930. args: [],
  47931. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  47932. referencedClasses: [],
  47933. messageSends: ["execute:", "setUp", "performTest"]
  47934. }),
  47935. $globals.TestContext);
  47936. $core.addMethod(
  47937. $core.method({
  47938. selector: "testCase:",
  47939. protocol: "accessing",
  47940. fn: function (aTestCase){
  47941. var self=this,$self=this;
  47942. $self["@testCase"]=aTestCase;
  47943. return self;
  47944. },
  47945. args: ["aTestCase"],
  47946. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  47947. referencedClasses: [],
  47948. messageSends: []
  47949. }),
  47950. $globals.TestContext);
  47951. $core.addMethod(
  47952. $core.method({
  47953. selector: "testCase:",
  47954. protocol: "instance creation",
  47955. fn: function (aTestCase){
  47956. var self=this,$self=this;
  47957. return $core.withContext(function($ctx1) {
  47958. var $1;
  47959. $1=$self._new();
  47960. $recv($1)._testCase_(aTestCase);
  47961. return $recv($1)._yourself();
  47962. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.a$cls)});
  47963. },
  47964. args: ["aTestCase"],
  47965. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  47966. referencedClasses: [],
  47967. messageSends: ["testCase:", "new", "yourself"]
  47968. }),
  47969. $globals.TestContext.a$cls);
  47970. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  47971. $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`.";
  47972. $core.addMethod(
  47973. $core.method({
  47974. selector: "execute:",
  47975. protocol: "running",
  47976. fn: function (aBlock){
  47977. var self=this,$self=this;
  47978. return $core.withContext(function($ctx1) {
  47979. var $1;
  47980. $recv((function(){
  47981. return $core.withContext(function($ctx2) {
  47982. return $self._withErrorReporting_((function(){
  47983. return $core.withContext(function($ctx3) {
  47984. return (
  47985. $ctx3.supercall = true,
  47986. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
  47987. $ctx3.supercall = false;
  47988. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47989. }));
  47990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47991. }))._ensure_((function(){
  47992. return $core.withContext(function($ctx2) {
  47993. $1=$recv($self["@testCase"])._isAsync();
  47994. if(!$core.assert($1)){
  47995. $recv($self["@result"])._increaseRuns();
  47996. return $recv($self["@finished"])._value();
  47997. }
  47998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47999. }));
  48000. return self;
  48001. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48002. },
  48003. args: ["aBlock"],
  48004. 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 ] ]",
  48005. referencedClasses: [],
  48006. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  48007. }),
  48008. $globals.ReportingTestContext);
  48009. $core.addMethod(
  48010. $core.method({
  48011. selector: "finished:",
  48012. protocol: "accessing",
  48013. fn: function (aBlock){
  48014. var self=this,$self=this;
  48015. $self["@finished"]=aBlock;
  48016. return self;
  48017. },
  48018. args: ["aBlock"],
  48019. source: "finished: aBlock\x0a\x09finished := aBlock",
  48020. referencedClasses: [],
  48021. messageSends: []
  48022. }),
  48023. $globals.ReportingTestContext);
  48024. $core.addMethod(
  48025. $core.method({
  48026. selector: "result:",
  48027. protocol: "accessing",
  48028. fn: function (aTestResult){
  48029. var self=this,$self=this;
  48030. $self["@result"]=aTestResult;
  48031. return self;
  48032. },
  48033. args: ["aTestResult"],
  48034. source: "result: aTestResult\x0a\x09result := aTestResult",
  48035. referencedClasses: [],
  48036. messageSends: []
  48037. }),
  48038. $globals.ReportingTestContext);
  48039. $core.addMethod(
  48040. $core.method({
  48041. selector: "withErrorReporting:",
  48042. protocol: "private",
  48043. fn: function (aBlock){
  48044. var self=this,$self=this;
  48045. return $core.withContext(function($ctx1) {
  48046. $recv((function(){
  48047. return $core.withContext(function($ctx2) {
  48048. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  48049. return $core.withContext(function($ctx3) {
  48050. return $recv($self["@result"])._addFailure_($self["@testCase"]);
  48051. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  48052. }));
  48053. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48054. }))._on_do_($globals.Error,(function(ex){
  48055. return $core.withContext(function($ctx2) {
  48056. return $recv($self["@result"])._addError_($self["@testCase"]);
  48057. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  48058. }));
  48059. $ctx1.sendIdx["on:do:"]=1;
  48060. return self;
  48061. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48062. },
  48063. args: ["aBlock"],
  48064. 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 ]",
  48065. referencedClasses: ["TestFailure", "Error"],
  48066. messageSends: ["on:do:", "addFailure:", "addError:"]
  48067. }),
  48068. $globals.ReportingTestContext);
  48069. $core.addMethod(
  48070. $core.method({
  48071. selector: "testCase:result:finished:",
  48072. protocol: "instance creation",
  48073. fn: function (aTestCase,aTestResult,aBlock){
  48074. var self=this,$self=this;
  48075. return $core.withContext(function($ctx1) {
  48076. var $1;
  48077. $1=(
  48078. $ctx1.supercall = true,
  48079. ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
  48080. $ctx1.supercall = false;
  48081. $recv($1)._result_(aTestResult);
  48082. $recv($1)._finished_(aBlock);
  48083. return $recv($1)._yourself();
  48084. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.a$cls)});
  48085. },
  48086. args: ["aTestCase", "aTestResult", "aBlock"],
  48087. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  48088. referencedClasses: [],
  48089. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  48090. }),
  48091. $globals.ReportingTestContext.a$cls);
  48092. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  48093. $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.";
  48094. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  48095. $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";
  48096. $core.addMethod(
  48097. $core.method({
  48098. selector: "addError:",
  48099. protocol: "accessing",
  48100. fn: function (anError){
  48101. var self=this,$self=this;
  48102. return $core.withContext(function($ctx1) {
  48103. $recv($self._errors())._add_(anError);
  48104. return self;
  48105. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  48106. },
  48107. args: ["anError"],
  48108. source: "addError: anError\x0a\x09self errors add: anError",
  48109. referencedClasses: [],
  48110. messageSends: ["add:", "errors"]
  48111. }),
  48112. $globals.TestResult);
  48113. $core.addMethod(
  48114. $core.method({
  48115. selector: "addFailure:",
  48116. protocol: "accessing",
  48117. fn: function (aFailure){
  48118. var self=this,$self=this;
  48119. return $core.withContext(function($ctx1) {
  48120. $recv($self._failures())._add_(aFailure);
  48121. return self;
  48122. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  48123. },
  48124. args: ["aFailure"],
  48125. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  48126. referencedClasses: [],
  48127. messageSends: ["add:", "failures"]
  48128. }),
  48129. $globals.TestResult);
  48130. $core.addMethod(
  48131. $core.method({
  48132. selector: "errors",
  48133. protocol: "accessing",
  48134. fn: function (){
  48135. var self=this,$self=this;
  48136. return $self["@errors"];
  48137. },
  48138. args: [],
  48139. source: "errors\x0a\x09^ errors",
  48140. referencedClasses: [],
  48141. messageSends: []
  48142. }),
  48143. $globals.TestResult);
  48144. $core.addMethod(
  48145. $core.method({
  48146. selector: "failures",
  48147. protocol: "accessing",
  48148. fn: function (){
  48149. var self=this,$self=this;
  48150. return $self["@failures"];
  48151. },
  48152. args: [],
  48153. source: "failures\x0a\x09^ failures",
  48154. referencedClasses: [],
  48155. messageSends: []
  48156. }),
  48157. $globals.TestResult);
  48158. $core.addMethod(
  48159. $core.method({
  48160. selector: "increaseRuns",
  48161. protocol: "accessing",
  48162. fn: function (){
  48163. var self=this,$self=this;
  48164. return $core.withContext(function($ctx1) {
  48165. $self["@runs"]=$recv($self["@runs"]).__plus((1));
  48166. return self;
  48167. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  48168. },
  48169. args: [],
  48170. source: "increaseRuns\x0a\x09runs := runs + 1",
  48171. referencedClasses: [],
  48172. messageSends: ["+"]
  48173. }),
  48174. $globals.TestResult);
  48175. $core.addMethod(
  48176. $core.method({
  48177. selector: "initialize",
  48178. protocol: "initialization",
  48179. fn: function (){
  48180. var self=this,$self=this;
  48181. return $core.withContext(function($ctx1) {
  48182. (
  48183. $ctx1.supercall = true,
  48184. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48185. $ctx1.supercall = false;
  48186. $self["@timestamp"]=$recv($globals.Date)._now();
  48187. $self["@runs"]=(0);
  48188. $self["@errors"]=$recv($globals.Array)._new();
  48189. $ctx1.sendIdx["new"]=1;
  48190. $self["@failures"]=$recv($globals.Array)._new();
  48191. $self["@total"]=(0);
  48192. return self;
  48193. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  48194. },
  48195. args: [],
  48196. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  48197. referencedClasses: ["Date", "Array"],
  48198. messageSends: ["initialize", "now", "new"]
  48199. }),
  48200. $globals.TestResult);
  48201. $core.addMethod(
  48202. $core.method({
  48203. selector: "nextRunDo:",
  48204. protocol: "running",
  48205. fn: function (aBlock){
  48206. var self=this,$self=this;
  48207. return $core.withContext(function($ctx1) {
  48208. var $2,$1;
  48209. $2=$self._runs();
  48210. $ctx1.sendIdx["runs"]=1;
  48211. $1=$recv($2).__eq_eq($self._total());
  48212. if(!$core.assert($1)){
  48213. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  48214. }
  48215. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  48216. },
  48217. args: ["aBlock"],
  48218. 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 ]",
  48219. referencedClasses: [],
  48220. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  48221. }),
  48222. $globals.TestResult);
  48223. $core.addMethod(
  48224. $core.method({
  48225. selector: "runCase:",
  48226. protocol: "running",
  48227. fn: function (aTestCase){
  48228. var self=this,$self=this;
  48229. return $core.withContext(function($ctx1) {
  48230. $recv((function(){
  48231. return $core.withContext(function($ctx2) {
  48232. return $recv((function(){
  48233. return $core.withContext(function($ctx3) {
  48234. $self._increaseRuns();
  48235. return $recv(aTestCase)._runCase();
  48236. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48237. }))._on_do_($globals.TestFailure,(function(ex){
  48238. return $core.withContext(function($ctx3) {
  48239. return $self._addFailure_(aTestCase);
  48240. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  48241. }));
  48242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48243. }))._on_do_($globals.Error,(function(ex){
  48244. return $core.withContext(function($ctx2) {
  48245. return $self._addError_(aTestCase);
  48246. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  48247. }));
  48248. $ctx1.sendIdx["on:do:"]=1;
  48249. return self;
  48250. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  48251. },
  48252. args: ["aTestCase"],
  48253. 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 ]",
  48254. referencedClasses: ["TestFailure", "Error"],
  48255. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  48256. }),
  48257. $globals.TestResult);
  48258. $core.addMethod(
  48259. $core.method({
  48260. selector: "runs",
  48261. protocol: "accessing",
  48262. fn: function (){
  48263. var self=this,$self=this;
  48264. return $self["@runs"];
  48265. },
  48266. args: [],
  48267. source: "runs\x0a\x09^ runs",
  48268. referencedClasses: [],
  48269. messageSends: []
  48270. }),
  48271. $globals.TestResult);
  48272. $core.addMethod(
  48273. $core.method({
  48274. selector: "status",
  48275. protocol: "accessing",
  48276. fn: function (){
  48277. var self=this,$self=this;
  48278. return $core.withContext(function($ctx1) {
  48279. var $1;
  48280. $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  48281. return "error";
  48282. }),(function(){
  48283. return $core.withContext(function($ctx2) {
  48284. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  48285. return "failure";
  48286. }),(function(){
  48287. return "success";
  48288. }));
  48289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48290. }));
  48291. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  48292. return $1;
  48293. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  48294. },
  48295. args: [],
  48296. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  48297. referencedClasses: [],
  48298. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  48299. }),
  48300. $globals.TestResult);
  48301. $core.addMethod(
  48302. $core.method({
  48303. selector: "timestamp",
  48304. protocol: "accessing",
  48305. fn: function (){
  48306. var self=this,$self=this;
  48307. return $self["@timestamp"];
  48308. },
  48309. args: [],
  48310. source: "timestamp\x0a\x09^ timestamp",
  48311. referencedClasses: [],
  48312. messageSends: []
  48313. }),
  48314. $globals.TestResult);
  48315. $core.addMethod(
  48316. $core.method({
  48317. selector: "total",
  48318. protocol: "accessing",
  48319. fn: function (){
  48320. var self=this,$self=this;
  48321. return $self["@total"];
  48322. },
  48323. args: [],
  48324. source: "total\x0a\x09^ total",
  48325. referencedClasses: [],
  48326. messageSends: []
  48327. }),
  48328. $globals.TestResult);
  48329. $core.addMethod(
  48330. $core.method({
  48331. selector: "total:",
  48332. protocol: "accessing",
  48333. fn: function (aNumber){
  48334. var self=this,$self=this;
  48335. $self["@total"]=aNumber;
  48336. return self;
  48337. },
  48338. args: ["aNumber"],
  48339. source: "total: aNumber\x0a\x09total := aNumber",
  48340. referencedClasses: [],
  48341. messageSends: []
  48342. }),
  48343. $globals.TestResult);
  48344. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  48345. $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`.";
  48346. $core.addMethod(
  48347. $core.method({
  48348. selector: "announcer",
  48349. protocol: "accessing",
  48350. fn: function (){
  48351. var self=this,$self=this;
  48352. return $self["@announcer"];
  48353. },
  48354. args: [],
  48355. source: "announcer\x0a\x09^ announcer",
  48356. referencedClasses: [],
  48357. messageSends: []
  48358. }),
  48359. $globals.TestSuiteRunner);
  48360. $core.addMethod(
  48361. $core.method({
  48362. selector: "contextOf:",
  48363. protocol: "private",
  48364. fn: function (anInteger){
  48365. var self=this,$self=this;
  48366. return $core.withContext(function($ctx1) {
  48367. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self["@suite"])._at_(anInteger),$self["@result"],(function(){
  48368. return $core.withContext(function($ctx2) {
  48369. return $self._resume();
  48370. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48371. }));
  48372. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  48373. },
  48374. args: ["anInteger"],
  48375. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  48376. referencedClasses: ["ReportingTestContext"],
  48377. messageSends: ["testCase:result:finished:", "at:", "resume"]
  48378. }),
  48379. $globals.TestSuiteRunner);
  48380. $core.addMethod(
  48381. $core.method({
  48382. selector: "initialize",
  48383. protocol: "initialization",
  48384. fn: function (){
  48385. var self=this,$self=this;
  48386. return $core.withContext(function($ctx1) {
  48387. var $1;
  48388. (
  48389. $ctx1.supercall = true,
  48390. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48391. $ctx1.supercall = false;
  48392. $self["@announcer"]=$recv($globals.Announcer)._new();
  48393. $ctx1.sendIdx["new"]=1;
  48394. $self["@result"]=$recv($globals.TestResult)._new();
  48395. $self["@runNextTest"]=(function(){
  48396. var runs;
  48397. return $core.withContext(function($ctx2) {
  48398. runs=$recv($self["@result"])._runs();
  48399. $1=$recv(runs).__lt($recv($self["@result"])._total());
  48400. if($core.assert($1)){
  48401. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  48402. }
  48403. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  48404. });
  48405. return self;
  48406. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  48407. },
  48408. args: [],
  48409. 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 ] ].",
  48410. referencedClasses: ["Announcer", "TestResult"],
  48411. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  48412. }),
  48413. $globals.TestSuiteRunner);
  48414. $core.addMethod(
  48415. $core.method({
  48416. selector: "result",
  48417. protocol: "accessing",
  48418. fn: function (){
  48419. var self=this,$self=this;
  48420. return $self["@result"];
  48421. },
  48422. args: [],
  48423. source: "result\x0a\x09^ result",
  48424. referencedClasses: [],
  48425. messageSends: []
  48426. }),
  48427. $globals.TestSuiteRunner);
  48428. $core.addMethod(
  48429. $core.method({
  48430. selector: "resume",
  48431. protocol: "actions",
  48432. fn: function (){
  48433. var self=this,$self=this;
  48434. return $core.withContext(function($ctx1) {
  48435. $recv($self["@runNextTest"])._fork();
  48436. $recv($self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self["@result"]));
  48437. return self;
  48438. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  48439. },
  48440. args: [],
  48441. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  48442. referencedClasses: ["ResultAnnouncement"],
  48443. messageSends: ["fork", "announce:", "result:", "new"]
  48444. }),
  48445. $globals.TestSuiteRunner);
  48446. $core.addMethod(
  48447. $core.method({
  48448. selector: "run",
  48449. protocol: "actions",
  48450. fn: function (){
  48451. var self=this,$self=this;
  48452. return $core.withContext(function($ctx1) {
  48453. $recv($self["@result"])._total_($recv($self["@suite"])._size());
  48454. $self._resume();
  48455. return self;
  48456. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  48457. },
  48458. args: [],
  48459. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  48460. referencedClasses: [],
  48461. messageSends: ["total:", "size", "resume"]
  48462. }),
  48463. $globals.TestSuiteRunner);
  48464. $core.addMethod(
  48465. $core.method({
  48466. selector: "suite:",
  48467. protocol: "accessing",
  48468. fn: function (aCollection){
  48469. var self=this,$self=this;
  48470. $self["@suite"]=aCollection;
  48471. return self;
  48472. },
  48473. args: ["aCollection"],
  48474. source: "suite: aCollection\x0a\x09suite := aCollection",
  48475. referencedClasses: [],
  48476. messageSends: []
  48477. }),
  48478. $globals.TestSuiteRunner);
  48479. $core.addMethod(
  48480. $core.method({
  48481. selector: "new",
  48482. protocol: "instance creation",
  48483. fn: function (){
  48484. var self=this,$self=this;
  48485. return $core.withContext(function($ctx1) {
  48486. $self._shouldNotImplement();
  48487. return self;
  48488. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.a$cls)});
  48489. },
  48490. args: [],
  48491. source: "new\x0a\x09self shouldNotImplement",
  48492. referencedClasses: [],
  48493. messageSends: ["shouldNotImplement"]
  48494. }),
  48495. $globals.TestSuiteRunner.a$cls);
  48496. $core.addMethod(
  48497. $core.method({
  48498. selector: "on:",
  48499. protocol: "instance creation",
  48500. fn: function (aCollection){
  48501. var self=this,$self=this;
  48502. return $core.withContext(function($ctx1) {
  48503. var $1;
  48504. $1=(
  48505. $ctx1.supercall = true,
  48506. ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  48507. $ctx1.supercall = false;
  48508. return $recv($1)._suite_(aCollection);
  48509. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.a$cls)});
  48510. },
  48511. args: ["aCollection"],
  48512. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  48513. referencedClasses: [],
  48514. messageSends: ["suite:", "new"]
  48515. }),
  48516. $globals.TestSuiteRunner.a$cls);
  48517. $core.addMethod(
  48518. $core.method({
  48519. selector: "isTestPackage",
  48520. protocol: "*SUnit",
  48521. fn: function (){
  48522. var self=this,$self=this;
  48523. return $core.withContext(function($ctx1) {
  48524. return $recv($self._classes())._anySatisfy_((function(each){
  48525. return $core.withContext(function($ctx2) {
  48526. return $recv(each)._isTestClass();
  48527. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48528. }));
  48529. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  48530. },
  48531. args: [],
  48532. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  48533. referencedClasses: [],
  48534. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  48535. }),
  48536. $globals.Package);
  48537. $core.addMethod(
  48538. $core.method({
  48539. selector: "isTestClass",
  48540. protocol: "*SUnit",
  48541. fn: function (){
  48542. var self=this,$self=this;
  48543. return false;
  48544. },
  48545. args: [],
  48546. source: "isTestClass\x0a\x09^ false",
  48547. referencedClasses: [],
  48548. messageSends: []
  48549. }),
  48550. $globals.TBehaviorDefaults);
  48551. });
  48552. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  48553. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  48554. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48555. $core.addPackage("Compiler-Tests");
  48556. ($core.packageDescriptors||$core.packages)["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  48557. ($core.packageDescriptors||$core.packages)["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  48558. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  48559. $core.addMethod(
  48560. $core.method({
  48561. selector: "parse:forClass:",
  48562. protocol: "parsing",
  48563. fn: function (aString,aClass){
  48564. var self=this,$self=this;
  48565. return $core.withContext(function($ctx1) {
  48566. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_(aString,aClass,"test");
  48567. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  48568. },
  48569. args: ["aString", "aClass"],
  48570. source: "parse: aString forClass: aClass\x0a\x09^ Compiler new\x0a\x09\x09ast: aString\x0a\x09\x09forClass: aClass\x0a\x09\x09protocol: 'test'",
  48571. referencedClasses: ["Compiler"],
  48572. messageSends: ["ast:forClass:protocol:", "new"]
  48573. }),
  48574. $globals.ASTParsingTest);
  48575. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48576. $core.addMethod(
  48577. $core.method({
  48578. selector: "astPCNodeVisitor",
  48579. protocol: "factory",
  48580. fn: function (){
  48581. var self=this,$self=this;
  48582. return $core.withContext(function($ctx1) {
  48583. var $1;
  48584. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48585. $recv($1)._index_((0));
  48586. return $recv($1)._yourself();
  48587. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  48588. },
  48589. args: [],
  48590. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48591. referencedClasses: ["ASTPCNodeVisitor"],
  48592. messageSends: ["index:", "new", "yourself"]
  48593. }),
  48594. $globals.ASTPCNodeVisitorTest);
  48595. $core.addMethod(
  48596. $core.method({
  48597. selector: "astPCNodeVisitorForSelector:",
  48598. protocol: "factory",
  48599. fn: function (aString){
  48600. var self=this,$self=this;
  48601. return $core.withContext(function($ctx1) {
  48602. var $1;
  48603. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48604. $recv($1)._selector_(aString);
  48605. $recv($1)._index_((0));
  48606. return $recv($1)._yourself();
  48607. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  48608. },
  48609. args: ["aString"],
  48610. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48611. referencedClasses: ["ASTPCNodeVisitor"],
  48612. messageSends: ["selector:", "new", "index:", "yourself"]
  48613. }),
  48614. $globals.ASTPCNodeVisitorTest);
  48615. $core.addMethod(
  48616. $core.method({
  48617. selector: "testJSStatementNode",
  48618. protocol: "tests",
  48619. fn: function (){
  48620. var self=this,$self=this;
  48621. var ast,visitor;
  48622. return $core.withContext(function($ctx1) {
  48623. var $3,$2,$1;
  48624. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  48625. $3=$self._astPCNodeVisitor();
  48626. $recv($3)._visit_(ast);
  48627. $2=$recv($3)._currentNode();
  48628. $1=$recv($2)._isJSStatementNode();
  48629. $self._assert_($1);
  48630. return self;
  48631. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48632. },
  48633. args: [],
  48634. 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",
  48635. referencedClasses: ["Object"],
  48636. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48637. }),
  48638. $globals.ASTPCNodeVisitorTest);
  48639. $core.addMethod(
  48640. $core.method({
  48641. selector: "testMessageSend",
  48642. protocol: "tests",
  48643. fn: function (){
  48644. var self=this,$self=this;
  48645. var ast;
  48646. return $core.withContext(function($ctx1) {
  48647. var $3,$2,$1;
  48648. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  48649. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48650. $recv($3)._visit_(ast);
  48651. $2=$recv($3)._currentNode();
  48652. $1=$recv($2)._selector();
  48653. $self._assert_equals_($1,"yourself");
  48654. return self;
  48655. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48656. },
  48657. args: [],
  48658. 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'",
  48659. referencedClasses: ["Object"],
  48660. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48661. }),
  48662. $globals.ASTPCNodeVisitorTest);
  48663. $core.addMethod(
  48664. $core.method({
  48665. selector: "testMessageSendWithBlocks",
  48666. protocol: "tests",
  48667. fn: function (){
  48668. var self=this,$self=this;
  48669. var ast;
  48670. return $core.withContext(function($ctx1) {
  48671. var $3,$2,$1;
  48672. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  48673. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48674. $recv($3)._visit_(ast);
  48675. $2=$recv($3)._currentNode();
  48676. $1=$recv($2)._selector();
  48677. $self._assert_equals_($1,"yourself");
  48678. return self;
  48679. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48680. },
  48681. args: [],
  48682. 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'",
  48683. referencedClasses: ["Object"],
  48684. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48685. }),
  48686. $globals.ASTPCNodeVisitorTest);
  48687. $core.addMethod(
  48688. $core.method({
  48689. selector: "testMessageSendWithInlining",
  48690. protocol: "tests",
  48691. fn: function (){
  48692. var self=this,$self=this;
  48693. var ast;
  48694. return $core.withContext(function($ctx1) {
  48695. var $3,$4,$2,$1,$7,$6,$5;
  48696. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48697. $ctx1.sendIdx["parse:forClass:"]=1;
  48698. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48699. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  48700. $recv($3)._visit_(ast);
  48701. $ctx1.sendIdx["visit:"]=1;
  48702. $4=$recv($3)._currentNode();
  48703. $ctx1.sendIdx["currentNode"]=1;
  48704. $2=$4;
  48705. $1=$recv($2)._selector();
  48706. $ctx1.sendIdx["selector"]=1;
  48707. $self._assert_equals_($1,"yourself");
  48708. $ctx1.sendIdx["assert:equals:"]=1;
  48709. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48710. $7=$self._astPCNodeVisitorForSelector_("asBoolean");
  48711. $recv($7)._visit_(ast);
  48712. $6=$recv($7)._currentNode();
  48713. $5=$recv($6)._selector();
  48714. $self._assert_equals_($5,"asBoolean");
  48715. return self;
  48716. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48717. },
  48718. args: [],
  48719. 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'",
  48720. referencedClasses: ["Object"],
  48721. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48722. }),
  48723. $globals.ASTPCNodeVisitorTest);
  48724. $core.addMethod(
  48725. $core.method({
  48726. selector: "testNoMessageSend",
  48727. protocol: "tests",
  48728. fn: function (){
  48729. var self=this,$self=this;
  48730. var ast;
  48731. return $core.withContext(function($ctx1) {
  48732. var $3,$2,$1;
  48733. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  48734. $3=$self._astPCNodeVisitor();
  48735. $recv($3)._visit_(ast);
  48736. $2=$recv($3)._currentNode();
  48737. $1=$recv($2)._isNil();
  48738. $self._assert_($1);
  48739. return self;
  48740. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48741. },
  48742. args: [],
  48743. 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",
  48744. referencedClasses: ["Object"],
  48745. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  48746. }),
  48747. $globals.ASTPCNodeVisitorTest);
  48748. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48749. $core.addMethod(
  48750. $core.method({
  48751. selector: "testNodeAtPosition",
  48752. protocol: "tests",
  48753. fn: function (){
  48754. var self=this,$self=this;
  48755. var node;
  48756. return $core.withContext(function($ctx1) {
  48757. var $3,$4,$2,$1,$7,$8,$6,$5;
  48758. node=$self._parse_forClass_("yourself\x0a\x09^ self",$globals.Object);
  48759. $ctx1.sendIdx["parse:forClass:"]=1;
  48760. $3=node;
  48761. $4=(2).__at((4));
  48762. $ctx1.sendIdx["@"]=1;
  48763. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  48764. return nil;
  48765. }));
  48766. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  48767. $1=$recv($2)._source();
  48768. $self._assert_equals_($1,"self");
  48769. $ctx1.sendIdx["assert:equals:"]=1;
  48770. node=$self._parse_forClass_("foo\x0a\x09true ifTrue: [ 1 ]",$globals.Object);
  48771. $ctx1.sendIdx["parse:forClass:"]=2;
  48772. $7=node;
  48773. $8=(2).__at((7));
  48774. $ctx1.sendIdx["@"]=2;
  48775. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  48776. return nil;
  48777. }));
  48778. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  48779. $5=$recv($6)._selector();
  48780. $ctx1.sendIdx["selector"]=1;
  48781. $self._assert_equals_($5,"ifTrue:");
  48782. $ctx1.sendIdx["assert:equals:"]=2;
  48783. node=$self._parse_forClass_("foo\x0a\x09self foo; bar; baz",$globals.Object);
  48784. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  48785. return nil;
  48786. })))._selector(),"foo");
  48787. return self;
  48788. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  48789. },
  48790. args: [],
  48791. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  48792. referencedClasses: ["Object"],
  48793. messageSends: ["parse:forClass:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  48794. }),
  48795. $globals.ASTPositionTest);
  48796. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  48797. $core.addMethod(
  48798. $core.method({
  48799. selector: "codeGeneratorClass",
  48800. protocol: "accessing",
  48801. fn: function (){
  48802. var self=this,$self=this;
  48803. return $globals.CodeGenerator;
  48804. },
  48805. args: [],
  48806. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  48807. referencedClasses: ["CodeGenerator"],
  48808. messageSends: []
  48809. }),
  48810. $globals.CodeGeneratorTest);
  48811. $core.addMethod(
  48812. $core.method({
  48813. selector: "compiler",
  48814. protocol: "factory",
  48815. fn: function (){
  48816. var self=this,$self=this;
  48817. return $core.withContext(function($ctx1) {
  48818. var $1;
  48819. $1=$recv($globals.Compiler)._new();
  48820. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  48821. return $recv($1)._yourself();
  48822. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  48823. },
  48824. args: [],
  48825. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  48826. referencedClasses: ["Compiler"],
  48827. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  48828. }),
  48829. $globals.CodeGeneratorTest);
  48830. $core.addMethod(
  48831. $core.method({
  48832. selector: "setUp",
  48833. protocol: "initialization",
  48834. fn: function (){
  48835. var self=this,$self=this;
  48836. return $core.withContext(function($ctx1) {
  48837. $self["@receiver"]=$recv($globals.DoIt)._new();
  48838. return self;
  48839. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  48840. },
  48841. args: [],
  48842. source: "setUp\x0a\x09receiver := DoIt new",
  48843. referencedClasses: ["DoIt"],
  48844. messageSends: ["new"]
  48845. }),
  48846. $globals.CodeGeneratorTest);
  48847. $core.addMethod(
  48848. $core.method({
  48849. selector: "should:receiver:raise:",
  48850. protocol: "testing",
  48851. fn: function (aString,anObject,anErrorClass){
  48852. var self=this,$self=this;
  48853. var method,result;
  48854. return $core.withContext(function($ctx1) {
  48855. var $1,$2,$3,$receiver;
  48856. $self["@receiver"]=anObject;
  48857. $recv((function(){
  48858. return $core.withContext(function($ctx2) {
  48859. return $self._should_raise_((function(){
  48860. return $core.withContext(function($ctx3) {
  48861. $1=$self._compiler();
  48862. $2=$recv(anObject)._class();
  48863. $ctx3.sendIdx["class"]=1;
  48864. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48865. return $recv($self["@receiver"])._perform_($recv(method)._selector());
  48866. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48867. }),anErrorClass);
  48868. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48869. }))._ensure_((function(){
  48870. return $core.withContext(function($ctx2) {
  48871. $3=method;
  48872. if(($receiver = $3) == null || $receiver.a$nil){
  48873. return $3;
  48874. } else {
  48875. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48876. }
  48877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48878. }));
  48879. return self;
  48880. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  48881. },
  48882. args: ["aString", "anObject", "anErrorClass"],
  48883. 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 ] ]",
  48884. referencedClasses: [],
  48885. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  48886. }),
  48887. $globals.CodeGeneratorTest);
  48888. $core.addMethod(
  48889. $core.method({
  48890. selector: "should:receiver:return:",
  48891. protocol: "testing",
  48892. fn: function (aString,anObject,aResult){
  48893. var self=this,$self=this;
  48894. var method,result;
  48895. return $core.withContext(function($ctx1) {
  48896. var $1,$2;
  48897. $self["@receiver"]=anObject;
  48898. $1=$self._compiler();
  48899. $2=$recv(anObject)._class();
  48900. $ctx1.sendIdx["class"]=1;
  48901. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48902. result=$recv($self["@receiver"])._perform_($recv(method)._selector());
  48903. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48904. $self._assert_equals_(aResult,result);
  48905. return self;
  48906. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  48907. },
  48908. args: ["aString", "anObject", "aResult"],
  48909. 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",
  48910. referencedClasses: [],
  48911. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  48912. }),
  48913. $globals.CodeGeneratorTest);
  48914. $core.addMethod(
  48915. $core.method({
  48916. selector: "should:return:",
  48917. protocol: "testing",
  48918. fn: function (aString,anObject){
  48919. var self=this,$self=this;
  48920. return $core.withContext(function($ctx1) {
  48921. return $self._should_receiver_return_(aString,$self["@receiver"],anObject);
  48922. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  48923. },
  48924. args: ["aString", "anObject"],
  48925. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  48926. referencedClasses: [],
  48927. messageSends: ["should:receiver:return:"]
  48928. }),
  48929. $globals.CodeGeneratorTest);
  48930. $core.addMethod(
  48931. $core.method({
  48932. selector: "tearDown",
  48933. protocol: "initialization",
  48934. fn: function (){
  48935. var self=this,$self=this;
  48936. return self;
  48937. },
  48938. args: [],
  48939. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  48940. referencedClasses: [],
  48941. messageSends: []
  48942. }),
  48943. $globals.CodeGeneratorTest);
  48944. $core.addMethod(
  48945. $core.method({
  48946. selector: "testAssignment",
  48947. protocol: "tests",
  48948. fn: function (){
  48949. var self=this,$self=this;
  48950. return $core.withContext(function($ctx1) {
  48951. $self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  48952. $ctx1.sendIdx["should:return:"]=1;
  48953. $self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  48954. $ctx1.sendIdx["should:return:"]=2;
  48955. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  48956. return self;
  48957. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  48958. },
  48959. args: [],
  48960. 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",
  48961. referencedClasses: [],
  48962. messageSends: ["should:return:"]
  48963. }),
  48964. $globals.CodeGeneratorTest);
  48965. $core.addMethod(
  48966. $core.method({
  48967. selector: "testBackslashSelectors",
  48968. protocol: "tests",
  48969. fn: function (){
  48970. var self=this,$self=this;
  48971. return $core.withContext(function($ctx1) {
  48972. $self._should_return_("\x5c arg ^ 4",(4));
  48973. $ctx1.sendIdx["should:return:"]=1;
  48974. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  48975. return self;
  48976. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  48977. },
  48978. args: [],
  48979. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  48980. referencedClasses: [],
  48981. messageSends: ["should:return:"]
  48982. }),
  48983. $globals.CodeGeneratorTest);
  48984. $core.addMethod(
  48985. $core.method({
  48986. selector: "testBlockReturn",
  48987. protocol: "tests",
  48988. fn: function (){
  48989. var self=this,$self=this;
  48990. return $core.withContext(function($ctx1) {
  48991. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  48992. $ctx1.sendIdx["should:return:"]=1;
  48993. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  48994. $ctx1.sendIdx["should:return:"]=2;
  48995. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  48996. return self;
  48997. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  48998. },
  48999. args: [],
  49000. 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).",
  49001. referencedClasses: [],
  49002. messageSends: ["should:return:"]
  49003. }),
  49004. $globals.CodeGeneratorTest);
  49005. $core.addMethod(
  49006. $core.method({
  49007. selector: "testCascades",
  49008. protocol: "tests",
  49009. fn: function (){
  49010. var self=this,$self=this;
  49011. return $core.withContext(function($ctx1) {
  49012. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  49013. return self;
  49014. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  49015. },
  49016. args: [],
  49017. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  49018. referencedClasses: [],
  49019. messageSends: ["should:return:"]
  49020. }),
  49021. $globals.CodeGeneratorTest);
  49022. $core.addMethod(
  49023. $core.method({
  49024. selector: "testCascadesInDynamicArray",
  49025. protocol: "tests",
  49026. fn: function (){
  49027. var self=this,$self=this;
  49028. return $core.withContext(function($ctx1) {
  49029. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  49030. return self;
  49031. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  49032. },
  49033. args: [],
  49034. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  49035. referencedClasses: [],
  49036. messageSends: ["should:return:"]
  49037. }),
  49038. $globals.CodeGeneratorTest);
  49039. $core.addMethod(
  49040. $core.method({
  49041. selector: "testCascadesInDynamicDictioary",
  49042. protocol: "tests",
  49043. fn: function (){
  49044. var self=this,$self=this;
  49045. return $core.withContext(function($ctx1) {
  49046. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  49047. return self;
  49048. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  49049. },
  49050. args: [],
  49051. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  49052. referencedClasses: [],
  49053. messageSends: ["should:return:"]
  49054. }),
  49055. $globals.CodeGeneratorTest);
  49056. $core.addMethod(
  49057. $core.method({
  49058. selector: "testCascadesInSend",
  49059. protocol: "tests",
  49060. fn: function (){
  49061. var self=this,$self=this;
  49062. return $core.withContext(function($ctx1) {
  49063. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  49064. return self;
  49065. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  49066. },
  49067. args: [],
  49068. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  49069. referencedClasses: [],
  49070. messageSends: ["should:return:"]
  49071. }),
  49072. $globals.CodeGeneratorTest);
  49073. $core.addMethod(
  49074. $core.method({
  49075. selector: "testCascadesWithInlining",
  49076. protocol: "tests",
  49077. fn: function (){
  49078. var self=this,$self=this;
  49079. return $core.withContext(function($ctx1) {
  49080. $self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  49081. $ctx1.sendIdx["should:return:"]=1;
  49082. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  49083. return self;
  49084. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  49085. },
  49086. args: [],
  49087. 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",
  49088. referencedClasses: [],
  49089. messageSends: ["should:return:"]
  49090. }),
  49091. $globals.CodeGeneratorTest);
  49092. $core.addMethod(
  49093. $core.method({
  49094. selector: "testDynamicArrayElementsOrdered",
  49095. protocol: "tests",
  49096. fn: function (){
  49097. var self=this,$self=this;
  49098. return $core.withContext(function($ctx1) {
  49099. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  49100. $ctx1.sendIdx["should:return:"]=1;
  49101. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  49102. return self;
  49103. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  49104. },
  49105. args: [],
  49106. 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).",
  49107. referencedClasses: [],
  49108. messageSends: ["should:return:"]
  49109. }),
  49110. $globals.CodeGeneratorTest);
  49111. $core.addMethod(
  49112. $core.method({
  49113. selector: "testDynamicDictionaryElementsOrdered",
  49114. protocol: "tests",
  49115. fn: function (){
  49116. var self=this,$self=this;
  49117. return $core.withContext(function($ctx1) {
  49118. $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)]));
  49119. return self;
  49120. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  49121. },
  49122. args: [],
  49123. 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}.",
  49124. referencedClasses: [],
  49125. messageSends: ["should:return:"]
  49126. }),
  49127. $globals.CodeGeneratorTest);
  49128. $core.addMethod(
  49129. $core.method({
  49130. selector: "testDynamicDictionaryWithMoreArrows",
  49131. protocol: "tests",
  49132. fn: function (){
  49133. var self=this,$self=this;
  49134. return $core.withContext(function($ctx1) {
  49135. var $2,$1;
  49136. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  49137. $ctx1.sendIdx["->"]=1;
  49138. $1=$recv($globals.HashedCollection)._with_($2);
  49139. $self._should_return_("foo ^ #{1->2->3}",$1);
  49140. return self;
  49141. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  49142. },
  49143. args: [],
  49144. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  49145. referencedClasses: ["HashedCollection"],
  49146. messageSends: ["should:return:", "with:", "->"]
  49147. }),
  49148. $globals.CodeGeneratorTest);
  49149. $core.addMethod(
  49150. $core.method({
  49151. selector: "testGlobalVar",
  49152. protocol: "tests",
  49153. fn: function (){
  49154. var self=this,$self=this;
  49155. return $core.withContext(function($ctx1) {
  49156. $self._should_return_("foo ^ eval class",$globals.BlockClosure);
  49157. $ctx1.sendIdx["should:return:"]=1;
  49158. $self._should_return_("foo ^ Math cos: 0",(1));
  49159. $ctx1.sendIdx["should:return:"]=2;
  49160. $self._should_return_("foo ^ NonExistingVar",nil);
  49161. return self;
  49162. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  49163. },
  49164. args: [],
  49165. 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",
  49166. referencedClasses: ["BlockClosure"],
  49167. messageSends: ["should:return:"]
  49168. }),
  49169. $globals.CodeGeneratorTest);
  49170. $core.addMethod(
  49171. $core.method({
  49172. selector: "testInnerTemporalDependentElementsOrdered",
  49173. protocol: "tests",
  49174. fn: function (){
  49175. var self=this,$self=this;
  49176. return $core.withContext(function($ctx1) {
  49177. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  49178. $2="foo".__minus_gt($globals.Array);
  49179. $ctx1.sendIdx["->"]=1;
  49180. $3="bar".__minus_gt((2));
  49181. $ctx1.sendIdx["->"]=2;
  49182. $1=[$2,$3];
  49183. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  49184. $ctx1.sendIdx["should:return:"]=1;
  49185. $5="foo".__minus_gt($globals.Array);
  49186. $ctx1.sendIdx["->"]=3;
  49187. $6="bar".__minus_gt((2));
  49188. $ctx1.sendIdx["->"]=4;
  49189. $4=[$5,$6];
  49190. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  49191. $ctx1.sendIdx["should:return:"]=2;
  49192. $8="foo".__minus_gt((1));
  49193. $ctx1.sendIdx["->"]=5;
  49194. $9="bar".__minus_gt((2));
  49195. $ctx1.sendIdx["->"]=6;
  49196. $7=[$8,$9];
  49197. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  49198. $ctx1.sendIdx["should:return:"]=3;
  49199. $11="foo".__minus_gt((1));
  49200. $ctx1.sendIdx["->"]=7;
  49201. $10=[$11,"bar".__minus_gt((2))];
  49202. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  49203. $ctx1.sendIdx["should:return:"]=4;
  49204. $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)]));
  49205. return self;
  49206. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  49207. },
  49208. args: [],
  49209. 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}.",
  49210. referencedClasses: ["Array"],
  49211. messageSends: ["should:return:", "->"]
  49212. }),
  49213. $globals.CodeGeneratorTest);
  49214. $core.addMethod(
  49215. $core.method({
  49216. selector: "testLexicalScope",
  49217. protocol: "tests",
  49218. fn: function (){
  49219. var self=this,$self=this;
  49220. return $core.withContext(function($ctx1) {
  49221. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  49222. return self;
  49223. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  49224. },
  49225. args: [],
  49226. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  49227. referencedClasses: [],
  49228. messageSends: ["should:return:"]
  49229. }),
  49230. $globals.CodeGeneratorTest);
  49231. $core.addMethod(
  49232. $core.method({
  49233. selector: "testLiterals",
  49234. protocol: "tests",
  49235. fn: function (){
  49236. var self=this,$self=this;
  49237. return $core.withContext(function($ctx1) {
  49238. $self._should_return_("foo ^ 1",(1));
  49239. $ctx1.sendIdx["should:return:"]=1;
  49240. $self._should_return_("foo ^ 'hello'","hello");
  49241. $ctx1.sendIdx["should:return:"]=2;
  49242. $self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  49243. $ctx1.sendIdx["should:return:"]=3;
  49244. $self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  49245. $ctx1.sendIdx["should:return:"]=4;
  49246. $self._should_return_("foo ^ true",true);
  49247. $ctx1.sendIdx["should:return:"]=5;
  49248. $self._should_return_("foo ^ false",false);
  49249. $ctx1.sendIdx["should:return:"]=6;
  49250. $self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  49251. $ctx1.sendIdx["should:return:"]=7;
  49252. $self._should_return_("foo ^ #hello","hello");
  49253. $ctx1.sendIdx["should:return:"]=8;
  49254. $self._should_return_("foo ^ $h","h");
  49255. $ctx1.sendIdx["should:return:"]=9;
  49256. $self._should_return_("foo ^ -123.456",(-123.456));
  49257. $ctx1.sendIdx["should:return:"]=10;
  49258. $self._should_return_("foo ^ -2.5e4",(-25000));
  49259. return self;
  49260. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  49261. },
  49262. args: [],
  49263. 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.",
  49264. referencedClasses: [],
  49265. messageSends: ["should:return:"]
  49266. }),
  49267. $globals.CodeGeneratorTest);
  49268. $core.addMethod(
  49269. $core.method({
  49270. selector: "testLocalReturn",
  49271. protocol: "tests",
  49272. fn: function (){
  49273. var self=this,$self=this;
  49274. return $core.withContext(function($ctx1) {
  49275. $self._should_return_("foo ^ 1",(1));
  49276. $ctx1.sendIdx["should:return:"]=1;
  49277. $self._should_return_("foo ^ 1 + 1",(2));
  49278. $ctx1.sendIdx["should:return:"]=2;
  49279. $self._should_return_("foo ",$self["@receiver"]);
  49280. $ctx1.sendIdx["should:return:"]=3;
  49281. $self._should_return_("foo self asString",$self["@receiver"]);
  49282. $ctx1.sendIdx["should:return:"]=4;
  49283. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  49284. return self;
  49285. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  49286. },
  49287. args: [],
  49288. 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",
  49289. referencedClasses: [],
  49290. messageSends: ["should:return:"]
  49291. }),
  49292. $globals.CodeGeneratorTest);
  49293. $core.addMethod(
  49294. $core.method({
  49295. selector: "testMessageSends",
  49296. protocol: "tests",
  49297. fn: function (){
  49298. var self=this,$self=this;
  49299. return $core.withContext(function($ctx1) {
  49300. $self._should_return_("foo ^ 1 asString","1");
  49301. $ctx1.sendIdx["should:return:"]=1;
  49302. $self._should_return_("foo ^ 1 + 1",(2));
  49303. $ctx1.sendIdx["should:return:"]=2;
  49304. $self._should_return_("foo ^ 1 + 2 * 3",(9));
  49305. $ctx1.sendIdx["should:return:"]=3;
  49306. $self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  49307. $ctx1.sendIdx["should:return:"]=4;
  49308. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  49309. return self;
  49310. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  49311. },
  49312. args: [],
  49313. 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)",
  49314. referencedClasses: [],
  49315. messageSends: ["should:return:"]
  49316. }),
  49317. $globals.CodeGeneratorTest);
  49318. $core.addMethod(
  49319. $core.method({
  49320. selector: "testMistypedPragmaJSStatement",
  49321. protocol: "tests",
  49322. fn: function (){
  49323. var self=this,$self=this;
  49324. return $core.withContext(function($ctx1) {
  49325. $self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",$self["@receiver"],$globals.ParseError);
  49326. return self;
  49327. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49328. },
  49329. args: [],
  49330. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  49331. referencedClasses: ["ParseError"],
  49332. messageSends: ["should:receiver:raise:"]
  49333. }),
  49334. $globals.CodeGeneratorTest);
  49335. $core.addMethod(
  49336. $core.method({
  49337. selector: "testMultipleSequences",
  49338. protocol: "tests",
  49339. fn: function (){
  49340. var self=this,$self=this;
  49341. return $core.withContext(function($ctx1) {
  49342. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  49343. return self;
  49344. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  49345. },
  49346. args: [],
  49347. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  49348. referencedClasses: [],
  49349. messageSends: ["should:return:"]
  49350. }),
  49351. $globals.CodeGeneratorTest);
  49352. $core.addMethod(
  49353. $core.method({
  49354. selector: "testMutableLiterals",
  49355. protocol: "tests",
  49356. fn: function (){
  49357. var self=this,$self=this;
  49358. return $core.withContext(function($ctx1) {
  49359. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  49360. return self;
  49361. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  49362. },
  49363. args: [],
  49364. 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)",
  49365. referencedClasses: [],
  49366. messageSends: ["should:return:"]
  49367. }),
  49368. $globals.CodeGeneratorTest);
  49369. $core.addMethod(
  49370. $core.method({
  49371. selector: "testNestedIfTrue",
  49372. protocol: "tests",
  49373. fn: function (){
  49374. var self=this,$self=this;
  49375. return $core.withContext(function($ctx1) {
  49376. $self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  49377. $ctx1.sendIdx["should:return:"]=1;
  49378. $self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  49379. $ctx1.sendIdx["should:return:"]=2;
  49380. $self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  49381. $ctx1.sendIdx["should:return:"]=3;
  49382. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self["@receiver"]);
  49383. return self;
  49384. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  49385. },
  49386. args: [],
  49387. 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.",
  49388. referencedClasses: [],
  49389. messageSends: ["should:return:"]
  49390. }),
  49391. $globals.CodeGeneratorTest);
  49392. $core.addMethod(
  49393. $core.method({
  49394. selector: "testNestedSends",
  49395. protocol: "tests",
  49396. fn: function (){
  49397. var self=this,$self=this;
  49398. return $core.withContext(function($ctx1) {
  49399. $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());
  49400. return self;
  49401. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  49402. },
  49403. args: [],
  49404. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  49405. referencedClasses: ["Point"],
  49406. messageSends: ["should:return:", "asString", "x:y:", "@"]
  49407. }),
  49408. $globals.CodeGeneratorTest);
  49409. $core.addMethod(
  49410. $core.method({
  49411. selector: "testNonLocalReturn",
  49412. protocol: "tests",
  49413. fn: function (){
  49414. var self=this,$self=this;
  49415. return $core.withContext(function($ctx1) {
  49416. $self._should_return_("foo [ ^ 1 ] value",(1));
  49417. $ctx1.sendIdx["should:return:"]=1;
  49418. $self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  49419. $ctx1.sendIdx["should:return:"]=2;
  49420. $self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  49421. $ctx1.sendIdx["should:return:"]=3;
  49422. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  49423. return self;
  49424. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  49425. },
  49426. args: [],
  49427. 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",
  49428. referencedClasses: [],
  49429. messageSends: ["should:return:"]
  49430. }),
  49431. $globals.CodeGeneratorTest);
  49432. $core.addMethod(
  49433. $core.method({
  49434. selector: "testPascalCaseGlobal",
  49435. protocol: "tests",
  49436. fn: function (){
  49437. var self=this,$self=this;
  49438. return $core.withContext(function($ctx1) {
  49439. $self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  49440. $ctx1.sendIdx["should:return:"]=1;
  49441. $self._should_return_("foo ^NonExistent",nil);
  49442. return self;
  49443. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  49444. },
  49445. args: [],
  49446. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  49447. referencedClasses: ["Smalltalk"],
  49448. messageSends: ["should:return:", "at:", "globals"]
  49449. }),
  49450. $globals.CodeGeneratorTest);
  49451. $core.addMethod(
  49452. $core.method({
  49453. selector: "testPragmaInBlock",
  49454. protocol: "tests",
  49455. fn: function (){
  49456. var self=this,$self=this;
  49457. return $core.withContext(function($ctx1) {
  49458. $self._should_receiver_raise_("foo ^ [ < fooBar > 4 ] value",$self["@receiver"],$globals.CompilerError);
  49459. return self;
  49460. }, function($ctx1) {$ctx1.fill(self,"testPragmaInBlock",{},$globals.CodeGeneratorTest)});
  49461. },
  49462. args: [],
  49463. source: "testPragmaInBlock\x0a\x09self should: 'foo ^ [ < fooBar > 4 ] value' receiver: receiver raise: CompilerError",
  49464. referencedClasses: ["CompilerError"],
  49465. messageSends: ["should:receiver:raise:"]
  49466. }),
  49467. $globals.CodeGeneratorTest);
  49468. $core.addMethod(
  49469. $core.method({
  49470. selector: "testPragmaJSStatement",
  49471. protocol: "tests",
  49472. fn: function (){
  49473. var self=this,$self=this;
  49474. return $core.withContext(function($ctx1) {
  49475. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  49476. return self;
  49477. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49478. },
  49479. args: [],
  49480. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  49481. referencedClasses: [],
  49482. messageSends: ["should:return:"]
  49483. }),
  49484. $globals.CodeGeneratorTest);
  49485. $core.addMethod(
  49486. $core.method({
  49487. selector: "testRootSuperSend",
  49488. protocol: "tests",
  49489. fn: function (){
  49490. var self=this,$self=this;
  49491. return $core.withContext(function($ctx1) {
  49492. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  49493. return self;
  49494. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  49495. },
  49496. args: [],
  49497. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  49498. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  49499. messageSends: ["should:receiver:raise:", "new"]
  49500. }),
  49501. $globals.CodeGeneratorTest);
  49502. $core.addMethod(
  49503. $core.method({
  49504. selector: "testSendReceiverAndArgumentsOrdered",
  49505. protocol: "tests",
  49506. fn: function (){
  49507. var self=this,$self=this;
  49508. return $core.withContext(function($ctx1) {
  49509. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  49510. $ctx1.sendIdx["should:return:"]=1;
  49511. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  49512. return self;
  49513. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  49514. },
  49515. args: [],
  49516. 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}.",
  49517. referencedClasses: ["Array"],
  49518. messageSends: ["should:return:"]
  49519. }),
  49520. $globals.CodeGeneratorTest);
  49521. $core.addMethod(
  49522. $core.method({
  49523. selector: "testSuperSend",
  49524. protocol: "tests",
  49525. fn: function (){
  49526. var self=this,$self=this;
  49527. return $core.withContext(function($ctx1) {
  49528. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  49529. return self;
  49530. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  49531. },
  49532. args: [],
  49533. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  49534. referencedClasses: [],
  49535. messageSends: ["should:receiver:return:"]
  49536. }),
  49537. $globals.CodeGeneratorTest);
  49538. $core.addMethod(
  49539. $core.method({
  49540. selector: "testTempVariables",
  49541. protocol: "tests",
  49542. fn: function (){
  49543. var self=this,$self=this;
  49544. return $core.withContext(function($ctx1) {
  49545. $self._should_return_("foo | a | ^ a",nil);
  49546. $ctx1.sendIdx["should:return:"]=1;
  49547. $self._should_return_("foo | AVariable | ^ AVariable",nil);
  49548. $ctx1.sendIdx["should:return:"]=2;
  49549. $self._should_return_("foo | a b c | ^ c",nil);
  49550. $ctx1.sendIdx["should:return:"]=3;
  49551. $self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  49552. $ctx1.sendIdx["should:return:"]=4;
  49553. $self._should_return_("foo | a | a:= 1. ^ a",(1));
  49554. $ctx1.sendIdx["should:return:"]=5;
  49555. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  49556. return self;
  49557. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  49558. },
  49559. args: [],
  49560. 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.",
  49561. referencedClasses: [],
  49562. messageSends: ["should:return:"]
  49563. }),
  49564. $globals.CodeGeneratorTest);
  49565. $core.addMethod(
  49566. $core.method({
  49567. selector: "testThisContext",
  49568. protocol: "tests",
  49569. fn: function (){
  49570. var self=this,$self=this;
  49571. return $core.withContext(function($ctx1) {
  49572. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  49573. return self;
  49574. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  49575. },
  49576. args: [],
  49577. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  49578. referencedClasses: [],
  49579. messageSends: ["should:return:"]
  49580. }),
  49581. $globals.CodeGeneratorTest);
  49582. $core.addMethod(
  49583. $core.method({
  49584. selector: "testUnknownPragma",
  49585. protocol: "tests",
  49586. fn: function (){
  49587. var self=this,$self=this;
  49588. return $core.withContext(function($ctx1) {
  49589. $self._should_return_("foo < fooBar: 'return 2+3' > | x | ^ x := 6",(6));
  49590. $ctx1.sendIdx["should:return:"]=1;
  49591. $self._should_return_("foo | x | < fooBar: 'return 2+3' > ^ x := 6",(6));
  49592. return self;
  49593. }, function($ctx1) {$ctx1.fill(self,"testUnknownPragma",{},$globals.CodeGeneratorTest)});
  49594. },
  49595. args: [],
  49596. source: "testUnknownPragma\x0a\x09self should: 'foo < fooBar: ''return 2+3'' > | x | ^ x := 6' return: 6.\x0a\x09self should: 'foo | x | < fooBar: ''return 2+3'' > ^ x := 6' return: 6",
  49597. referencedClasses: [],
  49598. messageSends: ["should:return:"]
  49599. }),
  49600. $globals.CodeGeneratorTest);
  49601. $core.addMethod(
  49602. $core.method({
  49603. selector: "testifFalse",
  49604. protocol: "tests",
  49605. fn: function (){
  49606. var self=this,$self=this;
  49607. return $core.withContext(function($ctx1) {
  49608. $self._should_return_("foo true ifFalse: [ ^ 1 ]",$self["@receiver"]);
  49609. $ctx1.sendIdx["should:return:"]=1;
  49610. $self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  49611. $ctx1.sendIdx["should:return:"]=2;
  49612. $self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  49613. $ctx1.sendIdx["should:return:"]=3;
  49614. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  49615. return self;
  49616. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  49617. },
  49618. args: [],
  49619. 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.",
  49620. referencedClasses: [],
  49621. messageSends: ["should:return:"]
  49622. }),
  49623. $globals.CodeGeneratorTest);
  49624. $core.addMethod(
  49625. $core.method({
  49626. selector: "testifFalseIfTrue",
  49627. protocol: "tests",
  49628. fn: function (){
  49629. var self=this,$self=this;
  49630. return $core.withContext(function($ctx1) {
  49631. $self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  49632. $ctx1.sendIdx["should:return:"]=1;
  49633. $self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  49634. $ctx1.sendIdx["should:return:"]=2;
  49635. $self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  49636. $ctx1.sendIdx["should:return:"]=3;
  49637. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  49638. return self;
  49639. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  49640. },
  49641. args: [],
  49642. 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.",
  49643. referencedClasses: [],
  49644. messageSends: ["should:return:"]
  49645. }),
  49646. $globals.CodeGeneratorTest);
  49647. $core.addMethod(
  49648. $core.method({
  49649. selector: "testifNil",
  49650. protocol: "tests",
  49651. fn: function (){
  49652. var self=this,$self=this;
  49653. return $core.withContext(function($ctx1) {
  49654. $self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  49655. $ctx1.sendIdx["should:return:"]=1;
  49656. $self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  49657. $ctx1.sendIdx["should:return:"]=2;
  49658. $self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self["@receiver"]);
  49659. $ctx1.sendIdx["should:return:"]=3;
  49660. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  49661. return self;
  49662. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  49663. },
  49664. args: [],
  49665. 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.",
  49666. referencedClasses: [],
  49667. messageSends: ["should:return:"]
  49668. }),
  49669. $globals.CodeGeneratorTest);
  49670. $core.addMethod(
  49671. $core.method({
  49672. selector: "testifNilIfNotNil",
  49673. protocol: "tests",
  49674. fn: function (){
  49675. var self=this,$self=this;
  49676. return $core.withContext(function($ctx1) {
  49677. $self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  49678. $ctx1.sendIdx["should:return:"]=1;
  49679. $self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  49680. $ctx1.sendIdx["should:return:"]=2;
  49681. $self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  49682. $ctx1.sendIdx["should:return:"]=3;
  49683. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  49684. return self;
  49685. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  49686. },
  49687. args: [],
  49688. 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.",
  49689. referencedClasses: [],
  49690. messageSends: ["should:return:"]
  49691. }),
  49692. $globals.CodeGeneratorTest);
  49693. $core.addMethod(
  49694. $core.method({
  49695. selector: "testifNotNil",
  49696. protocol: "tests",
  49697. fn: function (){
  49698. var self=this,$self=this;
  49699. return $core.withContext(function($ctx1) {
  49700. $self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  49701. $ctx1.sendIdx["should:return:"]=1;
  49702. $self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  49703. $ctx1.sendIdx["should:return:"]=2;
  49704. $self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  49705. $ctx1.sendIdx["should:return:"]=3;
  49706. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self["@receiver"]);
  49707. return self;
  49708. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  49709. },
  49710. args: [],
  49711. 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.",
  49712. referencedClasses: [],
  49713. messageSends: ["should:return:"]
  49714. }),
  49715. $globals.CodeGeneratorTest);
  49716. $core.addMethod(
  49717. $core.method({
  49718. selector: "testifNotNilWithArgument",
  49719. protocol: "tests",
  49720. fn: function (){
  49721. var self=this,$self=this;
  49722. return $core.withContext(function($ctx1) {
  49723. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  49724. $ctx1.sendIdx["should:return:"]=1;
  49725. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  49726. $ctx1.sendIdx["should:return:"]=2;
  49727. $self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  49728. $ctx1.sendIdx["should:return:"]=3;
  49729. $self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  49730. $ctx1.sendIdx["should:return:"]=4;
  49731. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  49732. $ctx1.sendIdx["should:return:"]=5;
  49733. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  49734. return self;
  49735. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  49736. },
  49737. args: [],
  49738. 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",
  49739. referencedClasses: [],
  49740. messageSends: ["should:return:"]
  49741. }),
  49742. $globals.CodeGeneratorTest);
  49743. $core.addMethod(
  49744. $core.method({
  49745. selector: "testifTrue",
  49746. protocol: "tests",
  49747. fn: function (){
  49748. var self=this,$self=this;
  49749. return $core.withContext(function($ctx1) {
  49750. $self._should_return_("foo false ifTrue: [ ^ 1 ]",$self["@receiver"]);
  49751. $ctx1.sendIdx["should:return:"]=1;
  49752. $self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  49753. $ctx1.sendIdx["should:return:"]=2;
  49754. $self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  49755. $ctx1.sendIdx["should:return:"]=3;
  49756. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  49757. return self;
  49758. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  49759. },
  49760. args: [],
  49761. 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.",
  49762. referencedClasses: [],
  49763. messageSends: ["should:return:"]
  49764. }),
  49765. $globals.CodeGeneratorTest);
  49766. $core.addMethod(
  49767. $core.method({
  49768. selector: "testifTrueIfFalse",
  49769. protocol: "tests",
  49770. fn: function (){
  49771. var self=this,$self=this;
  49772. return $core.withContext(function($ctx1) {
  49773. $self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  49774. $ctx1.sendIdx["should:return:"]=1;
  49775. $self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  49776. $ctx1.sendIdx["should:return:"]=2;
  49777. $self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  49778. $ctx1.sendIdx["should:return:"]=3;
  49779. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  49780. return self;
  49781. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  49782. },
  49783. args: [],
  49784. 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.",
  49785. referencedClasses: [],
  49786. messageSends: ["should:return:"]
  49787. }),
  49788. $globals.CodeGeneratorTest);
  49789. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49790. $core.addMethod(
  49791. $core.method({
  49792. selector: "interpret:receiver:withArguments:",
  49793. protocol: "private",
  49794. fn: function (aString,anObject,aDictionary){
  49795. var self=this,$self=this;
  49796. var ctx,ast,interpreter;
  49797. return $core.withContext(function($ctx1) {
  49798. var $1,$2,$3,$receiver;
  49799. interpreter=$recv($globals.ASTInterpreter)._new();
  49800. $ctx1.sendIdx["new"]=1;
  49801. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49802. $1=$recv($globals.AIContext)._new();
  49803. $recv($1)._receiver_(anObject);
  49804. $recv($1)._interpreter_(interpreter);
  49805. ctx=$recv($1)._yourself();
  49806. $2=$recv(ast)._sequenceNode();
  49807. if(($receiver = $2) == null || $receiver.a$nil){
  49808. $2;
  49809. } else {
  49810. var sequence;
  49811. sequence=$receiver;
  49812. $recv($recv(sequence)._temps())._do_((function(each){
  49813. return $core.withContext(function($ctx2) {
  49814. return $recv(ctx)._defineLocal_(each);
  49815. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49816. }));
  49817. }
  49818. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49819. return $core.withContext(function($ctx2) {
  49820. return $recv(ctx)._localAt_put_(key,value);
  49821. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49822. }));
  49823. $3=interpreter;
  49824. $recv($3)._context_(ctx);
  49825. $recv($3)._node_(ast);
  49826. $recv($3)._enterNode();
  49827. $recv($3)._proceed();
  49828. return $recv($3)._result();
  49829. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  49830. },
  49831. args: ["aString", "anObject", "aDictionary"],
  49832. 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",
  49833. referencedClasses: ["ASTInterpreter", "AIContext"],
  49834. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  49835. }),
  49836. $globals.ASTInterpreterTest);
  49837. $core.addMethod(
  49838. $core.method({
  49839. selector: "should:receiver:return:",
  49840. protocol: "testing",
  49841. fn: function (aString,anObject,aResult){
  49842. var self=this,$self=this;
  49843. return $core.withContext(function($ctx1) {
  49844. $self["@receiver"]=anObject;
  49845. return $self._assert_equals_($self._interpret_receiver_withArguments_(aString,$self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  49846. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  49847. },
  49848. args: ["aString", "anObject", "aResult"],
  49849. 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",
  49850. referencedClasses: [],
  49851. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  49852. }),
  49853. $globals.ASTInterpreterTest);
  49854. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  49855. $core.addMethod(
  49856. $core.method({
  49857. selector: "interpret:receiver:withArguments:",
  49858. protocol: "private",
  49859. fn: function (aString,anObject,aDictionary){
  49860. var self=this,$self=this;
  49861. var ctx,ast,debugger_;
  49862. return $core.withContext(function($ctx1) {
  49863. var $1,$2,$3,$4,$5,$receiver;
  49864. $1=$recv($globals.AIContext)._new();
  49865. $ctx1.sendIdx["new"]=1;
  49866. $recv($1)._receiver_(anObject);
  49867. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  49868. ctx=$recv($1)._yourself();
  49869. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49870. $2=$recv(ast)._sequenceNode();
  49871. if(($receiver = $2) == null || $receiver.a$nil){
  49872. $2;
  49873. } else {
  49874. var sequence;
  49875. sequence=$receiver;
  49876. $recv($recv(sequence)._temps())._do_((function(each){
  49877. return $core.withContext(function($ctx2) {
  49878. return $recv(ctx)._defineLocal_(each);
  49879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49880. }));
  49881. }
  49882. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49883. return $core.withContext(function($ctx2) {
  49884. return $recv(ctx)._localAt_put_(key,value);
  49885. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49886. }));
  49887. $3=$recv(ctx)._interpreter();
  49888. $ctx1.sendIdx["interpreter"]=1;
  49889. $recv($3)._context_(ctx);
  49890. $ctx1.sendIdx["context:"]=1;
  49891. $4=$recv(ctx)._interpreter();
  49892. $recv($4)._node_(ast);
  49893. $recv($4)._enterNode();
  49894. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  49895. $5=debugger_;
  49896. $recv($5)._proceed();
  49897. return $recv($5)._result();
  49898. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  49899. },
  49900. args: ["aString", "anObject", "aDictionary"],
  49901. 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",
  49902. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  49903. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  49904. }),
  49905. $globals.ASTDebuggerTest);
  49906. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49907. $core.addMethod(
  49908. $core.method({
  49909. selector: "codeGeneratorClass",
  49910. protocol: "accessing",
  49911. fn: function (){
  49912. var self=this,$self=this;
  49913. return $globals.InliningCodeGenerator;
  49914. },
  49915. args: [],
  49916. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  49917. referencedClasses: ["InliningCodeGenerator"],
  49918. messageSends: []
  49919. }),
  49920. $globals.InliningCodeGeneratorTest);
  49921. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  49922. $core.addMethod(
  49923. $core.method({
  49924. selector: "testClassRefVar",
  49925. protocol: "tests",
  49926. fn: function (){
  49927. var self=this,$self=this;
  49928. var node;
  49929. return $core.withContext(function($ctx1) {
  49930. var $1,$2;
  49931. $1=$recv($globals.VariableNode)._new();
  49932. $ctx1.sendIdx["new"]=1;
  49933. $recv($1)._value_("Object");
  49934. node=$recv($1)._yourself();
  49935. $2=$recv($globals.SemanticAnalyzer)._new();
  49936. $ctx1.sendIdx["new"]=2;
  49937. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  49938. $recv($2)._visit_(node);
  49939. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  49940. return self;
  49941. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  49942. },
  49943. args: [],
  49944. 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",
  49945. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  49946. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  49947. }),
  49948. $globals.ScopeVarTest);
  49949. $core.addMethod(
  49950. $core.method({
  49951. selector: "testInstanceVar",
  49952. protocol: "tests",
  49953. fn: function (){
  49954. var self=this,$self=this;
  49955. var node,scope;
  49956. return $core.withContext(function($ctx1) {
  49957. var $1;
  49958. $1=$recv($globals.VariableNode)._new();
  49959. $ctx1.sendIdx["new"]=1;
  49960. $recv($1)._value_("bzzz");
  49961. node=$recv($1)._yourself();
  49962. scope=$recv($globals.MethodLexicalScope)._new();
  49963. $recv(scope)._addIVar_("bzzz");
  49964. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  49965. return self;
  49966. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  49967. },
  49968. args: [],
  49969. 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",
  49970. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49971. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  49972. }),
  49973. $globals.ScopeVarTest);
  49974. $core.addMethod(
  49975. $core.method({
  49976. selector: "testPseudoVar",
  49977. protocol: "tests",
  49978. fn: function (){
  49979. var self=this,$self=this;
  49980. var node,pseudoVars;
  49981. return $core.withContext(function($ctx1) {
  49982. var $1;
  49983. pseudoVars=["self", "super", "true", "false", "nil"];
  49984. $recv(pseudoVars)._do_((function(each){
  49985. return $core.withContext(function($ctx2) {
  49986. $1=$recv($globals.VariableNode)._new();
  49987. $ctx2.sendIdx["new"]=1;
  49988. $recv($1)._value_(each);
  49989. node=$recv($1)._yourself();
  49990. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  49991. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49992. }));
  49993. return self;
  49994. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  49995. },
  49996. args: [],
  49997. 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]",
  49998. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49999. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  50000. }),
  50001. $globals.ScopeVarTest);
  50002. $core.addMethod(
  50003. $core.method({
  50004. selector: "testTempVar",
  50005. protocol: "tests",
  50006. fn: function (){
  50007. var self=this,$self=this;
  50008. var node,scope;
  50009. return $core.withContext(function($ctx1) {
  50010. var $1;
  50011. $1=$recv($globals.VariableNode)._new();
  50012. $ctx1.sendIdx["new"]=1;
  50013. $recv($1)._value_("bzzz");
  50014. node=$recv($1)._yourself();
  50015. scope=$recv($globals.MethodLexicalScope)._new();
  50016. $recv(scope)._addTemp_("bzzz");
  50017. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  50018. return self;
  50019. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  50020. },
  50021. args: [],
  50022. 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",
  50023. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50024. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  50025. }),
  50026. $globals.ScopeVarTest);
  50027. $core.addMethod(
  50028. $core.method({
  50029. selector: "testUnknownVar",
  50030. protocol: "tests",
  50031. fn: function (){
  50032. var self=this,$self=this;
  50033. var node;
  50034. return $core.withContext(function($ctx1) {
  50035. var $1;
  50036. $1=$recv($globals.VariableNode)._new();
  50037. $ctx1.sendIdx["new"]=1;
  50038. $recv($1)._value_("bzzz");
  50039. node=$recv($1)._yourself();
  50040. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  50041. return self;
  50042. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  50043. },
  50044. args: [],
  50045. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  50046. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50047. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  50048. }),
  50049. $globals.ScopeVarTest);
  50050. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  50051. $core.addMethod(
  50052. $core.method({
  50053. selector: "setUp",
  50054. protocol: "running",
  50055. fn: function (){
  50056. var self=this,$self=this;
  50057. return $core.withContext(function($ctx1) {
  50058. $self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  50059. return self;
  50060. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  50061. },
  50062. args: [],
  50063. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  50064. referencedClasses: ["SemanticAnalyzer", "Object"],
  50065. messageSends: ["on:"]
  50066. }),
  50067. $globals.SemanticAnalyzerTest);
  50068. $core.addMethod(
  50069. $core.method({
  50070. selector: "testAssignment",
  50071. protocol: "tests",
  50072. fn: function (){
  50073. var self=this,$self=this;
  50074. var src,ast;
  50075. return $core.withContext(function($ctx1) {
  50076. src="foo self := 1";
  50077. ast=$recv($globals.Smalltalk)._parse_(src);
  50078. $self._should_raise_((function(){
  50079. return $core.withContext(function($ctx2) {
  50080. return $recv($self["@analyzer"])._visit_(ast);
  50081. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50082. }),$globals.InvalidAssignmentError);
  50083. return self;
  50084. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50085. },
  50086. args: [],
  50087. 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",
  50088. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  50089. messageSends: ["parse:", "should:raise:", "visit:"]
  50090. }),
  50091. $globals.SemanticAnalyzerTest);
  50092. $core.addMethod(
  50093. $core.method({
  50094. selector: "testNonLocalReturn",
  50095. protocol: "tests",
  50096. fn: function (){
  50097. var self=this,$self=this;
  50098. var src,ast;
  50099. return $core.withContext(function($ctx1) {
  50100. src="foo | a | a + 1. ^ a";
  50101. ast=$recv($globals.Smalltalk)._parse_(src);
  50102. $recv($self["@analyzer"])._visit_(ast);
  50103. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50104. return self;
  50105. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50106. },
  50107. args: [],
  50108. 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",
  50109. referencedClasses: ["Smalltalk"],
  50110. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  50111. }),
  50112. $globals.SemanticAnalyzerTest);
  50113. $core.addMethod(
  50114. $core.method({
  50115. selector: "testNonLocalReturn2",
  50116. protocol: "tests",
  50117. fn: function (){
  50118. var self=this,$self=this;
  50119. var src,ast;
  50120. return $core.withContext(function($ctx1) {
  50121. src="foo | a | a + 1. [ [ ^ a] ]";
  50122. ast=$recv($globals.Smalltalk)._parse_(src);
  50123. $recv($self["@analyzer"])._visit_(ast);
  50124. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50125. return self;
  50126. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50127. },
  50128. args: [],
  50129. 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",
  50130. referencedClasses: ["Smalltalk"],
  50131. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  50132. }),
  50133. $globals.SemanticAnalyzerTest);
  50134. $core.addMethod(
  50135. $core.method({
  50136. selector: "testScope",
  50137. protocol: "tests",
  50138. fn: function (){
  50139. var self=this,$self=this;
  50140. var src,ast;
  50141. return $core.withContext(function($ctx1) {
  50142. var $4,$3,$2,$1;
  50143. src="foo | a | a + 1. [ | b | b := a ]";
  50144. ast=$recv($globals.Smalltalk)._parse_(src);
  50145. $recv($self["@analyzer"])._visit_(ast);
  50146. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50147. $ctx1.sendIdx["dagChildren"]=1;
  50148. $3=$recv($4)._last();
  50149. $2=$recv($3)._scope();
  50150. $ctx1.sendIdx["scope"]=1;
  50151. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50152. $self._deny_($1);
  50153. return self;
  50154. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50155. },
  50156. args: [],
  50157. 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.",
  50158. referencedClasses: ["Smalltalk"],
  50159. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  50160. }),
  50161. $globals.SemanticAnalyzerTest);
  50162. $core.addMethod(
  50163. $core.method({
  50164. selector: "testScope2",
  50165. protocol: "tests",
  50166. fn: function (){
  50167. var self=this,$self=this;
  50168. var src,ast;
  50169. return $core.withContext(function($ctx1) {
  50170. var $8,$7,$6,$5,$4,$3,$2,$1;
  50171. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50172. ast=$recv($globals.Smalltalk)._parse_(src);
  50173. $recv($self["@analyzer"])._visit_(ast);
  50174. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50175. $ctx1.sendIdx["dagChildren"]=3;
  50176. $7=$recv($8)._last();
  50177. $6=$recv($7)._dagChildren();
  50178. $ctx1.sendIdx["dagChildren"]=2;
  50179. $5=$recv($6)._first();
  50180. $ctx1.sendIdx["first"]=2;
  50181. $4=$recv($5)._dagChildren();
  50182. $ctx1.sendIdx["dagChildren"]=1;
  50183. $3=$recv($4)._first();
  50184. $ctx1.sendIdx["first"]=1;
  50185. $2=$recv($3)._scope();
  50186. $ctx1.sendIdx["scope"]=1;
  50187. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50188. $self._deny_($1);
  50189. return self;
  50190. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50191. },
  50192. args: [],
  50193. 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.",
  50194. referencedClasses: ["Smalltalk"],
  50195. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  50196. }),
  50197. $globals.SemanticAnalyzerTest);
  50198. $core.addMethod(
  50199. $core.method({
  50200. selector: "testScopeLevel",
  50201. protocol: "tests",
  50202. fn: function (){
  50203. var self=this,$self=this;
  50204. var src,ast;
  50205. return $core.withContext(function($ctx1) {
  50206. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  50207. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50208. ast=$recv($globals.Smalltalk)._parse_(src);
  50209. $recv($self["@analyzer"])._visit_(ast);
  50210. $2=$recv(ast)._scope();
  50211. $ctx1.sendIdx["scope"]=1;
  50212. $1=$recv($2)._scopeLevel();
  50213. $ctx1.sendIdx["scopeLevel"]=1;
  50214. $self._assert_equals_($1,(1));
  50215. $ctx1.sendIdx["assert:equals:"]=1;
  50216. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50217. $ctx1.sendIdx["dagChildren"]=3;
  50218. $9=$recv($10)._last();
  50219. $8=$recv($9)._dagChildren();
  50220. $ctx1.sendIdx["dagChildren"]=2;
  50221. $7=$recv($8)._first();
  50222. $ctx1.sendIdx["first"]=2;
  50223. $6=$recv($7)._dagChildren();
  50224. $ctx1.sendIdx["dagChildren"]=1;
  50225. $5=$recv($6)._first();
  50226. $ctx1.sendIdx["first"]=1;
  50227. $4=$recv($5)._scope();
  50228. $3=$recv($4)._scopeLevel();
  50229. $self._assert_equals_($3,(3));
  50230. return self;
  50231. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50232. },
  50233. args: [],
  50234. 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",
  50235. referencedClasses: ["Smalltalk"],
  50236. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  50237. }),
  50238. $globals.SemanticAnalyzerTest);
  50239. $core.addMethod(
  50240. $core.method({
  50241. selector: "testUnknownVariables",
  50242. protocol: "tests",
  50243. fn: function (){
  50244. var self=this,$self=this;
  50245. var src,ast;
  50246. return $core.withContext(function($ctx1) {
  50247. src="foo | a | b + a";
  50248. ast=$recv($globals.Smalltalk)._parse_(src);
  50249. $self._should_raise_((function(){
  50250. return $core.withContext(function($ctx2) {
  50251. return $recv($self["@analyzer"])._visit_(ast);
  50252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50253. }),$globals.UnknownVariableError);
  50254. return self;
  50255. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50256. },
  50257. args: [],
  50258. 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",
  50259. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50260. messageSends: ["parse:", "should:raise:", "visit:"]
  50261. }),
  50262. $globals.SemanticAnalyzerTest);
  50263. $core.addMethod(
  50264. $core.method({
  50265. selector: "testUnknownVariablesWithScope",
  50266. protocol: "tests",
  50267. fn: function (){
  50268. var self=this,$self=this;
  50269. var src,ast;
  50270. return $core.withContext(function($ctx1) {
  50271. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  50272. ast=$recv($globals.Smalltalk)._parse_(src);
  50273. $self._should_raise_((function(){
  50274. return $core.withContext(function($ctx2) {
  50275. return $recv($self["@analyzer"])._visit_(ast);
  50276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50277. }),$globals.UnknownVariableError);
  50278. return self;
  50279. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50280. },
  50281. args: [],
  50282. 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",
  50283. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50284. messageSends: ["parse:", "should:raise:", "visit:"]
  50285. }),
  50286. $globals.SemanticAnalyzerTest);
  50287. $core.addMethod(
  50288. $core.method({
  50289. selector: "testVariableShadowing",
  50290. protocol: "tests",
  50291. fn: function (){
  50292. var self=this,$self=this;
  50293. var src,ast;
  50294. return $core.withContext(function($ctx1) {
  50295. src="foo | a | a + 1";
  50296. ast=$recv($globals.Smalltalk)._parse_(src);
  50297. $recv($self["@analyzer"])._visit_(ast);
  50298. return self;
  50299. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50300. },
  50301. args: [],
  50302. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50303. referencedClasses: ["Smalltalk"],
  50304. messageSends: ["parse:", "visit:"]
  50305. }),
  50306. $globals.SemanticAnalyzerTest);
  50307. $core.addMethod(
  50308. $core.method({
  50309. selector: "testVariableShadowing2",
  50310. protocol: "tests",
  50311. fn: function (){
  50312. var self=this,$self=this;
  50313. var src,ast;
  50314. return $core.withContext(function($ctx1) {
  50315. src="foo | a | a + 1. [ | a | a := 2 ]";
  50316. ast=$recv($globals.Smalltalk)._parse_(src);
  50317. $self._should_raise_((function(){
  50318. return $core.withContext(function($ctx2) {
  50319. return $recv($self["@analyzer"])._visit_(ast);
  50320. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50321. }),$globals.ShadowingVariableError);
  50322. return self;
  50323. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50324. },
  50325. args: [],
  50326. 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",
  50327. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50328. messageSends: ["parse:", "should:raise:", "visit:"]
  50329. }),
  50330. $globals.SemanticAnalyzerTest);
  50331. $core.addMethod(
  50332. $core.method({
  50333. selector: "testVariableShadowing3",
  50334. protocol: "tests",
  50335. fn: function (){
  50336. var self=this,$self=this;
  50337. var src,ast;
  50338. return $core.withContext(function($ctx1) {
  50339. src="foo | a | a + 1. [ | b | b := 2 ]";
  50340. ast=$recv($globals.Smalltalk)._parse_(src);
  50341. $recv($self["@analyzer"])._visit_(ast);
  50342. return self;
  50343. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50344. },
  50345. args: [],
  50346. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50347. referencedClasses: ["Smalltalk"],
  50348. messageSends: ["parse:", "visit:"]
  50349. }),
  50350. $globals.SemanticAnalyzerTest);
  50351. $core.addMethod(
  50352. $core.method({
  50353. selector: "testVariableShadowing4",
  50354. protocol: "tests",
  50355. fn: function (){
  50356. var self=this,$self=this;
  50357. var src,ast;
  50358. return $core.withContext(function($ctx1) {
  50359. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  50360. ast=$recv($globals.Smalltalk)._parse_(src);
  50361. $recv($self["@analyzer"])._visit_(ast);
  50362. return self;
  50363. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50364. },
  50365. args: [],
  50366. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50367. referencedClasses: ["Smalltalk"],
  50368. messageSends: ["parse:", "visit:"]
  50369. }),
  50370. $globals.SemanticAnalyzerTest);
  50371. $core.addMethod(
  50372. $core.method({
  50373. selector: "testVariableShadowing5",
  50374. protocol: "tests",
  50375. fn: function (){
  50376. var self=this,$self=this;
  50377. var src,ast;
  50378. return $core.withContext(function($ctx1) {
  50379. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  50380. ast=$recv($globals.Smalltalk)._parse_(src);
  50381. $self._should_raise_((function(){
  50382. return $core.withContext(function($ctx2) {
  50383. return $recv($self["@analyzer"])._visit_(ast);
  50384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50385. }),$globals.ShadowingVariableError);
  50386. return self;
  50387. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50388. },
  50389. args: [],
  50390. 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",
  50391. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50392. messageSends: ["parse:", "should:raise:", "visit:"]
  50393. }),
  50394. $globals.SemanticAnalyzerTest);
  50395. $core.addMethod(
  50396. $core.method({
  50397. selector: "testVariablesLookup",
  50398. protocol: "tests",
  50399. fn: function (){
  50400. var self=this,$self=this;
  50401. var src,ast;
  50402. return $core.withContext(function($ctx1) {
  50403. 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;
  50404. src="foo | a | a + 1. [ | b | b := a ]";
  50405. ast=$recv($globals.Smalltalk)._parse_(src);
  50406. $recv($self["@analyzer"])._visit_(ast);
  50407. $7=$recv(ast)._dagChildren();
  50408. $ctx1.sendIdx["dagChildren"]=2;
  50409. $6=$recv($7)._first();
  50410. $ctx1.sendIdx["first"]=2;
  50411. $5=$recv($6)._dagChildren();
  50412. $ctx1.sendIdx["dagChildren"]=1;
  50413. $4=$recv($5)._first();
  50414. $ctx1.sendIdx["first"]=1;
  50415. $3=$recv($4)._receiver();
  50416. $ctx1.sendIdx["receiver"]=1;
  50417. $2=$recv($3)._binding();
  50418. $ctx1.sendIdx["binding"]=1;
  50419. $1=$recv($2)._isTempVar();
  50420. $ctx1.sendIdx["isTempVar"]=1;
  50421. $self._assert_($1);
  50422. $ctx1.sendIdx["assert:"]=1;
  50423. $15=$recv(ast)._dagChildren();
  50424. $ctx1.sendIdx["dagChildren"]=4;
  50425. $14=$recv($15)._first();
  50426. $ctx1.sendIdx["first"]=4;
  50427. $13=$recv($14)._dagChildren();
  50428. $ctx1.sendIdx["dagChildren"]=3;
  50429. $12=$recv($13)._first();
  50430. $ctx1.sendIdx["first"]=3;
  50431. $11=$recv($12)._receiver();
  50432. $10=$recv($11)._binding();
  50433. $ctx1.sendIdx["binding"]=2;
  50434. $9=$recv($10)._scope();
  50435. $ctx1.sendIdx["scope"]=1;
  50436. $16=$recv(ast)._scope();
  50437. $ctx1.sendIdx["scope"]=2;
  50438. $8=$recv($9).__eq_eq($16);
  50439. $ctx1.sendIdx["=="]=1;
  50440. $self._assert_($8);
  50441. $ctx1.sendIdx["assert:"]=2;
  50442. $27=$recv(ast)._dagChildren();
  50443. $ctx1.sendIdx["dagChildren"]=8;
  50444. $26=$recv($27)._first();
  50445. $ctx1.sendIdx["first"]=7;
  50446. $25=$recv($26)._dagChildren();
  50447. $ctx1.sendIdx["dagChildren"]=7;
  50448. $24=$recv($25)._last();
  50449. $ctx1.sendIdx["last"]=1;
  50450. $23=$recv($24)._dagChildren();
  50451. $ctx1.sendIdx["dagChildren"]=6;
  50452. $22=$recv($23)._first();
  50453. $ctx1.sendIdx["first"]=6;
  50454. $21=$recv($22)._dagChildren();
  50455. $ctx1.sendIdx["dagChildren"]=5;
  50456. $20=$recv($21)._first();
  50457. $ctx1.sendIdx["first"]=5;
  50458. $19=$recv($20)._left();
  50459. $ctx1.sendIdx["left"]=1;
  50460. $18=$recv($19)._binding();
  50461. $ctx1.sendIdx["binding"]=3;
  50462. $17=$recv($18)._isTempVar();
  50463. $self._assert_($17);
  50464. $ctx1.sendIdx["assert:"]=3;
  50465. $39=$recv(ast)._dagChildren();
  50466. $ctx1.sendIdx["dagChildren"]=12;
  50467. $38=$recv($39)._first();
  50468. $ctx1.sendIdx["first"]=10;
  50469. $37=$recv($38)._dagChildren();
  50470. $ctx1.sendIdx["dagChildren"]=11;
  50471. $36=$recv($37)._last();
  50472. $ctx1.sendIdx["last"]=2;
  50473. $35=$recv($36)._dagChildren();
  50474. $ctx1.sendIdx["dagChildren"]=10;
  50475. $34=$recv($35)._first();
  50476. $ctx1.sendIdx["first"]=9;
  50477. $33=$recv($34)._dagChildren();
  50478. $ctx1.sendIdx["dagChildren"]=9;
  50479. $32=$recv($33)._first();
  50480. $ctx1.sendIdx["first"]=8;
  50481. $31=$recv($32)._left();
  50482. $30=$recv($31)._binding();
  50483. $29=$recv($30)._scope();
  50484. $ctx1.sendIdx["scope"]=3;
  50485. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50486. $ctx1.sendIdx["dagChildren"]=13;
  50487. $41=$recv($42)._last();
  50488. $40=$recv($41)._scope();
  50489. $28=$recv($29).__eq_eq($40);
  50490. $self._assert_($28);
  50491. return self;
  50492. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50493. },
  50494. args: [],
  50495. 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.",
  50496. referencedClasses: ["Smalltalk"],
  50497. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  50498. }),
  50499. $globals.SemanticAnalyzerTest);
  50500. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  50501. $core.addMethod(
  50502. $core.method({
  50503. selector: "setUp",
  50504. protocol: "running",
  50505. fn: function (){
  50506. var self=this,$self=this;
  50507. return $core.withContext(function($ctx1) {
  50508. var $1,$3,$4,$2;
  50509. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  50510. $3=$recv($globals.AIContext)._new();
  50511. $recv($3)._defineLocal_("local");
  50512. $recv($3)._localAt_put_("local",(3));
  50513. $4=$recv($3)._yourself();
  50514. $ctx1.sendIdx["yourself"]=1;
  50515. $2=$4;
  50516. $recv($1)._context_($2);
  50517. $self["@analyzer"]=$recv($1)._yourself();
  50518. return self;
  50519. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  50520. },
  50521. args: [],
  50522. 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",
  50523. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  50524. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  50525. }),
  50526. $globals.AISemanticAnalyzerTest);
  50527. $core.addMethod(
  50528. $core.method({
  50529. selector: "testContextVariables",
  50530. protocol: "tests",
  50531. fn: function (){
  50532. var self=this,$self=this;
  50533. var src,ast;
  50534. return $core.withContext(function($ctx1) {
  50535. src="foo | a | local + a";
  50536. ast=$recv($globals.Smalltalk)._parse_(src);
  50537. $self._shouldnt_raise_((function(){
  50538. return $core.withContext(function($ctx2) {
  50539. return $recv($self["@analyzer"])._visit_(ast);
  50540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50541. }),$globals.UnknownVariableError);
  50542. return self;
  50543. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  50544. },
  50545. args: [],
  50546. 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",
  50547. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50548. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  50549. }),
  50550. $globals.AISemanticAnalyzerTest);
  50551. });
  50552. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  50553. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  50554. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  50555. $core.addPackage("Kernel-Tests");
  50556. ($core.packageDescriptors||$core.packages)["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  50557. ($core.packageDescriptors||$core.packages)["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  50558. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  50559. $core.addMethod(
  50560. $core.method({
  50561. selector: "testAddExtensionMethod",
  50562. protocol: "tests",
  50563. fn: function (){
  50564. var self=this,$self=this;
  50565. var method,dirty;
  50566. return $core.withContext(function($ctx1) {
  50567. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  50568. $2=$self._class();
  50569. $ctx1.sendIdx["class"]=1;
  50570. $1=$recv($2)._package();
  50571. $ctx1.sendIdx["package"]=1;
  50572. dirty=$recv($1)._isDirty();
  50573. $ctx1.sendIdx["isDirty"]=1;
  50574. $4=$self._class();
  50575. $ctx1.sendIdx["class"]=2;
  50576. $3=$recv($4)._package();
  50577. $ctx1.sendIdx["package"]=2;
  50578. $recv($3)._beClean();
  50579. $5=$self._class();
  50580. $ctx1.sendIdx["class"]=3;
  50581. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  50582. $8=$self._class();
  50583. $ctx1.sendIdx["class"]=4;
  50584. $7=$recv($8)._package();
  50585. $ctx1.sendIdx["package"]=3;
  50586. $6=$recv($7)._isDirty();
  50587. $self._deny_($6);
  50588. $9=$self._class();
  50589. $ctx1.sendIdx["class"]=5;
  50590. $recv($9)._removeCompiledMethod_(method);
  50591. $10=dirty;
  50592. if($core.assert($10)){
  50593. $recv($recv($self._class())._package())._beDirty();
  50594. }
  50595. return self;
  50596. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  50597. },
  50598. args: [],
  50599. 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 ]",
  50600. referencedClasses: [],
  50601. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  50602. }),
  50603. $globals.AnnouncementSubscriptionTest);
  50604. $core.addMethod(
  50605. $core.method({
  50606. selector: "testHandlesAnnouncement",
  50607. protocol: "tests",
  50608. fn: function (){
  50609. var self=this,$self=this;
  50610. var subscription,announcementClass1,announcementClass2,classBuilder;
  50611. return $core.withContext(function($ctx1) {
  50612. var $1,$3,$4,$2,$6,$7,$5;
  50613. classBuilder=$recv($globals.ClassBuilder)._new();
  50614. $ctx1.sendIdx["new"]=1;
  50615. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  50616. $1=$recv($globals.AnnouncementSubscription)._new();
  50617. $ctx1.sendIdx["new"]=2;
  50618. subscription=$recv($1)._announcementClass_($globals.SystemAnnouncement);
  50619. $3=subscription;
  50620. $4=$recv($globals.SystemAnnouncement)._new();
  50621. $ctx1.sendIdx["new"]=3;
  50622. $2=$recv($3)._handlesAnnouncement_($4);
  50623. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  50624. $self._assert_equals_($2,true);
  50625. $ctx1.sendIdx["assert:equals:"]=1;
  50626. $6=subscription;
  50627. $7=$recv(announcementClass1)._new();
  50628. $ctx1.sendIdx["new"]=4;
  50629. $5=$recv($6)._handlesAnnouncement_($7);
  50630. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  50631. $self._assert_equals_($5,true);
  50632. $ctx1.sendIdx["assert:equals:"]=2;
  50633. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($recv($globals.Object)._new()),false);
  50634. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  50635. return self;
  50636. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  50637. },
  50638. args: [],
  50639. 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 new) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1 new) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object new) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  50640. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  50641. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  50642. }),
  50643. $globals.AnnouncementSubscriptionTest);
  50644. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  50645. $core.addMethod(
  50646. $core.method({
  50647. selector: "testOnDo",
  50648. protocol: "tests",
  50649. fn: function (){
  50650. var self=this,$self=this;
  50651. var counter,announcer;
  50652. return $core.withContext(function($ctx1) {
  50653. var $1,$2;
  50654. counter=(0);
  50655. announcer=$recv($globals.Announcer)._new();
  50656. $ctx1.sendIdx["new"]=1;
  50657. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  50658. return $core.withContext(function($ctx2) {
  50659. counter=$recv(counter).__plus((1));
  50660. return counter;
  50661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50662. }));
  50663. $1=announcer;
  50664. $2=$recv($globals.SystemAnnouncement)._new();
  50665. $ctx1.sendIdx["new"]=2;
  50666. $recv($1)._announce_($2);
  50667. $ctx1.sendIdx["announce:"]=1;
  50668. $self._assert_equals_(counter,(1));
  50669. $ctx1.sendIdx["assert:equals:"]=1;
  50670. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50671. $self._assert_equals_(counter,(2));
  50672. return self;
  50673. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50674. },
  50675. args: [],
  50676. 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.",
  50677. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50678. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  50679. }),
  50680. $globals.AnnouncerTest);
  50681. $core.addMethod(
  50682. $core.method({
  50683. selector: "testOnDoFor",
  50684. protocol: "tests",
  50685. fn: function (){
  50686. var self=this,$self=this;
  50687. var counter,announcer;
  50688. return $core.withContext(function($ctx1) {
  50689. var $1,$2,$3,$4;
  50690. counter=(0);
  50691. announcer=$recv($globals.Announcer)._new();
  50692. $ctx1.sendIdx["new"]=1;
  50693. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  50694. return $core.withContext(function($ctx2) {
  50695. counter=$recv(counter).__plus((1));
  50696. return counter;
  50697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50698. }),self);
  50699. $1=announcer;
  50700. $2=$recv($globals.SystemAnnouncement)._new();
  50701. $ctx1.sendIdx["new"]=2;
  50702. $recv($1)._announce_($2);
  50703. $ctx1.sendIdx["announce:"]=1;
  50704. $self._assert_equals_(counter,(1));
  50705. $ctx1.sendIdx["assert:equals:"]=1;
  50706. $3=announcer;
  50707. $4=$recv($globals.SystemAnnouncement)._new();
  50708. $ctx1.sendIdx["new"]=3;
  50709. $recv($3)._announce_($4);
  50710. $ctx1.sendIdx["announce:"]=2;
  50711. $self._assert_equals_(counter,(2));
  50712. $ctx1.sendIdx["assert:equals:"]=2;
  50713. $recv(announcer)._unsubscribe_(self);
  50714. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50715. $self._assert_equals_(counter,(2));
  50716. return self;
  50717. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50718. },
  50719. args: [],
  50720. 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.",
  50721. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50722. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  50723. }),
  50724. $globals.AnnouncerTest);
  50725. $core.addMethod(
  50726. $core.method({
  50727. selector: "testOnDoOnce",
  50728. protocol: "tests",
  50729. fn: function (){
  50730. var self=this,$self=this;
  50731. var counter,announcer;
  50732. return $core.withContext(function($ctx1) {
  50733. var $1,$2;
  50734. counter=(0);
  50735. announcer=$recv($globals.Announcer)._new();
  50736. $ctx1.sendIdx["new"]=1;
  50737. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  50738. return $core.withContext(function($ctx2) {
  50739. counter=$recv(counter).__plus((1));
  50740. return counter;
  50741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50742. }));
  50743. $1=announcer;
  50744. $2=$recv($globals.SystemAnnouncement)._new();
  50745. $ctx1.sendIdx["new"]=2;
  50746. $recv($1)._announce_($2);
  50747. $ctx1.sendIdx["announce:"]=1;
  50748. $self._assert_equals_(counter,(1));
  50749. $ctx1.sendIdx["assert:equals:"]=1;
  50750. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50751. $self._assert_equals_(counter,(1));
  50752. return self;
  50753. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50754. },
  50755. args: [],
  50756. 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.",
  50757. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50758. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  50759. }),
  50760. $globals.AnnouncerTest);
  50761. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  50762. $core.addMethod(
  50763. $core.method({
  50764. selector: "localReturnOnDoCatch",
  50765. protocol: "fixture",
  50766. fn: function (){
  50767. var self=this,$self=this;
  50768. return $core.withContext(function($ctx1) {
  50769. var $early={};
  50770. try {
  50771. $recv((function(){
  50772. throw $early=[(2)];
  50773. }))._on_do_($globals.Error,(function(){
  50774. }));
  50775. return (3);
  50776. }
  50777. catch(e) {if(e===$early)return e[0]; throw e}
  50778. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50779. },
  50780. args: [],
  50781. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  50782. referencedClasses: ["Error"],
  50783. messageSends: ["on:do:"]
  50784. }),
  50785. $globals.BlockClosureTest);
  50786. $core.addMethod(
  50787. $core.method({
  50788. selector: "localReturnOnDoMiss",
  50789. protocol: "fixture",
  50790. fn: function (){
  50791. var self=this,$self=this;
  50792. return $core.withContext(function($ctx1) {
  50793. var $early={};
  50794. try {
  50795. $recv((function(){
  50796. throw $early=[(2)];
  50797. }))._on_do_($globals.Class,(function(){
  50798. }));
  50799. return (3);
  50800. }
  50801. catch(e) {if(e===$early)return e[0]; throw e}
  50802. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  50803. },
  50804. args: [],
  50805. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  50806. referencedClasses: ["Class"],
  50807. messageSends: ["on:do:"]
  50808. }),
  50809. $globals.BlockClosureTest);
  50810. $core.addMethod(
  50811. $core.method({
  50812. selector: "testCanClearInterval",
  50813. protocol: "tests",
  50814. fn: function (){
  50815. var self=this,$self=this;
  50816. return $core.withContext(function($ctx1) {
  50817. $self._shouldnt_raise_((function(){
  50818. return $core.withContext(function($ctx2) {
  50819. return $recv($recv((function(){
  50820. return $core.withContext(function($ctx3) {
  50821. return $recv($recv($globals.Error)._new())._signal();
  50822. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50823. }))._valueWithInterval_((0)))._clearInterval();
  50824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50825. }),$globals.Error);
  50826. return self;
  50827. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  50828. },
  50829. args: [],
  50830. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  50831. referencedClasses: ["Error"],
  50832. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  50833. }),
  50834. $globals.BlockClosureTest);
  50835. $core.addMethod(
  50836. $core.method({
  50837. selector: "testCanClearTimeout",
  50838. protocol: "tests",
  50839. fn: function (){
  50840. var self=this,$self=this;
  50841. return $core.withContext(function($ctx1) {
  50842. $self._shouldnt_raise_((function(){
  50843. return $core.withContext(function($ctx2) {
  50844. return $recv($recv((function(){
  50845. return $core.withContext(function($ctx3) {
  50846. return $recv($recv($globals.Error)._new())._signal();
  50847. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50848. }))._valueWithTimeout_((0)))._clearTimeout();
  50849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50850. }),$globals.Error);
  50851. return self;
  50852. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  50853. },
  50854. args: [],
  50855. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  50856. referencedClasses: ["Error"],
  50857. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  50858. }),
  50859. $globals.BlockClosureTest);
  50860. $core.addMethod(
  50861. $core.method({
  50862. selector: "testCompiledSource",
  50863. protocol: "tests",
  50864. fn: function (){
  50865. var self=this,$self=this;
  50866. return $core.withContext(function($ctx1) {
  50867. $self._assert_($recv($recv((function(){
  50868. return $core.withContext(function($ctx2) {
  50869. return (1).__plus((1));
  50870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50871. }))._compiledSource())._includesSubString_("function"));
  50872. return self;
  50873. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  50874. },
  50875. args: [],
  50876. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  50877. referencedClasses: [],
  50878. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  50879. }),
  50880. $globals.BlockClosureTest);
  50881. $core.addMethod(
  50882. $core.method({
  50883. selector: "testCurrySelf",
  50884. protocol: "tests",
  50885. fn: function (){
  50886. var self=this,$self=this;
  50887. var curriedMethod,array;
  50888. return $core.withContext(function($ctx1) {
  50889. curriedMethod=$recv($recv((function(selfarg,x){
  50890. return $core.withContext(function($ctx2) {
  50891. return $recv(selfarg)._at_(x);
  50892. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  50893. }))._currySelf())._asCompiledMethod_("foo:");
  50894. array=[(3), (1), (4)];
  50895. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  50896. $recv((function(){
  50897. return $core.withContext(function($ctx2) {
  50898. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  50899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50900. }))._ensure_((function(){
  50901. return $core.withContext(function($ctx2) {
  50902. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  50903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50904. }));
  50905. return self;
  50906. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  50907. },
  50908. args: [],
  50909. 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 ]",
  50910. referencedClasses: ["ClassBuilder", "Array"],
  50911. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  50912. }),
  50913. $globals.BlockClosureTest);
  50914. $core.addMethod(
  50915. $core.method({
  50916. selector: "testEnsure",
  50917. protocol: "tests",
  50918. fn: function (){
  50919. var self=this,$self=this;
  50920. return $core.withContext(function($ctx1) {
  50921. $self._assert_equals_($recv((function(){
  50922. return (3);
  50923. }))._ensure_((function(){
  50924. return (4);
  50925. })),(3));
  50926. return self;
  50927. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  50928. },
  50929. args: [],
  50930. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  50931. referencedClasses: [],
  50932. messageSends: ["assert:equals:", "ensure:"]
  50933. }),
  50934. $globals.BlockClosureTest);
  50935. $core.addMethod(
  50936. $core.method({
  50937. selector: "testEnsureRaises",
  50938. protocol: "tests",
  50939. fn: function (){
  50940. var self=this,$self=this;
  50941. return $core.withContext(function($ctx1) {
  50942. $self._should_raise_((function(){
  50943. return $core.withContext(function($ctx2) {
  50944. return $recv((function(){
  50945. return $core.withContext(function($ctx3) {
  50946. return $recv($recv($globals.Error)._new())._signal();
  50947. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50948. }))._ensure_((function(){
  50949. return true;
  50950. }));
  50951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50952. }),$globals.Error);
  50953. return self;
  50954. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  50955. },
  50956. args: [],
  50957. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  50958. referencedClasses: ["Error"],
  50959. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  50960. }),
  50961. $globals.BlockClosureTest);
  50962. $core.addMethod(
  50963. $core.method({
  50964. selector: "testExceptionSemantics",
  50965. protocol: "tests",
  50966. fn: function (){
  50967. var self=this,$self=this;
  50968. return $core.withContext(function($ctx1) {
  50969. $self._timeout_((100));
  50970. $recv($self._async_((function(){
  50971. return $core.withContext(function($ctx2) {
  50972. return $recv((function(){
  50973. return $core.withContext(function($ctx3) {
  50974. $self._assert_(true);
  50975. $recv($globals.Error)._signal();
  50976. $self._deny_(true);
  50977. return $self._finished();
  50978. $ctx3.sendIdx["finished"]=1;
  50979. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50980. }))._on_do_($globals.Error,(function(ex){
  50981. return $core.withContext(function($ctx3) {
  50982. return $self._finished();
  50983. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  50984. }));
  50985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50986. })))._valueWithTimeout_((0));
  50987. return self;
  50988. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  50989. },
  50990. args: [],
  50991. 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",
  50992. referencedClasses: ["Error"],
  50993. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  50994. }),
  50995. $globals.BlockClosureTest);
  50996. $core.addMethod(
  50997. $core.method({
  50998. selector: "testLocalReturnOnDoCatch",
  50999. protocol: "tests",
  51000. fn: function (){
  51001. var self=this,$self=this;
  51002. return $core.withContext(function($ctx1) {
  51003. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  51004. return self;
  51005. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  51006. },
  51007. args: [],
  51008. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  51009. referencedClasses: [],
  51010. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  51011. }),
  51012. $globals.BlockClosureTest);
  51013. $core.addMethod(
  51014. $core.method({
  51015. selector: "testLocalReturnOnDoMiss",
  51016. protocol: "tests",
  51017. fn: function (){
  51018. var self=this,$self=this;
  51019. return $core.withContext(function($ctx1) {
  51020. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  51021. return self;
  51022. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  51023. },
  51024. args: [],
  51025. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  51026. referencedClasses: [],
  51027. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  51028. }),
  51029. $globals.BlockClosureTest);
  51030. $core.addMethod(
  51031. $core.method({
  51032. selector: "testNewWithValues",
  51033. protocol: "tests",
  51034. fn: function (){
  51035. var self=this,$self=this;
  51036. return $core.withContext(function($ctx1) {
  51037. function TestConstructor(arg1, arg2, arg3) {}
  51038. TestConstructor.prototype.name = "theTestPrototype";
  51039. var wrappedConstructor = $recv(TestConstructor);
  51040. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  51041. $self._assert_(result instanceof TestConstructor);
  51042. $self._assert_equals_(result.name, "theTestPrototype");
  51043. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  51044. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  51045. return self;
  51046. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  51047. },
  51048. args: [],
  51049. 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'>",
  51050. referencedClasses: [],
  51051. messageSends: []
  51052. }),
  51053. $globals.BlockClosureTest);
  51054. $core.addMethod(
  51055. $core.method({
  51056. selector: "testNumArgs",
  51057. protocol: "tests",
  51058. fn: function (){
  51059. var self=this,$self=this;
  51060. return $core.withContext(function($ctx1) {
  51061. var $1;
  51062. $1=$recv((function(){
  51063. }))._numArgs();
  51064. $ctx1.sendIdx["numArgs"]=1;
  51065. $self._assert_equals_($1,(0));
  51066. $ctx1.sendIdx["assert:equals:"]=1;
  51067. $self._assert_equals_($recv((function(a,b){
  51068. }))._numArgs(),(2));
  51069. return self;
  51070. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  51071. },
  51072. args: [],
  51073. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  51074. referencedClasses: [],
  51075. messageSends: ["assert:equals:", "numArgs"]
  51076. }),
  51077. $globals.BlockClosureTest);
  51078. $core.addMethod(
  51079. $core.method({
  51080. selector: "testOnDo",
  51081. protocol: "tests",
  51082. fn: function (){
  51083. var self=this,$self=this;
  51084. return $core.withContext(function($ctx1) {
  51085. $self._assert_($recv((function(){
  51086. return $core.withContext(function($ctx2) {
  51087. return $recv($recv($globals.Error)._new())._signal();
  51088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51089. }))._on_do_($globals.Error,(function(ex){
  51090. return true;
  51091. })));
  51092. return self;
  51093. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  51094. },
  51095. args: [],
  51096. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  51097. referencedClasses: ["Error"],
  51098. messageSends: ["assert:", "on:do:", "signal", "new"]
  51099. }),
  51100. $globals.BlockClosureTest);
  51101. $core.addMethod(
  51102. $core.method({
  51103. selector: "testValue",
  51104. protocol: "tests",
  51105. fn: function (){
  51106. var self=this,$self=this;
  51107. return $core.withContext(function($ctx1) {
  51108. var $1;
  51109. $1=$recv((function(){
  51110. return $core.withContext(function($ctx2) {
  51111. return (1).__plus((1));
  51112. $ctx2.sendIdx["+"]=1;
  51113. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51114. }))._value();
  51115. $ctx1.sendIdx["value"]=1;
  51116. $self._assert_equals_($1,(2));
  51117. $ctx1.sendIdx["assert:equals:"]=1;
  51118. $self._assert_equals_($recv((function(x){
  51119. return $core.withContext(function($ctx2) {
  51120. return $recv(x).__plus((1));
  51121. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  51122. }))._value_((2)),(3));
  51123. $ctx1.sendIdx["assert:equals:"]=2;
  51124. $self._assert_equals_($recv((function(x,y){
  51125. return $core.withContext(function($ctx2) {
  51126. return $recv(x).__star(y);
  51127. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  51128. }))._value_value_((2),(4)),(8));
  51129. $ctx1.sendIdx["assert:equals:"]=3;
  51130. $self._assert_equals_($recv((function(a,b,c){
  51131. return (1);
  51132. }))._value(),(1));
  51133. return self;
  51134. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  51135. },
  51136. args: [],
  51137. 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",
  51138. referencedClasses: [],
  51139. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  51140. }),
  51141. $globals.BlockClosureTest);
  51142. $core.addMethod(
  51143. $core.method({
  51144. selector: "testValueWithPossibleArguments",
  51145. protocol: "tests",
  51146. fn: function (){
  51147. var self=this,$self=this;
  51148. return $core.withContext(function($ctx1) {
  51149. var $1,$2;
  51150. $1=$recv((function(){
  51151. return (1);
  51152. }))._valueWithPossibleArguments_([(3), (4)]);
  51153. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  51154. $self._assert_equals_($1,(1));
  51155. $ctx1.sendIdx["assert:equals:"]=1;
  51156. $2=$recv((function(a){
  51157. return $core.withContext(function($ctx2) {
  51158. return $recv(a).__plus((4));
  51159. $ctx2.sendIdx["+"]=1;
  51160. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  51161. }))._valueWithPossibleArguments_([(3), (4)]);
  51162. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  51163. $self._assert_equals_($2,(7));
  51164. $ctx1.sendIdx["assert:equals:"]=2;
  51165. $self._assert_equals_($recv((function(a,b){
  51166. return $core.withContext(function($ctx2) {
  51167. return $recv(a).__plus(b);
  51168. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  51169. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  51170. return self;
  51171. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  51172. },
  51173. args: [],
  51174. 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.",
  51175. referencedClasses: [],
  51176. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  51177. }),
  51178. $globals.BlockClosureTest);
  51179. $core.addMethod(
  51180. $core.method({
  51181. selector: "testWhileFalse",
  51182. protocol: "tests",
  51183. fn: function (){
  51184. var self=this,$self=this;
  51185. var i;
  51186. return $core.withContext(function($ctx1) {
  51187. i=(0);
  51188. $recv((function(){
  51189. return $core.withContext(function($ctx2) {
  51190. return $recv(i).__gt((5));
  51191. $ctx2.sendIdx[">"]=1;
  51192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51193. }))._whileFalse_((function(){
  51194. return $core.withContext(function($ctx2) {
  51195. i=$recv(i).__plus((1));
  51196. $ctx2.sendIdx["+"]=1;
  51197. return i;
  51198. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51199. }));
  51200. $self._assert_equals_(i,(6));
  51201. $ctx1.sendIdx["assert:equals:"]=1;
  51202. i=(0);
  51203. $recv((function(){
  51204. return $core.withContext(function($ctx2) {
  51205. i=$recv(i).__plus((1));
  51206. return $recv(i).__gt((5));
  51207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51208. }))._whileFalse();
  51209. $self._assert_equals_(i,(6));
  51210. return self;
  51211. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  51212. },
  51213. args: [],
  51214. 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",
  51215. referencedClasses: [],
  51216. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  51217. }),
  51218. $globals.BlockClosureTest);
  51219. $core.addMethod(
  51220. $core.method({
  51221. selector: "testWhileTrue",
  51222. protocol: "tests",
  51223. fn: function (){
  51224. var self=this,$self=this;
  51225. var i;
  51226. return $core.withContext(function($ctx1) {
  51227. i=(0);
  51228. $recv((function(){
  51229. return $core.withContext(function($ctx2) {
  51230. return $recv(i).__lt((5));
  51231. $ctx2.sendIdx["<"]=1;
  51232. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51233. }))._whileTrue_((function(){
  51234. return $core.withContext(function($ctx2) {
  51235. i=$recv(i).__plus((1));
  51236. $ctx2.sendIdx["+"]=1;
  51237. return i;
  51238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51239. }));
  51240. $self._assert_equals_(i,(5));
  51241. $ctx1.sendIdx["assert:equals:"]=1;
  51242. i=(0);
  51243. $recv((function(){
  51244. return $core.withContext(function($ctx2) {
  51245. i=$recv(i).__plus((1));
  51246. return $recv(i).__lt((5));
  51247. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51248. }))._whileTrue();
  51249. $self._assert_equals_(i,(5));
  51250. return self;
  51251. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  51252. },
  51253. args: [],
  51254. 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",
  51255. referencedClasses: [],
  51256. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  51257. }),
  51258. $globals.BlockClosureTest);
  51259. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  51260. $core.addMethod(
  51261. $core.method({
  51262. selector: "testEquality",
  51263. protocol: "tests",
  51264. fn: function (){
  51265. var self=this,$self=this;
  51266. return $core.withContext(function($ctx1) {
  51267. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51268. $1=(0).__eq(false);
  51269. $ctx1.sendIdx["="]=1;
  51270. $self._deny_($1);
  51271. $ctx1.sendIdx["deny:"]=1;
  51272. $2=false.__eq((0));
  51273. $ctx1.sendIdx["="]=2;
  51274. $self._deny_($2);
  51275. $ctx1.sendIdx["deny:"]=2;
  51276. $3="".__eq(false);
  51277. $ctx1.sendIdx["="]=3;
  51278. $self._deny_($3);
  51279. $ctx1.sendIdx["deny:"]=3;
  51280. $4=false.__eq("");
  51281. $ctx1.sendIdx["="]=4;
  51282. $self._deny_($4);
  51283. $ctx1.sendIdx["deny:"]=4;
  51284. $5=true.__eq(true);
  51285. $ctx1.sendIdx["="]=5;
  51286. $self._assert_($5);
  51287. $ctx1.sendIdx["assert:"]=1;
  51288. $6=false.__eq(true);
  51289. $ctx1.sendIdx["="]=6;
  51290. $self._deny_($6);
  51291. $ctx1.sendIdx["deny:"]=5;
  51292. $7=true.__eq(false);
  51293. $ctx1.sendIdx["="]=7;
  51294. $self._deny_($7);
  51295. $8=false.__eq(false);
  51296. $ctx1.sendIdx["="]=8;
  51297. $self._assert_($8);
  51298. $ctx1.sendIdx["assert:"]=2;
  51299. $10=true._yourself();
  51300. $ctx1.sendIdx["yourself"]=1;
  51301. $9=$recv($10).__eq(true);
  51302. $ctx1.sendIdx["="]=9;
  51303. $self._assert_($9);
  51304. $ctx1.sendIdx["assert:"]=3;
  51305. $12=true._yourself();
  51306. $ctx1.sendIdx["yourself"]=2;
  51307. $11=$recv($12).__eq(true._yourself());
  51308. $self._assert_($11);
  51309. return self;
  51310. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  51311. },
  51312. args: [],
  51313. 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)",
  51314. referencedClasses: [],
  51315. messageSends: ["deny:", "=", "assert:", "yourself"]
  51316. }),
  51317. $globals.BooleanTest);
  51318. $core.addMethod(
  51319. $core.method({
  51320. selector: "testIdentity",
  51321. protocol: "tests",
  51322. fn: function (){
  51323. var self=this,$self=this;
  51324. return $core.withContext(function($ctx1) {
  51325. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51326. $1=(0).__eq_eq(false);
  51327. $ctx1.sendIdx["=="]=1;
  51328. $self._deny_($1);
  51329. $ctx1.sendIdx["deny:"]=1;
  51330. $2=false.__eq_eq((0));
  51331. $ctx1.sendIdx["=="]=2;
  51332. $self._deny_($2);
  51333. $ctx1.sendIdx["deny:"]=2;
  51334. $3="".__eq_eq(false);
  51335. $ctx1.sendIdx["=="]=3;
  51336. $self._deny_($3);
  51337. $ctx1.sendIdx["deny:"]=3;
  51338. $4=false.__eq_eq("");
  51339. $ctx1.sendIdx["=="]=4;
  51340. $self._deny_($4);
  51341. $ctx1.sendIdx["deny:"]=4;
  51342. $5=true.__eq_eq(true);
  51343. $ctx1.sendIdx["=="]=5;
  51344. $self._assert_($5);
  51345. $ctx1.sendIdx["assert:"]=1;
  51346. $6=false.__eq_eq(true);
  51347. $ctx1.sendIdx["=="]=6;
  51348. $self._deny_($6);
  51349. $ctx1.sendIdx["deny:"]=5;
  51350. $7=true.__eq_eq(false);
  51351. $ctx1.sendIdx["=="]=7;
  51352. $self._deny_($7);
  51353. $8=false.__eq_eq(false);
  51354. $ctx1.sendIdx["=="]=8;
  51355. $self._assert_($8);
  51356. $ctx1.sendIdx["assert:"]=2;
  51357. $10=true._yourself();
  51358. $ctx1.sendIdx["yourself"]=1;
  51359. $9=$recv($10).__eq_eq(true);
  51360. $ctx1.sendIdx["=="]=9;
  51361. $self._assert_($9);
  51362. $ctx1.sendIdx["assert:"]=3;
  51363. $12=true._yourself();
  51364. $ctx1.sendIdx["yourself"]=2;
  51365. $11=$recv($12).__eq_eq(true._yourself());
  51366. $self._assert_($11);
  51367. return self;
  51368. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  51369. },
  51370. args: [],
  51371. 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",
  51372. referencedClasses: [],
  51373. messageSends: ["deny:", "==", "assert:", "yourself"]
  51374. }),
  51375. $globals.BooleanTest);
  51376. $core.addMethod(
  51377. $core.method({
  51378. selector: "testIfTrueIfFalse",
  51379. protocol: "tests",
  51380. fn: function (){
  51381. var self=this,$self=this;
  51382. return $core.withContext(function($ctx1) {
  51383. var $1,$2,$3,$4,$5,$6,$7,$8;
  51384. if($core.assert(true)){
  51385. $1="alternative block";
  51386. }
  51387. $self._assert_equals_($1,"alternative block");
  51388. $ctx1.sendIdx["assert:equals:"]=1;
  51389. if(!$core.assert(true)){
  51390. $2="alternative block";
  51391. }
  51392. $self._assert_equals_($2,nil);
  51393. $ctx1.sendIdx["assert:equals:"]=2;
  51394. if($core.assert(false)){
  51395. $3="alternative block";
  51396. }
  51397. $self._assert_equals_($3,nil);
  51398. $ctx1.sendIdx["assert:equals:"]=3;
  51399. if(!$core.assert(false)){
  51400. $4="alternative block";
  51401. }
  51402. $self._assert_equals_($4,"alternative block");
  51403. $ctx1.sendIdx["assert:equals:"]=4;
  51404. if($core.assert(false)){
  51405. $5="alternative block";
  51406. } else {
  51407. $5="alternative block2";
  51408. }
  51409. $self._assert_equals_($5,"alternative block2");
  51410. $ctx1.sendIdx["assert:equals:"]=5;
  51411. if($core.assert(false)){
  51412. $6="alternative block2";
  51413. } else {
  51414. $6="alternative block";
  51415. }
  51416. $self._assert_equals_($6,"alternative block");
  51417. $ctx1.sendIdx["assert:equals:"]=6;
  51418. if($core.assert(true)){
  51419. $7="alternative block";
  51420. } else {
  51421. $7="alternative block2";
  51422. }
  51423. $self._assert_equals_($7,"alternative block");
  51424. $ctx1.sendIdx["assert:equals:"]=7;
  51425. if($core.assert(true)){
  51426. $8="alternative block2";
  51427. } else {
  51428. $8="alternative block";
  51429. }
  51430. $self._assert_equals_($8,"alternative block2");
  51431. return self;
  51432. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  51433. },
  51434. args: [],
  51435. 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'.",
  51436. referencedClasses: [],
  51437. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51438. }),
  51439. $globals.BooleanTest);
  51440. $core.addMethod(
  51441. $core.method({
  51442. selector: "testIfTrueIfFalseWithBoxing",
  51443. protocol: "tests",
  51444. fn: function (){
  51445. var self=this,$self=this;
  51446. return $core.withContext(function($ctx1) {
  51447. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  51448. $2=true._yourself();
  51449. $ctx1.sendIdx["yourself"]=1;
  51450. if($core.assert($2)){
  51451. $1="alternative block";
  51452. }
  51453. $self._assert_equals_($1,"alternative block");
  51454. $ctx1.sendIdx["assert:equals:"]=1;
  51455. $4=true._yourself();
  51456. $ctx1.sendIdx["yourself"]=2;
  51457. if(!$core.assert($4)){
  51458. $3="alternative block";
  51459. }
  51460. $self._assert_equals_($3,nil);
  51461. $ctx1.sendIdx["assert:equals:"]=2;
  51462. $6=false._yourself();
  51463. $ctx1.sendIdx["yourself"]=3;
  51464. if($core.assert($6)){
  51465. $5="alternative block";
  51466. }
  51467. $self._assert_equals_($5,nil);
  51468. $ctx1.sendIdx["assert:equals:"]=3;
  51469. $8=false._yourself();
  51470. $ctx1.sendIdx["yourself"]=4;
  51471. if(!$core.assert($8)){
  51472. $7="alternative block";
  51473. }
  51474. $self._assert_equals_($7,"alternative block");
  51475. $ctx1.sendIdx["assert:equals:"]=4;
  51476. $10=false._yourself();
  51477. $ctx1.sendIdx["yourself"]=5;
  51478. if($core.assert($10)){
  51479. $9="alternative block";
  51480. } else {
  51481. $9="alternative block2";
  51482. }
  51483. $self._assert_equals_($9,"alternative block2");
  51484. $ctx1.sendIdx["assert:equals:"]=5;
  51485. $12=false._yourself();
  51486. $ctx1.sendIdx["yourself"]=6;
  51487. if($core.assert($12)){
  51488. $11="alternative block2";
  51489. } else {
  51490. $11="alternative block";
  51491. }
  51492. $self._assert_equals_($11,"alternative block");
  51493. $ctx1.sendIdx["assert:equals:"]=6;
  51494. $14=true._yourself();
  51495. $ctx1.sendIdx["yourself"]=7;
  51496. if($core.assert($14)){
  51497. $13="alternative block";
  51498. } else {
  51499. $13="alternative block2";
  51500. }
  51501. $self._assert_equals_($13,"alternative block");
  51502. $ctx1.sendIdx["assert:equals:"]=7;
  51503. $16=true._yourself();
  51504. if($core.assert($16)){
  51505. $15="alternative block2";
  51506. } else {
  51507. $15="alternative block";
  51508. }
  51509. $self._assert_equals_($15,"alternative block2");
  51510. return self;
  51511. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  51512. },
  51513. args: [],
  51514. 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'.",
  51515. referencedClasses: [],
  51516. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51517. }),
  51518. $globals.BooleanTest);
  51519. $core.addMethod(
  51520. $core.method({
  51521. selector: "testLogic",
  51522. protocol: "tests",
  51523. fn: function (){
  51524. var self=this,$self=this;
  51525. return $core.withContext(function($ctx1) {
  51526. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  51527. $1=true.__and(true);
  51528. $ctx1.sendIdx["&"]=1;
  51529. $self._assert_($1);
  51530. $ctx1.sendIdx["assert:"]=1;
  51531. $2=true.__and(false);
  51532. $ctx1.sendIdx["&"]=2;
  51533. $self._deny_($2);
  51534. $ctx1.sendIdx["deny:"]=1;
  51535. $3=false.__and(true);
  51536. $ctx1.sendIdx["&"]=3;
  51537. $self._deny_($3);
  51538. $ctx1.sendIdx["deny:"]=2;
  51539. $5=false.__and(false);
  51540. $ctx1.sendIdx["&"]=4;
  51541. $4=$self._deny_($5);
  51542. $ctx1.sendIdx["deny:"]=3;
  51543. $6=true.__or(true);
  51544. $ctx1.sendIdx["|"]=1;
  51545. $self._assert_($6);
  51546. $ctx1.sendIdx["assert:"]=2;
  51547. $7=true.__or(false);
  51548. $ctx1.sendIdx["|"]=2;
  51549. $self._assert_($7);
  51550. $ctx1.sendIdx["assert:"]=3;
  51551. $8=false.__or(true);
  51552. $ctx1.sendIdx["|"]=3;
  51553. $self._assert_($8);
  51554. $ctx1.sendIdx["assert:"]=4;
  51555. $10=false.__or(false);
  51556. $ctx1.sendIdx["|"]=4;
  51557. $9=$self._deny_($10);
  51558. $ctx1.sendIdx["deny:"]=4;
  51559. $12=(1).__gt((0));
  51560. $ctx1.sendIdx[">"]=1;
  51561. $11=true.__and($12);
  51562. $ctx1.sendIdx["&"]=5;
  51563. $self._assert_($11);
  51564. $ctx1.sendIdx["assert:"]=5;
  51565. $14=(1).__gt((0));
  51566. $ctx1.sendIdx[">"]=2;
  51567. $13=$recv($14).__and(false);
  51568. $ctx1.sendIdx["&"]=6;
  51569. $self._deny_($13);
  51570. $ctx1.sendIdx["deny:"]=5;
  51571. $16=(1).__gt((0));
  51572. $ctx1.sendIdx[">"]=3;
  51573. $17=(1).__gt((2));
  51574. $ctx1.sendIdx[">"]=4;
  51575. $15=$recv($16).__and($17);
  51576. $self._deny_($15);
  51577. $19=(1).__gt((0));
  51578. $ctx1.sendIdx[">"]=5;
  51579. $18=false.__or($19);
  51580. $ctx1.sendIdx["|"]=5;
  51581. $self._assert_($18);
  51582. $ctx1.sendIdx["assert:"]=6;
  51583. $21=(1).__gt((0));
  51584. $ctx1.sendIdx[">"]=6;
  51585. $20=$recv($21).__or(false);
  51586. $ctx1.sendIdx["|"]=6;
  51587. $self._assert_($20);
  51588. $ctx1.sendIdx["assert:"]=7;
  51589. $23=(1).__gt((0));
  51590. $ctx1.sendIdx[">"]=7;
  51591. $22=$recv($23).__or((1).__gt((2)));
  51592. $self._assert_($22);
  51593. return self;
  51594. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  51595. },
  51596. args: [],
  51597. 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))",
  51598. referencedClasses: [],
  51599. messageSends: ["assert:", "&", "deny:", "|", ">"]
  51600. }),
  51601. $globals.BooleanTest);
  51602. $core.addMethod(
  51603. $core.method({
  51604. selector: "testLogicKeywords",
  51605. protocol: "tests",
  51606. fn: function (){
  51607. var self=this,$self=this;
  51608. return $core.withContext(function($ctx1) {
  51609. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  51610. $1=true._and_((function(){
  51611. return true;
  51612. }));
  51613. $ctx1.sendIdx["and:"]=1;
  51614. $self._assert_($1);
  51615. $ctx1.sendIdx["assert:"]=1;
  51616. $2=true._and_((function(){
  51617. return false;
  51618. }));
  51619. $ctx1.sendIdx["and:"]=2;
  51620. $self._deny_($2);
  51621. $ctx1.sendIdx["deny:"]=1;
  51622. $3=false._and_((function(){
  51623. return true;
  51624. }));
  51625. $ctx1.sendIdx["and:"]=3;
  51626. $self._deny_($3);
  51627. $ctx1.sendIdx["deny:"]=2;
  51628. $5=false._and_((function(){
  51629. return false;
  51630. }));
  51631. $ctx1.sendIdx["and:"]=4;
  51632. $4=$self._deny_($5);
  51633. $ctx1.sendIdx["deny:"]=3;
  51634. $6=true._or_((function(){
  51635. return true;
  51636. }));
  51637. $ctx1.sendIdx["or:"]=1;
  51638. $self._assert_($6);
  51639. $ctx1.sendIdx["assert:"]=2;
  51640. $7=true._or_((function(){
  51641. return false;
  51642. }));
  51643. $ctx1.sendIdx["or:"]=2;
  51644. $self._assert_($7);
  51645. $ctx1.sendIdx["assert:"]=3;
  51646. $8=false._or_((function(){
  51647. return true;
  51648. }));
  51649. $ctx1.sendIdx["or:"]=3;
  51650. $self._assert_($8);
  51651. $ctx1.sendIdx["assert:"]=4;
  51652. $10=false._or_((function(){
  51653. return false;
  51654. }));
  51655. $ctx1.sendIdx["or:"]=4;
  51656. $9=$self._deny_($10);
  51657. $ctx1.sendIdx["deny:"]=4;
  51658. $11=true._and_((function(){
  51659. return $core.withContext(function($ctx2) {
  51660. return (1).__gt((0));
  51661. $ctx2.sendIdx[">"]=1;
  51662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  51663. }));
  51664. $ctx1.sendIdx["and:"]=5;
  51665. $self._assert_($11);
  51666. $ctx1.sendIdx["assert:"]=5;
  51667. $13=(1).__gt((0));
  51668. $ctx1.sendIdx[">"]=2;
  51669. $12=$recv($13)._and_((function(){
  51670. return false;
  51671. }));
  51672. $ctx1.sendIdx["and:"]=6;
  51673. $self._deny_($12);
  51674. $ctx1.sendIdx["deny:"]=5;
  51675. $15=(1).__gt((0));
  51676. $ctx1.sendIdx[">"]=3;
  51677. $14=$recv($15)._and_((function(){
  51678. return $core.withContext(function($ctx2) {
  51679. return (1).__gt((2));
  51680. $ctx2.sendIdx[">"]=4;
  51681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  51682. }));
  51683. $self._deny_($14);
  51684. $16=false._or_((function(){
  51685. return $core.withContext(function($ctx2) {
  51686. return (1).__gt((0));
  51687. $ctx2.sendIdx[">"]=5;
  51688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  51689. }));
  51690. $ctx1.sendIdx["or:"]=5;
  51691. $self._assert_($16);
  51692. $ctx1.sendIdx["assert:"]=6;
  51693. $18=(1).__gt((0));
  51694. $ctx1.sendIdx[">"]=6;
  51695. $17=$recv($18)._or_((function(){
  51696. return false;
  51697. }));
  51698. $ctx1.sendIdx["or:"]=6;
  51699. $self._assert_($17);
  51700. $ctx1.sendIdx["assert:"]=7;
  51701. $20=(1).__gt((0));
  51702. $ctx1.sendIdx[">"]=7;
  51703. $19=$recv($20)._or_((function(){
  51704. return $core.withContext(function($ctx2) {
  51705. return (1).__gt((2));
  51706. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  51707. }));
  51708. $self._assert_($19);
  51709. return self;
  51710. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  51711. },
  51712. args: [],
  51713. 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 ])",
  51714. referencedClasses: [],
  51715. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  51716. }),
  51717. $globals.BooleanTest);
  51718. $core.addMethod(
  51719. $core.method({
  51720. selector: "testNonBooleanError",
  51721. protocol: "tests",
  51722. fn: function (){
  51723. var self=this,$self=this;
  51724. return $core.withContext(function($ctx1) {
  51725. $self._should_raise_((function(){
  51726. return $core.withContext(function($ctx2) {
  51727. if($core.assert("")){
  51728. } else {
  51729. }
  51730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51731. }),$globals.NonBooleanReceiver);
  51732. return self;
  51733. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  51734. },
  51735. args: [],
  51736. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  51737. referencedClasses: ["NonBooleanReceiver"],
  51738. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  51739. }),
  51740. $globals.BooleanTest);
  51741. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51742. $core.addMethod(
  51743. $core.method({
  51744. selector: "setUp",
  51745. protocol: "running",
  51746. fn: function (){
  51747. var self=this,$self=this;
  51748. return $core.withContext(function($ctx1) {
  51749. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  51750. return self;
  51751. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  51752. },
  51753. args: [],
  51754. source: "setUp\x0a\x09builder := ClassBuilder new",
  51755. referencedClasses: ["ClassBuilder"],
  51756. messageSends: ["new"]
  51757. }),
  51758. $globals.ClassBuilderTest);
  51759. $core.addMethod(
  51760. $core.method({
  51761. selector: "tearDown",
  51762. protocol: "running",
  51763. fn: function (){
  51764. var self=this,$self=this;
  51765. return $core.withContext(function($ctx1) {
  51766. var $1,$receiver;
  51767. $1=$self["@theClass"];
  51768. if(($receiver = $1) == null || $receiver.a$nil){
  51769. $1;
  51770. } else {
  51771. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  51772. $self._deny_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51773. $self["@theClass"]=nil;
  51774. $self["@theClass"];
  51775. }
  51776. return self;
  51777. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  51778. },
  51779. args: [],
  51780. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09self deny: (theClass package classes includes: theClass).\x0a\x09\x09theClass := nil ]",
  51781. referencedClasses: ["Smalltalk"],
  51782. messageSends: ["ifNotNil:", "removeClass:", "deny:", "includes:", "classes", "package"]
  51783. }),
  51784. $globals.ClassBuilderTest);
  51785. $core.addMethod(
  51786. $core.method({
  51787. selector: "testAddTrait",
  51788. protocol: "tests",
  51789. fn: function (){
  51790. var self=this,$self=this;
  51791. return $core.withContext(function($ctx1) {
  51792. var $3,$2,$1,$4;
  51793. $self["@theClass"]=$recv($self["@builder"])._addTraitNamed_package_("ObjectMock2","Kernel-Tests");
  51794. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51795. $ctx1.sendIdx["assert:equals:"]=1;
  51796. $3=$recv($self["@theClass"])._package();
  51797. $ctx1.sendIdx["package"]=1;
  51798. $2=$recv($3)._classes();
  51799. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51800. $self._assert_equals_($1,(1));
  51801. $ctx1.sendIdx["assert:equals:"]=2;
  51802. $4=$recv($self["@theClass"])._package();
  51803. $ctx1.sendIdx["package"]=2;
  51804. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  51805. return self;
  51806. }, function($ctx1) {$ctx1.fill(self,"testAddTrait",{},$globals.ClassBuilderTest)});
  51807. },
  51808. args: [],
  51809. 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",
  51810. referencedClasses: ["ObjectMock"],
  51811. messageSends: ["addTraitNamed:package:", "assert:equals:", "name", "occurrencesOf:", "classes", "package"]
  51812. }),
  51813. $globals.ClassBuilderTest);
  51814. $core.addMethod(
  51815. $core.method({
  51816. selector: "testClassCopy",
  51817. protocol: "tests",
  51818. fn: function (){
  51819. var self=this,$self=this;
  51820. return $core.withContext(function($ctx1) {
  51821. var $2,$1,$4,$3,$6,$7,$5,$9,$8;
  51822. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51823. $2=$recv($self["@theClass"])._superclass();
  51824. $ctx1.sendIdx["superclass"]=1;
  51825. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51826. $ctx1.sendIdx["=="]=1;
  51827. $self._assert_($1);
  51828. $ctx1.sendIdx["assert:"]=1;
  51829. $4=$recv($self["@theClass"])._instanceVariableNames();
  51830. $ctx1.sendIdx["instanceVariableNames"]=1;
  51831. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51832. $ctx1.sendIdx["=="]=2;
  51833. $self._assert_($3);
  51834. $ctx1.sendIdx["assert:"]=2;
  51835. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51836. $ctx1.sendIdx["assert:equals:"]=1;
  51837. $6=$recv($self["@theClass"])._package();
  51838. $ctx1.sendIdx["package"]=1;
  51839. $7=$recv($globals.ObjectMock)._package();
  51840. $ctx1.sendIdx["package"]=2;
  51841. $5=$recv($6).__eq_eq($7);
  51842. $self._assert_($5);
  51843. $ctx1.sendIdx["assert:"]=3;
  51844. $self._assert_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51845. $9=$recv($self["@theClass"])._methodDictionary();
  51846. $ctx1.sendIdx["methodDictionary"]=1;
  51847. $8=$recv($9)._keys();
  51848. $ctx1.sendIdx["keys"]=1;
  51849. $self._assert_equals_($8,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51850. return self;
  51851. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  51852. },
  51853. args: [],
  51854. 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",
  51855. referencedClasses: ["ObjectMock"],
  51856. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "includes:", "classes", "keys", "methodDictionary"]
  51857. }),
  51858. $globals.ClassBuilderTest);
  51859. $core.addMethod(
  51860. $core.method({
  51861. selector: "testClassMigration",
  51862. protocol: "tests",
  51863. fn: function (){
  51864. var self=this,$self=this;
  51865. var instance,oldClass;
  51866. return $core.withContext(function($ctx1) {
  51867. var $2,$1,$4,$3,$5,$6,$7,$8,$10,$9,$12,$11;
  51868. oldClass=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51869. $2=$recv($globals.Smalltalk)._globals();
  51870. $ctx1.sendIdx["globals"]=1;
  51871. $1=$recv($2)._at_("ObjectMock2");
  51872. $ctx1.sendIdx["at:"]=1;
  51873. instance=$recv($1)._new();
  51874. $4=$recv($globals.Smalltalk)._globals();
  51875. $ctx1.sendIdx["globals"]=2;
  51876. $3=$recv($4)._at_("ObjectMock2");
  51877. $ctx1.sendIdx["at:"]=2;
  51878. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  51879. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  51880. $ctx1.sendIdx["=="]=1;
  51881. $self._deny_($5);
  51882. $ctx1.sendIdx["deny:"]=1;
  51883. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  51884. $ctx1.sendIdx["=="]=2;
  51885. $self._assert_($6);
  51886. $ctx1.sendIdx["assert:"]=1;
  51887. $self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  51888. $ctx1.sendIdx["assert:"]=2;
  51889. $7=$recv($globals.ObjectMock2)._selectors();
  51890. $ctx1.sendIdx["selectors"]=1;
  51891. $self._assert_equals_($7,$recv(oldClass)._selectors());
  51892. $ctx1.sendIdx["assert:equals:"]=1;
  51893. $8=$recv($globals.ObjectMock2)._comment();
  51894. $ctx1.sendIdx["comment"]=1;
  51895. $self._assert_equals_($8,$recv(oldClass)._comment());
  51896. $ctx1.sendIdx["assert:equals:"]=2;
  51897. $10=$recv($globals.ObjectMock2)._package();
  51898. $ctx1.sendIdx["package"]=1;
  51899. $9=$recv($10)._name();
  51900. $ctx1.sendIdx["name"]=1;
  51901. $self._assert_equals_($9,"Kernel-Tests");
  51902. $self._assert_($recv($recv($recv($globals.ObjectMock2)._package())._classes())._includes_($globals.ObjectMock2));
  51903. $ctx1.sendIdx["assert:"]=3;
  51904. $12=$recv(instance)._class();
  51905. $ctx1.sendIdx["class"]=1;
  51906. $11=$recv($12).__eq_eq($globals.ObjectMock2);
  51907. $self._deny_($11);
  51908. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  51909. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51910. return self;
  51911. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  51912. },
  51913. args: [],
  51914. 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",
  51915. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  51916. 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:"]
  51917. }),
  51918. $globals.ClassBuilderTest);
  51919. $core.addMethod(
  51920. $core.method({
  51921. selector: "testClassMigrationWithClassInstanceVariables",
  51922. protocol: "tests",
  51923. fn: function (){
  51924. var self=this,$self=this;
  51925. return $core.withContext(function($ctx1) {
  51926. var $1;
  51927. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51928. $1=$recv($globals.ObjectMock2)._class();
  51929. $ctx1.sendIdx["class"]=1;
  51930. $recv($1)._instanceVariableNames_("foo bar");
  51931. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  51932. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  51933. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51934. return self;
  51935. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  51936. },
  51937. args: [],
  51938. 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",
  51939. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  51940. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  51941. }),
  51942. $globals.ClassBuilderTest);
  51943. $core.addMethod(
  51944. $core.method({
  51945. selector: "testClassMigrationWithSubclasses",
  51946. protocol: "tests",
  51947. fn: function (){
  51948. var self=this,$self=this;
  51949. return $core.withContext(function($ctx1) {
  51950. var $2,$1,$4,$3;
  51951. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51952. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  51953. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  51954. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  51955. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  51956. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  51957. $2=$recv($globals.ObjectMock)._subclasses();
  51958. $ctx1.sendIdx["subclasses"]=1;
  51959. $1=$recv($2)._includes_($globals.ObjectMock2);
  51960. $ctx1.sendIdx["includes:"]=1;
  51961. $self._assert_($1);
  51962. $ctx1.sendIdx["assert:"]=1;
  51963. $4=$recv($globals.ObjectMock2)._subclasses();
  51964. $ctx1.sendIdx["subclasses"]=2;
  51965. $3=$recv($4)._includes_($globals.ObjectMock3);
  51966. $ctx1.sendIdx["includes:"]=2;
  51967. $self._assert_($3);
  51968. $ctx1.sendIdx["assert:"]=2;
  51969. $self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  51970. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  51971. return $core.withContext(function($ctx2) {
  51972. return $recv($globals.Smalltalk)._removeClass_(each);
  51973. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51974. }));
  51975. return self;
  51976. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  51977. },
  51978. args: [],
  51979. 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 ]",
  51980. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  51981. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  51982. }),
  51983. $globals.ClassBuilderTest);
  51984. $core.addMethod(
  51985. $core.method({
  51986. selector: "testInstanceVariableNames",
  51987. protocol: "tests",
  51988. fn: function (){
  51989. var self=this,$self=this;
  51990. return $core.withContext(function($ctx1) {
  51991. $self._assert_equals_($recv($self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  51992. return self;
  51993. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  51994. },
  51995. args: [],
  51996. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  51997. referencedClasses: [],
  51998. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  51999. }),
  52000. $globals.ClassBuilderTest);
  52001. $core.addMethod(
  52002. $core.method({
  52003. selector: "testSubclass",
  52004. protocol: "tests",
  52005. fn: function (){
  52006. var self=this,$self=this;
  52007. return $core.withContext(function($ctx1) {
  52008. var $3,$2,$1,$4;
  52009. $self["@theClass"]=$recv($self["@builder"])._addSubclassOf_named_instanceVariableNames_package_($globals.ObjectMock,"ObjectMock2","foo bar","Kernel-Tests");
  52010. $self._assert_equals_($recv($self["@theClass"])._superclass(),$globals.ObjectMock);
  52011. $ctx1.sendIdx["assert:equals:"]=1;
  52012. $self._assert_equals_($recv($self["@theClass"])._instanceVariableNames(),"foo bar");
  52013. $ctx1.sendIdx["assert:equals:"]=2;
  52014. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52015. $ctx1.sendIdx["assert:equals:"]=3;
  52016. $3=$recv($self["@theClass"])._package();
  52017. $ctx1.sendIdx["package"]=1;
  52018. $2=$recv($3)._classes();
  52019. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  52020. $self._assert_equals_($1,(1));
  52021. $ctx1.sendIdx["assert:equals:"]=4;
  52022. $4=$recv($self["@theClass"])._package();
  52023. $ctx1.sendIdx["package"]=2;
  52024. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  52025. $ctx1.sendIdx["assert:equals:"]=5;
  52026. $self._assert_equals_($recv($recv($recv($self["@theClass"])._methodDictionary())._keys())._size(),(0));
  52027. return self;
  52028. }, function($ctx1) {$ctx1.fill(self,"testSubclass",{},$globals.ClassBuilderTest)});
  52029. },
  52030. args: [],
  52031. 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",
  52032. referencedClasses: ["ObjectMock"],
  52033. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "assert:equals:", "superclass", "instanceVariableNames", "name", "occurrencesOf:", "classes", "package", "size", "keys", "methodDictionary"]
  52034. }),
  52035. $globals.ClassBuilderTest);
  52036. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  52037. $core.addMethod(
  52038. $core.method({
  52039. selector: "jsConstructor",
  52040. protocol: "running",
  52041. fn: function (){
  52042. var self=this,$self=this;
  52043. return $core.withContext(function($ctx1) {
  52044. function Foo(){}
  52045. Foo.prototype.valueOf = function () {return 4;};
  52046. return Foo;
  52047. ;
  52048. return self;
  52049. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  52050. },
  52051. args: [],
  52052. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  52053. referencedClasses: [],
  52054. messageSends: []
  52055. }),
  52056. $globals.ClassTest);
  52057. $core.addMethod(
  52058. $core.method({
  52059. selector: "setUp",
  52060. protocol: "running",
  52061. fn: function (){
  52062. var self=this,$self=this;
  52063. return $core.withContext(function($ctx1) {
  52064. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  52065. return self;
  52066. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  52067. },
  52068. args: [],
  52069. source: "setUp\x0a\x09builder := ClassBuilder new",
  52070. referencedClasses: ["ClassBuilder"],
  52071. messageSends: ["new"]
  52072. }),
  52073. $globals.ClassTest);
  52074. $core.addMethod(
  52075. $core.method({
  52076. selector: "tearDown",
  52077. protocol: "running",
  52078. fn: function (){
  52079. var self=this,$self=this;
  52080. return $core.withContext(function($ctx1) {
  52081. var $1,$receiver;
  52082. $1=$self["@theClass"];
  52083. if(($receiver = $1) == null || $receiver.a$nil){
  52084. $1;
  52085. } else {
  52086. $recv($recv($self["@theClass"])._allSubclasses())._reverseDo_((function(each){
  52087. return $core.withContext(function($ctx2) {
  52088. return $recv($globals.Smalltalk)._removeClass_(each);
  52089. $ctx2.sendIdx["removeClass:"]=1;
  52090. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52091. }));
  52092. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  52093. $self["@theClass"]=nil;
  52094. $self["@theClass"];
  52095. }
  52096. return self;
  52097. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  52098. },
  52099. args: [],
  52100. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  52101. referencedClasses: ["Smalltalk"],
  52102. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  52103. }),
  52104. $globals.ClassTest);
  52105. $core.addMethod(
  52106. $core.method({
  52107. selector: "testAllSubclasses",
  52108. protocol: "tests",
  52109. fn: function (){
  52110. var self=this,$self=this;
  52111. var subclasses,index;
  52112. return $core.withContext(function($ctx1) {
  52113. subclasses=$recv($globals.Object)._subclasses();
  52114. $ctx1.sendIdx["subclasses"]=1;
  52115. index=(1);
  52116. $recv((function(){
  52117. return $core.withContext(function($ctx2) {
  52118. return $recv(index).__gt($recv(subclasses)._size());
  52119. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52120. }))._whileFalse_((function(){
  52121. return $core.withContext(function($ctx2) {
  52122. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  52123. index=$recv(index).__plus((1));
  52124. return index;
  52125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  52126. }));
  52127. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  52128. return self;
  52129. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  52130. },
  52131. args: [],
  52132. 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",
  52133. referencedClasses: ["Object"],
  52134. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  52135. }),
  52136. $globals.ClassTest);
  52137. $core.addMethod(
  52138. $core.method({
  52139. selector: "testMetaclassSubclasses",
  52140. protocol: "tests",
  52141. fn: function (){
  52142. var self=this,$self=this;
  52143. var subclasses;
  52144. return $core.withContext(function($ctx1) {
  52145. var $4,$3,$2,$1;
  52146. $4=$recv($globals.Object)._class();
  52147. $ctx1.sendIdx["class"]=1;
  52148. $3=$recv($4)._instanceClass();
  52149. $2=$recv($3)._subclasses();
  52150. $ctx1.sendIdx["subclasses"]=1;
  52151. $1=$recv($2)._select_((function(each){
  52152. return $core.withContext(function($ctx2) {
  52153. return $recv($recv(each)._isMetaclass())._not();
  52154. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52155. }));
  52156. subclasses=$recv($1)._collect_((function(each){
  52157. return $core.withContext(function($ctx2) {
  52158. return $recv(each)._theMetaClass();
  52159. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52160. }));
  52161. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  52162. return self;
  52163. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  52164. },
  52165. args: [],
  52166. 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",
  52167. referencedClasses: ["Object"],
  52168. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  52169. }),
  52170. $globals.ClassTest);
  52171. $core.addMethod(
  52172. $core.method({
  52173. selector: "testSetJavaScriptConstructor",
  52174. protocol: "tests",
  52175. fn: function (){
  52176. var self=this,$self=this;
  52177. var instance;
  52178. return $core.withContext(function($ctx1) {
  52179. var $2,$1,$4,$3,$6,$5,$8,$7;
  52180. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52181. $recv($self["@theClass"])._javascriptConstructor_($self._jsConstructor());
  52182. $2=$recv($self["@theClass"])._superclass();
  52183. $ctx1.sendIdx["superclass"]=1;
  52184. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52185. $ctx1.sendIdx["=="]=1;
  52186. $self._assert_($1);
  52187. $ctx1.sendIdx["assert:"]=1;
  52188. $4=$recv($self["@theClass"])._instanceVariableNames();
  52189. $ctx1.sendIdx["instanceVariableNames"]=1;
  52190. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52191. $ctx1.sendIdx["=="]=2;
  52192. $self._assert_($3);
  52193. $ctx1.sendIdx["assert:"]=2;
  52194. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52195. $ctx1.sendIdx["assert:equals:"]=1;
  52196. $6=$recv($self["@theClass"])._package();
  52197. $ctx1.sendIdx["package"]=1;
  52198. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52199. $ctx1.sendIdx["=="]=3;
  52200. $self._assert_($5);
  52201. $ctx1.sendIdx["assert:"]=3;
  52202. $8=$recv($self["@theClass"])._methodDictionary();
  52203. $ctx1.sendIdx["methodDictionary"]=1;
  52204. $7=$recv($8)._keys();
  52205. $ctx1.sendIdx["keys"]=1;
  52206. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52207. $ctx1.sendIdx["assert:equals:"]=2;
  52208. instance=$recv($self["@theClass"])._new();
  52209. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52210. $self._assert_equals_($recv(instance)._value(),(4));
  52211. $ctx1.sendIdx["assert:equals:"]=3;
  52212. $self._shouldnt_raise_((function(){
  52213. return $core.withContext(function($ctx2) {
  52214. return $recv(instance)._foo_((9));
  52215. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52216. }),$globals.Error);
  52217. $self._assert_equals_($recv(instance)._foo(),(9));
  52218. return self;
  52219. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52220. },
  52221. args: [],
  52222. 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",
  52223. referencedClasses: ["ObjectMock", "Error"],
  52224. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52225. }),
  52226. $globals.ClassTest);
  52227. $core.addMethod(
  52228. $core.method({
  52229. selector: "testTrickySetJavaScriptConstructor",
  52230. protocol: "tests",
  52231. fn: function (){
  52232. var self=this,$self=this;
  52233. var instance;
  52234. return $core.withContext(function($ctx1) {
  52235. var $2,$1,$4,$3,$6,$5,$8,$7;
  52236. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52237. $recv($self["@theClass"])._javascriptConstructor_($self._trickyJsConstructor());
  52238. $2=$recv($self["@theClass"])._superclass();
  52239. $ctx1.sendIdx["superclass"]=1;
  52240. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52241. $ctx1.sendIdx["=="]=1;
  52242. $self._assert_($1);
  52243. $ctx1.sendIdx["assert:"]=1;
  52244. $4=$recv($self["@theClass"])._instanceVariableNames();
  52245. $ctx1.sendIdx["instanceVariableNames"]=1;
  52246. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52247. $ctx1.sendIdx["=="]=2;
  52248. $self._assert_($3);
  52249. $ctx1.sendIdx["assert:"]=2;
  52250. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52251. $ctx1.sendIdx["assert:equals:"]=1;
  52252. $6=$recv($self["@theClass"])._package();
  52253. $ctx1.sendIdx["package"]=1;
  52254. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52255. $ctx1.sendIdx["=="]=3;
  52256. $self._assert_($5);
  52257. $ctx1.sendIdx["assert:"]=3;
  52258. $8=$recv($self["@theClass"])._methodDictionary();
  52259. $ctx1.sendIdx["methodDictionary"]=1;
  52260. $7=$recv($8)._keys();
  52261. $ctx1.sendIdx["keys"]=1;
  52262. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52263. $ctx1.sendIdx["assert:equals:"]=2;
  52264. instance=$recv($self["@theClass"])._new();
  52265. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52266. $self._assert_equals_($recv(instance)._value(),(4));
  52267. $ctx1.sendIdx["assert:equals:"]=3;
  52268. $self._shouldnt_raise_((function(){
  52269. return $core.withContext(function($ctx2) {
  52270. return $recv(instance)._foo_((9));
  52271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52272. }),$globals.Error);
  52273. $self._assert_equals_($recv(instance)._foo(),(9));
  52274. return self;
  52275. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52276. },
  52277. args: [],
  52278. 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",
  52279. referencedClasses: ["ObjectMock", "Error"],
  52280. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52281. }),
  52282. $globals.ClassTest);
  52283. $core.addMethod(
  52284. $core.method({
  52285. selector: "trickyJsConstructor",
  52286. protocol: "running",
  52287. fn: function (){
  52288. var self=this,$self=this;
  52289. return $core.withContext(function($ctx1) {
  52290. function Foo(){}
  52291. Foo.prototype.valueOf = function () {return 4;};
  52292. Foo.prototype._foo = function () {return "bar";};
  52293. return Foo;
  52294. ;
  52295. return self;
  52296. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  52297. },
  52298. args: [],
  52299. 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'>",
  52300. referencedClasses: [],
  52301. messageSends: []
  52302. }),
  52303. $globals.ClassTest);
  52304. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  52305. $core.addMethod(
  52306. $core.method({
  52307. selector: "assertSameContents:as:",
  52308. protocol: "convenience",
  52309. fn: function (aCollection,anotherCollection){
  52310. var self=this,$self=this;
  52311. return $core.withContext(function($ctx1) {
  52312. var $2,$1,$4,$3;
  52313. $2=$recv(aCollection)._size();
  52314. $ctx1.sendIdx["size"]=1;
  52315. $1=$recv($2).__eq($recv(anotherCollection)._size());
  52316. $ctx1.sendIdx["="]=1;
  52317. $self._assert_($1);
  52318. $ctx1.sendIdx["assert:"]=1;
  52319. $recv(aCollection)._do_((function(each){
  52320. return $core.withContext(function($ctx2) {
  52321. $4=$recv(aCollection)._occurrencesOf_(each);
  52322. $ctx2.sendIdx["occurrencesOf:"]=1;
  52323. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  52324. return $self._assert_($3);
  52325. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52326. }));
  52327. return self;
  52328. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  52329. },
  52330. args: ["aCollection", "anotherCollection"],
  52331. 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)) ]",
  52332. referencedClasses: [],
  52333. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  52334. }),
  52335. $globals.CollectionTest);
  52336. $core.addMethod(
  52337. $core.method({
  52338. selector: "collection",
  52339. protocol: "fixture",
  52340. fn: function (){
  52341. var self=this,$self=this;
  52342. return $core.withContext(function($ctx1) {
  52343. $self._subclassResponsibility();
  52344. return self;
  52345. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  52346. },
  52347. args: [],
  52348. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  52349. referencedClasses: [],
  52350. messageSends: ["subclassResponsibility"]
  52351. }),
  52352. $globals.CollectionTest);
  52353. $core.addMethod(
  52354. $core.method({
  52355. selector: "collectionClass",
  52356. protocol: "fixture",
  52357. fn: function (){
  52358. var self=this,$self=this;
  52359. return $core.withContext(function($ctx1) {
  52360. return $recv($self._class())._collectionClass();
  52361. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  52362. },
  52363. args: [],
  52364. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  52365. referencedClasses: [],
  52366. messageSends: ["collectionClass", "class"]
  52367. }),
  52368. $globals.CollectionTest);
  52369. $core.addMethod(
  52370. $core.method({
  52371. selector: "collectionOfPrintStrings",
  52372. protocol: "fixture",
  52373. fn: function (){
  52374. var self=this,$self=this;
  52375. return $core.withContext(function($ctx1) {
  52376. $self._subclassResponsibility();
  52377. return self;
  52378. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  52379. },
  52380. args: [],
  52381. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  52382. referencedClasses: [],
  52383. messageSends: ["subclassResponsibility"]
  52384. }),
  52385. $globals.CollectionTest);
  52386. $core.addMethod(
  52387. $core.method({
  52388. selector: "collectionSize",
  52389. protocol: "fixture",
  52390. fn: function (){
  52391. var self=this,$self=this;
  52392. return $core.withContext(function($ctx1) {
  52393. $self._subclassResponsibility();
  52394. return self;
  52395. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  52396. },
  52397. args: [],
  52398. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  52399. referencedClasses: [],
  52400. messageSends: ["subclassResponsibility"]
  52401. }),
  52402. $globals.CollectionTest);
  52403. $core.addMethod(
  52404. $core.method({
  52405. selector: "collectionWithDuplicates",
  52406. protocol: "fixture",
  52407. fn: function (){
  52408. var self=this,$self=this;
  52409. return $core.withContext(function($ctx1) {
  52410. $self._subclassResponsibility();
  52411. return self;
  52412. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  52413. },
  52414. args: [],
  52415. 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",
  52416. referencedClasses: [],
  52417. messageSends: ["subclassResponsibility"]
  52418. }),
  52419. $globals.CollectionTest);
  52420. $core.addMethod(
  52421. $core.method({
  52422. selector: "collectionWithNewValue",
  52423. protocol: "fixture",
  52424. fn: function (){
  52425. var self=this,$self=this;
  52426. return $core.withContext(function($ctx1) {
  52427. $self._subclassResponsibility();
  52428. return self;
  52429. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  52430. },
  52431. args: [],
  52432. 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",
  52433. referencedClasses: [],
  52434. messageSends: ["subclassResponsibility"]
  52435. }),
  52436. $globals.CollectionTest);
  52437. $core.addMethod(
  52438. $core.method({
  52439. selector: "initialize",
  52440. protocol: "initialization",
  52441. fn: function (){
  52442. var self=this,$self=this;
  52443. return $core.withContext(function($ctx1) {
  52444. (
  52445. $ctx1.supercall = true,
  52446. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  52447. $ctx1.supercall = false;
  52448. $self["@sampleBlock"]=(function(){
  52449. });
  52450. return self;
  52451. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  52452. },
  52453. args: [],
  52454. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  52455. referencedClasses: [],
  52456. messageSends: ["initialize"]
  52457. }),
  52458. $globals.CollectionTest);
  52459. $core.addMethod(
  52460. $core.method({
  52461. selector: "sampleNewValue",
  52462. protocol: "fixture",
  52463. fn: function (){
  52464. var self=this,$self=this;
  52465. return "N";
  52466. },
  52467. args: [],
  52468. 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'",
  52469. referencedClasses: [],
  52470. messageSends: []
  52471. }),
  52472. $globals.CollectionTest);
  52473. $core.addMethod(
  52474. $core.method({
  52475. selector: "sampleNewValueAsCollection",
  52476. protocol: "fixture",
  52477. fn: function (){
  52478. var self=this,$self=this;
  52479. return $core.withContext(function($ctx1) {
  52480. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  52481. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  52482. },
  52483. args: [],
  52484. 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",
  52485. referencedClasses: [],
  52486. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  52487. }),
  52488. $globals.CollectionTest);
  52489. $core.addMethod(
  52490. $core.method({
  52491. selector: "testAddAll",
  52492. protocol: "tests",
  52493. fn: function (){
  52494. var self=this,$self=this;
  52495. return $core.withContext(function($ctx1) {
  52496. 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;
  52497. $2=$self._collection();
  52498. $ctx1.sendIdx["collection"]=1;
  52499. $4=$self._collectionClass();
  52500. $ctx1.sendIdx["collectionClass"]=1;
  52501. $3=$recv($4)._new();
  52502. $ctx1.sendIdx["new"]=1;
  52503. $recv($2)._addAll_($3);
  52504. $ctx1.sendIdx["addAll:"]=1;
  52505. $5=$recv($2)._yourself();
  52506. $ctx1.sendIdx["yourself"]=1;
  52507. $1=$5;
  52508. $6=$self._collection();
  52509. $ctx1.sendIdx["collection"]=2;
  52510. $self._assert_equals_($1,$6);
  52511. $ctx1.sendIdx["assert:equals:"]=1;
  52512. $9=$self._collectionClass();
  52513. $ctx1.sendIdx["collectionClass"]=2;
  52514. $8=$recv($9)._new();
  52515. $ctx1.sendIdx["new"]=2;
  52516. $10=$self._collection();
  52517. $ctx1.sendIdx["collection"]=3;
  52518. $recv($8)._addAll_($10);
  52519. $ctx1.sendIdx["addAll:"]=2;
  52520. $11=$recv($8)._yourself();
  52521. $ctx1.sendIdx["yourself"]=2;
  52522. $7=$11;
  52523. $12=$self._collection();
  52524. $ctx1.sendIdx["collection"]=4;
  52525. $self._assert_equals_($7,$12);
  52526. $ctx1.sendIdx["assert:equals:"]=2;
  52527. $15=$self._collectionClass();
  52528. $ctx1.sendIdx["collectionClass"]=3;
  52529. $14=$recv($15)._new();
  52530. $ctx1.sendIdx["new"]=3;
  52531. $17=$self._collectionClass();
  52532. $ctx1.sendIdx["collectionClass"]=4;
  52533. $16=$recv($17)._new();
  52534. $ctx1.sendIdx["new"]=4;
  52535. $recv($14)._addAll_($16);
  52536. $ctx1.sendIdx["addAll:"]=3;
  52537. $18=$recv($14)._yourself();
  52538. $ctx1.sendIdx["yourself"]=3;
  52539. $13=$18;
  52540. $self._assert_equals_($13,$recv($self._collectionClass())._new());
  52541. $ctx1.sendIdx["assert:equals:"]=3;
  52542. $20=$self._collection();
  52543. $ctx1.sendIdx["collection"]=5;
  52544. $21=$self._sampleNewValueAsCollection();
  52545. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52546. $recv($20)._addAll_($21);
  52547. $ctx1.sendIdx["addAll:"]=4;
  52548. $22=$recv($20)._yourself();
  52549. $ctx1.sendIdx["yourself"]=4;
  52550. $19=$22;
  52551. $23=$self._collectionWithNewValue();
  52552. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52553. $self._assert_equals_($19,$23);
  52554. $25=$self._sampleNewValueAsCollection();
  52555. $recv($25)._addAll_($self._collection());
  52556. $24=$recv($25)._yourself();
  52557. $self._assertSameContents_as_($24,$self._collectionWithNewValue());
  52558. return self;
  52559. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  52560. },
  52561. args: [],
  52562. 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",
  52563. referencedClasses: [],
  52564. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52565. }),
  52566. $globals.CollectionTest);
  52567. $core.addMethod(
  52568. $core.method({
  52569. selector: "testAllSatisfy",
  52570. protocol: "tests",
  52571. fn: function (){
  52572. var self=this,$self=this;
  52573. var collection,anyOne;
  52574. return $core.withContext(function($ctx1) {
  52575. var $1;
  52576. collection=$self._collection();
  52577. anyOne=$recv(collection)._anyOne();
  52578. $1=$recv(collection)._allSatisfy_((function(each){
  52579. return $core.withContext(function($ctx2) {
  52580. return $recv(collection)._includes_(each);
  52581. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52582. }));
  52583. $ctx1.sendIdx["allSatisfy:"]=1;
  52584. $self._assert_($1);
  52585. $self._deny_($recv(collection)._allSatisfy_((function(each){
  52586. return $core.withContext(function($ctx2) {
  52587. return $recv(each).__tild_eq(anyOne);
  52588. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52589. })));
  52590. return self;
  52591. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  52592. },
  52593. args: [],
  52594. 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 ])",
  52595. referencedClasses: [],
  52596. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  52597. }),
  52598. $globals.CollectionTest);
  52599. $core.addMethod(
  52600. $core.method({
  52601. selector: "testAnyOne",
  52602. protocol: "tests",
  52603. fn: function (){
  52604. var self=this,$self=this;
  52605. return $core.withContext(function($ctx1) {
  52606. var $2,$1;
  52607. $self._should_raise_((function(){
  52608. return $core.withContext(function($ctx2) {
  52609. return $recv($recv($self._collectionClass())._new())._anyOne();
  52610. $ctx2.sendIdx["anyOne"]=1;
  52611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52612. }),$globals.Error);
  52613. $2=$self._collection();
  52614. $ctx1.sendIdx["collection"]=1;
  52615. $1=$recv($2)._includes_($recv($self._collection())._anyOne());
  52616. $self._assert_($1);
  52617. return self;
  52618. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  52619. },
  52620. args: [],
  52621. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  52622. referencedClasses: ["Error"],
  52623. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  52624. }),
  52625. $globals.CollectionTest);
  52626. $core.addMethod(
  52627. $core.method({
  52628. selector: "testAnySatisfy",
  52629. protocol: "tests",
  52630. fn: function (){
  52631. var self=this,$self=this;
  52632. var anyOne;
  52633. return $core.withContext(function($ctx1) {
  52634. var $1,$3,$2;
  52635. $1=$self._collection();
  52636. $ctx1.sendIdx["collection"]=1;
  52637. anyOne=$recv($1)._anyOne();
  52638. $3=$self._collection();
  52639. $ctx1.sendIdx["collection"]=2;
  52640. $2=$recv($3)._anySatisfy_((function(each){
  52641. return $core.withContext(function($ctx2) {
  52642. return $recv(each).__eq(anyOne);
  52643. $ctx2.sendIdx["="]=1;
  52644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52645. }));
  52646. $ctx1.sendIdx["anySatisfy:"]=1;
  52647. $self._assert_($2);
  52648. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  52649. return $core.withContext(function($ctx2) {
  52650. return $recv(each).__eq($recv($globals.Object)._new());
  52651. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52652. })));
  52653. return self;
  52654. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  52655. },
  52656. args: [],
  52657. 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 ])",
  52658. referencedClasses: ["Object"],
  52659. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  52660. }),
  52661. $globals.CollectionTest);
  52662. $core.addMethod(
  52663. $core.method({
  52664. selector: "testAsArray",
  52665. protocol: "tests",
  52666. fn: function (){
  52667. var self=this,$self=this;
  52668. return $core.withContext(function($ctx1) {
  52669. var $1;
  52670. $1=$self._collection();
  52671. $ctx1.sendIdx["collection"]=1;
  52672. $self._assertSameContents_as_($1,$recv($self._collection())._asArray());
  52673. return self;
  52674. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  52675. },
  52676. args: [],
  52677. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  52678. referencedClasses: [],
  52679. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  52680. }),
  52681. $globals.CollectionTest);
  52682. $core.addMethod(
  52683. $core.method({
  52684. selector: "testAsOrderedCollection",
  52685. protocol: "tests",
  52686. fn: function (){
  52687. var self=this,$self=this;
  52688. return $core.withContext(function($ctx1) {
  52689. var $1;
  52690. $1=$self._collection();
  52691. $ctx1.sendIdx["collection"]=1;
  52692. $self._assertSameContents_as_($1,$recv($self._collection())._asOrderedCollection());
  52693. return self;
  52694. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  52695. },
  52696. args: [],
  52697. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  52698. referencedClasses: [],
  52699. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  52700. }),
  52701. $globals.CollectionTest);
  52702. $core.addMethod(
  52703. $core.method({
  52704. selector: "testAsSet",
  52705. protocol: "tests",
  52706. fn: function (){
  52707. var self=this,$self=this;
  52708. var c,set;
  52709. return $core.withContext(function($ctx1) {
  52710. c=$self._collectionWithDuplicates();
  52711. set=$recv(c)._asSet();
  52712. $self._assert_equals_($recv(set)._size(),(6));
  52713. $recv(c)._do_((function(each){
  52714. return $core.withContext(function($ctx2) {
  52715. return $self._assert_($recv(set)._includes_(each));
  52716. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52717. }));
  52718. return self;
  52719. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  52720. },
  52721. args: [],
  52722. 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) ]",
  52723. referencedClasses: [],
  52724. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  52725. }),
  52726. $globals.CollectionTest);
  52727. $core.addMethod(
  52728. $core.method({
  52729. selector: "testCollect",
  52730. protocol: "tests",
  52731. fn: function (){
  52732. var self=this,$self=this;
  52733. return $core.withContext(function($ctx1) {
  52734. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  52735. $2=$self._collection();
  52736. $ctx1.sendIdx["collection"]=1;
  52737. $1=$recv($2)._collect_((function(each){
  52738. return each;
  52739. }));
  52740. $ctx1.sendIdx["collect:"]=1;
  52741. $3=$self._collection();
  52742. $ctx1.sendIdx["collection"]=2;
  52743. $self._assert_equals_($1,$3);
  52744. $ctx1.sendIdx["assert:equals:"]=1;
  52745. $5=$self._collectionWithNewValue();
  52746. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52747. $4=$recv($5)._collect_((function(each){
  52748. return each;
  52749. }));
  52750. $ctx1.sendIdx["collect:"]=2;
  52751. $self._assert_equals_($4,$self._collectionWithNewValue());
  52752. $ctx1.sendIdx["assert:equals:"]=2;
  52753. $8=$self._collectionClass();
  52754. $ctx1.sendIdx["collectionClass"]=1;
  52755. $7=$recv($8)._new();
  52756. $ctx1.sendIdx["new"]=1;
  52757. $6=$recv($7)._collect_((function(each){
  52758. return $core.withContext(function($ctx2) {
  52759. return $recv(each)._printString();
  52760. $ctx2.sendIdx["printString"]=1;
  52761. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  52762. }));
  52763. $ctx1.sendIdx["collect:"]=3;
  52764. $self._assert_equals_($6,$recv($self._collectionClass())._new());
  52765. $ctx1.sendIdx["assert:equals:"]=3;
  52766. $11=$self._collection();
  52767. $ctx1.sendIdx["collection"]=3;
  52768. $10=$recv($11)._collect_((function(){
  52769. return $core.withContext(function($ctx2) {
  52770. return $self._sampleNewValue();
  52771. $ctx2.sendIdx["sampleNewValue"]=1;
  52772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  52773. }));
  52774. $ctx1.sendIdx["collect:"]=4;
  52775. $9=$recv($10)._detect_((function(){
  52776. return true;
  52777. }));
  52778. $self._assert_equals_($9,$self._sampleNewValue());
  52779. $ctx1.sendIdx["assert:equals:"]=4;
  52780. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  52781. return $core.withContext(function($ctx2) {
  52782. return $recv(each)._printString();
  52783. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52784. })),$self._collectionOfPrintStrings());
  52785. return self;
  52786. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  52787. },
  52788. args: [],
  52789. 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",
  52790. referencedClasses: [],
  52791. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  52792. }),
  52793. $globals.CollectionTest);
  52794. $core.addMethod(
  52795. $core.method({
  52796. selector: "testComma",
  52797. protocol: "tests",
  52798. fn: function (){
  52799. var self=this,$self=this;
  52800. return $core.withContext(function($ctx1) {
  52801. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  52802. $2=$self._collection();
  52803. $ctx1.sendIdx["collection"]=1;
  52804. $4=$self._collectionClass();
  52805. $ctx1.sendIdx["collectionClass"]=1;
  52806. $3=$recv($4)._new();
  52807. $ctx1.sendIdx["new"]=1;
  52808. $1=$recv($2).__comma($3);
  52809. $ctx1.sendIdx[","]=1;
  52810. $5=$self._collection();
  52811. $ctx1.sendIdx["collection"]=2;
  52812. $self._assert_equals_($1,$5);
  52813. $ctx1.sendIdx["assert:equals:"]=1;
  52814. $8=$self._collectionClass();
  52815. $ctx1.sendIdx["collectionClass"]=2;
  52816. $7=$recv($8)._new();
  52817. $ctx1.sendIdx["new"]=2;
  52818. $9=$self._collection();
  52819. $ctx1.sendIdx["collection"]=3;
  52820. $6=$recv($7).__comma($9);
  52821. $ctx1.sendIdx[","]=2;
  52822. $10=$self._collection();
  52823. $ctx1.sendIdx["collection"]=4;
  52824. $self._assert_equals_($6,$10);
  52825. $ctx1.sendIdx["assert:equals:"]=2;
  52826. $13=$self._collectionClass();
  52827. $ctx1.sendIdx["collectionClass"]=3;
  52828. $12=$recv($13)._new();
  52829. $ctx1.sendIdx["new"]=3;
  52830. $15=$self._collectionClass();
  52831. $ctx1.sendIdx["collectionClass"]=4;
  52832. $14=$recv($15)._new();
  52833. $ctx1.sendIdx["new"]=4;
  52834. $11=$recv($12).__comma($14);
  52835. $ctx1.sendIdx[","]=3;
  52836. $self._assert_equals_($11,$recv($self._collectionClass())._new());
  52837. $ctx1.sendIdx["assert:equals:"]=3;
  52838. $17=$self._collection();
  52839. $ctx1.sendIdx["collection"]=5;
  52840. $18=$self._sampleNewValueAsCollection();
  52841. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52842. $16=$recv($17).__comma($18);
  52843. $ctx1.sendIdx[","]=4;
  52844. $19=$self._collectionWithNewValue();
  52845. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52846. $self._assert_equals_($16,$19);
  52847. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  52848. return self;
  52849. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  52850. },
  52851. args: [],
  52852. 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",
  52853. referencedClasses: [],
  52854. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52855. }),
  52856. $globals.CollectionTest);
  52857. $core.addMethod(
  52858. $core.method({
  52859. selector: "testCopy",
  52860. protocol: "tests",
  52861. fn: function (){
  52862. var self=this,$self=this;
  52863. return $core.withContext(function($ctx1) {
  52864. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  52865. $3=$self._collectionClass();
  52866. $ctx1.sendIdx["collectionClass"]=1;
  52867. $2=$recv($3)._new();
  52868. $ctx1.sendIdx["new"]=1;
  52869. $1=$recv($2)._copy();
  52870. $ctx1.sendIdx["copy"]=1;
  52871. $5=$self._collectionClass();
  52872. $ctx1.sendIdx["collectionClass"]=2;
  52873. $4=$recv($5)._new();
  52874. $ctx1.sendIdx["new"]=2;
  52875. $self._assert_equals_($1,$4);
  52876. $ctx1.sendIdx["assert:equals:"]=1;
  52877. $7=$self._collection();
  52878. $ctx1.sendIdx["collection"]=1;
  52879. $6=$recv($7)._copy();
  52880. $ctx1.sendIdx["copy"]=2;
  52881. $8=$self._collection();
  52882. $ctx1.sendIdx["collection"]=2;
  52883. $self._assert_equals_($6,$8);
  52884. $ctx1.sendIdx["assert:equals:"]=2;
  52885. $10=$self._collectionWithNewValue();
  52886. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52887. $9=$recv($10)._copy();
  52888. $ctx1.sendIdx["copy"]=3;
  52889. $11=$self._collectionWithNewValue();
  52890. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52891. $self._assert_equals_($9,$11);
  52892. $15=$self._collectionClass();
  52893. $ctx1.sendIdx["collectionClass"]=3;
  52894. $14=$recv($15)._new();
  52895. $ctx1.sendIdx["new"]=3;
  52896. $13=$recv($14)._copy();
  52897. $ctx1.sendIdx["copy"]=4;
  52898. $16=$self._collection();
  52899. $ctx1.sendIdx["collection"]=3;
  52900. $12=$recv($13).__eq($16);
  52901. $ctx1.sendIdx["="]=1;
  52902. $self._deny_($12);
  52903. $ctx1.sendIdx["deny:"]=1;
  52904. $19=$self._collection();
  52905. $ctx1.sendIdx["collection"]=4;
  52906. $18=$recv($19)._copy();
  52907. $ctx1.sendIdx["copy"]=5;
  52908. $17=$recv($18).__eq($recv($self._collectionClass())._new());
  52909. $ctx1.sendIdx["="]=2;
  52910. $self._deny_($17);
  52911. $ctx1.sendIdx["deny:"]=2;
  52912. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  52913. return self;
  52914. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  52915. },
  52916. args: [],
  52917. 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",
  52918. referencedClasses: [],
  52919. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  52920. }),
  52921. $globals.CollectionTest);
  52922. $core.addMethod(
  52923. $core.method({
  52924. selector: "testCopySeparates",
  52925. protocol: "tests",
  52926. fn: function (){
  52927. var self=this,$self=this;
  52928. var original,copy;
  52929. return $core.withContext(function($ctx1) {
  52930. original=$self._collection();
  52931. $ctx1.sendIdx["collection"]=1;
  52932. copy=$recv(original)._copy();
  52933. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  52934. $self._assert_($recv(original).__eq($self._collection()));
  52935. return self;
  52936. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  52937. },
  52938. args: [],
  52939. 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",
  52940. referencedClasses: [],
  52941. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  52942. }),
  52943. $globals.CollectionTest);
  52944. $core.addMethod(
  52945. $core.method({
  52946. selector: "testDetect",
  52947. protocol: "tests",
  52948. fn: function (){
  52949. var self=this,$self=this;
  52950. return $core.withContext(function($ctx1) {
  52951. var $1,$2,$3,$4,$6,$5,$7;
  52952. $self._shouldnt_raise_((function(){
  52953. return $core.withContext(function($ctx2) {
  52954. $1=$self._collection();
  52955. $ctx2.sendIdx["collection"]=1;
  52956. return $recv($1)._detect_((function(){
  52957. return true;
  52958. }));
  52959. $ctx2.sendIdx["detect:"]=1;
  52960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52961. }),$globals.Error);
  52962. $self._should_raise_((function(){
  52963. return $core.withContext(function($ctx2) {
  52964. $2=$self._collection();
  52965. $ctx2.sendIdx["collection"]=2;
  52966. return $recv($2)._detect_((function(){
  52967. return false;
  52968. }));
  52969. $ctx2.sendIdx["detect:"]=2;
  52970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  52971. }),$globals.Error);
  52972. $ctx1.sendIdx["should:raise:"]=1;
  52973. $3=$recv($self._sampleNewValueAsCollection())._detect_((function(){
  52974. return true;
  52975. }));
  52976. $ctx1.sendIdx["detect:"]=3;
  52977. $4=$self._sampleNewValue();
  52978. $ctx1.sendIdx["sampleNewValue"]=1;
  52979. $self._assert_equals_($3,$4);
  52980. $ctx1.sendIdx["assert:equals:"]=1;
  52981. $5=$recv($self._collectionWithNewValue())._detect_((function(each){
  52982. return $core.withContext(function($ctx2) {
  52983. $6=$self._sampleNewValue();
  52984. $ctx2.sendIdx["sampleNewValue"]=2;
  52985. return $recv(each).__eq($6);
  52986. $ctx2.sendIdx["="]=1;
  52987. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52988. }));
  52989. $ctx1.sendIdx["detect:"]=4;
  52990. $7=$self._sampleNewValue();
  52991. $ctx1.sendIdx["sampleNewValue"]=3;
  52992. $self._assert_equals_($5,$7);
  52993. $self._should_raise_((function(){
  52994. return $core.withContext(function($ctx2) {
  52995. return $recv($self._collection())._detect_((function(each){
  52996. return $core.withContext(function($ctx3) {
  52997. return $recv(each).__eq($self._sampleNewValue());
  52998. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  52999. }));
  53000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  53001. }),$globals.Error);
  53002. return self;
  53003. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  53004. },
  53005. args: [],
  53006. 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",
  53007. referencedClasses: ["Error"],
  53008. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53009. }),
  53010. $globals.CollectionTest);
  53011. $core.addMethod(
  53012. $core.method({
  53013. selector: "testDetectIfNone",
  53014. protocol: "tests",
  53015. fn: function (){
  53016. var self=this,$self=this;
  53017. var sentinel;
  53018. return $core.withContext(function($ctx1) {
  53019. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  53020. sentinel=$recv($globals.Object)._new();
  53021. $3=$self._collection();
  53022. $ctx1.sendIdx["collection"]=1;
  53023. $2=$recv($3)._detect_ifNone_((function(){
  53024. return true;
  53025. }),(function(){
  53026. return sentinel;
  53027. }));
  53028. $ctx1.sendIdx["detect:ifNone:"]=1;
  53029. $1=$recv($2).__tild_eq(sentinel);
  53030. $self._assert_($1);
  53031. $5=$self._collection();
  53032. $ctx1.sendIdx["collection"]=2;
  53033. $4=$recv($5)._detect_ifNone_((function(){
  53034. return false;
  53035. }),(function(){
  53036. return sentinel;
  53037. }));
  53038. $ctx1.sendIdx["detect:ifNone:"]=2;
  53039. $self._assert_equals_($4,sentinel);
  53040. $ctx1.sendIdx["assert:equals:"]=1;
  53041. $6=$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  53042. return true;
  53043. }),(function(){
  53044. return sentinel;
  53045. }));
  53046. $ctx1.sendIdx["detect:ifNone:"]=3;
  53047. $7=$self._sampleNewValue();
  53048. $ctx1.sendIdx["sampleNewValue"]=1;
  53049. $self._assert_equals_($6,$7);
  53050. $ctx1.sendIdx["assert:equals:"]=2;
  53051. $8=$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  53052. return $core.withContext(function($ctx2) {
  53053. $9=$self._sampleNewValue();
  53054. $ctx2.sendIdx["sampleNewValue"]=2;
  53055. return $recv(each).__eq($9);
  53056. $ctx2.sendIdx["="]=1;
  53057. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  53058. }),(function(){
  53059. return sentinel;
  53060. }));
  53061. $ctx1.sendIdx["detect:ifNone:"]=4;
  53062. $10=$self._sampleNewValue();
  53063. $ctx1.sendIdx["sampleNewValue"]=3;
  53064. $self._assert_equals_($8,$10);
  53065. $ctx1.sendIdx["assert:equals:"]=3;
  53066. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  53067. return $core.withContext(function($ctx2) {
  53068. return $recv(each).__eq($self._sampleNewValue());
  53069. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  53070. }),(function(){
  53071. return sentinel;
  53072. })),sentinel);
  53073. return self;
  53074. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  53075. },
  53076. args: [],
  53077. 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",
  53078. referencedClasses: ["Object"],
  53079. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53080. }),
  53081. $globals.CollectionTest);
  53082. $core.addMethod(
  53083. $core.method({
  53084. selector: "testDo",
  53085. protocol: "tests",
  53086. fn: function (){
  53087. var self=this,$self=this;
  53088. var newCollection;
  53089. return $core.withContext(function($ctx1) {
  53090. var $1,$2;
  53091. newCollection=$recv($globals.OrderedCollection)._new();
  53092. $ctx1.sendIdx["new"]=1;
  53093. $1=$self._collection();
  53094. $ctx1.sendIdx["collection"]=1;
  53095. $recv($1)._do_((function(each){
  53096. return $core.withContext(function($ctx2) {
  53097. return $recv(newCollection)._add_(each);
  53098. $ctx2.sendIdx["add:"]=1;
  53099. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53100. }));
  53101. $ctx1.sendIdx["do:"]=1;
  53102. $self._assertSameContents_as_($self._collection(),newCollection);
  53103. $ctx1.sendIdx["assertSameContents:as:"]=1;
  53104. newCollection=$recv($globals.OrderedCollection)._new();
  53105. $2=$self._collectionWithDuplicates();
  53106. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  53107. $recv($2)._do_((function(each){
  53108. return $core.withContext(function($ctx2) {
  53109. return $recv(newCollection)._add_(each);
  53110. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53111. }));
  53112. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  53113. return self;
  53114. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  53115. },
  53116. args: [],
  53117. 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",
  53118. referencedClasses: ["OrderedCollection"],
  53119. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  53120. }),
  53121. $globals.CollectionTest);
  53122. $core.addMethod(
  53123. $core.method({
  53124. selector: "testEquality",
  53125. protocol: "tests",
  53126. fn: function (){
  53127. var self=this,$self=this;
  53128. return $core.withContext(function($ctx1) {
  53129. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  53130. $2=$self._collectionClass();
  53131. $ctx1.sendIdx["collectionClass"]=1;
  53132. $1=$recv($2)._new();
  53133. $ctx1.sendIdx["new"]=1;
  53134. $4=$self._collectionClass();
  53135. $ctx1.sendIdx["collectionClass"]=2;
  53136. $3=$recv($4)._new();
  53137. $ctx1.sendIdx["new"]=2;
  53138. $self._assert_equals_($1,$3);
  53139. $ctx1.sendIdx["assert:equals:"]=1;
  53140. $5=$self._collection();
  53141. $ctx1.sendIdx["collection"]=1;
  53142. $6=$self._collection();
  53143. $ctx1.sendIdx["collection"]=2;
  53144. $self._assert_equals_($5,$6);
  53145. $ctx1.sendIdx["assert:equals:"]=2;
  53146. $7=$self._collectionWithNewValue();
  53147. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53148. $8=$self._collectionWithNewValue();
  53149. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53150. $self._assert_equals_($7,$8);
  53151. $11=$self._collectionClass();
  53152. $ctx1.sendIdx["collectionClass"]=3;
  53153. $10=$recv($11)._new();
  53154. $ctx1.sendIdx["new"]=3;
  53155. $12=$self._collection();
  53156. $ctx1.sendIdx["collection"]=3;
  53157. $9=$recv($10).__eq($12);
  53158. $ctx1.sendIdx["="]=1;
  53159. $self._deny_($9);
  53160. $ctx1.sendIdx["deny:"]=1;
  53161. $14=$self._collection();
  53162. $ctx1.sendIdx["collection"]=4;
  53163. $13=$recv($14).__eq($recv($self._collectionClass())._new());
  53164. $ctx1.sendIdx["="]=2;
  53165. $self._deny_($13);
  53166. $ctx1.sendIdx["deny:"]=2;
  53167. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  53168. return self;
  53169. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  53170. },
  53171. args: [],
  53172. 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",
  53173. referencedClasses: [],
  53174. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  53175. }),
  53176. $globals.CollectionTest);
  53177. $core.addMethod(
  53178. $core.method({
  53179. selector: "testIfEmptyFamily",
  53180. protocol: "tests",
  53181. fn: function (){
  53182. var self=this,$self=this;
  53183. return $core.withContext(function($ctx1) {
  53184. 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;
  53185. $3=$self._collectionClass();
  53186. $ctx1.sendIdx["collectionClass"]=1;
  53187. $2=$recv($3)._new();
  53188. $ctx1.sendIdx["new"]=1;
  53189. $1=$recv($2)._ifEmpty_((function(){
  53190. return (42);
  53191. }));
  53192. $ctx1.sendIdx["ifEmpty:"]=1;
  53193. $self._assert_equals_($1,(42));
  53194. $ctx1.sendIdx["assert:equals:"]=1;
  53195. $5=$self._collection();
  53196. $ctx1.sendIdx["collection"]=1;
  53197. $4=$recv($5)._ifEmpty_((function(){
  53198. return (42);
  53199. }));
  53200. $6=$self._collection();
  53201. $ctx1.sendIdx["collection"]=2;
  53202. $self._assert_equals_($4,$6);
  53203. $ctx1.sendIdx["assert:equals:"]=2;
  53204. $9=$self._collectionClass();
  53205. $ctx1.sendIdx["collectionClass"]=2;
  53206. $8=$recv($9)._new();
  53207. $ctx1.sendIdx["new"]=2;
  53208. $7=$recv($8)._ifNotEmpty_((function(){
  53209. return (42);
  53210. }));
  53211. $ctx1.sendIdx["ifNotEmpty:"]=1;
  53212. $11=$self._collectionClass();
  53213. $ctx1.sendIdx["collectionClass"]=3;
  53214. $10=$recv($11)._new();
  53215. $ctx1.sendIdx["new"]=3;
  53216. $self._assert_equals_($7,$10);
  53217. $ctx1.sendIdx["assert:equals:"]=3;
  53218. $13=$self._collection();
  53219. $ctx1.sendIdx["collection"]=3;
  53220. $12=$recv($13)._ifNotEmpty_((function(){
  53221. return (42);
  53222. }));
  53223. $ctx1.sendIdx["ifNotEmpty:"]=2;
  53224. $self._assert_equals_($12,(42));
  53225. $ctx1.sendIdx["assert:equals:"]=4;
  53226. $15=$self._collection();
  53227. $ctx1.sendIdx["collection"]=4;
  53228. $14=$recv($15)._ifNotEmpty_((function(col){
  53229. return col;
  53230. }));
  53231. $16=$self._collection();
  53232. $ctx1.sendIdx["collection"]=5;
  53233. $self._assert_equals_($14,$16);
  53234. $ctx1.sendIdx["assert:equals:"]=5;
  53235. $19=$self._collectionClass();
  53236. $ctx1.sendIdx["collectionClass"]=4;
  53237. $18=$recv($19)._new();
  53238. $ctx1.sendIdx["new"]=4;
  53239. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  53240. return (42);
  53241. }),(function(){
  53242. return (999);
  53243. }));
  53244. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  53245. $self._assert_equals_($17,(42));
  53246. $ctx1.sendIdx["assert:equals:"]=6;
  53247. $21=$self._collection();
  53248. $ctx1.sendIdx["collection"]=6;
  53249. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  53250. return (42);
  53251. }),(function(){
  53252. return (999);
  53253. }));
  53254. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  53255. $self._assert_equals_($20,(999));
  53256. $ctx1.sendIdx["assert:equals:"]=7;
  53257. $23=$self._collection();
  53258. $ctx1.sendIdx["collection"]=7;
  53259. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  53260. return (42);
  53261. }),(function(col){
  53262. return col;
  53263. }));
  53264. $24=$self._collection();
  53265. $ctx1.sendIdx["collection"]=8;
  53266. $self._assert_equals_($22,$24);
  53267. $ctx1.sendIdx["assert:equals:"]=8;
  53268. $25=$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  53269. return (42);
  53270. }),(function(){
  53271. return (999);
  53272. }));
  53273. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  53274. $self._assert_equals_($25,(999));
  53275. $ctx1.sendIdx["assert:equals:"]=9;
  53276. $27=$self._collection();
  53277. $ctx1.sendIdx["collection"]=9;
  53278. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  53279. return (42);
  53280. }),(function(){
  53281. return (999);
  53282. }));
  53283. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  53284. $self._assert_equals_($26,(42));
  53285. $ctx1.sendIdx["assert:equals:"]=10;
  53286. $29=$self._collection();
  53287. $ctx1.sendIdx["collection"]=10;
  53288. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  53289. return col;
  53290. }),(function(){
  53291. return (999);
  53292. }));
  53293. $self._assert_equals_($28,$self._collection());
  53294. return self;
  53295. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  53296. },
  53297. args: [],
  53298. 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.",
  53299. referencedClasses: [],
  53300. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  53301. }),
  53302. $globals.CollectionTest);
  53303. $core.addMethod(
  53304. $core.method({
  53305. selector: "testIsEmpty",
  53306. protocol: "tests",
  53307. fn: function (){
  53308. var self=this,$self=this;
  53309. return $core.withContext(function($ctx1) {
  53310. var $1;
  53311. $1=$recv($recv($self._collectionClass())._new())._isEmpty();
  53312. $ctx1.sendIdx["isEmpty"]=1;
  53313. $self._assert_($1);
  53314. $self._deny_($recv($self._collection())._isEmpty());
  53315. return self;
  53316. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  53317. },
  53318. args: [],
  53319. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  53320. referencedClasses: [],
  53321. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  53322. }),
  53323. $globals.CollectionTest);
  53324. $core.addMethod(
  53325. $core.method({
  53326. selector: "testNoneSatisfy",
  53327. protocol: "tests",
  53328. fn: function (){
  53329. var self=this,$self=this;
  53330. var anyOne;
  53331. return $core.withContext(function($ctx1) {
  53332. var $1,$3,$2;
  53333. $1=$self._collection();
  53334. $ctx1.sendIdx["collection"]=1;
  53335. anyOne=$recv($1)._anyOne();
  53336. $3=$self._collection();
  53337. $ctx1.sendIdx["collection"]=2;
  53338. $2=$recv($3)._noneSatisfy_((function(each){
  53339. return $core.withContext(function($ctx2) {
  53340. return $recv(each).__eq(anyOne);
  53341. $ctx2.sendIdx["="]=1;
  53342. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53343. }));
  53344. $ctx1.sendIdx["noneSatisfy:"]=1;
  53345. $self._deny_($2);
  53346. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  53347. return $core.withContext(function($ctx2) {
  53348. return $recv(each).__eq($recv($globals.Object)._new());
  53349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53350. })));
  53351. return self;
  53352. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  53353. },
  53354. args: [],
  53355. 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 ])",
  53356. referencedClasses: ["Object"],
  53357. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  53358. }),
  53359. $globals.CollectionTest);
  53360. $core.addMethod(
  53361. $core.method({
  53362. selector: "testRegression1224",
  53363. protocol: "tests",
  53364. fn: function (){
  53365. var self=this,$self=this;
  53366. return $core.withContext(function($ctx1) {
  53367. var $3,$2,$1;
  53368. $3=$recv($self._collectionClass())._new();
  53369. $recv($3)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  53370. }));
  53371. $2=$recv($3)._yourself();
  53372. $1=$recv($2)._size();
  53373. $self._assert_equals_($1,(0));
  53374. return self;
  53375. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.CollectionTest)});
  53376. },
  53377. args: [],
  53378. source: "testRegression1224\x0a\x09self assert: (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size equals: 0",
  53379. referencedClasses: [],
  53380. messageSends: ["assert:equals:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  53381. }),
  53382. $globals.CollectionTest);
  53383. $core.addMethod(
  53384. $core.method({
  53385. selector: "testRemoveAll",
  53386. protocol: "tests",
  53387. fn: function (){
  53388. var self=this,$self=this;
  53389. return $core.withContext(function($ctx1) {
  53390. var $2,$1;
  53391. $2=$self._collection();
  53392. $recv($2)._removeAll();
  53393. $1=$recv($2)._yourself();
  53394. $self._assert_equals_($1,$recv($self._collectionClass())._new());
  53395. return self;
  53396. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  53397. },
  53398. args: [],
  53399. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  53400. referencedClasses: [],
  53401. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  53402. }),
  53403. $globals.CollectionTest);
  53404. $core.addMethod(
  53405. $core.method({
  53406. selector: "testSelect",
  53407. protocol: "tests",
  53408. fn: function (){
  53409. var self=this,$self=this;
  53410. return $core.withContext(function($ctx1) {
  53411. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  53412. $2=$self._collection();
  53413. $ctx1.sendIdx["collection"]=1;
  53414. $1=$recv($2)._select_((function(){
  53415. return false;
  53416. }));
  53417. $ctx1.sendIdx["select:"]=1;
  53418. $4=$self._collectionClass();
  53419. $ctx1.sendIdx["collectionClass"]=1;
  53420. $3=$recv($4)._new();
  53421. $ctx1.sendIdx["new"]=1;
  53422. $self._assert_equals_($1,$3);
  53423. $ctx1.sendIdx["assert:equals:"]=1;
  53424. $6=$self._collection();
  53425. $ctx1.sendIdx["collection"]=2;
  53426. $5=$recv($6)._select_((function(){
  53427. return true;
  53428. }));
  53429. $ctx1.sendIdx["select:"]=2;
  53430. $7=$self._collection();
  53431. $ctx1.sendIdx["collection"]=3;
  53432. $self._assert_equals_($5,$7);
  53433. $ctx1.sendIdx["assert:equals:"]=2;
  53434. $9=$self._collectionWithNewValue();
  53435. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53436. $8=$recv($9)._select_((function(each){
  53437. return $core.withContext(function($ctx2) {
  53438. $10=$self._sampleNewValue();
  53439. $ctx2.sendIdx["sampleNewValue"]=1;
  53440. return $recv(each).__eq($10);
  53441. $ctx2.sendIdx["="]=1;
  53442. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  53443. }));
  53444. $ctx1.sendIdx["select:"]=3;
  53445. $self._assert_equals_($8,$self._sampleNewValueAsCollection());
  53446. $ctx1.sendIdx["assert:equals:"]=3;
  53447. $12=$self._collectionWithNewValue();
  53448. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53449. $11=$recv($12)._select_((function(each){
  53450. return $core.withContext(function($ctx2) {
  53451. $13=$self._sampleNewValue();
  53452. $ctx2.sendIdx["sampleNewValue"]=2;
  53453. return $recv(each).__tild_eq($13);
  53454. $ctx2.sendIdx["~="]=1;
  53455. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53456. }));
  53457. $ctx1.sendIdx["select:"]=4;
  53458. $14=$self._collection();
  53459. $ctx1.sendIdx["collection"]=4;
  53460. $self._assert_equals_($11,$14);
  53461. $ctx1.sendIdx["assert:equals:"]=4;
  53462. $16=$self._collection();
  53463. $ctx1.sendIdx["collection"]=5;
  53464. $15=$recv($16)._select_((function(each){
  53465. return $core.withContext(function($ctx2) {
  53466. $17=$self._sampleNewValue();
  53467. $ctx2.sendIdx["sampleNewValue"]=3;
  53468. return $recv(each).__eq($17);
  53469. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  53470. }));
  53471. $ctx1.sendIdx["select:"]=5;
  53472. $self._assert_equals_($15,$recv($self._collectionClass())._new());
  53473. $ctx1.sendIdx["assert:equals:"]=5;
  53474. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  53475. return $core.withContext(function($ctx2) {
  53476. return $recv(each).__tild_eq($self._sampleNewValue());
  53477. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53478. })),$self._collection());
  53479. return self;
  53480. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  53481. },
  53482. args: [],
  53483. 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",
  53484. referencedClasses: [],
  53485. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  53486. }),
  53487. $globals.CollectionTest);
  53488. $core.addMethod(
  53489. $core.method({
  53490. selector: "testSelectThenCollect",
  53491. protocol: "tests",
  53492. fn: function (){
  53493. var self=this,$self=this;
  53494. return $core.withContext(function($ctx1) {
  53495. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  53496. $2=$self._collection();
  53497. $ctx1.sendIdx["collection"]=1;
  53498. $1=$recv($2)._select_thenCollect_((function(){
  53499. return false;
  53500. }),"isString");
  53501. $ctx1.sendIdx["select:thenCollect:"]=1;
  53502. $4=$self._collectionClass();
  53503. $ctx1.sendIdx["collectionClass"]=1;
  53504. $3=$recv($4)._new();
  53505. $ctx1.sendIdx["new"]=1;
  53506. $self._assert_equals_($1,$3);
  53507. $ctx1.sendIdx["assert:equals:"]=1;
  53508. $6=$self._collection();
  53509. $ctx1.sendIdx["collection"]=2;
  53510. $5=$recv($6)._select_thenCollect_((function(){
  53511. return true;
  53512. }),(function(x){
  53513. return x;
  53514. }));
  53515. $ctx1.sendIdx["select:thenCollect:"]=2;
  53516. $7=$self._collection();
  53517. $ctx1.sendIdx["collection"]=3;
  53518. $self._assert_equals_($5,$7);
  53519. $ctx1.sendIdx["assert:equals:"]=2;
  53520. $8=$recv($self._collection())._select_thenCollect_((function(each){
  53521. return $core.withContext(function($ctx2) {
  53522. $9=$self._sampleNewValue();
  53523. $ctx2.sendIdx["sampleNewValue"]=1;
  53524. return $recv(each).__eq($9);
  53525. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53526. }),(function(x){
  53527. return x;
  53528. }));
  53529. $ctx1.sendIdx["select:thenCollect:"]=3;
  53530. $self._assert_equals_($8,$recv($self._collectionClass())._new());
  53531. $ctx1.sendIdx["assert:equals:"]=3;
  53532. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  53533. return $core.withContext(function($ctx2) {
  53534. return $recv(each).__tild_eq($self._sampleNewValue());
  53535. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53536. }),"printString"),$self._collectionOfPrintStrings());
  53537. return self;
  53538. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{},$globals.CollectionTest)});
  53539. },
  53540. args: [],
  53541. 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",
  53542. referencedClasses: [],
  53543. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  53544. }),
  53545. $globals.CollectionTest);
  53546. $core.addMethod(
  53547. $core.method({
  53548. selector: "testSingle",
  53549. protocol: "tests",
  53550. fn: function (){
  53551. var self=this,$self=this;
  53552. return $core.withContext(function($ctx1) {
  53553. $self._should_raise_((function(){
  53554. return $core.withContext(function($ctx2) {
  53555. return $recv($recv($self._collectionClass())._new())._single();
  53556. $ctx2.sendIdx["single"]=1;
  53557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53558. }),$globals.Error);
  53559. $ctx1.sendIdx["should:raise:"]=1;
  53560. $self._should_raise_((function(){
  53561. return $core.withContext(function($ctx2) {
  53562. return $recv($self._collection())._single();
  53563. $ctx2.sendIdx["single"]=2;
  53564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53565. }),$globals.Error);
  53566. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  53567. return self;
  53568. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  53569. },
  53570. args: [],
  53571. 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",
  53572. referencedClasses: ["Error"],
  53573. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  53574. }),
  53575. $globals.CollectionTest);
  53576. $core.addMethod(
  53577. $core.method({
  53578. selector: "testSize",
  53579. protocol: "tests",
  53580. fn: function (){
  53581. var self=this,$self=this;
  53582. return $core.withContext(function($ctx1) {
  53583. var $1,$2;
  53584. $1=$recv($recv($self._collectionClass())._new())._size();
  53585. $ctx1.sendIdx["size"]=1;
  53586. $self._assert_equals_($1,(0));
  53587. $ctx1.sendIdx["assert:equals:"]=1;
  53588. $2=$recv($self._sampleNewValueAsCollection())._size();
  53589. $ctx1.sendIdx["size"]=2;
  53590. $self._assert_equals_($2,(1));
  53591. $ctx1.sendIdx["assert:equals:"]=2;
  53592. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  53593. return self;
  53594. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  53595. },
  53596. args: [],
  53597. 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",
  53598. referencedClasses: [],
  53599. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  53600. }),
  53601. $globals.CollectionTest);
  53602. $core.addMethod(
  53603. $core.method({
  53604. selector: "collectionClass",
  53605. protocol: "fixture",
  53606. fn: function (){
  53607. var self=this,$self=this;
  53608. return nil;
  53609. },
  53610. args: [],
  53611. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  53612. referencedClasses: [],
  53613. messageSends: []
  53614. }),
  53615. $globals.CollectionTest.a$cls);
  53616. $core.addMethod(
  53617. $core.method({
  53618. selector: "isAbstract",
  53619. protocol: "testing",
  53620. fn: function (){
  53621. var self=this,$self=this;
  53622. return $core.withContext(function($ctx1) {
  53623. return $recv($self._collectionClass())._isNil();
  53624. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.a$cls)});
  53625. },
  53626. args: [],
  53627. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  53628. referencedClasses: [],
  53629. messageSends: ["isNil", "collectionClass"]
  53630. }),
  53631. $globals.CollectionTest.a$cls);
  53632. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  53633. $core.addMethod(
  53634. $core.method({
  53635. selector: "collectionWithNewValue",
  53636. protocol: "fixture",
  53637. fn: function (){
  53638. var self=this,$self=this;
  53639. return $core.withContext(function($ctx1) {
  53640. $self._subclassResponsibility();
  53641. return self;
  53642. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  53643. },
  53644. args: [],
  53645. 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",
  53646. referencedClasses: [],
  53647. messageSends: ["subclassResponsibility"]
  53648. }),
  53649. $globals.IndexableCollectionTest);
  53650. $core.addMethod(
  53651. $core.method({
  53652. selector: "nonIndexesDo:",
  53653. protocol: "fixture",
  53654. fn: function (aBlock){
  53655. var self=this,$self=this;
  53656. return $core.withContext(function($ctx1) {
  53657. $self._subclassResponsibility();
  53658. return self;
  53659. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53660. },
  53661. args: ["aBlock"],
  53662. 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",
  53663. referencedClasses: [],
  53664. messageSends: ["subclassResponsibility"]
  53665. }),
  53666. $globals.IndexableCollectionTest);
  53667. $core.addMethod(
  53668. $core.method({
  53669. selector: "sampleNewIndex",
  53670. protocol: "fixture",
  53671. fn: function (){
  53672. var self=this,$self=this;
  53673. return $core.withContext(function($ctx1) {
  53674. $self._subclassResponsibility();
  53675. return self;
  53676. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  53677. },
  53678. args: [],
  53679. 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",
  53680. referencedClasses: [],
  53681. messageSends: ["subclassResponsibility"]
  53682. }),
  53683. $globals.IndexableCollectionTest);
  53684. $core.addMethod(
  53685. $core.method({
  53686. selector: "samplesDo:",
  53687. protocol: "fixture",
  53688. fn: function (aBlock){
  53689. var self=this,$self=this;
  53690. return $core.withContext(function($ctx1) {
  53691. $self._subclassResponsibility();
  53692. return self;
  53693. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53694. },
  53695. args: ["aBlock"],
  53696. 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",
  53697. referencedClasses: [],
  53698. messageSends: ["subclassResponsibility"]
  53699. }),
  53700. $globals.IndexableCollectionTest);
  53701. $core.addMethod(
  53702. $core.method({
  53703. selector: "testAt",
  53704. protocol: "tests",
  53705. fn: function (){
  53706. var self=this,$self=this;
  53707. return $core.withContext(function($ctx1) {
  53708. var $1;
  53709. $self._nonIndexesDo_((function(each){
  53710. return $core.withContext(function($ctx2) {
  53711. return $self._should_raise_((function(){
  53712. return $core.withContext(function($ctx3) {
  53713. $1=$self._collection();
  53714. $ctx3.sendIdx["collection"]=1;
  53715. return $recv($1)._at_(each);
  53716. $ctx3.sendIdx["at:"]=1;
  53717. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53718. }),$globals.Error);
  53719. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53720. }));
  53721. $self._samplesDo_((function(index,value){
  53722. return $core.withContext(function($ctx2) {
  53723. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  53724. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53725. }));
  53726. return self;
  53727. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  53728. },
  53729. args: [],
  53730. 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 ]",
  53731. referencedClasses: ["Error"],
  53732. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  53733. }),
  53734. $globals.IndexableCollectionTest);
  53735. $core.addMethod(
  53736. $core.method({
  53737. selector: "testAtIfAbsent",
  53738. protocol: "tests",
  53739. fn: function (){
  53740. var self=this,$self=this;
  53741. return $core.withContext(function($ctx1) {
  53742. var $2,$1,$3;
  53743. $self._nonIndexesDo_((function(each){
  53744. return $core.withContext(function($ctx2) {
  53745. $2=$self._collection();
  53746. $ctx2.sendIdx["collection"]=1;
  53747. $1=$recv($2)._at_ifAbsent_(each,(function(){
  53748. return $core.withContext(function($ctx3) {
  53749. return $self._sampleNewValue();
  53750. $ctx3.sendIdx["sampleNewValue"]=1;
  53751. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53752. }));
  53753. $ctx2.sendIdx["at:ifAbsent:"]=1;
  53754. $3=$self._sampleNewValue();
  53755. $ctx2.sendIdx["sampleNewValue"]=2;
  53756. return $self._assert_equals_($1,$3);
  53757. $ctx2.sendIdx["assert:equals:"]=1;
  53758. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53759. }));
  53760. $self._samplesDo_((function(index,value){
  53761. return $core.withContext(function($ctx2) {
  53762. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  53763. return $core.withContext(function($ctx3) {
  53764. return $self._sampleNewValue();
  53765. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  53766. })),value);
  53767. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53768. }));
  53769. return self;
  53770. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  53771. },
  53772. args: [],
  53773. 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 ].",
  53774. referencedClasses: [],
  53775. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  53776. }),
  53777. $globals.IndexableCollectionTest);
  53778. $core.addMethod(
  53779. $core.method({
  53780. selector: "testAtIfAbsentPut",
  53781. protocol: "tests",
  53782. fn: function (){
  53783. var self=this,$self=this;
  53784. var newCollection;
  53785. return $core.withContext(function($ctx1) {
  53786. var $1;
  53787. newCollection=$self._collection();
  53788. $ctx1.sendIdx["collection"]=1;
  53789. $self._samplesDo_((function(index,value){
  53790. return $core.withContext(function($ctx2) {
  53791. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  53792. return $core.withContext(function($ctx3) {
  53793. return $self._sampleNewValue();
  53794. $ctx3.sendIdx["sampleNewValue"]=1;
  53795. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53796. }));
  53797. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  53798. return $self._assert_equals_($1,value);
  53799. $ctx2.sendIdx["assert:equals:"]=1;
  53800. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53801. }));
  53802. $self._assert_equals_(newCollection,$self._collection());
  53803. $ctx1.sendIdx["assert:equals:"]=2;
  53804. $self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  53805. return $core.withContext(function($ctx2) {
  53806. return $self._sampleNewValue();
  53807. $ctx2.sendIdx["sampleNewValue"]=2;
  53808. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53809. })),$self._sampleNewValue());
  53810. $ctx1.sendIdx["assert:equals:"]=3;
  53811. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53812. return self;
  53813. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53814. },
  53815. args: [],
  53816. 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",
  53817. referencedClasses: [],
  53818. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  53819. }),
  53820. $globals.IndexableCollectionTest);
  53821. $core.addMethod(
  53822. $core.method({
  53823. selector: "testAtIfPresent",
  53824. protocol: "tests",
  53825. fn: function (){
  53826. var self=this,$self=this;
  53827. var visited,sentinel;
  53828. return $core.withContext(function($ctx1) {
  53829. var $2,$1,$4,$3;
  53830. sentinel=$recv($globals.Object)._new();
  53831. $self._nonIndexesDo_((function(each){
  53832. return $core.withContext(function($ctx2) {
  53833. visited=nil;
  53834. $2=$self._collection();
  53835. $ctx2.sendIdx["collection"]=1;
  53836. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  53837. visited=value1;
  53838. return sentinel;
  53839. }));
  53840. $ctx2.sendIdx["at:ifPresent:"]=1;
  53841. $self._assert_equals_($1,nil);
  53842. $ctx2.sendIdx["assert:equals:"]=1;
  53843. return $self._assert_($recv(visited)._isNil());
  53844. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53845. }));
  53846. $self._samplesDo_((function(index,value){
  53847. return $core.withContext(function($ctx2) {
  53848. visited=nil;
  53849. $4=$self._collection();
  53850. $ctx2.sendIdx["collection"]=2;
  53851. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  53852. visited=value2;
  53853. return sentinel;
  53854. }));
  53855. $self._assert_equals_($3,sentinel);
  53856. $ctx2.sendIdx["assert:equals:"]=2;
  53857. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53858. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53859. }));
  53860. return self;
  53861. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53862. },
  53863. args: [],
  53864. 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) ]",
  53865. referencedClasses: ["Object"],
  53866. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  53867. }),
  53868. $globals.IndexableCollectionTest);
  53869. $core.addMethod(
  53870. $core.method({
  53871. selector: "testAtIfPresentIfAbsent",
  53872. protocol: "tests",
  53873. fn: function (){
  53874. var self=this,$self=this;
  53875. var visited,sentinel;
  53876. return $core.withContext(function($ctx1) {
  53877. var $2,$1,$3,$5,$4;
  53878. sentinel=$recv($globals.Object)._new();
  53879. $self._nonIndexesDo_((function(each){
  53880. return $core.withContext(function($ctx2) {
  53881. visited=nil;
  53882. $2=$self._collection();
  53883. $ctx2.sendIdx["collection"]=1;
  53884. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  53885. visited=value1;
  53886. return sentinel;
  53887. }),(function(){
  53888. return $core.withContext(function($ctx3) {
  53889. return $self._sampleNewValue();
  53890. $ctx3.sendIdx["sampleNewValue"]=1;
  53891. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  53892. }));
  53893. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  53894. $3=$self._sampleNewValue();
  53895. $ctx2.sendIdx["sampleNewValue"]=2;
  53896. $self._assert_equals_($1,$3);
  53897. $ctx2.sendIdx["assert:equals:"]=1;
  53898. return $self._assert_($recv(visited)._isNil());
  53899. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53900. }));
  53901. $self._samplesDo_((function(index,value){
  53902. return $core.withContext(function($ctx2) {
  53903. visited=nil;
  53904. $5=$self._collection();
  53905. $ctx2.sendIdx["collection"]=2;
  53906. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  53907. visited=value2;
  53908. return sentinel;
  53909. }),(function(){
  53910. return $core.withContext(function($ctx3) {
  53911. return $self._sampleNewValue();
  53912. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  53913. }));
  53914. $self._assert_equals_($4,sentinel);
  53915. $ctx2.sendIdx["assert:equals:"]=2;
  53916. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53917. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  53918. }));
  53919. return self;
  53920. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53921. },
  53922. args: [],
  53923. 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) ]",
  53924. referencedClasses: ["Object"],
  53925. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  53926. }),
  53927. $globals.IndexableCollectionTest);
  53928. $core.addMethod(
  53929. $core.method({
  53930. selector: "testAtPut",
  53931. protocol: "tests",
  53932. fn: function (){
  53933. var self=this,$self=this;
  53934. var newCollection;
  53935. return $core.withContext(function($ctx1) {
  53936. newCollection=$self._collection();
  53937. $ctx1.sendIdx["collection"]=1;
  53938. $self._samplesDo_((function(index,value){
  53939. return $core.withContext(function($ctx2) {
  53940. return $recv(newCollection)._at_put_(index,value);
  53941. $ctx2.sendIdx["at:put:"]=1;
  53942. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53943. }));
  53944. $self._assert_equals_(newCollection,$self._collection());
  53945. $ctx1.sendIdx["assert:equals:"]=1;
  53946. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  53947. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53948. return self;
  53949. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53950. },
  53951. args: [],
  53952. 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",
  53953. referencedClasses: [],
  53954. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  53955. }),
  53956. $globals.IndexableCollectionTest);
  53957. $core.addMethod(
  53958. $core.method({
  53959. selector: "testIndexOf",
  53960. protocol: "tests",
  53961. fn: function (){
  53962. var self=this,$self=this;
  53963. return $core.withContext(function($ctx1) {
  53964. var $1;
  53965. $self._should_raise_((function(){
  53966. return $core.withContext(function($ctx2) {
  53967. $1=$self._collection();
  53968. $ctx2.sendIdx["collection"]=1;
  53969. return $recv($1)._indexOf_($self._sampleNewValue());
  53970. $ctx2.sendIdx["indexOf:"]=1;
  53971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53972. }),$globals.Error);
  53973. $self._samplesDo_((function(index,value){
  53974. return $core.withContext(function($ctx2) {
  53975. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  53976. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  53977. }));
  53978. return self;
  53979. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  53980. },
  53981. args: [],
  53982. 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 ]",
  53983. referencedClasses: ["Error"],
  53984. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  53985. }),
  53986. $globals.IndexableCollectionTest);
  53987. $core.addMethod(
  53988. $core.method({
  53989. selector: "testIndexOfWithNull",
  53990. protocol: "tests",
  53991. fn: function (){
  53992. var self=this,$self=this;
  53993. var jsNull;
  53994. return $core.withContext(function($ctx1) {
  53995. var $2,$1;
  53996. jsNull=$recv($globals.JSON)._parse_("null");
  53997. $self._samplesDo_((function(index,value){
  53998. return $core.withContext(function($ctx2) {
  53999. $2=$self._collection();
  54000. $recv($2)._at_put_(index,jsNull);
  54001. $1=$recv($2)._indexOf_(jsNull);
  54002. return $self._assert_equals_($1,index);
  54003. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54004. }));
  54005. return self;
  54006. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  54007. },
  54008. args: [],
  54009. 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 ]",
  54010. referencedClasses: ["JSON"],
  54011. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  54012. }),
  54013. $globals.IndexableCollectionTest);
  54014. $core.addMethod(
  54015. $core.method({
  54016. selector: "testWithIndexDo",
  54017. protocol: "tests",
  54018. fn: function (){
  54019. var self=this,$self=this;
  54020. var collection;
  54021. return $core.withContext(function($ctx1) {
  54022. collection=$self._collection();
  54023. $ctx1.sendIdx["collection"]=1;
  54024. $recv($self._collection())._withIndexDo_((function(each,index){
  54025. return $core.withContext(function($ctx2) {
  54026. return $self._assert_equals_($recv(collection)._at_(index),each);
  54027. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  54028. }));
  54029. return self;
  54030. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  54031. },
  54032. args: [],
  54033. 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 ]",
  54034. referencedClasses: [],
  54035. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  54036. }),
  54037. $globals.IndexableCollectionTest);
  54038. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  54039. $core.addMethod(
  54040. $core.method({
  54041. selector: "collectionKeys",
  54042. protocol: "fixture",
  54043. fn: function (){
  54044. var self=this,$self=this;
  54045. return $core.withContext(function($ctx1) {
  54046. $self._subclassResponsibility();
  54047. return self;
  54048. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  54049. },
  54050. args: [],
  54051. source: "collectionKeys\x0a\x09self subclassResponsibility",
  54052. referencedClasses: [],
  54053. messageSends: ["subclassResponsibility"]
  54054. }),
  54055. $globals.AssociativeCollectionTest);
  54056. $core.addMethod(
  54057. $core.method({
  54058. selector: "collectionValues",
  54059. protocol: "fixture",
  54060. fn: function (){
  54061. var self=this,$self=this;
  54062. return $core.withContext(function($ctx1) {
  54063. $self._subclassResponsibility();
  54064. return self;
  54065. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  54066. },
  54067. args: [],
  54068. source: "collectionValues\x0a\x09self subclassResponsibility",
  54069. referencedClasses: [],
  54070. messageSends: ["subclassResponsibility"]
  54071. }),
  54072. $globals.AssociativeCollectionTest);
  54073. $core.addMethod(
  54074. $core.method({
  54075. selector: "nonIndexesDo:",
  54076. protocol: "fixture",
  54077. fn: function (aBlock){
  54078. var self=this,$self=this;
  54079. return $core.withContext(function($ctx1) {
  54080. $recv(aBlock)._value_((5));
  54081. $ctx1.sendIdx["value:"]=1;
  54082. $recv(aBlock)._value_((function(){
  54083. }));
  54084. $ctx1.sendIdx["value:"]=2;
  54085. $recv(aBlock)._value_($recv($globals.Object)._new());
  54086. $ctx1.sendIdx["value:"]=3;
  54087. $recv(aBlock)._value_("z");
  54088. return self;
  54089. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54090. },
  54091. args: ["aBlock"],
  54092. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  54093. referencedClasses: ["Object"],
  54094. messageSends: ["value:", "new"]
  54095. }),
  54096. $globals.AssociativeCollectionTest);
  54097. $core.addMethod(
  54098. $core.method({
  54099. selector: "sampleNewIndex",
  54100. protocol: "fixture",
  54101. fn: function (){
  54102. var self=this,$self=this;
  54103. return "new";
  54104. },
  54105. args: [],
  54106. source: "sampleNewIndex\x0a\x09^ 'new'",
  54107. referencedClasses: [],
  54108. messageSends: []
  54109. }),
  54110. $globals.AssociativeCollectionTest);
  54111. $core.addMethod(
  54112. $core.method({
  54113. selector: "samplesDo:",
  54114. protocol: "fixture",
  54115. fn: function (aBlock){
  54116. var self=this,$self=this;
  54117. return $core.withContext(function($ctx1) {
  54118. $recv(aBlock)._value_value_("a",(2));
  54119. return self;
  54120. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54121. },
  54122. args: ["aBlock"],
  54123. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  54124. referencedClasses: [],
  54125. messageSends: ["value:value:"]
  54126. }),
  54127. $globals.AssociativeCollectionTest);
  54128. $core.addMethod(
  54129. $core.method({
  54130. selector: "testAddAll",
  54131. protocol: "tests",
  54132. fn: function (){
  54133. var self=this,$self=this;
  54134. return $core.withContext(function($ctx1) {
  54135. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  54136. (
  54137. $ctx1.supercall = true,
  54138. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  54139. $ctx1.supercall = false;
  54140. $2=$self._collection();
  54141. $ctx1.sendIdx["collection"]=1;
  54142. $3=$self._collection();
  54143. $ctx1.sendIdx["collection"]=2;
  54144. $recv($2)._addAll_($3);
  54145. $ctx1.sendIdx["addAll:"]=1;
  54146. $4=$recv($2)._yourself();
  54147. $ctx1.sendIdx["yourself"]=1;
  54148. $1=$4;
  54149. $5=$self._collection();
  54150. $ctx1.sendIdx["collection"]=3;
  54151. $self._assert_equals_($1,$5);
  54152. $ctx1.sendIdx["assert:equals:"]=1;
  54153. $7=$self._collection();
  54154. $ctx1.sendIdx["collection"]=4;
  54155. $8=$self._collectionWithNewValue();
  54156. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54157. $recv($7)._addAll_($8);
  54158. $ctx1.sendIdx["addAll:"]=2;
  54159. $9=$recv($7)._yourself();
  54160. $ctx1.sendIdx["yourself"]=2;
  54161. $6=$9;
  54162. $10=$self._collectionWithNewValue();
  54163. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54164. $self._assert_equals_($6,$10);
  54165. $ctx1.sendIdx["assert:equals:"]=2;
  54166. $12=$self._collectionWithNewValue();
  54167. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54168. $recv($12)._addAll_($self._collection());
  54169. $11=$recv($12)._yourself();
  54170. $self._assert_equals_($11,$self._collectionWithNewValue());
  54171. return self;
  54172. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  54173. },
  54174. args: [],
  54175. 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",
  54176. referencedClasses: [],
  54177. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  54178. }),
  54179. $globals.AssociativeCollectionTest);
  54180. $core.addMethod(
  54181. $core.method({
  54182. selector: "testAsDictionary",
  54183. protocol: "tests",
  54184. fn: function (){
  54185. var self=this,$self=this;
  54186. return $core.withContext(function($ctx1) {
  54187. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  54188. return self;
  54189. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  54190. },
  54191. args: [],
  54192. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  54193. referencedClasses: ["Dictionary"],
  54194. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  54195. }),
  54196. $globals.AssociativeCollectionTest);
  54197. $core.addMethod(
  54198. $core.method({
  54199. selector: "testAsHashedCollection",
  54200. protocol: "tests",
  54201. fn: function (){
  54202. var self=this,$self=this;
  54203. return $core.withContext(function($ctx1) {
  54204. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  54205. return self;
  54206. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  54207. },
  54208. args: [],
  54209. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  54210. referencedClasses: ["HashedCollection"],
  54211. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  54212. }),
  54213. $globals.AssociativeCollectionTest);
  54214. $core.addMethod(
  54215. $core.method({
  54216. selector: "testComma",
  54217. protocol: "tests",
  54218. fn: function (){
  54219. var self=this,$self=this;
  54220. return $core.withContext(function($ctx1) {
  54221. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  54222. (
  54223. $ctx1.supercall = true,
  54224. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  54225. $ctx1.supercall = false;
  54226. $2=$self._collection();
  54227. $ctx1.sendIdx["collection"]=1;
  54228. $3=$self._collection();
  54229. $ctx1.sendIdx["collection"]=2;
  54230. $1=$recv($2).__comma($3);
  54231. $ctx1.sendIdx[","]=1;
  54232. $4=$self._collection();
  54233. $ctx1.sendIdx["collection"]=3;
  54234. $self._assert_equals_($1,$4);
  54235. $ctx1.sendIdx["assert:equals:"]=1;
  54236. $6=$self._collection();
  54237. $ctx1.sendIdx["collection"]=4;
  54238. $7=$self._collectionWithNewValue();
  54239. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54240. $5=$recv($6).__comma($7);
  54241. $ctx1.sendIdx[","]=2;
  54242. $8=$self._collectionWithNewValue();
  54243. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54244. $self._assert_equals_($5,$8);
  54245. $ctx1.sendIdx["assert:equals:"]=2;
  54246. $10=$self._collectionWithNewValue();
  54247. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54248. $9=$recv($10).__comma($self._collection());
  54249. $self._assert_equals_($9,$self._collectionWithNewValue());
  54250. return self;
  54251. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  54252. },
  54253. args: [],
  54254. 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",
  54255. referencedClasses: [],
  54256. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  54257. }),
  54258. $globals.AssociativeCollectionTest);
  54259. $core.addMethod(
  54260. $core.method({
  54261. selector: "testFrom",
  54262. protocol: "tests",
  54263. fn: function (){
  54264. var self=this,$self=this;
  54265. var associations;
  54266. return $core.withContext(function($ctx1) {
  54267. var $1;
  54268. $1="a".__minus_gt((1));
  54269. $ctx1.sendIdx["->"]=1;
  54270. associations=[$1,"b".__minus_gt((2))];
  54271. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54272. return self;
  54273. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  54274. },
  54275. args: [],
  54276. 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 }.",
  54277. referencedClasses: [],
  54278. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  54279. }),
  54280. $globals.AssociativeCollectionTest);
  54281. $core.addMethod(
  54282. $core.method({
  54283. selector: "testKeys",
  54284. protocol: "tests",
  54285. fn: function (){
  54286. var self=this,$self=this;
  54287. return $core.withContext(function($ctx1) {
  54288. var $2,$1,$3,$4;
  54289. $2=$recv($recv($self._collectionClass())._new())._keys();
  54290. $ctx1.sendIdx["keys"]=1;
  54291. $1=$recv($2)._isEmpty();
  54292. $self._assert_($1);
  54293. $3=$recv($self._collection())._keys();
  54294. $ctx1.sendIdx["keys"]=2;
  54295. $4=$self._collectionKeys();
  54296. $ctx1.sendIdx["collectionKeys"]=1;
  54297. $self._assertSameContents_as_($3,$4);
  54298. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54299. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  54300. return self;
  54301. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  54302. },
  54303. args: [],
  54304. 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 }",
  54305. referencedClasses: [],
  54306. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  54307. }),
  54308. $globals.AssociativeCollectionTest);
  54309. $core.addMethod(
  54310. $core.method({
  54311. selector: "testNewFromPairs",
  54312. protocol: "tests",
  54313. fn: function (){
  54314. var self=this,$self=this;
  54315. var flattenedAssociations;
  54316. return $core.withContext(function($ctx1) {
  54317. flattenedAssociations=["a",(1),"b",(2)];
  54318. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54319. return self;
  54320. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  54321. },
  54322. args: [],
  54323. 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 }.",
  54324. referencedClasses: [],
  54325. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  54326. }),
  54327. $globals.AssociativeCollectionTest);
  54328. $core.addMethod(
  54329. $core.method({
  54330. selector: "testPrintString",
  54331. protocol: "tests",
  54332. fn: function (){
  54333. var self=this,$self=this;
  54334. return $core.withContext(function($ctx1) {
  54335. var $3,$2,$1,$4;
  54336. $3=$self._collectionClass();
  54337. $ctx1.sendIdx["collectionClass"]=1;
  54338. $2=$recv($3)._new();
  54339. $recv($2)._at_put_("firstname","James");
  54340. $ctx1.sendIdx["at:put:"]=1;
  54341. $recv($2)._at_put_("lastname","Bond");
  54342. $1=$recv($2)._printString();
  54343. $4=$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  54344. $ctx1.sendIdx[","]=1;
  54345. $self._assert_equals_($1,$4);
  54346. return self;
  54347. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  54348. },
  54349. args: [],
  54350. 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'')'",
  54351. referencedClasses: [],
  54352. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  54353. }),
  54354. $globals.AssociativeCollectionTest);
  54355. $core.addMethod(
  54356. $core.method({
  54357. selector: "testRemoveKey",
  54358. protocol: "tests",
  54359. fn: function (){
  54360. var self=this,$self=this;
  54361. return $core.withContext(function($ctx1) {
  54362. var $1,$2,$3,$5,$6,$4,$8,$7;
  54363. $self._nonIndexesDo_((function(each){
  54364. var collection;
  54365. return $core.withContext(function($ctx2) {
  54366. collection=$self._collection();
  54367. $ctx2.sendIdx["collection"]=1;
  54368. $self._should_raise_((function(){
  54369. return $core.withContext(function($ctx3) {
  54370. return $recv(collection)._removeKey_(each);
  54371. $ctx3.sendIdx["removeKey:"]=1;
  54372. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54373. }),$globals.Error);
  54374. $1=collection;
  54375. $2=$self._collection();
  54376. $ctx2.sendIdx["collection"]=2;
  54377. return $self._assert_equals_($1,$2);
  54378. $ctx2.sendIdx["assert:equals:"]=1;
  54379. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54380. }));
  54381. $self._samplesDo_((function(index,value){
  54382. var collection;
  54383. return $core.withContext(function($ctx2) {
  54384. collection=$self._collection();
  54385. $ctx2.sendIdx["collection"]=3;
  54386. $3=$recv(collection)._removeKey_(index);
  54387. $ctx2.sendIdx["removeKey:"]=2;
  54388. $self._assert_equals_($3,value);
  54389. $ctx2.sendIdx["assert:equals:"]=2;
  54390. $5=collection;
  54391. $6=$self._collection();
  54392. $ctx2.sendIdx["collection"]=4;
  54393. $4=$recv($5).__eq($6);
  54394. return $self._deny_($4);
  54395. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54396. }));
  54397. $8=$self._collectionWithNewValue();
  54398. $recv($8)._removeKey_($self._sampleNewIndex());
  54399. $7=$recv($8)._yourself();
  54400. $self._assert_equals_($7,$self._collection());
  54401. return self;
  54402. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  54403. },
  54404. args: [],
  54405. 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",
  54406. referencedClasses: ["Error"],
  54407. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  54408. }),
  54409. $globals.AssociativeCollectionTest);
  54410. $core.addMethod(
  54411. $core.method({
  54412. selector: "testRemoveKeyIfAbsent",
  54413. protocol: "tests",
  54414. fn: function (){
  54415. var self=this,$self=this;
  54416. return $core.withContext(function($ctx1) {
  54417. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  54418. $self._nonIndexesDo_((function(each){
  54419. var collection;
  54420. return $core.withContext(function($ctx2) {
  54421. collection=$self._collection();
  54422. $ctx2.sendIdx["collection"]=1;
  54423. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  54424. return $core.withContext(function($ctx3) {
  54425. return $self._sampleNewValue();
  54426. $ctx3.sendIdx["sampleNewValue"]=1;
  54427. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54428. }));
  54429. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  54430. $2=$self._sampleNewValue();
  54431. $ctx2.sendIdx["sampleNewValue"]=2;
  54432. $self._assert_equals_($1,$2);
  54433. $ctx2.sendIdx["assert:equals:"]=1;
  54434. $3=collection;
  54435. $4=$self._collection();
  54436. $ctx2.sendIdx["collection"]=2;
  54437. return $self._assert_equals_($3,$4);
  54438. $ctx2.sendIdx["assert:equals:"]=2;
  54439. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54440. }));
  54441. $self._samplesDo_((function(index,value){
  54442. var collection;
  54443. return $core.withContext(function($ctx2) {
  54444. collection=$self._collection();
  54445. $ctx2.sendIdx["collection"]=3;
  54446. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  54447. return $core.withContext(function($ctx3) {
  54448. return $self._sampleNewValue();
  54449. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  54450. }));
  54451. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  54452. $self._assert_equals_($5,value);
  54453. $ctx2.sendIdx["assert:equals:"]=3;
  54454. $7=collection;
  54455. $8=$self._collection();
  54456. $ctx2.sendIdx["collection"]=4;
  54457. $6=$recv($7).__eq($8);
  54458. return $self._deny_($6);
  54459. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54460. }));
  54461. $10=$self._collectionWithNewValue();
  54462. $recv($10)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  54463. return $core.withContext(function($ctx2) {
  54464. return $self._assert_(false);
  54465. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54466. }));
  54467. $9=$recv($10)._yourself();
  54468. $self._assert_equals_($9,$self._collection());
  54469. return self;
  54470. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  54471. },
  54472. args: [],
  54473. 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",
  54474. referencedClasses: [],
  54475. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  54476. }),
  54477. $globals.AssociativeCollectionTest);
  54478. $core.addMethod(
  54479. $core.method({
  54480. selector: "testValues",
  54481. protocol: "tests",
  54482. fn: function (){
  54483. var self=this,$self=this;
  54484. return $core.withContext(function($ctx1) {
  54485. var $2,$1,$3,$4;
  54486. $2=$recv($recv($self._collectionClass())._new())._values();
  54487. $ctx1.sendIdx["values"]=1;
  54488. $1=$recv($2)._isEmpty();
  54489. $self._assert_($1);
  54490. $3=$recv($self._collection())._values();
  54491. $ctx1.sendIdx["values"]=2;
  54492. $4=$self._collectionValues();
  54493. $ctx1.sendIdx["collectionValues"]=1;
  54494. $self._assertSameContents_as_($3,$4);
  54495. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54496. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  54497. return self;
  54498. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  54499. },
  54500. args: [],
  54501. 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 }",
  54502. referencedClasses: [],
  54503. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  54504. }),
  54505. $globals.AssociativeCollectionTest);
  54506. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54507. $core.addMethod(
  54508. $core.method({
  54509. selector: "collection",
  54510. protocol: "fixture",
  54511. fn: function (){
  54512. var self=this,$self=this;
  54513. return $core.withContext(function($ctx1) {
  54514. var $1;
  54515. $1=$recv($globals.Dictionary)._new();
  54516. $recv($1)._at_put_((1),(1));
  54517. $ctx1.sendIdx["at:put:"]=1;
  54518. $recv($1)._at_put_("a",(2));
  54519. $ctx1.sendIdx["at:put:"]=2;
  54520. $recv($1)._at_put_(true,(3));
  54521. $ctx1.sendIdx["at:put:"]=3;
  54522. $recv($1)._at_put_((1).__at((3)),(-4));
  54523. $ctx1.sendIdx["at:put:"]=4;
  54524. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54525. return $recv($1)._yourself();
  54526. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  54527. },
  54528. args: [],
  54529. 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",
  54530. referencedClasses: ["Dictionary"],
  54531. messageSends: ["at:put:", "new", "@", "yourself"]
  54532. }),
  54533. $globals.DictionaryTest);
  54534. $core.addMethod(
  54535. $core.method({
  54536. selector: "collectionKeys",
  54537. protocol: "fixture",
  54538. fn: function (){
  54539. var self=this,$self=this;
  54540. return $core.withContext(function($ctx1) {
  54541. return [(1),"a",true,(1).__at((3)),$self["@sampleBlock"]];
  54542. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  54543. },
  54544. args: [],
  54545. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  54546. referencedClasses: [],
  54547. messageSends: ["@"]
  54548. }),
  54549. $globals.DictionaryTest);
  54550. $core.addMethod(
  54551. $core.method({
  54552. selector: "collectionOfPrintStrings",
  54553. protocol: "fixture",
  54554. fn: function (){
  54555. var self=this,$self=this;
  54556. return $core.withContext(function($ctx1) {
  54557. var $1;
  54558. $1=$recv($globals.Dictionary)._new();
  54559. $recv($1)._at_put_((1),"1");
  54560. $ctx1.sendIdx["at:put:"]=1;
  54561. $recv($1)._at_put_("a","2");
  54562. $ctx1.sendIdx["at:put:"]=2;
  54563. $recv($1)._at_put_(true,"3");
  54564. $ctx1.sendIdx["at:put:"]=3;
  54565. $recv($1)._at_put_((1).__at((3)),"-4");
  54566. $ctx1.sendIdx["at:put:"]=4;
  54567. $recv($1)._at_put_($self["@sampleBlock"],"9");
  54568. return $recv($1)._yourself();
  54569. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  54570. },
  54571. args: [],
  54572. 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",
  54573. referencedClasses: ["Dictionary"],
  54574. messageSends: ["at:put:", "new", "@", "yourself"]
  54575. }),
  54576. $globals.DictionaryTest);
  54577. $core.addMethod(
  54578. $core.method({
  54579. selector: "collectionSize",
  54580. protocol: "fixture",
  54581. fn: function (){
  54582. var self=this,$self=this;
  54583. return (5);
  54584. },
  54585. args: [],
  54586. source: "collectionSize\x0a\x09^ 5",
  54587. referencedClasses: [],
  54588. messageSends: []
  54589. }),
  54590. $globals.DictionaryTest);
  54591. $core.addMethod(
  54592. $core.method({
  54593. selector: "collectionValues",
  54594. protocol: "fixture",
  54595. fn: function (){
  54596. var self=this,$self=this;
  54597. return [(1),(2),(3),(-4),(9)];
  54598. },
  54599. args: [],
  54600. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  54601. referencedClasses: [],
  54602. messageSends: []
  54603. }),
  54604. $globals.DictionaryTest);
  54605. $core.addMethod(
  54606. $core.method({
  54607. selector: "collectionWithDuplicates",
  54608. protocol: "fixture",
  54609. fn: function (){
  54610. var self=this,$self=this;
  54611. return $core.withContext(function($ctx1) {
  54612. var $1;
  54613. $1=$recv($globals.Dictionary)._new();
  54614. $recv($1)._at_put_((1),(1));
  54615. $ctx1.sendIdx["at:put:"]=1;
  54616. $recv($1)._at_put_("a",(2));
  54617. $ctx1.sendIdx["at:put:"]=2;
  54618. $recv($1)._at_put_(true,(3));
  54619. $ctx1.sendIdx["at:put:"]=3;
  54620. $recv($1)._at_put_((4),(-4));
  54621. $ctx1.sendIdx["at:put:"]=4;
  54622. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54623. $ctx1.sendIdx["at:put:"]=5;
  54624. $recv($1)._at_put_("b",(1));
  54625. $ctx1.sendIdx["at:put:"]=6;
  54626. $recv($1)._at_put_((3),(3));
  54627. $ctx1.sendIdx["at:put:"]=7;
  54628. $recv($1)._at_put_(false,(12));
  54629. return $recv($1)._yourself();
  54630. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  54631. },
  54632. args: [],
  54633. 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",
  54634. referencedClasses: ["Dictionary"],
  54635. messageSends: ["at:put:", "new", "yourself"]
  54636. }),
  54637. $globals.DictionaryTest);
  54638. $core.addMethod(
  54639. $core.method({
  54640. selector: "collectionWithNewValue",
  54641. protocol: "fixture",
  54642. fn: function (){
  54643. var self=this,$self=this;
  54644. return $core.withContext(function($ctx1) {
  54645. var $1;
  54646. $1=$recv($globals.Dictionary)._new();
  54647. $recv($1)._at_put_((1),(1));
  54648. $ctx1.sendIdx["at:put:"]=1;
  54649. $recv($1)._at_put_("a",(2));
  54650. $ctx1.sendIdx["at:put:"]=2;
  54651. $recv($1)._at_put_(true,(3));
  54652. $ctx1.sendIdx["at:put:"]=3;
  54653. $recv($1)._at_put_((1).__at((3)),(-4));
  54654. $ctx1.sendIdx["at:put:"]=4;
  54655. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54656. $ctx1.sendIdx["at:put:"]=5;
  54657. $recv($1)._at_put_("new","N");
  54658. return $recv($1)._yourself();
  54659. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  54660. },
  54661. args: [],
  54662. 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",
  54663. referencedClasses: ["Dictionary"],
  54664. messageSends: ["at:put:", "new", "@", "yourself"]
  54665. }),
  54666. $globals.DictionaryTest);
  54667. $core.addMethod(
  54668. $core.method({
  54669. selector: "sampleNewValueAsCollection",
  54670. protocol: "fixture",
  54671. fn: function (){
  54672. var self=this,$self=this;
  54673. return $core.withContext(function($ctx1) {
  54674. var $1;
  54675. $1=$recv($globals.Dictionary)._new();
  54676. $recv($1)._at_put_("new","N");
  54677. return $recv($1)._yourself();
  54678. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  54679. },
  54680. args: [],
  54681. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  54682. referencedClasses: ["Dictionary"],
  54683. messageSends: ["at:put:", "new", "yourself"]
  54684. }),
  54685. $globals.DictionaryTest);
  54686. $core.addMethod(
  54687. $core.method({
  54688. selector: "samplesDo:",
  54689. protocol: "fixture",
  54690. fn: function (aBlock){
  54691. var self=this,$self=this;
  54692. return $core.withContext(function($ctx1) {
  54693. (
  54694. $ctx1.supercall = true,
  54695. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  54696. $ctx1.supercall = false;
  54697. $recv(aBlock)._value_value_(true,(3));
  54698. $ctx1.sendIdx["value:value:"]=1;
  54699. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  54700. $ctx1.sendIdx["value:value:"]=2;
  54701. $recv(aBlock)._value_value_($self["@sampleBlock"],(9));
  54702. return self;
  54703. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  54704. },
  54705. args: ["aBlock"],
  54706. 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",
  54707. referencedClasses: [],
  54708. messageSends: ["samplesDo:", "value:value:", "@"]
  54709. }),
  54710. $globals.DictionaryTest);
  54711. $core.addMethod(
  54712. $core.method({
  54713. selector: "testAccessing",
  54714. protocol: "tests",
  54715. fn: function (){
  54716. var self=this,$self=this;
  54717. var d;
  54718. return $core.withContext(function($ctx1) {
  54719. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  54720. d=$recv($globals.Dictionary)._new();
  54721. $recv(d)._at_put_("hello","world");
  54722. $ctx1.sendIdx["at:put:"]=1;
  54723. $1=$recv(d)._at_("hello");
  54724. $ctx1.sendIdx["at:"]=1;
  54725. $self._assert_equals_($1,"world");
  54726. $ctx1.sendIdx["assert:equals:"]=1;
  54727. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  54728. return nil;
  54729. }));
  54730. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54731. $self._assert_equals_($2,"world");
  54732. $ctx1.sendIdx["assert:equals:"]=2;
  54733. $self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  54734. return nil;
  54735. }))).__eq("world"));
  54736. $ctx1.sendIdx["deny:"]=1;
  54737. $3=$recv(d)._includesKey_("hello");
  54738. $ctx1.sendIdx["includesKey:"]=1;
  54739. $self._assert_($3);
  54740. $ctx1.sendIdx["assert:"]=1;
  54741. $4=$recv(d)._includesKey_("foo");
  54742. $ctx1.sendIdx["includesKey:"]=2;
  54743. $self._deny_($4);
  54744. $ctx1.sendIdx["deny:"]=2;
  54745. $recv(d)._at_put_((1),(2));
  54746. $ctx1.sendIdx["at:put:"]=2;
  54747. $5=$recv(d)._at_((1));
  54748. $ctx1.sendIdx["at:"]=2;
  54749. $self._assert_equals_($5,(2));
  54750. $ctx1.sendIdx["assert:equals:"]=3;
  54751. $6=d;
  54752. $7=(1).__at((3));
  54753. $ctx1.sendIdx["@"]=1;
  54754. $recv($6)._at_put_($7,(3));
  54755. $9=d;
  54756. $10=(1).__at((3));
  54757. $ctx1.sendIdx["@"]=2;
  54758. $8=$recv($9)._at_($10);
  54759. $self._assert_equals_($8,(3));
  54760. $12=d;
  54761. $13=(1).__at((3));
  54762. $ctx1.sendIdx["@"]=3;
  54763. $11=$recv($12)._includesKey_($13);
  54764. $ctx1.sendIdx["includesKey:"]=3;
  54765. $self._assert_($11);
  54766. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  54767. return self;
  54768. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  54769. },
  54770. args: [],
  54771. 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)",
  54772. referencedClasses: ["Dictionary"],
  54773. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  54774. }),
  54775. $globals.DictionaryTest);
  54776. $core.addMethod(
  54777. $core.method({
  54778. selector: "testDynamicDictionaries",
  54779. protocol: "tests",
  54780. fn: function (){
  54781. var self=this,$self=this;
  54782. return $core.withContext(function($ctx1) {
  54783. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  54784. return self;
  54785. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  54786. },
  54787. args: [],
  54788. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  54789. referencedClasses: ["Dictionary"],
  54790. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  54791. }),
  54792. $globals.DictionaryTest);
  54793. $core.addMethod(
  54794. $core.method({
  54795. selector: "collectionClass",
  54796. protocol: "fixture",
  54797. fn: function (){
  54798. var self=this,$self=this;
  54799. return $globals.Dictionary;
  54800. },
  54801. args: [],
  54802. source: "collectionClass\x0a\x09^ Dictionary",
  54803. referencedClasses: ["Dictionary"],
  54804. messageSends: []
  54805. }),
  54806. $globals.DictionaryTest.a$cls);
  54807. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54808. $core.addMethod(
  54809. $core.method({
  54810. selector: "collection",
  54811. protocol: "fixture",
  54812. fn: function (){
  54813. var self=this,$self=this;
  54814. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  54815. },
  54816. args: [],
  54817. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  54818. referencedClasses: [],
  54819. messageSends: []
  54820. }),
  54821. $globals.HashedCollectionTest);
  54822. $core.addMethod(
  54823. $core.method({
  54824. selector: "collectionKeys",
  54825. protocol: "fixture",
  54826. fn: function (){
  54827. var self=this,$self=this;
  54828. return ["b","a","c","d"];
  54829. },
  54830. args: [],
  54831. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  54832. referencedClasses: [],
  54833. messageSends: []
  54834. }),
  54835. $globals.HashedCollectionTest);
  54836. $core.addMethod(
  54837. $core.method({
  54838. selector: "collectionOfPrintStrings",
  54839. protocol: "fixture",
  54840. fn: function (){
  54841. var self=this,$self=this;
  54842. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  54843. },
  54844. args: [],
  54845. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  54846. referencedClasses: [],
  54847. messageSends: []
  54848. }),
  54849. $globals.HashedCollectionTest);
  54850. $core.addMethod(
  54851. $core.method({
  54852. selector: "collectionSize",
  54853. protocol: "fixture",
  54854. fn: function (){
  54855. var self=this,$self=this;
  54856. return (4);
  54857. },
  54858. args: [],
  54859. source: "collectionSize\x0a\x09^ 4",
  54860. referencedClasses: [],
  54861. messageSends: []
  54862. }),
  54863. $globals.HashedCollectionTest);
  54864. $core.addMethod(
  54865. $core.method({
  54866. selector: "collectionValues",
  54867. protocol: "fixture",
  54868. fn: function (){
  54869. var self=this,$self=this;
  54870. return [(1),(2),(3),(-4)];
  54871. },
  54872. args: [],
  54873. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  54874. referencedClasses: [],
  54875. messageSends: []
  54876. }),
  54877. $globals.HashedCollectionTest);
  54878. $core.addMethod(
  54879. $core.method({
  54880. selector: "collectionWithDuplicates",
  54881. protocol: "fixture",
  54882. fn: function (){
  54883. var self=this,$self=this;
  54884. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  54885. },
  54886. args: [],
  54887. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  54888. referencedClasses: [],
  54889. messageSends: []
  54890. }),
  54891. $globals.HashedCollectionTest);
  54892. $core.addMethod(
  54893. $core.method({
  54894. selector: "collectionWithNewValue",
  54895. protocol: "fixture",
  54896. fn: function (){
  54897. var self=this,$self=this;
  54898. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  54899. },
  54900. args: [],
  54901. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  54902. referencedClasses: [],
  54903. messageSends: []
  54904. }),
  54905. $globals.HashedCollectionTest);
  54906. $core.addMethod(
  54907. $core.method({
  54908. selector: "sampleNewValueAsCollection",
  54909. protocol: "fixture",
  54910. fn: function (){
  54911. var self=this,$self=this;
  54912. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  54913. },
  54914. args: [],
  54915. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  54916. referencedClasses: [],
  54917. messageSends: []
  54918. }),
  54919. $globals.HashedCollectionTest);
  54920. $core.addMethod(
  54921. $core.method({
  54922. selector: "testDynamicDictionaries",
  54923. protocol: "tests",
  54924. fn: function (){
  54925. var self=this,$self=this;
  54926. return $core.withContext(function($ctx1) {
  54927. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  54928. return self;
  54929. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  54930. },
  54931. args: [],
  54932. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  54933. referencedClasses: ["HashedCollection"],
  54934. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  54935. }),
  54936. $globals.HashedCollectionTest);
  54937. $core.addMethod(
  54938. $core.method({
  54939. selector: "collectionClass",
  54940. protocol: "fixture",
  54941. fn: function (){
  54942. var self=this,$self=this;
  54943. return $globals.HashedCollection;
  54944. },
  54945. args: [],
  54946. source: "collectionClass\x0a\x09^ HashedCollection",
  54947. referencedClasses: ["HashedCollection"],
  54948. messageSends: []
  54949. }),
  54950. $globals.HashedCollectionTest.a$cls);
  54951. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  54952. $core.addMethod(
  54953. $core.method({
  54954. selector: "collectionFirst",
  54955. protocol: "fixture",
  54956. fn: function (){
  54957. var self=this,$self=this;
  54958. return $core.withContext(function($ctx1) {
  54959. $self._subclassResponsibility();
  54960. return self;
  54961. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  54962. },
  54963. args: [],
  54964. source: "collectionFirst\x0a\x09self subclassResponsibility",
  54965. referencedClasses: [],
  54966. messageSends: ["subclassResponsibility"]
  54967. }),
  54968. $globals.SequenceableCollectionTest);
  54969. $core.addMethod(
  54970. $core.method({
  54971. selector: "collectionFirstTwo",
  54972. protocol: "fixture",
  54973. fn: function (){
  54974. var self=this,$self=this;
  54975. return $core.withContext(function($ctx1) {
  54976. $self._subclassResponsibility();
  54977. return self;
  54978. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  54979. },
  54980. args: [],
  54981. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  54982. referencedClasses: [],
  54983. messageSends: ["subclassResponsibility"]
  54984. }),
  54985. $globals.SequenceableCollectionTest);
  54986. $core.addMethod(
  54987. $core.method({
  54988. selector: "collectionLast",
  54989. protocol: "fixture",
  54990. fn: function (){
  54991. var self=this,$self=this;
  54992. return $core.withContext(function($ctx1) {
  54993. $self._subclassResponsibility();
  54994. return self;
  54995. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  54996. },
  54997. args: [],
  54998. source: "collectionLast\x0a\x09self subclassResponsibility",
  54999. referencedClasses: [],
  55000. messageSends: ["subclassResponsibility"]
  55001. }),
  55002. $globals.SequenceableCollectionTest);
  55003. $core.addMethod(
  55004. $core.method({
  55005. selector: "collectionLastTwo",
  55006. protocol: "fixture",
  55007. fn: function (){
  55008. var self=this,$self=this;
  55009. return $core.withContext(function($ctx1) {
  55010. $self._subclassResponsibility();
  55011. return self;
  55012. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  55013. },
  55014. args: [],
  55015. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  55016. referencedClasses: [],
  55017. messageSends: ["subclassResponsibility"]
  55018. }),
  55019. $globals.SequenceableCollectionTest);
  55020. $core.addMethod(
  55021. $core.method({
  55022. selector: "nonIndexesDo:",
  55023. protocol: "fixture",
  55024. fn: function (aBlock){
  55025. var self=this,$self=this;
  55026. return $core.withContext(function($ctx1) {
  55027. $recv(aBlock)._value_((0));
  55028. $ctx1.sendIdx["value:"]=1;
  55029. $recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)));
  55030. $ctx1.sendIdx["value:"]=2;
  55031. $recv(aBlock)._value_("z");
  55032. return self;
  55033. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55034. },
  55035. args: ["aBlock"],
  55036. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  55037. referencedClasses: [],
  55038. messageSends: ["value:", "+", "collectionSize"]
  55039. }),
  55040. $globals.SequenceableCollectionTest);
  55041. $core.addMethod(
  55042. $core.method({
  55043. selector: "samplesDo:",
  55044. protocol: "fixture",
  55045. fn: function (aBlock){
  55046. var self=this,$self=this;
  55047. return $core.withContext(function($ctx1) {
  55048. $recv(aBlock)._value_value_((1),$self._collectionFirst());
  55049. $ctx1.sendIdx["value:value:"]=1;
  55050. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  55051. return self;
  55052. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55053. },
  55054. args: ["aBlock"],
  55055. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  55056. referencedClasses: [],
  55057. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  55058. }),
  55059. $globals.SequenceableCollectionTest);
  55060. $core.addMethod(
  55061. $core.method({
  55062. selector: "testBeginsWith",
  55063. protocol: "tests",
  55064. fn: function (){
  55065. var self=this,$self=this;
  55066. return $core.withContext(function($ctx1) {
  55067. var $2,$1,$4,$5,$3,$7,$6;
  55068. $2=$self._collection();
  55069. $ctx1.sendIdx["collection"]=1;
  55070. $1=$recv($2)._beginsWith_($recv($self._collectionClass())._new());
  55071. $ctx1.sendIdx["beginsWith:"]=1;
  55072. $self._assert_($1);
  55073. $ctx1.sendIdx["assert:"]=1;
  55074. $4=$self._collection();
  55075. $ctx1.sendIdx["collection"]=2;
  55076. $5=$self._collection();
  55077. $ctx1.sendIdx["collection"]=3;
  55078. $3=$recv($4)._beginsWith_($5);
  55079. $ctx1.sendIdx["beginsWith:"]=2;
  55080. $self._assert_($3);
  55081. $ctx1.sendIdx["assert:"]=2;
  55082. $7=$self._collection();
  55083. $ctx1.sendIdx["collection"]=4;
  55084. $6=$recv($7)._beginsWith_($self._collectionFirstTwo());
  55085. $ctx1.sendIdx["beginsWith:"]=3;
  55086. $self._assert_($6);
  55087. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  55088. return self;
  55089. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  55090. },
  55091. args: [],
  55092. 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)",
  55093. referencedClasses: [],
  55094. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  55095. }),
  55096. $globals.SequenceableCollectionTest);
  55097. $core.addMethod(
  55098. $core.method({
  55099. selector: "testEndsWith",
  55100. protocol: "tests",
  55101. fn: function (){
  55102. var self=this,$self=this;
  55103. return $core.withContext(function($ctx1) {
  55104. var $2,$1,$4,$5,$3,$7,$6;
  55105. $2=$self._collection();
  55106. $ctx1.sendIdx["collection"]=1;
  55107. $1=$recv($2)._endsWith_($recv($self._collectionClass())._new());
  55108. $ctx1.sendIdx["endsWith:"]=1;
  55109. $self._assert_($1);
  55110. $ctx1.sendIdx["assert:"]=1;
  55111. $4=$self._collection();
  55112. $ctx1.sendIdx["collection"]=2;
  55113. $5=$self._collection();
  55114. $ctx1.sendIdx["collection"]=3;
  55115. $3=$recv($4)._endsWith_($5);
  55116. $ctx1.sendIdx["endsWith:"]=2;
  55117. $self._assert_($3);
  55118. $ctx1.sendIdx["assert:"]=2;
  55119. $7=$self._collection();
  55120. $ctx1.sendIdx["collection"]=4;
  55121. $6=$recv($7)._endsWith_($self._collectionLastTwo());
  55122. $ctx1.sendIdx["endsWith:"]=3;
  55123. $self._assert_($6);
  55124. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  55125. return self;
  55126. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  55127. },
  55128. args: [],
  55129. 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)",
  55130. referencedClasses: [],
  55131. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  55132. }),
  55133. $globals.SequenceableCollectionTest);
  55134. $core.addMethod(
  55135. $core.method({
  55136. selector: "testFirst",
  55137. protocol: "tests",
  55138. fn: function (){
  55139. var self=this,$self=this;
  55140. return $core.withContext(function($ctx1) {
  55141. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  55142. return self;
  55143. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  55144. },
  55145. args: [],
  55146. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  55147. referencedClasses: [],
  55148. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  55149. }),
  55150. $globals.SequenceableCollectionTest);
  55151. $core.addMethod(
  55152. $core.method({
  55153. selector: "testFirstN",
  55154. protocol: "tests",
  55155. fn: function (){
  55156. var self=this,$self=this;
  55157. return $core.withContext(function($ctx1) {
  55158. var $2,$1,$4,$3,$6,$5,$7;
  55159. $2=$self._collection();
  55160. $ctx1.sendIdx["collection"]=1;
  55161. $1=$recv($2)._first_((2));
  55162. $ctx1.sendIdx["first:"]=1;
  55163. $self._assert_equals_($1,$self._collectionFirstTwo());
  55164. $ctx1.sendIdx["assert:equals:"]=1;
  55165. $4=$self._collection();
  55166. $ctx1.sendIdx["collection"]=2;
  55167. $3=$recv($4)._first_((0));
  55168. $ctx1.sendIdx["first:"]=2;
  55169. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55170. $ctx1.sendIdx["assert:equals:"]=2;
  55171. $6=$self._collection();
  55172. $ctx1.sendIdx["collection"]=3;
  55173. $5=$recv($6)._first_($self._collectionSize());
  55174. $ctx1.sendIdx["first:"]=3;
  55175. $7=$self._collection();
  55176. $ctx1.sendIdx["collection"]=4;
  55177. $self._assert_equals_($5,$7);
  55178. $self._should_raise_((function(){
  55179. return $core.withContext(function($ctx2) {
  55180. return $recv($self._collection())._first_((33));
  55181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55182. }),$globals.Error);
  55183. return self;
  55184. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  55185. },
  55186. args: [],
  55187. 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",
  55188. referencedClasses: ["Error"],
  55189. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55190. }),
  55191. $globals.SequenceableCollectionTest);
  55192. $core.addMethod(
  55193. $core.method({
  55194. selector: "testFourth",
  55195. protocol: "tests",
  55196. fn: function (){
  55197. var self=this,$self=this;
  55198. return $core.withContext(function($ctx1) {
  55199. var $2,$1;
  55200. $2=$self._collection();
  55201. $ctx1.sendIdx["collection"]=1;
  55202. $1=$recv($2)._fourth();
  55203. $self._assert_equals_($1,$recv($self._collection())._at_((4)));
  55204. return self;
  55205. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  55206. },
  55207. args: [],
  55208. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  55209. referencedClasses: [],
  55210. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  55211. }),
  55212. $globals.SequenceableCollectionTest);
  55213. $core.addMethod(
  55214. $core.method({
  55215. selector: "testIndexOfStartingAt",
  55216. protocol: "tests",
  55217. fn: function (){
  55218. var self=this,$self=this;
  55219. var jsNull;
  55220. return $core.withContext(function($ctx1) {
  55221. var $2,$1,$4,$3;
  55222. jsNull=$recv($globals.JSON)._parse_("null");
  55223. $self._samplesDo_((function(index,value){
  55224. return $core.withContext(function($ctx2) {
  55225. $2=$self._collection();
  55226. $ctx2.sendIdx["collection"]=1;
  55227. $1=$recv($2)._indexOf_startingAt_(value,(1));
  55228. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55229. $self._assert_equals_($1,index);
  55230. $ctx2.sendIdx["assert:equals:"]=1;
  55231. $4=$self._collection();
  55232. $ctx2.sendIdx["collection"]=2;
  55233. $3=$recv($4)._indexOf_startingAt_(value,index);
  55234. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55235. $self._assert_equals_($3,index);
  55236. $ctx2.sendIdx["assert:equals:"]=2;
  55237. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  55238. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  55239. }));
  55240. return self;
  55241. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55242. },
  55243. args: [],
  55244. 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 ]",
  55245. referencedClasses: ["JSON"],
  55246. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  55247. }),
  55248. $globals.SequenceableCollectionTest);
  55249. $core.addMethod(
  55250. $core.method({
  55251. selector: "testIndexOfStartingAtWithNull",
  55252. protocol: "tests",
  55253. fn: function (){
  55254. var self=this,$self=this;
  55255. var jsNull;
  55256. return $core.withContext(function($ctx1) {
  55257. var $1,$2;
  55258. jsNull=$recv($globals.JSON)._parse_("null");
  55259. $self._samplesDo_((function(index,value){
  55260. var collection;
  55261. return $core.withContext(function($ctx2) {
  55262. collection=$self._collection();
  55263. $recv(collection)._at_put_(index,jsNull);
  55264. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  55265. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55266. $self._assert_equals_($1,index);
  55267. $ctx2.sendIdx["assert:equals:"]=1;
  55268. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  55269. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55270. $self._assert_equals_($2,index);
  55271. $ctx2.sendIdx["assert:equals:"]=2;
  55272. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  55273. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  55274. }));
  55275. return self;
  55276. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55277. },
  55278. args: [],
  55279. 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 ]",
  55280. referencedClasses: ["JSON"],
  55281. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  55282. }),
  55283. $globals.SequenceableCollectionTest);
  55284. $core.addMethod(
  55285. $core.method({
  55286. selector: "testLast",
  55287. protocol: "tests",
  55288. fn: function (){
  55289. var self=this,$self=this;
  55290. return $core.withContext(function($ctx1) {
  55291. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  55292. return self;
  55293. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  55294. },
  55295. args: [],
  55296. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  55297. referencedClasses: [],
  55298. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  55299. }),
  55300. $globals.SequenceableCollectionTest);
  55301. $core.addMethod(
  55302. $core.method({
  55303. selector: "testLastN",
  55304. protocol: "tests",
  55305. fn: function (){
  55306. var self=this,$self=this;
  55307. return $core.withContext(function($ctx1) {
  55308. var $2,$1,$4,$3,$6,$5,$7;
  55309. $2=$self._collection();
  55310. $ctx1.sendIdx["collection"]=1;
  55311. $1=$recv($2)._last_((2));
  55312. $ctx1.sendIdx["last:"]=1;
  55313. $self._assert_equals_($1,$self._collectionLastTwo());
  55314. $ctx1.sendIdx["assert:equals:"]=1;
  55315. $4=$self._collection();
  55316. $ctx1.sendIdx["collection"]=2;
  55317. $3=$recv($4)._last_((0));
  55318. $ctx1.sendIdx["last:"]=2;
  55319. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55320. $ctx1.sendIdx["assert:equals:"]=2;
  55321. $6=$self._collection();
  55322. $ctx1.sendIdx["collection"]=3;
  55323. $5=$recv($6)._last_($self._collectionSize());
  55324. $ctx1.sendIdx["last:"]=3;
  55325. $7=$self._collection();
  55326. $ctx1.sendIdx["collection"]=4;
  55327. $self._assert_equals_($5,$7);
  55328. $self._should_raise_((function(){
  55329. return $core.withContext(function($ctx2) {
  55330. return $recv($self._collection())._last_((33));
  55331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55332. }),$globals.Error);
  55333. return self;
  55334. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  55335. },
  55336. args: [],
  55337. 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",
  55338. referencedClasses: ["Error"],
  55339. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55340. }),
  55341. $globals.SequenceableCollectionTest);
  55342. $core.addMethod(
  55343. $core.method({
  55344. selector: "testSecond",
  55345. protocol: "tests",
  55346. fn: function (){
  55347. var self=this,$self=this;
  55348. return $core.withContext(function($ctx1) {
  55349. var $2,$1;
  55350. $2=$self._collection();
  55351. $ctx1.sendIdx["collection"]=1;
  55352. $1=$recv($2)._second();
  55353. $self._assert_equals_($1,$recv($self._collection())._at_((2)));
  55354. return self;
  55355. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  55356. },
  55357. args: [],
  55358. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  55359. referencedClasses: [],
  55360. messageSends: ["assert:equals:", "second", "collection", "at:"]
  55361. }),
  55362. $globals.SequenceableCollectionTest);
  55363. $core.addMethod(
  55364. $core.method({
  55365. selector: "testThird",
  55366. protocol: "tests",
  55367. fn: function (){
  55368. var self=this,$self=this;
  55369. return $core.withContext(function($ctx1) {
  55370. var $2,$1;
  55371. $2=$self._collection();
  55372. $ctx1.sendIdx["collection"]=1;
  55373. $1=$recv($2)._third();
  55374. $self._assert_equals_($1,$recv($self._collection())._at_((3)));
  55375. return self;
  55376. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  55377. },
  55378. args: [],
  55379. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  55380. referencedClasses: [],
  55381. messageSends: ["assert:equals:", "third", "collection", "at:"]
  55382. }),
  55383. $globals.SequenceableCollectionTest);
  55384. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55385. $core.addMethod(
  55386. $core.method({
  55387. selector: "collection",
  55388. protocol: "fixture",
  55389. fn: function (){
  55390. var self=this,$self=this;
  55391. return [(1), (2), (3), (-4)];
  55392. },
  55393. args: [],
  55394. source: "collection\x0a\x09^ #(1 2 3 -4)",
  55395. referencedClasses: [],
  55396. messageSends: []
  55397. }),
  55398. $globals.ArrayTest);
  55399. $core.addMethod(
  55400. $core.method({
  55401. selector: "collectionFirst",
  55402. protocol: "fixture",
  55403. fn: function (){
  55404. var self=this,$self=this;
  55405. return (1);
  55406. },
  55407. args: [],
  55408. source: "collectionFirst\x0a\x09^ 1",
  55409. referencedClasses: [],
  55410. messageSends: []
  55411. }),
  55412. $globals.ArrayTest);
  55413. $core.addMethod(
  55414. $core.method({
  55415. selector: "collectionFirstTwo",
  55416. protocol: "fixture",
  55417. fn: function (){
  55418. var self=this,$self=this;
  55419. return [(1), (2)];
  55420. },
  55421. args: [],
  55422. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  55423. referencedClasses: [],
  55424. messageSends: []
  55425. }),
  55426. $globals.ArrayTest);
  55427. $core.addMethod(
  55428. $core.method({
  55429. selector: "collectionLast",
  55430. protocol: "fixture",
  55431. fn: function (){
  55432. var self=this,$self=this;
  55433. return (-4);
  55434. },
  55435. args: [],
  55436. source: "collectionLast\x0a\x09^ -4",
  55437. referencedClasses: [],
  55438. messageSends: []
  55439. }),
  55440. $globals.ArrayTest);
  55441. $core.addMethod(
  55442. $core.method({
  55443. selector: "collectionLastTwo",
  55444. protocol: "fixture",
  55445. fn: function (){
  55446. var self=this,$self=this;
  55447. return [(3), (-4)];
  55448. },
  55449. args: [],
  55450. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  55451. referencedClasses: [],
  55452. messageSends: []
  55453. }),
  55454. $globals.ArrayTest);
  55455. $core.addMethod(
  55456. $core.method({
  55457. selector: "collectionOfPrintStrings",
  55458. protocol: "fixture",
  55459. fn: function (){
  55460. var self=this,$self=this;
  55461. return ["1", "2", "3", "-4"];
  55462. },
  55463. args: [],
  55464. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  55465. referencedClasses: [],
  55466. messageSends: []
  55467. }),
  55468. $globals.ArrayTest);
  55469. $core.addMethod(
  55470. $core.method({
  55471. selector: "collectionSize",
  55472. protocol: "fixture",
  55473. fn: function (){
  55474. var self=this,$self=this;
  55475. return (4);
  55476. },
  55477. args: [],
  55478. source: "collectionSize\x0a\x09^ 4",
  55479. referencedClasses: [],
  55480. messageSends: []
  55481. }),
  55482. $globals.ArrayTest);
  55483. $core.addMethod(
  55484. $core.method({
  55485. selector: "collectionWithDuplicates",
  55486. protocol: "fixture",
  55487. fn: function (){
  55488. var self=this,$self=this;
  55489. return ["a", "b", "c", (1), (2), (1), "a", []];
  55490. },
  55491. args: [],
  55492. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  55493. referencedClasses: [],
  55494. messageSends: []
  55495. }),
  55496. $globals.ArrayTest);
  55497. $core.addMethod(
  55498. $core.method({
  55499. selector: "collectionWithNewValue",
  55500. protocol: "fixture",
  55501. fn: function (){
  55502. var self=this,$self=this;
  55503. return [(1), (2), (3), (-4), "N"];
  55504. },
  55505. args: [],
  55506. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  55507. referencedClasses: [],
  55508. messageSends: []
  55509. }),
  55510. $globals.ArrayTest);
  55511. $core.addMethod(
  55512. $core.method({
  55513. selector: "sampleNewIndex",
  55514. protocol: "fixture",
  55515. fn: function (){
  55516. var self=this,$self=this;
  55517. return (5);
  55518. },
  55519. args: [],
  55520. source: "sampleNewIndex\x0a\x09^ 5",
  55521. referencedClasses: [],
  55522. messageSends: []
  55523. }),
  55524. $globals.ArrayTest);
  55525. $core.addMethod(
  55526. $core.method({
  55527. selector: "samplesDo:",
  55528. protocol: "fixture",
  55529. fn: function (aBlock){
  55530. var self=this,$self=this;
  55531. return $core.withContext(function($ctx1) {
  55532. (
  55533. $ctx1.supercall = true,
  55534. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55535. $ctx1.supercall = false;
  55536. $recv(aBlock)._value_value_((3),(3));
  55537. return self;
  55538. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  55539. },
  55540. args: ["aBlock"],
  55541. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  55542. referencedClasses: [],
  55543. messageSends: ["samplesDo:", "value:value:"]
  55544. }),
  55545. $globals.ArrayTest);
  55546. $core.addMethod(
  55547. $core.method({
  55548. selector: "testAdd",
  55549. protocol: "tests",
  55550. fn: function (){
  55551. var self=this,$self=this;
  55552. var array;
  55553. return $core.withContext(function($ctx1) {
  55554. array=$self._collection();
  55555. $recv(array)._add_((6));
  55556. $self._assert_equals_($recv(array)._last(),(6));
  55557. return self;
  55558. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  55559. },
  55560. args: [],
  55561. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  55562. referencedClasses: [],
  55563. messageSends: ["collection", "add:", "assert:equals:", "last"]
  55564. }),
  55565. $globals.ArrayTest);
  55566. $core.addMethod(
  55567. $core.method({
  55568. selector: "testAddFirst",
  55569. protocol: "tests",
  55570. fn: function (){
  55571. var self=this,$self=this;
  55572. return $core.withContext(function($ctx1) {
  55573. var $3,$2,$1;
  55574. $3=$self._collection();
  55575. $recv($3)._addFirst_((0));
  55576. $2=$recv($3)._yourself();
  55577. $1=$recv($2)._first();
  55578. $self._assert_equals_($1,(0));
  55579. return self;
  55580. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  55581. },
  55582. args: [],
  55583. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  55584. referencedClasses: [],
  55585. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  55586. }),
  55587. $globals.ArrayTest);
  55588. $core.addMethod(
  55589. $core.method({
  55590. selector: "testPrintString",
  55591. protocol: "tests",
  55592. fn: function (){
  55593. var self=this,$self=this;
  55594. var array;
  55595. return $core.withContext(function($ctx1) {
  55596. var $1,$2,$3,$4,$5,$6,$7,$8;
  55597. array=$recv($globals.Array)._new();
  55598. $1=$recv(array)._printString();
  55599. $ctx1.sendIdx["printString"]=1;
  55600. $self._assert_equals_($1,"an Array ()");
  55601. $ctx1.sendIdx["assert:equals:"]=1;
  55602. $2=array;
  55603. $recv($2)._add_((1));
  55604. $ctx1.sendIdx["add:"]=1;
  55605. $3=$recv($2)._add_((3));
  55606. $ctx1.sendIdx["add:"]=2;
  55607. $4=$recv(array)._printString();
  55608. $ctx1.sendIdx["printString"]=2;
  55609. $self._assert_equals_($4,"an Array (1 3)");
  55610. $ctx1.sendIdx["assert:equals:"]=2;
  55611. $recv(array)._add_("foo");
  55612. $5=$recv(array)._printString();
  55613. $ctx1.sendIdx["printString"]=3;
  55614. $self._assert_equals_($5,"an Array (1 3 'foo')");
  55615. $ctx1.sendIdx["assert:equals:"]=3;
  55616. $6=array;
  55617. $recv($6)._remove_((1));
  55618. $ctx1.sendIdx["remove:"]=1;
  55619. $recv($6)._remove_((3));
  55620. $7=$recv(array)._printString();
  55621. $ctx1.sendIdx["printString"]=4;
  55622. $self._assert_equals_($7,"an Array ('foo')");
  55623. $ctx1.sendIdx["assert:equals:"]=4;
  55624. $recv(array)._addLast_((3));
  55625. $ctx1.sendIdx["addLast:"]=1;
  55626. $8=$recv(array)._printString();
  55627. $ctx1.sendIdx["printString"]=5;
  55628. $self._assert_equals_($8,"an Array ('foo' 3)");
  55629. $ctx1.sendIdx["assert:equals:"]=5;
  55630. $recv(array)._addLast_((3));
  55631. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  55632. return self;
  55633. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  55634. },
  55635. args: [],
  55636. 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)'.",
  55637. referencedClasses: ["Array"],
  55638. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  55639. }),
  55640. $globals.ArrayTest);
  55641. $core.addMethod(
  55642. $core.method({
  55643. selector: "testRemove",
  55644. protocol: "tests",
  55645. fn: function (){
  55646. var self=this,$self=this;
  55647. var array;
  55648. return $core.withContext(function($ctx1) {
  55649. array=[(1), (2), (3), (4), (5)];
  55650. $recv(array)._remove_((3));
  55651. $ctx1.sendIdx["remove:"]=1;
  55652. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  55653. $self._should_raise_((function(){
  55654. return $core.withContext(function($ctx2) {
  55655. return $recv(array)._remove_((3));
  55656. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55657. }),$globals.Error);
  55658. return self;
  55659. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  55660. },
  55661. args: [],
  55662. 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",
  55663. referencedClasses: ["Error"],
  55664. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  55665. }),
  55666. $globals.ArrayTest);
  55667. $core.addMethod(
  55668. $core.method({
  55669. selector: "testRemoveFromTo",
  55670. protocol: "tests",
  55671. fn: function (){
  55672. var self=this,$self=this;
  55673. return $core.withContext(function($ctx1) {
  55674. var $1,$2;
  55675. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  55676. $ctx1.sendIdx["removeFrom:to:"]=1;
  55677. $self._assert_equals_($1,[(4)]);
  55678. $ctx1.sendIdx["assert:equals:"]=1;
  55679. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  55680. $ctx1.sendIdx["removeFrom:to:"]=2;
  55681. $self._assert_equals_($2,[(1), (4)]);
  55682. $ctx1.sendIdx["assert:equals:"]=2;
  55683. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  55684. return self;
  55685. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  55686. },
  55687. args: [],
  55688. 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)",
  55689. referencedClasses: [],
  55690. messageSends: ["assert:equals:", "removeFrom:to:"]
  55691. }),
  55692. $globals.ArrayTest);
  55693. $core.addMethod(
  55694. $core.method({
  55695. selector: "testRemoveIndex",
  55696. protocol: "tests",
  55697. fn: function (){
  55698. var self=this,$self=this;
  55699. return $core.withContext(function($ctx1) {
  55700. var $1,$2;
  55701. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  55702. $ctx1.sendIdx["removeIndex:"]=1;
  55703. $self._assert_equals_($1,[(1), (3), (4)]);
  55704. $ctx1.sendIdx["assert:equals:"]=1;
  55705. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  55706. $ctx1.sendIdx["removeIndex:"]=2;
  55707. $self._assert_equals_($2,[(2), (3), (4)]);
  55708. $ctx1.sendIdx["assert:equals:"]=2;
  55709. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  55710. return self;
  55711. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  55712. },
  55713. args: [],
  55714. 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: #()",
  55715. referencedClasses: [],
  55716. messageSends: ["assert:equals:", "removeIndex:"]
  55717. }),
  55718. $globals.ArrayTest);
  55719. $core.addMethod(
  55720. $core.method({
  55721. selector: "testRemoveLast",
  55722. protocol: "tests",
  55723. fn: function (){
  55724. var self=this,$self=this;
  55725. var array;
  55726. return $core.withContext(function($ctx1) {
  55727. array=[(1), (2)];
  55728. $recv(array)._removeLast();
  55729. $self._assert_equals_($recv(array)._last(),(1));
  55730. return self;
  55731. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  55732. },
  55733. args: [],
  55734. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  55735. referencedClasses: [],
  55736. messageSends: ["removeLast", "assert:equals:", "last"]
  55737. }),
  55738. $globals.ArrayTest);
  55739. $core.addMethod(
  55740. $core.method({
  55741. selector: "testReversed",
  55742. protocol: "tests",
  55743. fn: function (){
  55744. var self=this,$self=this;
  55745. var array;
  55746. return $core.withContext(function($ctx1) {
  55747. array=[(5), (4), (3), (2), (1)];
  55748. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  55749. return self;
  55750. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  55751. },
  55752. args: [],
  55753. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  55754. referencedClasses: [],
  55755. messageSends: ["assert:equals:", "reversed"]
  55756. }),
  55757. $globals.ArrayTest);
  55758. $core.addMethod(
  55759. $core.method({
  55760. selector: "testSort",
  55761. protocol: "tests",
  55762. fn: function (){
  55763. var self=this,$self=this;
  55764. var array;
  55765. return $core.withContext(function($ctx1) {
  55766. array=[(10), (1), (5)];
  55767. $recv(array)._sort();
  55768. $self._assert_equals_(array,[(1), (5), (10)]);
  55769. return self;
  55770. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  55771. },
  55772. args: [],
  55773. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  55774. referencedClasses: [],
  55775. messageSends: ["sort", "assert:equals:"]
  55776. }),
  55777. $globals.ArrayTest);
  55778. $core.addMethod(
  55779. $core.method({
  55780. selector: "collectionClass",
  55781. protocol: "fixture",
  55782. fn: function (){
  55783. var self=this,$self=this;
  55784. return $globals.Array;
  55785. },
  55786. args: [],
  55787. source: "collectionClass\x0a\x09^ Array",
  55788. referencedClasses: ["Array"],
  55789. messageSends: []
  55790. }),
  55791. $globals.ArrayTest.a$cls);
  55792. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55793. $core.addMethod(
  55794. $core.method({
  55795. selector: "collection",
  55796. protocol: "fixture",
  55797. fn: function (){
  55798. var self=this,$self=this;
  55799. return "helLo";
  55800. },
  55801. args: [],
  55802. source: "collection\x0a\x09^ 'helLo'",
  55803. referencedClasses: [],
  55804. messageSends: []
  55805. }),
  55806. $globals.StringTest);
  55807. $core.addMethod(
  55808. $core.method({
  55809. selector: "collectionFirst",
  55810. protocol: "fixture",
  55811. fn: function (){
  55812. var self=this,$self=this;
  55813. return "h";
  55814. },
  55815. args: [],
  55816. source: "collectionFirst\x0a\x09^ 'h'",
  55817. referencedClasses: [],
  55818. messageSends: []
  55819. }),
  55820. $globals.StringTest);
  55821. $core.addMethod(
  55822. $core.method({
  55823. selector: "collectionFirstTwo",
  55824. protocol: "fixture",
  55825. fn: function (){
  55826. var self=this,$self=this;
  55827. return "he";
  55828. },
  55829. args: [],
  55830. source: "collectionFirstTwo\x0a\x09^ 'he'",
  55831. referencedClasses: [],
  55832. messageSends: []
  55833. }),
  55834. $globals.StringTest);
  55835. $core.addMethod(
  55836. $core.method({
  55837. selector: "collectionLast",
  55838. protocol: "fixture",
  55839. fn: function (){
  55840. var self=this,$self=this;
  55841. return "o";
  55842. },
  55843. args: [],
  55844. source: "collectionLast\x0a\x09^ 'o'",
  55845. referencedClasses: [],
  55846. messageSends: []
  55847. }),
  55848. $globals.StringTest);
  55849. $core.addMethod(
  55850. $core.method({
  55851. selector: "collectionLastTwo",
  55852. protocol: "fixture",
  55853. fn: function (){
  55854. var self=this,$self=this;
  55855. return "Lo";
  55856. },
  55857. args: [],
  55858. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  55859. referencedClasses: [],
  55860. messageSends: []
  55861. }),
  55862. $globals.StringTest);
  55863. $core.addMethod(
  55864. $core.method({
  55865. selector: "collectionOfPrintStrings",
  55866. protocol: "fixture",
  55867. fn: function (){
  55868. var self=this,$self=this;
  55869. return "'h''e''l''L''o'";
  55870. },
  55871. args: [],
  55872. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  55873. referencedClasses: [],
  55874. messageSends: []
  55875. }),
  55876. $globals.StringTest);
  55877. $core.addMethod(
  55878. $core.method({
  55879. selector: "collectionSize",
  55880. protocol: "fixture",
  55881. fn: function (){
  55882. var self=this,$self=this;
  55883. return (5);
  55884. },
  55885. args: [],
  55886. source: "collectionSize\x0a\x09^ 5",
  55887. referencedClasses: [],
  55888. messageSends: []
  55889. }),
  55890. $globals.StringTest);
  55891. $core.addMethod(
  55892. $core.method({
  55893. selector: "collectionWithDuplicates",
  55894. protocol: "fixture",
  55895. fn: function (){
  55896. var self=this,$self=this;
  55897. return "abbaerten";
  55898. },
  55899. args: [],
  55900. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  55901. referencedClasses: [],
  55902. messageSends: []
  55903. }),
  55904. $globals.StringTest);
  55905. $core.addMethod(
  55906. $core.method({
  55907. selector: "collectionWithNewValue",
  55908. protocol: "fixture",
  55909. fn: function (){
  55910. var self=this,$self=this;
  55911. return "helLoN";
  55912. },
  55913. args: [],
  55914. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  55915. referencedClasses: [],
  55916. messageSends: []
  55917. }),
  55918. $globals.StringTest);
  55919. $core.addMethod(
  55920. $core.method({
  55921. selector: "sampleNewValueAsCollection",
  55922. protocol: "fixture",
  55923. fn: function (){
  55924. var self=this,$self=this;
  55925. return "N";
  55926. },
  55927. args: [],
  55928. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  55929. referencedClasses: [],
  55930. messageSends: []
  55931. }),
  55932. $globals.StringTest);
  55933. $core.addMethod(
  55934. $core.method({
  55935. selector: "samplesDo:",
  55936. protocol: "fixture",
  55937. fn: function (aBlock){
  55938. var self=this,$self=this;
  55939. return $core.withContext(function($ctx1) {
  55940. (
  55941. $ctx1.supercall = true,
  55942. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55943. $ctx1.supercall = false;
  55944. $recv(aBlock)._value_value_((3),"l");
  55945. return self;
  55946. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  55947. },
  55948. args: ["aBlock"],
  55949. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  55950. referencedClasses: [],
  55951. messageSends: ["samplesDo:", "value:value:"]
  55952. }),
  55953. $globals.StringTest);
  55954. $core.addMethod(
  55955. $core.method({
  55956. selector: "testAddAll",
  55957. protocol: "tests",
  55958. fn: function (){
  55959. var self=this,$self=this;
  55960. return $core.withContext(function($ctx1) {
  55961. var $1;
  55962. $self._should_raise_((function(){
  55963. return $core.withContext(function($ctx2) {
  55964. $1=$self._collection();
  55965. $ctx2.sendIdx["collection"]=1;
  55966. return $recv($1)._addAll_($self._collection());
  55967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55968. }),$globals.Error);
  55969. return self;
  55970. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  55971. },
  55972. args: [],
  55973. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  55974. referencedClasses: ["Error"],
  55975. messageSends: ["should:raise:", "addAll:", "collection"]
  55976. }),
  55977. $globals.StringTest);
  55978. $core.addMethod(
  55979. $core.method({
  55980. selector: "testAddRemove",
  55981. protocol: "tests",
  55982. fn: function (){
  55983. var self=this,$self=this;
  55984. return $core.withContext(function($ctx1) {
  55985. $self._should_raise_((function(){
  55986. return $core.withContext(function($ctx2) {
  55987. return "hello"._add_("a");
  55988. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55989. }),$globals.Error);
  55990. $ctx1.sendIdx["should:raise:"]=1;
  55991. $self._should_raise_((function(){
  55992. return $core.withContext(function($ctx2) {
  55993. return "hello"._remove_("h");
  55994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55995. }),$globals.Error);
  55996. return self;
  55997. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  55998. },
  55999. args: [],
  56000. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  56001. referencedClasses: ["Error"],
  56002. messageSends: ["should:raise:", "add:", "remove:"]
  56003. }),
  56004. $globals.StringTest);
  56005. $core.addMethod(
  56006. $core.method({
  56007. selector: "testAsArray",
  56008. protocol: "tests",
  56009. fn: function (){
  56010. var self=this,$self=this;
  56011. return $core.withContext(function($ctx1) {
  56012. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  56013. return self;
  56014. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  56015. },
  56016. args: [],
  56017. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  56018. referencedClasses: [],
  56019. messageSends: ["assert:equals:", "asArray"]
  56020. }),
  56021. $globals.StringTest);
  56022. $core.addMethod(
  56023. $core.method({
  56024. selector: "testAsLowerCase",
  56025. protocol: "tests",
  56026. fn: function (){
  56027. var self=this,$self=this;
  56028. return $core.withContext(function($ctx1) {
  56029. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  56030. return self;
  56031. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  56032. },
  56033. args: [],
  56034. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  56035. referencedClasses: [],
  56036. messageSends: ["assert:equals:", "asLowercase"]
  56037. }),
  56038. $globals.StringTest);
  56039. $core.addMethod(
  56040. $core.method({
  56041. selector: "testAsNumber",
  56042. protocol: "tests",
  56043. fn: function (){
  56044. var self=this,$self=this;
  56045. return $core.withContext(function($ctx1) {
  56046. var $1,$2;
  56047. $1="3"._asNumber();
  56048. $ctx1.sendIdx["asNumber"]=1;
  56049. $self._assert_equals_($1,(3));
  56050. $ctx1.sendIdx["assert:equals:"]=1;
  56051. $2="-3"._asNumber();
  56052. $ctx1.sendIdx["asNumber"]=2;
  56053. $self._assert_equals_($2,(-3));
  56054. $ctx1.sendIdx["assert:equals:"]=2;
  56055. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  56056. return self;
  56057. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  56058. },
  56059. args: [],
  56060. 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.",
  56061. referencedClasses: [],
  56062. messageSends: ["assert:equals:", "asNumber"]
  56063. }),
  56064. $globals.StringTest);
  56065. $core.addMethod(
  56066. $core.method({
  56067. selector: "testAsUpperCase",
  56068. protocol: "tests",
  56069. fn: function (){
  56070. var self=this,$self=this;
  56071. return $core.withContext(function($ctx1) {
  56072. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  56073. return self;
  56074. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  56075. },
  56076. args: [],
  56077. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  56078. referencedClasses: [],
  56079. messageSends: ["assert:equals:", "asUppercase"]
  56080. }),
  56081. $globals.StringTest);
  56082. $core.addMethod(
  56083. $core.method({
  56084. selector: "testAsciiValue",
  56085. protocol: "tests",
  56086. fn: function (){
  56087. var self=this,$self=this;
  56088. var characterA,characterU;
  56089. return $core.withContext(function($ctx1) {
  56090. var $1;
  56091. characterA="A";
  56092. characterU="U";
  56093. $1=$recv(characterA)._asciiValue();
  56094. $ctx1.sendIdx["asciiValue"]=1;
  56095. $self._assert_equals_($1,(65));
  56096. $ctx1.sendIdx["assert:equals:"]=1;
  56097. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  56098. return self;
  56099. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  56100. },
  56101. args: [],
  56102. 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",
  56103. referencedClasses: [],
  56104. messageSends: ["assert:equals:", "asciiValue"]
  56105. }),
  56106. $globals.StringTest);
  56107. $core.addMethod(
  56108. $core.method({
  56109. selector: "testAtIfAbsentPut",
  56110. protocol: "tests",
  56111. fn: function (){
  56112. var self=this,$self=this;
  56113. return $core.withContext(function($ctx1) {
  56114. $self._should_raise_((function(){
  56115. return $core.withContext(function($ctx2) {
  56116. return "hello"._at_ifAbsentPut_((6),(function(){
  56117. return "a";
  56118. }));
  56119. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56120. }),$globals.Error);
  56121. return self;
  56122. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  56123. },
  56124. args: [],
  56125. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  56126. referencedClasses: ["Error"],
  56127. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  56128. }),
  56129. $globals.StringTest);
  56130. $core.addMethod(
  56131. $core.method({
  56132. selector: "testAtPut",
  56133. protocol: "tests",
  56134. fn: function (){
  56135. var self=this,$self=this;
  56136. return $core.withContext(function($ctx1) {
  56137. $self._should_raise_((function(){
  56138. return $core.withContext(function($ctx2) {
  56139. return "hello"._at_put_((1),"a");
  56140. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56141. }),$globals.Error);
  56142. return self;
  56143. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  56144. },
  56145. args: [],
  56146. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  56147. referencedClasses: ["Error"],
  56148. messageSends: ["should:raise:", "at:put:"]
  56149. }),
  56150. $globals.StringTest);
  56151. $core.addMethod(
  56152. $core.method({
  56153. selector: "testCapitalized",
  56154. protocol: "tests",
  56155. fn: function (){
  56156. var self=this,$self=this;
  56157. return $core.withContext(function($ctx1) {
  56158. var $1,$2,$3;
  56159. $1="test"._capitalized();
  56160. $ctx1.sendIdx["capitalized"]=1;
  56161. $self._assert_equals_($1,"Test");
  56162. $ctx1.sendIdx["assert:equals:"]=1;
  56163. $2="Test"._capitalized();
  56164. $ctx1.sendIdx["capitalized"]=2;
  56165. $self._assert_equals_($2,"Test");
  56166. $ctx1.sendIdx["assert:equals:"]=2;
  56167. $self._assert_equals_(""._capitalized(),"");
  56168. $ctx1.sendIdx["assert:equals:"]=3;
  56169. $3="Test"._isCapitalized();
  56170. $ctx1.sendIdx["isCapitalized"]=1;
  56171. $self._assert_equals_($3,true);
  56172. $ctx1.sendIdx["assert:equals:"]=4;
  56173. $self._assert_equals_("test"._isCapitalized(),false);
  56174. return self;
  56175. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  56176. },
  56177. args: [],
  56178. 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.",
  56179. referencedClasses: [],
  56180. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  56181. }),
  56182. $globals.StringTest);
  56183. $core.addMethod(
  56184. $core.method({
  56185. selector: "testCharCodeAt",
  56186. protocol: "tests",
  56187. fn: function (){
  56188. var self=this,$self=this;
  56189. return $core.withContext(function($ctx1) {
  56190. var $1,$2,$3,$4,$5;
  56191. $1="jackie"._charCodeAt_((1));
  56192. $ctx1.sendIdx["charCodeAt:"]=1;
  56193. $self._assert_equals_($1,(106));
  56194. $ctx1.sendIdx["assert:equals:"]=1;
  56195. $2="jackie"._charCodeAt_((2));
  56196. $ctx1.sendIdx["charCodeAt:"]=2;
  56197. $self._assert_equals_($2,(97));
  56198. $ctx1.sendIdx["assert:equals:"]=2;
  56199. $3="jackie"._charCodeAt_((3));
  56200. $ctx1.sendIdx["charCodeAt:"]=3;
  56201. $self._assert_equals_($3,(99));
  56202. $ctx1.sendIdx["assert:equals:"]=3;
  56203. $4="jackie"._charCodeAt_((4));
  56204. $ctx1.sendIdx["charCodeAt:"]=4;
  56205. $self._assert_equals_($4,(107));
  56206. $ctx1.sendIdx["assert:equals:"]=4;
  56207. $5="jackie"._charCodeAt_((5));
  56208. $ctx1.sendIdx["charCodeAt:"]=5;
  56209. $self._assert_equals_($5,(105));
  56210. $ctx1.sendIdx["assert:equals:"]=5;
  56211. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  56212. return self;
  56213. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  56214. },
  56215. args: [],
  56216. 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",
  56217. referencedClasses: [],
  56218. messageSends: ["assert:equals:", "charCodeAt:"]
  56219. }),
  56220. $globals.StringTest);
  56221. $core.addMethod(
  56222. $core.method({
  56223. selector: "testCopyFromTo",
  56224. protocol: "tests",
  56225. fn: function (){
  56226. var self=this,$self=this;
  56227. return $core.withContext(function($ctx1) {
  56228. var $1;
  56229. $1="jackie"._copyFrom_to_((1),(3));
  56230. $ctx1.sendIdx["copyFrom:to:"]=1;
  56231. $self._assert_equals_($1,"jac");
  56232. $ctx1.sendIdx["assert:equals:"]=1;
  56233. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  56234. return self;
  56235. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  56236. },
  56237. args: [],
  56238. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  56239. referencedClasses: [],
  56240. messageSends: ["assert:equals:", "copyFrom:to:"]
  56241. }),
  56242. $globals.StringTest);
  56243. $core.addMethod(
  56244. $core.method({
  56245. selector: "testCopySeparates",
  56246. protocol: "tests",
  56247. fn: function (){
  56248. var self=this,$self=this;
  56249. return $core.withContext(function($ctx1) {
  56250. var $3,$2,$1;
  56251. $3=$self._collection();
  56252. $ctx1.sendIdx["collection"]=1;
  56253. $2=$recv($3)._copy();
  56254. $1=$recv($2).__eq_eq($self._collection());
  56255. $self._assert_($1);
  56256. return self;
  56257. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  56258. },
  56259. args: [],
  56260. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  56261. referencedClasses: [],
  56262. messageSends: ["assert:", "==", "copy", "collection"]
  56263. }),
  56264. $globals.StringTest);
  56265. $core.addMethod(
  56266. $core.method({
  56267. selector: "testCopyWithoutAll",
  56268. protocol: "tests",
  56269. fn: function (){
  56270. var self=this,$self=this;
  56271. return $core.withContext(function($ctx1) {
  56272. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  56273. return self;
  56274. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  56275. },
  56276. args: [],
  56277. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  56278. referencedClasses: [],
  56279. messageSends: ["assert:equals:", "copyWithoutAll:"]
  56280. }),
  56281. $globals.StringTest);
  56282. $core.addMethod(
  56283. $core.method({
  56284. selector: "testEquality",
  56285. protocol: "tests",
  56286. fn: function (){
  56287. var self=this,$self=this;
  56288. return $core.withContext(function($ctx1) {
  56289. var $1,$2,$3;
  56290. $self._assert_equals_("hello","hello");
  56291. $ctx1.sendIdx["assert:equals:"]=1;
  56292. $1="hello".__eq("world");
  56293. $ctx1.sendIdx["="]=1;
  56294. $self._deny_($1);
  56295. $ctx1.sendIdx["deny:"]=1;
  56296. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  56297. })));
  56298. $ctx1.sendIdx["="]=2;
  56299. $self._deny_($2);
  56300. $ctx1.sendIdx["deny:"]=2;
  56301. $3="hello"._yourself();
  56302. $ctx1.sendIdx["yourself"]=1;
  56303. $self._assert_equals_("hello",$3);
  56304. $ctx1.sendIdx["assert:equals:"]=2;
  56305. $self._assert_equals_("hello"._yourself(),"hello");
  56306. $self._deny_("".__eq((0)));
  56307. return self;
  56308. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  56309. },
  56310. args: [],
  56311. 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",
  56312. referencedClasses: [],
  56313. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  56314. }),
  56315. $globals.StringTest);
  56316. $core.addMethod(
  56317. $core.method({
  56318. selector: "testIdentity",
  56319. protocol: "tests",
  56320. fn: function (){
  56321. var self=this,$self=this;
  56322. return $core.withContext(function($ctx1) {
  56323. var $1,$2,$4,$3,$5;
  56324. $1="hello".__eq_eq("hello");
  56325. $ctx1.sendIdx["=="]=1;
  56326. $self._assert_($1);
  56327. $ctx1.sendIdx["assert:"]=1;
  56328. $2="hello".__eq_eq("world");
  56329. $ctx1.sendIdx["=="]=2;
  56330. $self._deny_($2);
  56331. $ctx1.sendIdx["deny:"]=1;
  56332. $4="hello"._yourself();
  56333. $ctx1.sendIdx["yourself"]=1;
  56334. $3="hello".__eq_eq($4);
  56335. $ctx1.sendIdx["=="]=3;
  56336. $self._assert_($3);
  56337. $ctx1.sendIdx["assert:"]=2;
  56338. $5=$recv("hello"._yourself()).__eq_eq("hello");
  56339. $ctx1.sendIdx["=="]=4;
  56340. $self._assert_($5);
  56341. $self._deny_("".__eq_eq((0)));
  56342. return self;
  56343. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  56344. },
  56345. args: [],
  56346. 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",
  56347. referencedClasses: [],
  56348. messageSends: ["assert:", "==", "deny:", "yourself"]
  56349. }),
  56350. $globals.StringTest);
  56351. $core.addMethod(
  56352. $core.method({
  56353. selector: "testIncludesSubString",
  56354. protocol: "tests",
  56355. fn: function (){
  56356. var self=this,$self=this;
  56357. return $core.withContext(function($ctx1) {
  56358. var $1;
  56359. $1="amber"._includesSubString_("ber");
  56360. $ctx1.sendIdx["includesSubString:"]=1;
  56361. $self._assert_($1);
  56362. $self._deny_("amber"._includesSubString_("zork"));
  56363. return self;
  56364. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  56365. },
  56366. args: [],
  56367. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  56368. referencedClasses: [],
  56369. messageSends: ["assert:", "includesSubString:", "deny:"]
  56370. }),
  56371. $globals.StringTest);
  56372. $core.addMethod(
  56373. $core.method({
  56374. selector: "testIndexOfStartingAtWithNull",
  56375. protocol: "tests",
  56376. fn: function (){
  56377. var self=this,$self=this;
  56378. return self;
  56379. },
  56380. args: [],
  56381. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56382. referencedClasses: [],
  56383. messageSends: []
  56384. }),
  56385. $globals.StringTest);
  56386. $core.addMethod(
  56387. $core.method({
  56388. selector: "testIndexOfWithNull",
  56389. protocol: "tests",
  56390. fn: function (){
  56391. var self=this,$self=this;
  56392. return self;
  56393. },
  56394. args: [],
  56395. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56396. referencedClasses: [],
  56397. messageSends: []
  56398. }),
  56399. $globals.StringTest);
  56400. $core.addMethod(
  56401. $core.method({
  56402. selector: "testIsVowel",
  56403. protocol: "tests",
  56404. fn: function (){
  56405. var self=this,$self=this;
  56406. var vowel,consonant;
  56407. return $core.withContext(function($ctx1) {
  56408. var $1;
  56409. vowel="u";
  56410. consonant="z";
  56411. $1=$recv(vowel)._isVowel();
  56412. $ctx1.sendIdx["isVowel"]=1;
  56413. $self._assert_equals_($1,true);
  56414. $ctx1.sendIdx["assert:equals:"]=1;
  56415. $self._assert_equals_($recv(consonant)._isVowel(),false);
  56416. return self;
  56417. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  56418. },
  56419. args: [],
  56420. 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",
  56421. referencedClasses: [],
  56422. messageSends: ["assert:equals:", "isVowel"]
  56423. }),
  56424. $globals.StringTest);
  56425. $core.addMethod(
  56426. $core.method({
  56427. selector: "testJoin",
  56428. protocol: "tests",
  56429. fn: function (){
  56430. var self=this,$self=this;
  56431. return $core.withContext(function($ctx1) {
  56432. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  56433. return self;
  56434. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  56435. },
  56436. args: [],
  56437. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  56438. referencedClasses: [],
  56439. messageSends: ["assert:equals:", "join:"]
  56440. }),
  56441. $globals.StringTest);
  56442. $core.addMethod(
  56443. $core.method({
  56444. selector: "testRegression1224",
  56445. protocol: "tests",
  56446. fn: function (){
  56447. var self=this,$self=this;
  56448. return $core.withContext(function($ctx1) {
  56449. var $2,$1;
  56450. $self._should_raise_((function(){
  56451. return $core.withContext(function($ctx2) {
  56452. $2=$recv($self._collectionClass())._new();
  56453. $recv($2)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  56454. }));
  56455. $1=$recv($2)._yourself();
  56456. return $recv($1)._size();
  56457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56458. }),$globals.Error);
  56459. return self;
  56460. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.StringTest)});
  56461. },
  56462. args: [],
  56463. 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",
  56464. referencedClasses: ["Error"],
  56465. messageSends: ["should:raise:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  56466. }),
  56467. $globals.StringTest);
  56468. $core.addMethod(
  56469. $core.method({
  56470. selector: "testRemoveAll",
  56471. protocol: "tests",
  56472. fn: function (){
  56473. var self=this,$self=this;
  56474. return $core.withContext(function($ctx1) {
  56475. $self._should_raise_((function(){
  56476. return $core.withContext(function($ctx2) {
  56477. return $recv($self._collection())._removeAll();
  56478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56479. }),$globals.Error);
  56480. return self;
  56481. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  56482. },
  56483. args: [],
  56484. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  56485. referencedClasses: ["Error"],
  56486. messageSends: ["should:raise:", "removeAll", "collection"]
  56487. }),
  56488. $globals.StringTest);
  56489. $core.addMethod(
  56490. $core.method({
  56491. selector: "testReversed",
  56492. protocol: "tests",
  56493. fn: function (){
  56494. var self=this,$self=this;
  56495. return $core.withContext(function($ctx1) {
  56496. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  56497. return self;
  56498. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  56499. },
  56500. args: [],
  56501. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  56502. referencedClasses: [],
  56503. messageSends: ["assert:equals:", "reversed"]
  56504. }),
  56505. $globals.StringTest);
  56506. $core.addMethod(
  56507. $core.method({
  56508. selector: "testStreamContents",
  56509. protocol: "tests",
  56510. fn: function (){
  56511. var self=this,$self=this;
  56512. return $core.withContext(function($ctx1) {
  56513. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  56514. return $core.withContext(function($ctx2) {
  56515. $recv(aStream)._nextPutAll_("hello");
  56516. $ctx2.sendIdx["nextPutAll:"]=1;
  56517. $recv(aStream)._space();
  56518. return $recv(aStream)._nextPutAll_("world");
  56519. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  56520. })),"hello world");
  56521. return self;
  56522. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  56523. },
  56524. args: [],
  56525. 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'",
  56526. referencedClasses: ["String"],
  56527. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  56528. }),
  56529. $globals.StringTest);
  56530. $core.addMethod(
  56531. $core.method({
  56532. selector: "testSubStrings",
  56533. protocol: "tests",
  56534. fn: function (){
  56535. var self=this,$self=this;
  56536. return $core.withContext(function($ctx1) {
  56537. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  56538. return self;
  56539. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  56540. },
  56541. args: [],
  56542. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  56543. referencedClasses: [],
  56544. messageSends: ["assert:equals:", "subStrings:"]
  56545. }),
  56546. $globals.StringTest);
  56547. $core.addMethod(
  56548. $core.method({
  56549. selector: "testTrim",
  56550. protocol: "tests",
  56551. fn: function (){
  56552. var self=this,$self=this;
  56553. return $core.withContext(function($ctx1) {
  56554. $self._assert_equals_(" jackie"._trimLeft(),"jackie");
  56555. $ctx1.sendIdx["assert:equals:"]=1;
  56556. $self._assert_equals_("jackie "._trimRight(),"jackie");
  56557. return self;
  56558. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  56559. },
  56560. args: [],
  56561. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  56562. referencedClasses: [],
  56563. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  56564. }),
  56565. $globals.StringTest);
  56566. $core.addMethod(
  56567. $core.method({
  56568. selector: "testValue",
  56569. protocol: "tests",
  56570. fn: function (){
  56571. var self=this,$self=this;
  56572. return $core.withContext(function($ctx1) {
  56573. $self._assert_equals_("asString"._value_((1)),"1");
  56574. $ctx1.sendIdx["assert:equals:"]=1;
  56575. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  56576. return self;
  56577. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  56578. },
  56579. args: [],
  56580. 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')",
  56581. referencedClasses: [],
  56582. messageSends: ["assert:equals:", "value:", "collect:"]
  56583. }),
  56584. $globals.StringTest);
  56585. $core.addMethod(
  56586. $core.method({
  56587. selector: "collectionClass",
  56588. protocol: "fixture",
  56589. fn: function (){
  56590. var self=this,$self=this;
  56591. return $globals.String;
  56592. },
  56593. args: [],
  56594. source: "collectionClass\x0a\x09^ String",
  56595. referencedClasses: ["String"],
  56596. messageSends: []
  56597. }),
  56598. $globals.StringTest.a$cls);
  56599. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  56600. $core.addMethod(
  56601. $core.method({
  56602. selector: "collection",
  56603. protocol: "fixture",
  56604. fn: function (){
  56605. var self=this,$self=this;
  56606. return $core.withContext(function($ctx1) {
  56607. var $1;
  56608. $1=$recv($globals.Set)._new();
  56609. $recv($1)._add_($globals.Smalltalk);
  56610. $ctx1.sendIdx["add:"]=1;
  56611. $recv($1)._add_(nil);
  56612. $ctx1.sendIdx["add:"]=2;
  56613. $recv($1)._add_((3).__at((3)));
  56614. $ctx1.sendIdx["add:"]=3;
  56615. $recv($1)._add_(false);
  56616. $ctx1.sendIdx["add:"]=4;
  56617. $recv($1)._add_($self["@sampleBlock"]);
  56618. return $recv($1)._yourself();
  56619. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  56620. },
  56621. args: [],
  56622. 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",
  56623. referencedClasses: ["Set", "Smalltalk"],
  56624. messageSends: ["add:", "new", "@", "yourself"]
  56625. }),
  56626. $globals.SetTest);
  56627. $core.addMethod(
  56628. $core.method({
  56629. selector: "collectionOfPrintStrings",
  56630. protocol: "fixture",
  56631. fn: function (){
  56632. var self=this,$self=this;
  56633. return $core.withContext(function($ctx1) {
  56634. var $1;
  56635. $1=$recv($globals.Set)._new();
  56636. $recv($1)._add_("a SmalltalkImage");
  56637. $ctx1.sendIdx["add:"]=1;
  56638. $recv($1)._add_("nil");
  56639. $ctx1.sendIdx["add:"]=2;
  56640. $recv($1)._add_("3@3");
  56641. $ctx1.sendIdx["add:"]=3;
  56642. $recv($1)._add_("false");
  56643. $ctx1.sendIdx["add:"]=4;
  56644. $recv($1)._add_("a BlockClosure");
  56645. return $recv($1)._yourself();
  56646. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  56647. },
  56648. args: [],
  56649. 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",
  56650. referencedClasses: ["Set"],
  56651. messageSends: ["add:", "new", "yourself"]
  56652. }),
  56653. $globals.SetTest);
  56654. $core.addMethod(
  56655. $core.method({
  56656. selector: "collectionSize",
  56657. protocol: "fixture",
  56658. fn: function (){
  56659. var self=this,$self=this;
  56660. return (5);
  56661. },
  56662. args: [],
  56663. source: "collectionSize\x0a\x09^ 5",
  56664. referencedClasses: [],
  56665. messageSends: []
  56666. }),
  56667. $globals.SetTest);
  56668. $core.addMethod(
  56669. $core.method({
  56670. selector: "collectionWithDuplicates",
  56671. protocol: "fixture",
  56672. fn: function (){
  56673. var self=this,$self=this;
  56674. return $core.withContext(function($ctx1) {
  56675. var $1;
  56676. $1=$self._collection();
  56677. $recv($1)._add_((0));
  56678. return $recv($1)._yourself();
  56679. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  56680. },
  56681. args: [],
  56682. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  56683. referencedClasses: [],
  56684. messageSends: ["add:", "collection", "yourself"]
  56685. }),
  56686. $globals.SetTest);
  56687. $core.addMethod(
  56688. $core.method({
  56689. selector: "collectionWithNewValue",
  56690. protocol: "fixture",
  56691. fn: function (){
  56692. var self=this,$self=this;
  56693. return $core.withContext(function($ctx1) {
  56694. var $1;
  56695. $1=$recv($globals.Set)._new();
  56696. $recv($1)._add_($globals.Smalltalk);
  56697. $ctx1.sendIdx["add:"]=1;
  56698. $recv($1)._add_(nil);
  56699. $ctx1.sendIdx["add:"]=2;
  56700. $recv($1)._add_((3).__at((3)));
  56701. $ctx1.sendIdx["add:"]=3;
  56702. $recv($1)._add_("N");
  56703. $ctx1.sendIdx["add:"]=4;
  56704. $recv($1)._add_(false);
  56705. $ctx1.sendIdx["add:"]=5;
  56706. $recv($1)._add_($self["@sampleBlock"]);
  56707. return $recv($1)._yourself();
  56708. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  56709. },
  56710. args: [],
  56711. 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",
  56712. referencedClasses: ["Set", "Smalltalk"],
  56713. messageSends: ["add:", "new", "@", "yourself"]
  56714. }),
  56715. $globals.SetTest);
  56716. $core.addMethod(
  56717. $core.method({
  56718. selector: "testAddAll",
  56719. protocol: "tests",
  56720. fn: function (){
  56721. var self=this,$self=this;
  56722. return $core.withContext(function($ctx1) {
  56723. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  56724. (
  56725. $ctx1.supercall = true,
  56726. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  56727. $ctx1.supercall = false;
  56728. $2=$self._collection();
  56729. $ctx1.sendIdx["collection"]=1;
  56730. $3=$self._collection();
  56731. $ctx1.sendIdx["collection"]=2;
  56732. $recv($2)._addAll_($3);
  56733. $ctx1.sendIdx["addAll:"]=1;
  56734. $4=$recv($2)._yourself();
  56735. $ctx1.sendIdx["yourself"]=1;
  56736. $1=$4;
  56737. $5=$self._collection();
  56738. $ctx1.sendIdx["collection"]=3;
  56739. $self._assert_equals_($1,$5);
  56740. $ctx1.sendIdx["assert:equals:"]=1;
  56741. $7=$self._collection();
  56742. $ctx1.sendIdx["collection"]=4;
  56743. $8=$self._collectionWithNewValue();
  56744. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56745. $recv($7)._addAll_($8);
  56746. $ctx1.sendIdx["addAll:"]=2;
  56747. $9=$recv($7)._yourself();
  56748. $ctx1.sendIdx["yourself"]=2;
  56749. $6=$9;
  56750. $10=$self._collectionWithNewValue();
  56751. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56752. $self._assert_equals_($6,$10);
  56753. $ctx1.sendIdx["assert:equals:"]=2;
  56754. $12=$self._collectionWithNewValue();
  56755. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56756. $recv($12)._addAll_($self._collection());
  56757. $11=$recv($12)._yourself();
  56758. $self._assert_equals_($11,$self._collectionWithNewValue());
  56759. return self;
  56760. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  56761. },
  56762. args: [],
  56763. 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",
  56764. referencedClasses: [],
  56765. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  56766. }),
  56767. $globals.SetTest);
  56768. $core.addMethod(
  56769. $core.method({
  56770. selector: "testAddRemove",
  56771. protocol: "tests",
  56772. fn: function (){
  56773. var self=this,$self=this;
  56774. var set;
  56775. return $core.withContext(function($ctx1) {
  56776. var $1,$2;
  56777. set=$recv($globals.Set)._new();
  56778. $self._assert_($recv(set)._isEmpty());
  56779. $ctx1.sendIdx["assert:"]=1;
  56780. $recv(set)._add_((3));
  56781. $ctx1.sendIdx["add:"]=1;
  56782. $1=$recv(set)._includes_((3));
  56783. $ctx1.sendIdx["includes:"]=1;
  56784. $self._assert_($1);
  56785. $ctx1.sendIdx["assert:"]=2;
  56786. $recv(set)._add_((5));
  56787. $2=$recv(set)._includes_((5));
  56788. $ctx1.sendIdx["includes:"]=2;
  56789. $self._assert_($2);
  56790. $recv(set)._remove_((3));
  56791. $self._deny_($recv(set)._includes_((3)));
  56792. return self;
  56793. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  56794. },
  56795. args: [],
  56796. 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)",
  56797. referencedClasses: ["Set"],
  56798. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  56799. }),
  56800. $globals.SetTest);
  56801. $core.addMethod(
  56802. $core.method({
  56803. selector: "testAt",
  56804. protocol: "tests",
  56805. fn: function (){
  56806. var self=this,$self=this;
  56807. return $core.withContext(function($ctx1) {
  56808. $self._should_raise_((function(){
  56809. return $core.withContext(function($ctx2) {
  56810. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  56811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56812. }),$globals.Error);
  56813. return self;
  56814. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  56815. },
  56816. args: [],
  56817. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  56818. referencedClasses: ["Set", "Error"],
  56819. messageSends: ["should:raise:", "at:put:", "new"]
  56820. }),
  56821. $globals.SetTest);
  56822. $core.addMethod(
  56823. $core.method({
  56824. selector: "testCollect",
  56825. protocol: "tests",
  56826. fn: function (){
  56827. var self=this,$self=this;
  56828. return $core.withContext(function($ctx1) {
  56829. var $2,$1;
  56830. (
  56831. $ctx1.supercall = true,
  56832. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($self, []));
  56833. $ctx1.supercall = false;
  56834. $2=[(5), (6), (8)]._asSet();
  56835. $ctx1.sendIdx["asSet"]=1;
  56836. $1=$recv($2)._collect_((function(x){
  56837. return $core.withContext(function($ctx2) {
  56838. return $recv(x).__backslash_backslash((3));
  56839. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56840. }));
  56841. $self._assert_equals_($1,[(0), (2)]._asSet());
  56842. return self;
  56843. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  56844. },
  56845. args: [],
  56846. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  56847. referencedClasses: [],
  56848. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  56849. }),
  56850. $globals.SetTest);
  56851. $core.addMethod(
  56852. $core.method({
  56853. selector: "testComma",
  56854. protocol: "tests",
  56855. fn: function (){
  56856. var self=this,$self=this;
  56857. return $core.withContext(function($ctx1) {
  56858. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  56859. (
  56860. $ctx1.supercall = true,
  56861. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  56862. $ctx1.supercall = false;
  56863. $2=$self._collection();
  56864. $ctx1.sendIdx["collection"]=1;
  56865. $3=$self._collection();
  56866. $ctx1.sendIdx["collection"]=2;
  56867. $1=$recv($2).__comma($3);
  56868. $ctx1.sendIdx[","]=1;
  56869. $4=$self._collection();
  56870. $ctx1.sendIdx["collection"]=3;
  56871. $self._assert_equals_($1,$4);
  56872. $ctx1.sendIdx["assert:equals:"]=1;
  56873. $6=$self._collection();
  56874. $ctx1.sendIdx["collection"]=4;
  56875. $7=$self._collectionWithNewValue();
  56876. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56877. $5=$recv($6).__comma($7);
  56878. $ctx1.sendIdx[","]=2;
  56879. $8=$self._collectionWithNewValue();
  56880. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56881. $self._assert_equals_($5,$8);
  56882. $ctx1.sendIdx["assert:equals:"]=2;
  56883. $10=$self._collectionWithNewValue();
  56884. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56885. $9=$recv($10).__comma($self._collection());
  56886. $self._assert_equals_($9,$self._collectionWithNewValue());
  56887. return self;
  56888. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  56889. },
  56890. args: [],
  56891. 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",
  56892. referencedClasses: [],
  56893. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  56894. }),
  56895. $globals.SetTest);
  56896. $core.addMethod(
  56897. $core.method({
  56898. selector: "testComparing",
  56899. protocol: "tests",
  56900. fn: function (){
  56901. var self=this,$self=this;
  56902. return $core.withContext(function($ctx1) {
  56903. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  56904. $1=[(0), (2)]._asSet();
  56905. $ctx1.sendIdx["asSet"]=1;
  56906. $2=[(0), (2)]._asSet();
  56907. $ctx1.sendIdx["asSet"]=2;
  56908. $self._assert_equals_($1,$2);
  56909. $ctx1.sendIdx["assert:equals:"]=1;
  56910. $3=[(2), (0)]._asSet();
  56911. $ctx1.sendIdx["asSet"]=3;
  56912. $4=[(0), (2)]._asSet();
  56913. $ctx1.sendIdx["asSet"]=4;
  56914. $self._assert_equals_($3,$4);
  56915. $6=[(0), (2), (3)]._asSet();
  56916. $ctx1.sendIdx["asSet"]=5;
  56917. $7=[(0), (2)]._asSet();
  56918. $ctx1.sendIdx["asSet"]=6;
  56919. $5=$recv($6).__eq($7);
  56920. $ctx1.sendIdx["="]=1;
  56921. $self._deny_($5);
  56922. $ctx1.sendIdx["deny:"]=1;
  56923. $9=[(1), (2)]._asSet();
  56924. $ctx1.sendIdx["asSet"]=7;
  56925. $8=$recv($9).__eq([(0), (2)]._asSet());
  56926. $self._deny_($8);
  56927. return self;
  56928. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  56929. },
  56930. args: [],
  56931. 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",
  56932. referencedClasses: [],
  56933. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  56934. }),
  56935. $globals.SetTest);
  56936. $core.addMethod(
  56937. $core.method({
  56938. selector: "testPrintString",
  56939. protocol: "tests",
  56940. fn: function (){
  56941. var self=this,$self=this;
  56942. var set;
  56943. return $core.withContext(function($ctx1) {
  56944. var $1,$2,$3,$4,$5,$6,$7,$8;
  56945. set=$recv($globals.Set)._new();
  56946. $1=$recv(set)._printString();
  56947. $ctx1.sendIdx["printString"]=1;
  56948. $self._assert_equals_($1,"a Set ()");
  56949. $ctx1.sendIdx["assert:equals:"]=1;
  56950. $2=set;
  56951. $recv($2)._add_((1));
  56952. $ctx1.sendIdx["add:"]=1;
  56953. $3=$recv($2)._add_((3));
  56954. $ctx1.sendIdx["add:"]=2;
  56955. $4=$recv(set)._printString();
  56956. $ctx1.sendIdx["printString"]=2;
  56957. $self._assert_equals_($4,"a Set (1 3)");
  56958. $ctx1.sendIdx["assert:equals:"]=2;
  56959. $recv(set)._add_("foo");
  56960. $ctx1.sendIdx["add:"]=3;
  56961. $5=$recv(set)._printString();
  56962. $ctx1.sendIdx["printString"]=3;
  56963. $self._assert_equals_($5,"a Set (1 3 'foo')");
  56964. $ctx1.sendIdx["assert:equals:"]=3;
  56965. $6=set;
  56966. $recv($6)._remove_((1));
  56967. $ctx1.sendIdx["remove:"]=1;
  56968. $recv($6)._remove_((3));
  56969. $7=$recv(set)._printString();
  56970. $ctx1.sendIdx["printString"]=4;
  56971. $self._assert_equals_($7,"a Set ('foo')");
  56972. $ctx1.sendIdx["assert:equals:"]=4;
  56973. $recv(set)._add_((3));
  56974. $ctx1.sendIdx["add:"]=4;
  56975. $8=$recv(set)._printString();
  56976. $ctx1.sendIdx["printString"]=5;
  56977. $self._assert_equals_($8,"a Set (3 'foo')");
  56978. $ctx1.sendIdx["assert:equals:"]=5;
  56979. $recv(set)._add_((3));
  56980. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  56981. return self;
  56982. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  56983. },
  56984. args: [],
  56985. 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'')'",
  56986. referencedClasses: ["Set"],
  56987. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  56988. }),
  56989. $globals.SetTest);
  56990. $core.addMethod(
  56991. $core.method({
  56992. selector: "testRegression1225",
  56993. protocol: "tests",
  56994. fn: function (){
  56995. var self=this,$self=this;
  56996. return $core.withContext(function($ctx1) {
  56997. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._add_((3)),(3));
  56998. return self;
  56999. }, function($ctx1) {$ctx1.fill(self,"testRegression1225",{},$globals.SetTest)});
  57000. },
  57001. args: [],
  57002. source: "testRegression1225\x0a\x09self assert: (#(1 2 3) asSet add: 3) equals: 3",
  57003. referencedClasses: [],
  57004. messageSends: ["assert:equals:", "add:", "asSet"]
  57005. }),
  57006. $globals.SetTest);
  57007. $core.addMethod(
  57008. $core.method({
  57009. selector: "testRegression1226",
  57010. protocol: "tests",
  57011. fn: function (){
  57012. var self=this,$self=this;
  57013. return $core.withContext(function($ctx1) {
  57014. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._remove_((3)),(3));
  57015. return self;
  57016. }, function($ctx1) {$ctx1.fill(self,"testRegression1226",{},$globals.SetTest)});
  57017. },
  57018. args: [],
  57019. source: "testRegression1226\x0a\x09self assert: (#(1 2 3) asSet remove: 3) equals: 3",
  57020. referencedClasses: [],
  57021. messageSends: ["assert:equals:", "remove:", "asSet"]
  57022. }),
  57023. $globals.SetTest);
  57024. $core.addMethod(
  57025. $core.method({
  57026. selector: "testRegression1227",
  57027. protocol: "tests",
  57028. fn: function (){
  57029. var self=this,$self=this;
  57030. return $core.withContext(function($ctx1) {
  57031. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._remove_ifAbsent_((4),(function(){
  57032. return (5);
  57033. })),(5));
  57034. return self;
  57035. }, function($ctx1) {$ctx1.fill(self,"testRegression1227",{},$globals.SetTest)});
  57036. },
  57037. args: [],
  57038. source: "testRegression1227\x0a\x09self assert: (#(1 2 3) asSet remove: 4 ifAbsent: [5]) equals: 5",
  57039. referencedClasses: [],
  57040. messageSends: ["assert:equals:", "remove:ifAbsent:", "asSet"]
  57041. }),
  57042. $globals.SetTest);
  57043. $core.addMethod(
  57044. $core.method({
  57045. selector: "testRegression1228",
  57046. protocol: "tests",
  57047. fn: function (){
  57048. var self=this,$self=this;
  57049. return $core.withContext(function($ctx1) {
  57050. $self._should_raise_((function(){
  57051. return $core.withContext(function($ctx2) {
  57052. return $recv([(1), (2), (3)]._asSet())._remove_((4));
  57053. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57054. }),$globals.Error);
  57055. return self;
  57056. }, function($ctx1) {$ctx1.fill(self,"testRegression1228",{},$globals.SetTest)});
  57057. },
  57058. args: [],
  57059. source: "testRegression1228\x0a\x09self should: [#(1 2 3) asSet remove: 4] raise: Error",
  57060. referencedClasses: ["Error"],
  57061. messageSends: ["should:raise:", "remove:", "asSet"]
  57062. }),
  57063. $globals.SetTest);
  57064. $core.addMethod(
  57065. $core.method({
  57066. selector: "testUnboxedObjects",
  57067. protocol: "tests",
  57068. fn: function (){
  57069. var self=this,$self=this;
  57070. return $core.withContext(function($ctx1) {
  57071. var $4,$3,$2,$1;
  57072. $4="foo"._yourself();
  57073. $ctx1.sendIdx["yourself"]=1;
  57074. $3=[$4,"foo"._yourself()];
  57075. $2=$recv($3)._asSet();
  57076. $1=$recv($2)._asArray();
  57077. $self._assert_equals_($1,["foo"]);
  57078. return self;
  57079. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  57080. },
  57081. args: [],
  57082. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  57083. referencedClasses: [],
  57084. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  57085. }),
  57086. $globals.SetTest);
  57087. $core.addMethod(
  57088. $core.method({
  57089. selector: "testUnicity",
  57090. protocol: "tests",
  57091. fn: function (){
  57092. var self=this,$self=this;
  57093. var set;
  57094. return $core.withContext(function($ctx1) {
  57095. var $1;
  57096. set=$recv($globals.Set)._new();
  57097. $recv(set)._add_((21));
  57098. $ctx1.sendIdx["add:"]=1;
  57099. $recv(set)._add_("hello");
  57100. $ctx1.sendIdx["add:"]=2;
  57101. $recv(set)._add_((21));
  57102. $ctx1.sendIdx["add:"]=3;
  57103. $1=$recv(set)._size();
  57104. $ctx1.sendIdx["size"]=1;
  57105. $self._assert_equals_($1,(2));
  57106. $ctx1.sendIdx["assert:equals:"]=1;
  57107. $recv(set)._add_("hello");
  57108. $self._assert_equals_($recv(set)._size(),(2));
  57109. $ctx1.sendIdx["assert:equals:"]=2;
  57110. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  57111. return self;
  57112. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  57113. },
  57114. args: [],
  57115. 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')",
  57116. referencedClasses: ["Set"],
  57117. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  57118. }),
  57119. $globals.SetTest);
  57120. $core.addMethod(
  57121. $core.method({
  57122. selector: "collectionClass",
  57123. protocol: "fixture",
  57124. fn: function (){
  57125. var self=this,$self=this;
  57126. return $globals.Set;
  57127. },
  57128. args: [],
  57129. source: "collectionClass\x0a\x09^ Set",
  57130. referencedClasses: ["Set"],
  57131. messageSends: []
  57132. }),
  57133. $globals.SetTest.a$cls);
  57134. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  57135. $core.addMethod(
  57136. $core.method({
  57137. selector: "testShow",
  57138. protocol: "tests",
  57139. fn: function (){
  57140. var self=this,$self=this;
  57141. var originalTranscript;
  57142. return $core.withContext(function($ctx1) {
  57143. originalTranscript=$recv($globals.Transcript)._current();
  57144. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  57145. $ctx1.sendIdx["register:"]=1;
  57146. $self._shouldnt_raise_((function(){
  57147. return $core.withContext(function($ctx2) {
  57148. return $recv($globals.Transcript)._show_("Hello console!");
  57149. $ctx2.sendIdx["show:"]=1;
  57150. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57151. }),$globals.Error);
  57152. $ctx1.sendIdx["shouldnt:raise:"]=1;
  57153. $self._shouldnt_raise_((function(){
  57154. return $core.withContext(function($ctx2) {
  57155. return $recv($globals.Transcript)._show_(console);
  57156. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57157. }),$globals.Error);
  57158. $recv($globals.Transcript)._register_(originalTranscript);
  57159. return self;
  57160. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  57161. },
  57162. args: [],
  57163. 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.",
  57164. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  57165. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  57166. }),
  57167. $globals.ConsoleTranscriptTest);
  57168. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  57169. $core.addMethod(
  57170. $core.method({
  57171. selector: "testEquality",
  57172. protocol: "tests",
  57173. fn: function (){
  57174. var self=this,$self=this;
  57175. var now;
  57176. return $core.withContext(function($ctx1) {
  57177. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57178. now=$recv($globals.Date)._new();
  57179. $1=$recv(now).__eq(now);
  57180. $ctx1.sendIdx["="]=1;
  57181. $self._assert_($1);
  57182. $ctx1.sendIdx["assert:"]=1;
  57183. $3=now;
  57184. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57185. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57186. $2=$recv($3).__eq($4);
  57187. $ctx1.sendIdx["="]=2;
  57188. $self._deny_($2);
  57189. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57190. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57191. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57192. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57193. $5=$recv($6).__eq($7);
  57194. $ctx1.sendIdx["="]=3;
  57195. $self._assert_($5);
  57196. $ctx1.sendIdx["assert:"]=2;
  57197. $9=now;
  57198. $11=$recv(now)._asMilliseconds();
  57199. $ctx1.sendIdx["asMilliseconds"]=1;
  57200. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57201. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57202. $8=$recv($9).__eq($10);
  57203. $ctx1.sendIdx["="]=4;
  57204. $self._assert_($8);
  57205. $ctx1.sendIdx["assert:"]=3;
  57206. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  57207. return self;
  57208. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  57209. },
  57210. args: [],
  57211. 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",
  57212. referencedClasses: ["Date"],
  57213. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57214. }),
  57215. $globals.DateTest);
  57216. $core.addMethod(
  57217. $core.method({
  57218. selector: "testIdentity",
  57219. protocol: "tests",
  57220. fn: function (){
  57221. var self=this,$self=this;
  57222. var now;
  57223. return $core.withContext(function($ctx1) {
  57224. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57225. now=$recv($globals.Date)._new();
  57226. $1=$recv(now).__eq_eq(now);
  57227. $ctx1.sendIdx["=="]=1;
  57228. $self._assert_($1);
  57229. $3=now;
  57230. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57231. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57232. $2=$recv($3).__eq_eq($4);
  57233. $ctx1.sendIdx["=="]=2;
  57234. $self._deny_($2);
  57235. $ctx1.sendIdx["deny:"]=1;
  57236. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57237. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57238. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57239. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57240. $5=$recv($6).__eq_eq($7);
  57241. $ctx1.sendIdx["=="]=3;
  57242. $self._deny_($5);
  57243. $ctx1.sendIdx["deny:"]=2;
  57244. $9=now;
  57245. $11=$recv(now)._asMilliseconds();
  57246. $ctx1.sendIdx["asMilliseconds"]=1;
  57247. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57248. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57249. $8=$recv($9).__eq_eq($10);
  57250. $ctx1.sendIdx["=="]=4;
  57251. $self._deny_($8);
  57252. $ctx1.sendIdx["deny:"]=3;
  57253. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  57254. return self;
  57255. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  57256. },
  57257. args: [],
  57258. 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",
  57259. referencedClasses: ["Date"],
  57260. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57261. }),
  57262. $globals.DateTest);
  57263. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  57264. $core.addMethod(
  57265. $core.method({
  57266. selector: "jsObject",
  57267. protocol: "accessing",
  57268. fn: function (){
  57269. var self=this,$self=this;
  57270. return $core.withContext(function($ctx1) {
  57271. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  57272. return self;
  57273. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  57274. },
  57275. args: [],
  57276. 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}'>",
  57277. referencedClasses: [],
  57278. messageSends: []
  57279. }),
  57280. $globals.JSObjectProxyTest);
  57281. $core.addMethod(
  57282. $core.method({
  57283. selector: "jsUndefined",
  57284. protocol: "accessing",
  57285. fn: function (){
  57286. var self=this,$self=this;
  57287. return $core.withContext(function($ctx1) {
  57288. return;
  57289. return self;
  57290. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  57291. },
  57292. args: [],
  57293. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  57294. referencedClasses: [],
  57295. messageSends: []
  57296. }),
  57297. $globals.JSObjectProxyTest);
  57298. $core.addMethod(
  57299. $core.method({
  57300. selector: "testAtIfAbsent",
  57301. protocol: "tests",
  57302. fn: function (){
  57303. var self=this,$self=this;
  57304. var testObject;
  57305. return $core.withContext(function($ctx1) {
  57306. var $1,$2,$3;
  57307. testObject=$self._jsObject();
  57308. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  57309. return "Property does not exist";
  57310. }));
  57311. $ctx1.sendIdx["at:ifAbsent:"]=1;
  57312. $self._assert_equals_($1,"Property does not exist");
  57313. $ctx1.sendIdx["assert:equals:"]=1;
  57314. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  57315. return "Property does not exist";
  57316. }));
  57317. $ctx1.sendIdx["at:ifAbsent:"]=2;
  57318. $self._assert_equals_($2,nil);
  57319. $ctx1.sendIdx["assert:equals:"]=2;
  57320. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  57321. return "Property does not exist";
  57322. }));
  57323. $ctx1.sendIdx["at:ifAbsent:"]=3;
  57324. $self._assert_equals_($3,(1));
  57325. $ctx1.sendIdx["assert:equals:"]=3;
  57326. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  57327. return "Property does not exist";
  57328. })),nil);
  57329. return self;
  57330. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57331. },
  57332. args: [],
  57333. 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.",
  57334. referencedClasses: [],
  57335. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  57336. }),
  57337. $globals.JSObjectProxyTest);
  57338. $core.addMethod(
  57339. $core.method({
  57340. selector: "testAtIfPresent",
  57341. protocol: "tests",
  57342. fn: function (){
  57343. var self=this,$self=this;
  57344. var testObject;
  57345. return $core.withContext(function($ctx1) {
  57346. var $2,$1,$4,$3,$6,$5;
  57347. testObject=$self._jsObject();
  57348. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  57349. return $core.withContext(function($ctx2) {
  57350. $2=$recv(x)._asString();
  57351. $ctx2.sendIdx["asString"]=1;
  57352. return "hello ".__comma($2);
  57353. $ctx2.sendIdx[","]=1;
  57354. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57355. }));
  57356. $ctx1.sendIdx["at:ifPresent:"]=1;
  57357. $self._assert_equals_($1,nil);
  57358. $ctx1.sendIdx["assert:equals:"]=1;
  57359. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  57360. return $core.withContext(function($ctx2) {
  57361. $4=$recv(x)._asString();
  57362. $ctx2.sendIdx["asString"]=2;
  57363. return "hello ".__comma($4);
  57364. $ctx2.sendIdx[","]=2;
  57365. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  57366. }));
  57367. $ctx1.sendIdx["at:ifPresent:"]=2;
  57368. $self._assert_equals_($3,"hello nil");
  57369. $ctx1.sendIdx["assert:equals:"]=2;
  57370. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  57371. return $core.withContext(function($ctx2) {
  57372. $6=$recv(x)._asString();
  57373. $ctx2.sendIdx["asString"]=3;
  57374. return "hello ".__comma($6);
  57375. $ctx2.sendIdx[","]=3;
  57376. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57377. }));
  57378. $ctx1.sendIdx["at:ifPresent:"]=3;
  57379. $self._assert_equals_($5,"hello 1");
  57380. $ctx1.sendIdx["assert:equals:"]=3;
  57381. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  57382. return $core.withContext(function($ctx2) {
  57383. return "hello ".__comma($recv(x)._asString());
  57384. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  57385. })),"hello nil");
  57386. return self;
  57387. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57388. },
  57389. args: [],
  57390. 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'.",
  57391. referencedClasses: [],
  57392. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  57393. }),
  57394. $globals.JSObjectProxyTest);
  57395. $core.addMethod(
  57396. $core.method({
  57397. selector: "testAtIfPresentIfAbsent",
  57398. protocol: "tests",
  57399. fn: function (){
  57400. var self=this,$self=this;
  57401. var testObject;
  57402. return $core.withContext(function($ctx1) {
  57403. var $2,$1,$4,$3,$6,$5;
  57404. testObject=$self._jsObject();
  57405. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  57406. return $core.withContext(function($ctx2) {
  57407. $2=$recv(x)._asString();
  57408. $ctx2.sendIdx["asString"]=1;
  57409. return "hello ".__comma($2);
  57410. $ctx2.sendIdx[","]=1;
  57411. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57412. }),(function(){
  57413. return "not present";
  57414. }));
  57415. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  57416. $self._assert_equals_($1,"not present");
  57417. $ctx1.sendIdx["assert:equals:"]=1;
  57418. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  57419. return $core.withContext(function($ctx2) {
  57420. $4=$recv(x)._asString();
  57421. $ctx2.sendIdx["asString"]=2;
  57422. return "hello ".__comma($4);
  57423. $ctx2.sendIdx[","]=2;
  57424. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57425. }),(function(){
  57426. return "not present";
  57427. }));
  57428. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  57429. $self._assert_equals_($3,"hello nil");
  57430. $ctx1.sendIdx["assert:equals:"]=2;
  57431. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  57432. return $core.withContext(function($ctx2) {
  57433. $6=$recv(x)._asString();
  57434. $ctx2.sendIdx["asString"]=3;
  57435. return "hello ".__comma($6);
  57436. $ctx2.sendIdx[","]=3;
  57437. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  57438. }),(function(){
  57439. return "not present";
  57440. }));
  57441. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  57442. $self._assert_equals_($5,"hello 1");
  57443. $ctx1.sendIdx["assert:equals:"]=3;
  57444. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  57445. return $core.withContext(function($ctx2) {
  57446. return "hello ".__comma($recv(x)._asString());
  57447. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  57448. }),(function(){
  57449. return "not present";
  57450. })),"hello nil");
  57451. return self;
  57452. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57453. },
  57454. args: [],
  57455. 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'.",
  57456. referencedClasses: [],
  57457. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  57458. }),
  57459. $globals.JSObjectProxyTest);
  57460. $core.addMethod(
  57461. $core.method({
  57462. selector: "testAtPut",
  57463. protocol: "tests",
  57464. fn: function (){
  57465. var self=this,$self=this;
  57466. var testObject;
  57467. return $core.withContext(function($ctx1) {
  57468. var $2,$1;
  57469. testObject=$self._jsObject();
  57470. $2=$recv(testObject)._at_("abc");
  57471. $ctx1.sendIdx["at:"]=1;
  57472. $1=$recv($2).__tild_eq("xyz");
  57473. $self._assert_($1);
  57474. $self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  57475. $ctx1.sendIdx["assert:equals:"]=1;
  57476. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  57477. return self;
  57478. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  57479. },
  57480. args: [],
  57481. 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'",
  57482. referencedClasses: [],
  57483. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  57484. }),
  57485. $globals.JSObjectProxyTest);
  57486. $core.addMethod(
  57487. $core.method({
  57488. selector: "testComparison",
  57489. protocol: "tests",
  57490. fn: function (){
  57491. var self=this,$self=this;
  57492. return $core.withContext(function($ctx1) {
  57493. var $1,$2;
  57494. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  57495. $1=$recv(console).__eq(console);
  57496. $ctx1.sendIdx["="]=1;
  57497. $self._assert_($1);
  57498. $2=$recv(console).__eq($recv($globals.Object)._new());
  57499. $ctx1.sendIdx["="]=2;
  57500. $self._deny_($2);
  57501. $ctx1.sendIdx["deny:"]=1;
  57502. $self._deny_($recv(console).__eq($self._jsObject()));
  57503. return self;
  57504. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  57505. },
  57506. args: [],
  57507. 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",
  57508. referencedClasses: ["Object"],
  57509. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  57510. }),
  57511. $globals.JSObjectProxyTest);
  57512. $core.addMethod(
  57513. $core.method({
  57514. selector: "testDNU",
  57515. protocol: "tests",
  57516. fn: function (){
  57517. var self=this,$self=this;
  57518. return $core.withContext(function($ctx1) {
  57519. $self._should_raise_((function(){
  57520. return $core.withContext(function($ctx2) {
  57521. return $recv($self._jsObject())._foo();
  57522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57523. }),$globals.MessageNotUnderstood);
  57524. return self;
  57525. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  57526. },
  57527. args: [],
  57528. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  57529. referencedClasses: ["MessageNotUnderstood"],
  57530. messageSends: ["should:raise:", "foo", "jsObject"]
  57531. }),
  57532. $globals.JSObjectProxyTest);
  57533. $core.addMethod(
  57534. $core.method({
  57535. selector: "testDNUWithAllowJavaScriptCalls",
  57536. protocol: "tests",
  57537. fn: function (){
  57538. var self=this,$self=this;
  57539. var jsObject;
  57540. return $core.withContext(function($ctx1) {
  57541. jsObject=[];
  57542. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  57543. $self._should_raise_((function(){
  57544. return $core.withContext(function($ctx2) {
  57545. return $recv(jsObject)._foo();
  57546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57547. }),$globals.MessageNotUnderstood);
  57548. return self;
  57549. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57550. },
  57551. args: [],
  57552. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  57553. referencedClasses: ["MessageNotUnderstood"],
  57554. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  57555. }),
  57556. $globals.JSObjectProxyTest);
  57557. $core.addMethod(
  57558. $core.method({
  57559. selector: "testMessageSend",
  57560. protocol: "tests",
  57561. fn: function (){
  57562. var self=this,$self=this;
  57563. return $core.withContext(function($ctx1) {
  57564. var $2,$1,$4,$3;
  57565. $2=$self._jsObject();
  57566. $ctx1.sendIdx["jsObject"]=1;
  57567. $1=$recv($2)._a();
  57568. $self._assert_equals_($1,(1));
  57569. $ctx1.sendIdx["assert:equals:"]=1;
  57570. $4=$self._jsObject();
  57571. $ctx1.sendIdx["jsObject"]=2;
  57572. $3=$recv($4)._b();
  57573. $self._assert_equals_($3,(2));
  57574. $ctx1.sendIdx["assert:equals:"]=2;
  57575. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  57576. return self;
  57577. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  57578. },
  57579. args: [],
  57580. 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",
  57581. referencedClasses: [],
  57582. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  57583. }),
  57584. $globals.JSObjectProxyTest);
  57585. $core.addMethod(
  57586. $core.method({
  57587. selector: "testMethodWithArguments",
  57588. protocol: "tests",
  57589. fn: function (){
  57590. var self=this,$self=this;
  57591. return $core.withContext(function($ctx1) {
  57592. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  57593. return self;
  57594. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  57595. },
  57596. args: [],
  57597. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  57598. referencedClasses: [],
  57599. messageSends: ["assert:equals:", "c:", "jsObject"]
  57600. }),
  57601. $globals.JSObjectProxyTest);
  57602. $core.addMethod(
  57603. $core.method({
  57604. selector: "testNull",
  57605. protocol: "tests",
  57606. fn: function (){
  57607. var self=this,$self=this;
  57608. return $core.withContext(function($ctx1) {
  57609. var $2,$1;
  57610. $2=$recv($globals.JSObjectProxy)._null();
  57611. $ctx1.sendIdx["null"]=1;
  57612. $1=$recv($2)._isNil();
  57613. $self._assert_($1);
  57614. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._null()])),"{\x22foo\x22:null}");
  57615. return self;
  57616. }, function($ctx1) {$ctx1.fill(self,"testNull",{},$globals.JSObjectProxyTest)});
  57617. },
  57618. args: [],
  57619. source: "testNull\x0a\x09self assert: JSObjectProxy null isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy null})\x0a\x09\x09equals: '{\x22foo\x22:null}'",
  57620. referencedClasses: ["JSObjectProxy", "JSON"],
  57621. messageSends: ["assert:", "isNil", "null", "assert:equals:", "stringify:"]
  57622. }),
  57623. $globals.JSObjectProxyTest);
  57624. $core.addMethod(
  57625. $core.method({
  57626. selector: "testPrinting",
  57627. protocol: "tests",
  57628. fn: function (){
  57629. var self=this,$self=this;
  57630. return $core.withContext(function($ctx1) {
  57631. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  57632. return self;
  57633. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  57634. },
  57635. args: [],
  57636. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  57637. referencedClasses: [],
  57638. messageSends: ["assert:equals:", "printString", "jsObject"]
  57639. }),
  57640. $globals.JSObjectProxyTest);
  57641. $core.addMethod(
  57642. $core.method({
  57643. selector: "testPropertyThatReturnsEmptyString",
  57644. protocol: "tests",
  57645. fn: function (){
  57646. var self=this,$self=this;
  57647. var object;
  57648. return $core.withContext(function($ctx1) {
  57649. var $1;
  57650. object=$self._jsObject();
  57651. $1=$recv(object)._d();
  57652. $ctx1.sendIdx["d"]=1;
  57653. $self._assert_equals_($1,"");
  57654. $ctx1.sendIdx["assert:equals:"]=1;
  57655. $recv(object)._d_("hello");
  57656. $self._assert_equals_($recv(object)._d(),"hello");
  57657. return self;
  57658. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  57659. },
  57660. args: [],
  57661. 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'",
  57662. referencedClasses: [],
  57663. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  57664. }),
  57665. $globals.JSObjectProxyTest);
  57666. $core.addMethod(
  57667. $core.method({
  57668. selector: "testPropertyThatReturnsUndefined",
  57669. protocol: "tests",
  57670. fn: function (){
  57671. var self=this,$self=this;
  57672. var object;
  57673. return $core.withContext(function($ctx1) {
  57674. object=$self._jsObject();
  57675. $self._shouldnt_raise_((function(){
  57676. return $core.withContext(function($ctx2) {
  57677. return $recv(object)._e();
  57678. $ctx2.sendIdx["e"]=1;
  57679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57680. }),$globals.MessageNotUnderstood);
  57681. $self._assert_($recv($recv(object)._e())._isNil());
  57682. return self;
  57683. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  57684. },
  57685. args: [],
  57686. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  57687. referencedClasses: ["MessageNotUnderstood"],
  57688. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  57689. }),
  57690. $globals.JSObjectProxyTest);
  57691. $core.addMethod(
  57692. $core.method({
  57693. selector: "testSetPropertyWithFalsyValue",
  57694. protocol: "tests",
  57695. fn: function (){
  57696. var self=this,$self=this;
  57697. var jsObject;
  57698. return $core.withContext(function($ctx1) {
  57699. var $1,$2,$3,$4,$5;
  57700. jsObject=$self._jsObject();
  57701. $1=$recv(jsObject)._a();
  57702. $ctx1.sendIdx["a"]=1;
  57703. $self._assert_equals_($1,(1));
  57704. $ctx1.sendIdx["assert:equals:"]=1;
  57705. $recv(jsObject)._a_($recv($globals.JSObjectProxy)._null());
  57706. $ctx1.sendIdx["a:"]=1;
  57707. $2=$recv(jsObject)._a();
  57708. $ctx1.sendIdx["a"]=2;
  57709. $self._assert_equals_($2,nil);
  57710. $ctx1.sendIdx["assert:equals:"]=2;
  57711. $recv(jsObject)._a_((0));
  57712. $ctx1.sendIdx["a:"]=2;
  57713. $3=$recv(jsObject)._a();
  57714. $ctx1.sendIdx["a"]=3;
  57715. $self._assert_equals_($3,(0));
  57716. $ctx1.sendIdx["assert:equals:"]=3;
  57717. $recv(jsObject)._a_($self._jsUndefined());
  57718. $ctx1.sendIdx["a:"]=3;
  57719. $4=$recv(jsObject)._a();
  57720. $ctx1.sendIdx["a"]=4;
  57721. $self._assert_equals_($4,nil);
  57722. $ctx1.sendIdx["assert:equals:"]=4;
  57723. $recv(jsObject)._a_("");
  57724. $ctx1.sendIdx["a:"]=4;
  57725. $5=$recv(jsObject)._a();
  57726. $ctx1.sendIdx["a"]=5;
  57727. $self._assert_equals_($5,"");
  57728. $ctx1.sendIdx["assert:equals:"]=5;
  57729. $recv(jsObject)._a_(false);
  57730. $self._assert_equals_($recv(jsObject)._a(),false);
  57731. return self;
  57732. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57733. },
  57734. args: [],
  57735. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: JSObjectProxy null.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  57736. referencedClasses: ["JSObjectProxy"],
  57737. messageSends: ["jsObject", "assert:equals:", "a", "a:", "null", "jsUndefined"]
  57738. }),
  57739. $globals.JSObjectProxyTest);
  57740. $core.addMethod(
  57741. $core.method({
  57742. selector: "testUndefined",
  57743. protocol: "tests",
  57744. fn: function (){
  57745. var self=this,$self=this;
  57746. return $core.withContext(function($ctx1) {
  57747. var $2,$1;
  57748. $2=$recv($globals.JSObjectProxy)._undefined();
  57749. $ctx1.sendIdx["undefined"]=1;
  57750. $1=$recv($2)._isNil();
  57751. $self._assert_($1);
  57752. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._undefined()])),"{}");
  57753. return self;
  57754. }, function($ctx1) {$ctx1.fill(self,"testUndefined",{},$globals.JSObjectProxyTest)});
  57755. },
  57756. args: [],
  57757. source: "testUndefined\x0a\x09self assert: JSObjectProxy undefined isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy undefined})\x0a\x09\x09equals: '{}'",
  57758. referencedClasses: ["JSObjectProxy", "JSON"],
  57759. messageSends: ["assert:", "isNil", "undefined", "assert:equals:", "stringify:"]
  57760. }),
  57761. $globals.JSObjectProxyTest);
  57762. $core.addMethod(
  57763. $core.method({
  57764. selector: "testValue",
  57765. protocol: "tests",
  57766. fn: function (){
  57767. var self=this,$self=this;
  57768. var testObject;
  57769. return $core.withContext(function($ctx1) {
  57770. testObject=$self._jsObject();
  57771. $recv(testObject)._at_put_("value","aValue");
  57772. $self._assert_equals_($recv(testObject)._value(),"aValue");
  57773. return self;
  57774. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  57775. },
  57776. args: [],
  57777. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  57778. referencedClasses: [],
  57779. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  57780. }),
  57781. $globals.JSObjectProxyTest);
  57782. $core.addMethod(
  57783. $core.method({
  57784. selector: "testYourself",
  57785. protocol: "tests",
  57786. fn: function (){
  57787. var self=this,$self=this;
  57788. var object;
  57789. return $core.withContext(function($ctx1) {
  57790. var $1;
  57791. $1=$self._jsObject();
  57792. $recv($1)._d_("test");
  57793. object=$recv($1)._yourself();
  57794. $self._assert_equals_($recv(object)._d(),"test");
  57795. return self;
  57796. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  57797. },
  57798. args: [],
  57799. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  57800. referencedClasses: [],
  57801. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  57802. }),
  57803. $globals.JSObjectProxyTest);
  57804. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  57805. $core.addMethod(
  57806. $core.method({
  57807. selector: "testCatchingException",
  57808. protocol: "tests",
  57809. fn: function (){
  57810. var self=this,$self=this;
  57811. return $core.withContext(function($ctx1) {
  57812. $recv((function(){
  57813. return $core.withContext(function($ctx2) {
  57814. return $self._throwException();
  57815. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57816. }))._on_do_($globals.Error,(function(error){
  57817. return $core.withContext(function($ctx2) {
  57818. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  57819. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57820. }));
  57821. return self;
  57822. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  57823. },
  57824. args: [],
  57825. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  57826. referencedClasses: ["Error"],
  57827. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  57828. }),
  57829. $globals.JavaScriptExceptionTest);
  57830. $core.addMethod(
  57831. $core.method({
  57832. selector: "testRaisingException",
  57833. protocol: "tests",
  57834. fn: function (){
  57835. var self=this,$self=this;
  57836. return $core.withContext(function($ctx1) {
  57837. $self._should_raise_((function(){
  57838. return $core.withContext(function($ctx2) {
  57839. return $self._throwException();
  57840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57841. }),$globals.JavaScriptException);
  57842. return self;
  57843. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  57844. },
  57845. args: [],
  57846. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  57847. referencedClasses: ["JavaScriptException"],
  57848. messageSends: ["should:raise:", "throwException"]
  57849. }),
  57850. $globals.JavaScriptExceptionTest);
  57851. $core.addMethod(
  57852. $core.method({
  57853. selector: "throwException",
  57854. protocol: "helpers",
  57855. fn: function (){
  57856. var self=this,$self=this;
  57857. return $core.withContext(function($ctx1) {
  57858. throw "test";
  57859. return self;
  57860. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  57861. },
  57862. args: [],
  57863. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  57864. referencedClasses: [],
  57865. messageSends: []
  57866. }),
  57867. $globals.JavaScriptExceptionTest);
  57868. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  57869. $core.addMethod(
  57870. $core.method({
  57871. selector: "testValue",
  57872. protocol: "tests",
  57873. fn: function (){
  57874. var self=this,$self=this;
  57875. var messageSend;
  57876. return $core.withContext(function($ctx1) {
  57877. var $1;
  57878. $1=$recv($globals.MessageSend)._new();
  57879. $ctx1.sendIdx["new"]=1;
  57880. $recv($1)._receiver_($recv($globals.Object)._new());
  57881. $recv($1)._selector_("asString");
  57882. messageSend=$recv($1)._yourself();
  57883. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  57884. return self;
  57885. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  57886. },
  57887. args: [],
  57888. 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'",
  57889. referencedClasses: ["MessageSend", "Object"],
  57890. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  57891. }),
  57892. $globals.MessageSendTest);
  57893. $core.addMethod(
  57894. $core.method({
  57895. selector: "testValueWithArguments",
  57896. protocol: "tests",
  57897. fn: function (){
  57898. var self=this,$self=this;
  57899. var messageSend;
  57900. return $core.withContext(function($ctx1) {
  57901. var $1;
  57902. $1=$recv($globals.MessageSend)._new();
  57903. $recv($1)._receiver_((2));
  57904. $recv($1)._selector_("+");
  57905. messageSend=$recv($1)._yourself();
  57906. $self._assert_equals_($recv(messageSend)._value_((3)),(5));
  57907. $ctx1.sendIdx["assert:equals:"]=1;
  57908. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  57909. return self;
  57910. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  57911. },
  57912. args: [],
  57913. 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",
  57914. referencedClasses: ["MessageSend"],
  57915. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  57916. }),
  57917. $globals.MessageSendTest);
  57918. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  57919. $core.addMethod(
  57920. $core.method({
  57921. selector: "codeGeneratorClass",
  57922. protocol: "accessing",
  57923. fn: function (){
  57924. var self=this,$self=this;
  57925. return $globals.CodeGenerator;
  57926. },
  57927. args: [],
  57928. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  57929. referencedClasses: ["CodeGenerator"],
  57930. messageSends: []
  57931. }),
  57932. $globals.MethodInheritanceTest);
  57933. $core.addMethod(
  57934. $core.method({
  57935. selector: "compiler",
  57936. protocol: "factory",
  57937. fn: function (){
  57938. var self=this,$self=this;
  57939. return $core.withContext(function($ctx1) {
  57940. var $1;
  57941. $1=$recv($globals.Compiler)._new();
  57942. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  57943. return $recv($1)._yourself();
  57944. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  57945. },
  57946. args: [],
  57947. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  57948. referencedClasses: ["Compiler"],
  57949. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  57950. }),
  57951. $globals.MethodInheritanceTest);
  57952. $core.addMethod(
  57953. $core.method({
  57954. selector: "deinstallBottom",
  57955. protocol: "testing",
  57956. fn: function (){
  57957. var self=this,$self=this;
  57958. return $core.withContext(function($ctx1) {
  57959. $recv($self._targetClassBottom())._removeCompiledMethod_($self["@method"]);
  57960. return self;
  57961. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  57962. },
  57963. args: [],
  57964. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  57965. referencedClasses: [],
  57966. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  57967. }),
  57968. $globals.MethodInheritanceTest);
  57969. $core.addMethod(
  57970. $core.method({
  57971. selector: "deinstallMiddle",
  57972. protocol: "testing",
  57973. fn: function (){
  57974. var self=this,$self=this;
  57975. return $core.withContext(function($ctx1) {
  57976. $recv($self._targetClassMiddle())._removeCompiledMethod_($self["@method"]);
  57977. return self;
  57978. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  57979. },
  57980. args: [],
  57981. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  57982. referencedClasses: [],
  57983. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  57984. }),
  57985. $globals.MethodInheritanceTest);
  57986. $core.addMethod(
  57987. $core.method({
  57988. selector: "deinstallTop",
  57989. protocol: "testing",
  57990. fn: function (){
  57991. var self=this,$self=this;
  57992. return $core.withContext(function($ctx1) {
  57993. $recv($self._targetClassTop())._removeCompiledMethod_($self["@method"]);
  57994. return self;
  57995. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  57996. },
  57997. args: [],
  57998. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  57999. referencedClasses: [],
  58000. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  58001. }),
  58002. $globals.MethodInheritanceTest);
  58003. $core.addMethod(
  58004. $core.method({
  58005. selector: "installBottom:",
  58006. protocol: "testing",
  58007. fn: function (aString){
  58008. var self=this,$self=this;
  58009. return $core.withContext(function($ctx1) {
  58010. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  58011. return self;
  58012. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  58013. },
  58014. args: ["aString"],
  58015. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  58016. referencedClasses: [],
  58017. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  58018. }),
  58019. $globals.MethodInheritanceTest);
  58020. $core.addMethod(
  58021. $core.method({
  58022. selector: "installMiddle:",
  58023. protocol: "testing",
  58024. fn: function (aString){
  58025. var self=this,$self=this;
  58026. return $core.withContext(function($ctx1) {
  58027. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  58028. return self;
  58029. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  58030. },
  58031. args: ["aString"],
  58032. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  58033. referencedClasses: [],
  58034. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  58035. }),
  58036. $globals.MethodInheritanceTest);
  58037. $core.addMethod(
  58038. $core.method({
  58039. selector: "installTop:",
  58040. protocol: "testing",
  58041. fn: function (aString){
  58042. var self=this,$self=this;
  58043. return $core.withContext(function($ctx1) {
  58044. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  58045. return self;
  58046. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  58047. },
  58048. args: ["aString"],
  58049. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  58050. referencedClasses: [],
  58051. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  58052. }),
  58053. $globals.MethodInheritanceTest);
  58054. $core.addMethod(
  58055. $core.method({
  58056. selector: "setUp",
  58057. protocol: "initialization",
  58058. fn: function (){
  58059. var self=this,$self=this;
  58060. return $core.withContext(function($ctx1) {
  58061. $self["@receiverTop"]=$recv($self._targetClassTop())._new();
  58062. $ctx1.sendIdx["new"]=1;
  58063. $self["@receiverMiddle"]=$recv($self._targetClassMiddle())._new();
  58064. $ctx1.sendIdx["new"]=2;
  58065. $self["@receiverBottom"]=$recv($self._targetClassBottom())._new();
  58066. $self["@method"]=nil;
  58067. $self["@performBlock"]=(function(){
  58068. return $core.withContext(function($ctx2) {
  58069. return $self._error_("performBlock not initialized");
  58070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58071. });
  58072. return self;
  58073. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  58074. },
  58075. args: [],
  58076. 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' ]",
  58077. referencedClasses: [],
  58078. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  58079. }),
  58080. $globals.MethodInheritanceTest);
  58081. $core.addMethod(
  58082. $core.method({
  58083. selector: "shouldMNU",
  58084. protocol: "testing",
  58085. fn: function (){
  58086. var self=this,$self=this;
  58087. return $core.withContext(function($ctx1) {
  58088. $self._shouldMNUTop();
  58089. $self._shouldMNUMiddle();
  58090. $self._shouldMNUBottom();
  58091. return self;
  58092. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  58093. },
  58094. args: [],
  58095. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  58096. referencedClasses: [],
  58097. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  58098. }),
  58099. $globals.MethodInheritanceTest);
  58100. $core.addMethod(
  58101. $core.method({
  58102. selector: "shouldMNUBottom",
  58103. protocol: "testing",
  58104. fn: function (){
  58105. var self=this,$self=this;
  58106. return $core.withContext(function($ctx1) {
  58107. $self._should_raise_((function(){
  58108. return $core.withContext(function($ctx2) {
  58109. return $recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58111. }),$globals.MessageNotUnderstood);
  58112. return self;
  58113. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  58114. },
  58115. args: [],
  58116. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  58117. referencedClasses: ["MessageNotUnderstood"],
  58118. messageSends: ["should:raise:", "value:"]
  58119. }),
  58120. $globals.MethodInheritanceTest);
  58121. $core.addMethod(
  58122. $core.method({
  58123. selector: "shouldMNUMiddle",
  58124. protocol: "testing",
  58125. fn: function (){
  58126. var self=this,$self=this;
  58127. return $core.withContext(function($ctx1) {
  58128. $self._should_raise_((function(){
  58129. return $core.withContext(function($ctx2) {
  58130. return $recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58132. }),$globals.MessageNotUnderstood);
  58133. return self;
  58134. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  58135. },
  58136. args: [],
  58137. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  58138. referencedClasses: ["MessageNotUnderstood"],
  58139. messageSends: ["should:raise:", "value:"]
  58140. }),
  58141. $globals.MethodInheritanceTest);
  58142. $core.addMethod(
  58143. $core.method({
  58144. selector: "shouldMNUTop",
  58145. protocol: "testing",
  58146. fn: function (){
  58147. var self=this,$self=this;
  58148. return $core.withContext(function($ctx1) {
  58149. $self._should_raise_((function(){
  58150. return $core.withContext(function($ctx2) {
  58151. return $recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58153. }),$globals.MessageNotUnderstood);
  58154. return self;
  58155. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  58156. },
  58157. args: [],
  58158. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  58159. referencedClasses: ["MessageNotUnderstood"],
  58160. messageSends: ["should:raise:", "value:"]
  58161. }),
  58162. $globals.MethodInheritanceTest);
  58163. $core.addMethod(
  58164. $core.method({
  58165. selector: "shouldReturn:",
  58166. protocol: "testing",
  58167. fn: function (anObject){
  58168. var self=this,$self=this;
  58169. var result;
  58170. return $core.withContext(function($ctx1) {
  58171. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58172. $ctx1.sendIdx["value:"]=1;
  58173. $self._assert_equals_(["top",anObject],["top",result]);
  58174. $ctx1.sendIdx["assert:equals:"]=1;
  58175. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58176. $ctx1.sendIdx["value:"]=2;
  58177. $self._assert_equals_(["middle",anObject],["middle",result]);
  58178. $ctx1.sendIdx["assert:equals:"]=2;
  58179. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58180. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  58181. return self;
  58182. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  58183. },
  58184. args: ["anObject"],
  58185. 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 }",
  58186. referencedClasses: [],
  58187. messageSends: ["value:", "assert:equals:"]
  58188. }),
  58189. $globals.MethodInheritanceTest);
  58190. $core.addMethod(
  58191. $core.method({
  58192. selector: "shouldReturn:and:and:",
  58193. protocol: "testing",
  58194. fn: function (anObject,anObject2,anObject3){
  58195. var self=this,$self=this;
  58196. var result;
  58197. return $core.withContext(function($ctx1) {
  58198. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58199. $ctx1.sendIdx["value:"]=1;
  58200. $self._assert_equals_(["top",anObject],["top",result]);
  58201. $ctx1.sendIdx["assert:equals:"]=1;
  58202. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58203. $ctx1.sendIdx["value:"]=2;
  58204. $self._assert_equals_(["middle",anObject2],["middle",result]);
  58205. $ctx1.sendIdx["assert:equals:"]=2;
  58206. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58207. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  58208. return self;
  58209. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  58210. },
  58211. args: ["anObject", "anObject2", "anObject3"],
  58212. 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 }",
  58213. referencedClasses: [],
  58214. messageSends: ["value:", "assert:equals:"]
  58215. }),
  58216. $globals.MethodInheritanceTest);
  58217. $core.addMethod(
  58218. $core.method({
  58219. selector: "targetClassBottom",
  58220. protocol: "accessing",
  58221. fn: function (){
  58222. var self=this,$self=this;
  58223. return $globals.JavaScriptException;
  58224. },
  58225. args: [],
  58226. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  58227. referencedClasses: ["JavaScriptException"],
  58228. messageSends: []
  58229. }),
  58230. $globals.MethodInheritanceTest);
  58231. $core.addMethod(
  58232. $core.method({
  58233. selector: "targetClassMiddle",
  58234. protocol: "accessing",
  58235. fn: function (){
  58236. var self=this,$self=this;
  58237. return $globals.Error;
  58238. },
  58239. args: [],
  58240. source: "targetClassMiddle\x0a\x09^ Error",
  58241. referencedClasses: ["Error"],
  58242. messageSends: []
  58243. }),
  58244. $globals.MethodInheritanceTest);
  58245. $core.addMethod(
  58246. $core.method({
  58247. selector: "targetClassTop",
  58248. protocol: "accessing",
  58249. fn: function (){
  58250. var self=this,$self=this;
  58251. return $globals.Object;
  58252. },
  58253. args: [],
  58254. source: "targetClassTop\x0a\x09^ Object",
  58255. referencedClasses: ["Object"],
  58256. messageSends: []
  58257. }),
  58258. $globals.MethodInheritanceTest);
  58259. $core.addMethod(
  58260. $core.method({
  58261. selector: "tearDown",
  58262. protocol: "initialization",
  58263. fn: function (){
  58264. var self=this,$self=this;
  58265. return $core.withContext(function($ctx1) {
  58266. $recv((function(){
  58267. return $core.withContext(function($ctx2) {
  58268. return $self._deinstallTop();
  58269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58270. }))._on_do_($globals.Error,(function(){
  58271. }));
  58272. $ctx1.sendIdx["on:do:"]=1;
  58273. $recv((function(){
  58274. return $core.withContext(function($ctx2) {
  58275. return $self._deinstallMiddle();
  58276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58277. }))._on_do_($globals.Error,(function(){
  58278. }));
  58279. $ctx1.sendIdx["on:do:"]=2;
  58280. $recv((function(){
  58281. return $core.withContext(function($ctx2) {
  58282. return $self._deinstallBottom();
  58283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58284. }))._on_do_($globals.Error,(function(){
  58285. }));
  58286. return self;
  58287. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  58288. },
  58289. args: [],
  58290. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  58291. referencedClasses: ["Error"],
  58292. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  58293. }),
  58294. $globals.MethodInheritanceTest);
  58295. $core.addMethod(
  58296. $core.method({
  58297. selector: "testMNU11",
  58298. protocol: "tests",
  58299. fn: function (){
  58300. var self=this,$self=this;
  58301. return $core.withContext(function($ctx1) {
  58302. $self["@performBlock"]=(function(x){
  58303. return $core.withContext(function($ctx2) {
  58304. return $recv(x)._foo();
  58305. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58306. });
  58307. $self._shouldMNU();
  58308. $ctx1.sendIdx["shouldMNU"]=1;
  58309. $self._installTop_("foo ^ false");
  58310. $ctx1.sendIdx["installTop:"]=1;
  58311. $self._installTop_("foo ^ true");
  58312. $self._deinstallTop();
  58313. $self._shouldMNU();
  58314. return self;
  58315. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  58316. },
  58317. args: [],
  58318. 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",
  58319. referencedClasses: [],
  58320. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  58321. }),
  58322. $globals.MethodInheritanceTest);
  58323. $core.addMethod(
  58324. $core.method({
  58325. selector: "testMNU22",
  58326. protocol: "tests",
  58327. fn: function (){
  58328. var self=this,$self=this;
  58329. return $core.withContext(function($ctx1) {
  58330. $self["@performBlock"]=(function(x){
  58331. return $core.withContext(function($ctx2) {
  58332. return $recv(x)._foo();
  58333. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58334. });
  58335. $self._shouldMNU();
  58336. $ctx1.sendIdx["shouldMNU"]=1;
  58337. $self._installMiddle_("foo ^ false");
  58338. $ctx1.sendIdx["installMiddle:"]=1;
  58339. $self._installMiddle_("foo ^ true");
  58340. $self._deinstallMiddle();
  58341. $self._shouldMNU();
  58342. return self;
  58343. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  58344. },
  58345. args: [],
  58346. 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",
  58347. referencedClasses: [],
  58348. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  58349. }),
  58350. $globals.MethodInheritanceTest);
  58351. $core.addMethod(
  58352. $core.method({
  58353. selector: "testReturns1",
  58354. protocol: "tests",
  58355. fn: function (){
  58356. var self=this,$self=this;
  58357. return $core.withContext(function($ctx1) {
  58358. $self["@performBlock"]=(function(x){
  58359. return $core.withContext(function($ctx2) {
  58360. return $recv(x)._foo();
  58361. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58362. });
  58363. $self._installTop_("foo ^ false");
  58364. $ctx1.sendIdx["installTop:"]=1;
  58365. $self._shouldReturn_(false);
  58366. $ctx1.sendIdx["shouldReturn:"]=1;
  58367. $self._installTop_("foo ^ true");
  58368. $self._shouldReturn_(true);
  58369. return self;
  58370. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  58371. },
  58372. args: [],
  58373. 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",
  58374. referencedClasses: [],
  58375. messageSends: ["foo", "installTop:", "shouldReturn:"]
  58376. }),
  58377. $globals.MethodInheritanceTest);
  58378. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  58379. $core.addMethod(
  58380. $core.method({
  58381. selector: "testAbs",
  58382. protocol: "tests",
  58383. fn: function (){
  58384. var self=this,$self=this;
  58385. return $core.withContext(function($ctx1) {
  58386. var $1;
  58387. $1=(4)._abs();
  58388. $ctx1.sendIdx["abs"]=1;
  58389. $self._assert_equals_($1,(4));
  58390. $ctx1.sendIdx["assert:equals:"]=1;
  58391. $self._assert_equals_((-4)._abs(),(4));
  58392. return self;
  58393. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  58394. },
  58395. args: [],
  58396. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  58397. referencedClasses: [],
  58398. messageSends: ["assert:equals:", "abs"]
  58399. }),
  58400. $globals.NumberTest);
  58401. $core.addMethod(
  58402. $core.method({
  58403. selector: "testArithmetic",
  58404. protocol: "tests",
  58405. fn: function (){
  58406. var self=this,$self=this;
  58407. return $core.withContext(function($ctx1) {
  58408. var $1,$2,$3,$5,$4;
  58409. $1=(1.5).__plus((1));
  58410. $ctx1.sendIdx["+"]=1;
  58411. $self._assert_equals_($1,(2.5));
  58412. $ctx1.sendIdx["assert:equals:"]=1;
  58413. $2=(2).__minus((1));
  58414. $ctx1.sendIdx["-"]=1;
  58415. $self._assert_equals_($2,(1));
  58416. $ctx1.sendIdx["assert:equals:"]=2;
  58417. $self._assert_equals_((-2).__minus((1)),(-3));
  58418. $ctx1.sendIdx["assert:equals:"]=3;
  58419. $self._assert_equals_((12).__slash((2)),(6));
  58420. $ctx1.sendIdx["assert:equals:"]=4;
  58421. $3=(3).__star((4));
  58422. $ctx1.sendIdx["*"]=1;
  58423. $self._assert_equals_($3,(12));
  58424. $ctx1.sendIdx["assert:equals:"]=5;
  58425. $self._assert_equals_((7).__slash_slash((2)),(3));
  58426. $ctx1.sendIdx["assert:equals:"]=6;
  58427. $self._assert_equals_((7).__backslash_backslash((2)),(1));
  58428. $ctx1.sendIdx["assert:equals:"]=7;
  58429. $5=(1).__plus((2));
  58430. $ctx1.sendIdx["+"]=2;
  58431. $4=$recv($5).__star((3));
  58432. $ctx1.sendIdx["*"]=2;
  58433. $self._assert_equals_($4,(9));
  58434. $ctx1.sendIdx["assert:equals:"]=8;
  58435. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  58436. return self;
  58437. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  58438. },
  58439. args: [],
  58440. 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",
  58441. referencedClasses: [],
  58442. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  58443. }),
  58444. $globals.NumberTest);
  58445. $core.addMethod(
  58446. $core.method({
  58447. selector: "testAsNumber",
  58448. protocol: "tests",
  58449. fn: function (){
  58450. var self=this,$self=this;
  58451. return $core.withContext(function($ctx1) {
  58452. $self._assert_equals_((3)._asNumber(),(3));
  58453. return self;
  58454. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  58455. },
  58456. args: [],
  58457. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  58458. referencedClasses: [],
  58459. messageSends: ["assert:equals:", "asNumber"]
  58460. }),
  58461. $globals.NumberTest);
  58462. $core.addMethod(
  58463. $core.method({
  58464. selector: "testBetweenAnd",
  58465. protocol: "tests",
  58466. fn: function (){
  58467. var self=this,$self=this;
  58468. return $core.withContext(function($ctx1) {
  58469. var $1,$3,$2,$5,$4;
  58470. $1=(4)._between_and_((3),(5));
  58471. $ctx1.sendIdx["between:and:"]=1;
  58472. $self._assert_($1);
  58473. $ctx1.sendIdx["assert:"]=1;
  58474. $3=(1)._between_and_((5),(6));
  58475. $ctx1.sendIdx["between:and:"]=2;
  58476. $2=$recv($3)._not();
  58477. $ctx1.sendIdx["not"]=1;
  58478. $self._assert_($2);
  58479. $ctx1.sendIdx["assert:"]=2;
  58480. $5=(90)._between_and_((67),(87));
  58481. $ctx1.sendIdx["between:and:"]=3;
  58482. $4=$recv($5)._not();
  58483. $self._assert_($4);
  58484. $ctx1.sendIdx["assert:"]=3;
  58485. $self._assert_((1)._between_and_((1),(1)));
  58486. return self;
  58487. }, function($ctx1) {$ctx1.fill(self,"testBetweenAnd",{},$globals.NumberTest)});
  58488. },
  58489. args: [],
  58490. 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).",
  58491. referencedClasses: [],
  58492. messageSends: ["assert:", "between:and:", "not"]
  58493. }),
  58494. $globals.NumberTest);
  58495. $core.addMethod(
  58496. $core.method({
  58497. selector: "testBitAnd",
  58498. protocol: "tests",
  58499. fn: function (){
  58500. var self=this,$self=this;
  58501. return $core.withContext(function($ctx1) {
  58502. var $1,$2;
  58503. $1=(15)._bitAnd_((2));
  58504. $ctx1.sendIdx["bitAnd:"]=1;
  58505. $self._assert_equals_($1,(2));
  58506. $ctx1.sendIdx["assert:equals:"]=1;
  58507. $2=(15)._bitAnd_((15));
  58508. $ctx1.sendIdx["bitAnd:"]=2;
  58509. $self._assert_equals_($2,(15));
  58510. $ctx1.sendIdx["assert:equals:"]=2;
  58511. $self._assert_equals_((-1)._bitAnd_((1021)),(1021));
  58512. return self;
  58513. }, function($ctx1) {$ctx1.fill(self,"testBitAnd",{},$globals.NumberTest)});
  58514. },
  58515. args: [],
  58516. source: "testBitAnd\x0a\x09self assert: (15 bitAnd: 2) equals: 2.\x0a\x09self assert: (15 bitAnd: 15) equals: 15.\x0a\x09self assert: (-1 bitAnd: 1021) equals: 1021",
  58517. referencedClasses: [],
  58518. messageSends: ["assert:equals:", "bitAnd:"]
  58519. }),
  58520. $globals.NumberTest);
  58521. $core.addMethod(
  58522. $core.method({
  58523. selector: "testBitNot",
  58524. protocol: "tests",
  58525. fn: function (){
  58526. var self=this,$self=this;
  58527. return $core.withContext(function($ctx1) {
  58528. var $1,$2;
  58529. $1=(2)._bitNot();
  58530. $ctx1.sendIdx["bitNot"]=1;
  58531. $self._assert_equals_($1,(-3));
  58532. $ctx1.sendIdx["assert:equals:"]=1;
  58533. $2=(-1)._bitNot();
  58534. $ctx1.sendIdx["bitNot"]=2;
  58535. $self._assert_equals_($2,(0));
  58536. $ctx1.sendIdx["assert:equals:"]=2;
  58537. $self._assert_equals_((-1022)._bitNot(),(1021));
  58538. return self;
  58539. }, function($ctx1) {$ctx1.fill(self,"testBitNot",{},$globals.NumberTest)});
  58540. },
  58541. args: [],
  58542. source: "testBitNot\x0a\x09self assert: 2 bitNot equals: -3.\x0a\x09self assert: -1 bitNot equals: 0.\x0a\x09self assert: -1022 bitNot equals: 1021",
  58543. referencedClasses: [],
  58544. messageSends: ["assert:equals:", "bitNot"]
  58545. }),
  58546. $globals.NumberTest);
  58547. $core.addMethod(
  58548. $core.method({
  58549. selector: "testBitOr",
  58550. protocol: "tests",
  58551. fn: function (){
  58552. var self=this,$self=this;
  58553. return $core.withContext(function($ctx1) {
  58554. var $1,$2;
  58555. $1=(2)._bitOr_((4));
  58556. $ctx1.sendIdx["bitOr:"]=1;
  58557. $self._assert_equals_($1,(6));
  58558. $ctx1.sendIdx["assert:equals:"]=1;
  58559. $2=(7)._bitOr_((2));
  58560. $ctx1.sendIdx["bitOr:"]=2;
  58561. $self._assert_equals_($2,(7));
  58562. $ctx1.sendIdx["assert:equals:"]=2;
  58563. $self._assert_equals_((-1)._bitOr_((1021)),(-1));
  58564. return self;
  58565. }, function($ctx1) {$ctx1.fill(self,"testBitOr",{},$globals.NumberTest)});
  58566. },
  58567. args: [],
  58568. source: "testBitOr\x0a\x09self assert: (2 bitOr: 4) equals: 6.\x0a\x09self assert: (7 bitOr: 2) equals: 7.\x0a\x09self assert: (-1 bitOr: 1021) equals: -1",
  58569. referencedClasses: [],
  58570. messageSends: ["assert:equals:", "bitOr:"]
  58571. }),
  58572. $globals.NumberTest);
  58573. $core.addMethod(
  58574. $core.method({
  58575. selector: "testBitXor",
  58576. protocol: "tests",
  58577. fn: function (){
  58578. var self=this,$self=this;
  58579. return $core.withContext(function($ctx1) {
  58580. var $1,$2,$3;
  58581. $1=(2)._bitXor_((4));
  58582. $ctx1.sendIdx["bitXor:"]=1;
  58583. $self._assert_equals_($1,(6));
  58584. $ctx1.sendIdx["assert:equals:"]=1;
  58585. $2=(7)._bitXor_((2));
  58586. $ctx1.sendIdx["bitXor:"]=2;
  58587. $self._assert_equals_($2,(5));
  58588. $ctx1.sendIdx["assert:equals:"]=2;
  58589. $3=(-1)._bitXor_((1021));
  58590. $ctx1.sendIdx["bitXor:"]=3;
  58591. $self._assert_equals_($3,(-1022));
  58592. $ctx1.sendIdx["assert:equals:"]=3;
  58593. $self._assert_equals_((91)._bitXor_((91)),(0));
  58594. return self;
  58595. }, function($ctx1) {$ctx1.fill(self,"testBitXor",{},$globals.NumberTest)});
  58596. },
  58597. args: [],
  58598. source: "testBitXor\x0a\x09self assert: (2 bitXor: 4) equals: 6.\x0a\x09self assert: (7 bitXor: 2) equals: 5.\x0a\x09self assert: (-1 bitXor: 1021) equals: -1022.\x0a\x09self assert: (91 bitXor: 91) equals: 0",
  58599. referencedClasses: [],
  58600. messageSends: ["assert:equals:", "bitXor:"]
  58601. }),
  58602. $globals.NumberTest);
  58603. $core.addMethod(
  58604. $core.method({
  58605. selector: "testCeiling",
  58606. protocol: "tests",
  58607. fn: function (){
  58608. var self=this,$self=this;
  58609. return $core.withContext(function($ctx1) {
  58610. var $1,$2;
  58611. $1=(1.2)._ceiling();
  58612. $ctx1.sendIdx["ceiling"]=1;
  58613. $self._assert_equals_($1,(2));
  58614. $ctx1.sendIdx["assert:equals:"]=1;
  58615. $2=(-1.2)._ceiling();
  58616. $ctx1.sendIdx["ceiling"]=2;
  58617. $self._assert_equals_($2,(-1));
  58618. $ctx1.sendIdx["assert:equals:"]=2;
  58619. $self._assert_equals_((1)._ceiling(),(1));
  58620. return self;
  58621. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  58622. },
  58623. args: [],
  58624. 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.",
  58625. referencedClasses: [],
  58626. messageSends: ["assert:equals:", "ceiling"]
  58627. }),
  58628. $globals.NumberTest);
  58629. $core.addMethod(
  58630. $core.method({
  58631. selector: "testComparison",
  58632. protocol: "tests",
  58633. fn: function (){
  58634. var self=this,$self=this;
  58635. return $core.withContext(function($ctx1) {
  58636. var $1,$2,$3,$4;
  58637. $1=(3).__gt((2));
  58638. $ctx1.sendIdx[">"]=1;
  58639. $self._assert_($1);
  58640. $ctx1.sendIdx["assert:"]=1;
  58641. $2=(2).__lt((3));
  58642. $ctx1.sendIdx["<"]=1;
  58643. $self._assert_($2);
  58644. $ctx1.sendIdx["assert:"]=2;
  58645. $self._deny_((3).__lt((2)));
  58646. $ctx1.sendIdx["deny:"]=1;
  58647. $self._deny_((2).__gt((3)));
  58648. $3=(3).__gt_eq((3));
  58649. $ctx1.sendIdx[">="]=1;
  58650. $self._assert_($3);
  58651. $ctx1.sendIdx["assert:"]=3;
  58652. $self._assert_((3.1).__gt_eq((3)));
  58653. $ctx1.sendIdx["assert:"]=4;
  58654. $4=(3).__lt_eq((3));
  58655. $ctx1.sendIdx["<="]=1;
  58656. $self._assert_($4);
  58657. $ctx1.sendIdx["assert:"]=5;
  58658. $self._assert_((3).__lt_eq((3.1)));
  58659. return self;
  58660. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  58661. },
  58662. args: [],
  58663. 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",
  58664. referencedClasses: [],
  58665. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  58666. }),
  58667. $globals.NumberTest);
  58668. $core.addMethod(
  58669. $core.method({
  58670. selector: "testCopying",
  58671. protocol: "tests",
  58672. fn: function (){
  58673. var self=this,$self=this;
  58674. return $core.withContext(function($ctx1) {
  58675. var $1;
  58676. $1=$recv((1)._copy()).__eq_eq((1));
  58677. $ctx1.sendIdx["=="]=1;
  58678. $self._assert_($1);
  58679. $ctx1.sendIdx["assert:"]=1;
  58680. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  58681. return self;
  58682. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  58683. },
  58684. args: [],
  58685. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  58686. referencedClasses: [],
  58687. messageSends: ["assert:", "==", "copy", "deepCopy"]
  58688. }),
  58689. $globals.NumberTest);
  58690. $core.addMethod(
  58691. $core.method({
  58692. selector: "testDegreesToRadians",
  58693. protocol: "tests",
  58694. fn: function (){
  58695. var self=this,$self=this;
  58696. return $core.withContext(function($ctx1) {
  58697. $self._assert_($recv($recv($recv((180)._degreesToRadians()).__minus($recv($globals.Number)._pi()))._abs()).__lt_eq((0.01)));
  58698. return self;
  58699. }, function($ctx1) {$ctx1.fill(self,"testDegreesToRadians",{},$globals.NumberTest)});
  58700. },
  58701. args: [],
  58702. source: "testDegreesToRadians\x0a\x09self assert: (180 degreesToRadians - Number pi) abs <= 0.01.",
  58703. referencedClasses: ["Number"],
  58704. messageSends: ["assert:", "<=", "abs", "-", "degreesToRadians", "pi"]
  58705. }),
  58706. $globals.NumberTest);
  58707. $core.addMethod(
  58708. $core.method({
  58709. selector: "testEquality",
  58710. protocol: "tests",
  58711. fn: function (){
  58712. var self=this,$self=this;
  58713. return $core.withContext(function($ctx1) {
  58714. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  58715. $1=(1).__eq((1));
  58716. $ctx1.sendIdx["="]=1;
  58717. $self._assert_($1);
  58718. $ctx1.sendIdx["assert:"]=1;
  58719. $2=(0).__eq((0));
  58720. $ctx1.sendIdx["="]=2;
  58721. $self._assert_($2);
  58722. $ctx1.sendIdx["assert:"]=2;
  58723. $3=(1).__eq((0));
  58724. $ctx1.sendIdx["="]=3;
  58725. $self._deny_($3);
  58726. $ctx1.sendIdx["deny:"]=1;
  58727. $5=(1)._yourself();
  58728. $ctx1.sendIdx["yourself"]=1;
  58729. $4=$recv($5).__eq((1));
  58730. $ctx1.sendIdx["="]=4;
  58731. $self._assert_($4);
  58732. $ctx1.sendIdx["assert:"]=3;
  58733. $7=(1)._yourself();
  58734. $ctx1.sendIdx["yourself"]=2;
  58735. $6=(1).__eq($7);
  58736. $ctx1.sendIdx["="]=5;
  58737. $self._assert_($6);
  58738. $ctx1.sendIdx["assert:"]=4;
  58739. $9=(1)._yourself();
  58740. $ctx1.sendIdx["yourself"]=3;
  58741. $8=$recv($9).__eq((1)._yourself());
  58742. $ctx1.sendIdx["="]=6;
  58743. $self._assert_($8);
  58744. $10=(0).__eq(false);
  58745. $ctx1.sendIdx["="]=7;
  58746. $self._deny_($10);
  58747. $ctx1.sendIdx["deny:"]=2;
  58748. $11=false.__eq((0));
  58749. $ctx1.sendIdx["="]=8;
  58750. $self._deny_($11);
  58751. $ctx1.sendIdx["deny:"]=3;
  58752. $12="".__eq((0));
  58753. $ctx1.sendIdx["="]=9;
  58754. $self._deny_($12);
  58755. $ctx1.sendIdx["deny:"]=4;
  58756. $self._deny_((0).__eq(""));
  58757. return self;
  58758. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  58759. },
  58760. args: [],
  58761. 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 = ''",
  58762. referencedClasses: [],
  58763. messageSends: ["assert:", "=", "deny:", "yourself"]
  58764. }),
  58765. $globals.NumberTest);
  58766. $core.addMethod(
  58767. $core.method({
  58768. selector: "testFloor",
  58769. protocol: "tests",
  58770. fn: function (){
  58771. var self=this,$self=this;
  58772. return $core.withContext(function($ctx1) {
  58773. var $1,$2;
  58774. $1=(1.2)._floor();
  58775. $ctx1.sendIdx["floor"]=1;
  58776. $self._assert_equals_($1,(1));
  58777. $ctx1.sendIdx["assert:equals:"]=1;
  58778. $2=(-1.2)._floor();
  58779. $ctx1.sendIdx["floor"]=2;
  58780. $self._assert_equals_($2,(-2));
  58781. $ctx1.sendIdx["assert:equals:"]=2;
  58782. $self._assert_equals_((1)._floor(),(1));
  58783. return self;
  58784. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  58785. },
  58786. args: [],
  58787. 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.",
  58788. referencedClasses: [],
  58789. messageSends: ["assert:equals:", "floor"]
  58790. }),
  58791. $globals.NumberTest);
  58792. $core.addMethod(
  58793. $core.method({
  58794. selector: "testHexNumbers",
  58795. protocol: "tests",
  58796. fn: function (){
  58797. var self=this,$self=this;
  58798. return $core.withContext(function($ctx1) {
  58799. var $1,$2,$3,$4,$5;
  58800. $self._assert_equals_((9),(9));
  58801. $ctx1.sendIdx["assert:equals:"]=1;
  58802. $1=(10)._truncated();
  58803. $ctx1.sendIdx["truncated"]=1;
  58804. $self._assert_equals_($1,(10));
  58805. $ctx1.sendIdx["assert:equals:"]=2;
  58806. $2=(11)._truncated();
  58807. $ctx1.sendIdx["truncated"]=2;
  58808. $self._assert_equals_($2,(11));
  58809. $ctx1.sendIdx["assert:equals:"]=3;
  58810. $3=(12)._truncated();
  58811. $ctx1.sendIdx["truncated"]=3;
  58812. $self._assert_equals_($3,(12));
  58813. $ctx1.sendIdx["assert:equals:"]=4;
  58814. $4=(13)._truncated();
  58815. $ctx1.sendIdx["truncated"]=4;
  58816. $self._assert_equals_($4,(13));
  58817. $ctx1.sendIdx["assert:equals:"]=5;
  58818. $5=(14)._truncated();
  58819. $ctx1.sendIdx["truncated"]=5;
  58820. $self._assert_equals_($5,(14));
  58821. $ctx1.sendIdx["assert:equals:"]=6;
  58822. $self._assert_equals_((15)._truncated(),(15));
  58823. return self;
  58824. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  58825. },
  58826. args: [],
  58827. 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",
  58828. referencedClasses: [],
  58829. messageSends: ["assert:equals:", "truncated"]
  58830. }),
  58831. $globals.NumberTest);
  58832. $core.addMethod(
  58833. $core.method({
  58834. selector: "testIdentity",
  58835. protocol: "tests",
  58836. fn: function (){
  58837. var self=this,$self=this;
  58838. return $core.withContext(function($ctx1) {
  58839. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  58840. $1=(1).__eq_eq((1));
  58841. $ctx1.sendIdx["=="]=1;
  58842. $self._assert_($1);
  58843. $ctx1.sendIdx["assert:"]=1;
  58844. $2=(0).__eq_eq((0));
  58845. $ctx1.sendIdx["=="]=2;
  58846. $self._assert_($2);
  58847. $ctx1.sendIdx["assert:"]=2;
  58848. $3=(1).__eq_eq((0));
  58849. $ctx1.sendIdx["=="]=3;
  58850. $self._deny_($3);
  58851. $ctx1.sendIdx["deny:"]=1;
  58852. $5=(1)._yourself();
  58853. $ctx1.sendIdx["yourself"]=1;
  58854. $4=$recv($5).__eq_eq((1));
  58855. $ctx1.sendIdx["=="]=4;
  58856. $self._assert_($4);
  58857. $ctx1.sendIdx["assert:"]=3;
  58858. $7=(1)._yourself();
  58859. $ctx1.sendIdx["yourself"]=2;
  58860. $6=(1).__eq_eq($7);
  58861. $ctx1.sendIdx["=="]=5;
  58862. $self._assert_($6);
  58863. $ctx1.sendIdx["assert:"]=4;
  58864. $9=(1)._yourself();
  58865. $ctx1.sendIdx["yourself"]=3;
  58866. $8=$recv($9).__eq_eq((1)._yourself());
  58867. $ctx1.sendIdx["=="]=6;
  58868. $self._assert_($8);
  58869. $self._deny_((1).__eq_eq((2)));
  58870. return self;
  58871. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  58872. },
  58873. args: [],
  58874. 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",
  58875. referencedClasses: [],
  58876. messageSends: ["assert:", "==", "deny:", "yourself"]
  58877. }),
  58878. $globals.NumberTest);
  58879. $core.addMethod(
  58880. $core.method({
  58881. selector: "testInvalidHexNumbers",
  58882. protocol: "tests",
  58883. fn: function (){
  58884. var self=this,$self=this;
  58885. return $core.withContext(function($ctx1) {
  58886. $self._should_raise_((function(){
  58887. return $core.withContext(function($ctx2) {
  58888. return (16)._rG();
  58889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58890. }),$globals.MessageNotUnderstood);
  58891. $ctx1.sendIdx["should:raise:"]=1;
  58892. $self._should_raise_((function(){
  58893. return $core.withContext(function($ctx2) {
  58894. return (16)._rg();
  58895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58896. }),$globals.MessageNotUnderstood);
  58897. $ctx1.sendIdx["should:raise:"]=2;
  58898. $self._should_raise_((function(){
  58899. return $core.withContext(function($ctx2) {
  58900. return (16)._rH();
  58901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58902. }),$globals.MessageNotUnderstood);
  58903. $ctx1.sendIdx["should:raise:"]=3;
  58904. $self._should_raise_((function(){
  58905. return $core.withContext(function($ctx2) {
  58906. return (16)._rh();
  58907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58908. }),$globals.MessageNotUnderstood);
  58909. $ctx1.sendIdx["should:raise:"]=4;
  58910. $self._should_raise_((function(){
  58911. return $core.withContext(function($ctx2) {
  58912. return (16)._rI();
  58913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58914. }),$globals.MessageNotUnderstood);
  58915. $ctx1.sendIdx["should:raise:"]=5;
  58916. $self._should_raise_((function(){
  58917. return $core.withContext(function($ctx2) {
  58918. return (16)._ri();
  58919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  58920. }),$globals.MessageNotUnderstood);
  58921. $ctx1.sendIdx["should:raise:"]=6;
  58922. $self._should_raise_((function(){
  58923. return $core.withContext(function($ctx2) {
  58924. return (16)._rJ();
  58925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  58926. }),$globals.MessageNotUnderstood);
  58927. $ctx1.sendIdx["should:raise:"]=7;
  58928. $self._should_raise_((function(){
  58929. return $core.withContext(function($ctx2) {
  58930. return (16)._rj();
  58931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  58932. }),$globals.MessageNotUnderstood);
  58933. $ctx1.sendIdx["should:raise:"]=8;
  58934. $self._should_raise_((function(){
  58935. return $core.withContext(function($ctx2) {
  58936. return (16)._rK();
  58937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  58938. }),$globals.MessageNotUnderstood);
  58939. $ctx1.sendIdx["should:raise:"]=9;
  58940. $self._should_raise_((function(){
  58941. return $core.withContext(function($ctx2) {
  58942. return (16)._rk();
  58943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  58944. }),$globals.MessageNotUnderstood);
  58945. $ctx1.sendIdx["should:raise:"]=10;
  58946. $self._should_raise_((function(){
  58947. return $core.withContext(function($ctx2) {
  58948. return (16)._rL();
  58949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  58950. }),$globals.MessageNotUnderstood);
  58951. $ctx1.sendIdx["should:raise:"]=11;
  58952. $self._should_raise_((function(){
  58953. return $core.withContext(function($ctx2) {
  58954. return (16)._rl();
  58955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  58956. }),$globals.MessageNotUnderstood);
  58957. $ctx1.sendIdx["should:raise:"]=12;
  58958. $self._should_raise_((function(){
  58959. return $core.withContext(function($ctx2) {
  58960. return (16)._rM();
  58961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  58962. }),$globals.MessageNotUnderstood);
  58963. $ctx1.sendIdx["should:raise:"]=13;
  58964. $self._should_raise_((function(){
  58965. return $core.withContext(function($ctx2) {
  58966. return (16)._rm();
  58967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  58968. }),$globals.MessageNotUnderstood);
  58969. $ctx1.sendIdx["should:raise:"]=14;
  58970. $self._should_raise_((function(){
  58971. return $core.withContext(function($ctx2) {
  58972. return (16)._rN();
  58973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  58974. }),$globals.MessageNotUnderstood);
  58975. $ctx1.sendIdx["should:raise:"]=15;
  58976. $self._should_raise_((function(){
  58977. return $core.withContext(function($ctx2) {
  58978. return (16)._rn();
  58979. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  58980. }),$globals.MessageNotUnderstood);
  58981. $ctx1.sendIdx["should:raise:"]=16;
  58982. $self._should_raise_((function(){
  58983. return $core.withContext(function($ctx2) {
  58984. return (16)._rO();
  58985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  58986. }),$globals.MessageNotUnderstood);
  58987. $ctx1.sendIdx["should:raise:"]=17;
  58988. $self._should_raise_((function(){
  58989. return $core.withContext(function($ctx2) {
  58990. return (16)._ro();
  58991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  58992. }),$globals.MessageNotUnderstood);
  58993. $ctx1.sendIdx["should:raise:"]=18;
  58994. $self._should_raise_((function(){
  58995. return $core.withContext(function($ctx2) {
  58996. return (16)._rP();
  58997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  58998. }),$globals.MessageNotUnderstood);
  58999. $ctx1.sendIdx["should:raise:"]=19;
  59000. $self._should_raise_((function(){
  59001. return $core.withContext(function($ctx2) {
  59002. return (16)._rp();
  59003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  59004. }),$globals.MessageNotUnderstood);
  59005. $ctx1.sendIdx["should:raise:"]=20;
  59006. $self._should_raise_((function(){
  59007. return $core.withContext(function($ctx2) {
  59008. return (16)._rQ();
  59009. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  59010. }),$globals.MessageNotUnderstood);
  59011. $ctx1.sendIdx["should:raise:"]=21;
  59012. $self._should_raise_((function(){
  59013. return $core.withContext(function($ctx2) {
  59014. return (16)._rq();
  59015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  59016. }),$globals.MessageNotUnderstood);
  59017. $ctx1.sendIdx["should:raise:"]=22;
  59018. $self._should_raise_((function(){
  59019. return $core.withContext(function($ctx2) {
  59020. return (16)._rR();
  59021. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  59022. }),$globals.MessageNotUnderstood);
  59023. $ctx1.sendIdx["should:raise:"]=23;
  59024. $self._should_raise_((function(){
  59025. return $core.withContext(function($ctx2) {
  59026. return (16)._rr();
  59027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  59028. }),$globals.MessageNotUnderstood);
  59029. $ctx1.sendIdx["should:raise:"]=24;
  59030. $self._should_raise_((function(){
  59031. return $core.withContext(function($ctx2) {
  59032. return (16)._rS();
  59033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  59034. }),$globals.MessageNotUnderstood);
  59035. $ctx1.sendIdx["should:raise:"]=25;
  59036. $self._should_raise_((function(){
  59037. return $core.withContext(function($ctx2) {
  59038. return (16)._rs();
  59039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  59040. }),$globals.MessageNotUnderstood);
  59041. $ctx1.sendIdx["should:raise:"]=26;
  59042. $self._should_raise_((function(){
  59043. return $core.withContext(function($ctx2) {
  59044. return (16)._rT();
  59045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  59046. }),$globals.MessageNotUnderstood);
  59047. $ctx1.sendIdx["should:raise:"]=27;
  59048. $self._should_raise_((function(){
  59049. return $core.withContext(function($ctx2) {
  59050. return (16)._rt();
  59051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  59052. }),$globals.MessageNotUnderstood);
  59053. $ctx1.sendIdx["should:raise:"]=28;
  59054. $self._should_raise_((function(){
  59055. return $core.withContext(function($ctx2) {
  59056. return (16)._rU();
  59057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  59058. }),$globals.MessageNotUnderstood);
  59059. $ctx1.sendIdx["should:raise:"]=29;
  59060. $self._should_raise_((function(){
  59061. return $core.withContext(function($ctx2) {
  59062. return (16)._ru();
  59063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  59064. }),$globals.MessageNotUnderstood);
  59065. $ctx1.sendIdx["should:raise:"]=30;
  59066. $self._should_raise_((function(){
  59067. return $core.withContext(function($ctx2) {
  59068. return (16)._rV();
  59069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  59070. }),$globals.MessageNotUnderstood);
  59071. $ctx1.sendIdx["should:raise:"]=31;
  59072. $self._should_raise_((function(){
  59073. return $core.withContext(function($ctx2) {
  59074. return (16)._rv();
  59075. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  59076. }),$globals.MessageNotUnderstood);
  59077. $ctx1.sendIdx["should:raise:"]=32;
  59078. $self._should_raise_((function(){
  59079. return $core.withContext(function($ctx2) {
  59080. return (16)._rW();
  59081. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  59082. }),$globals.MessageNotUnderstood);
  59083. $ctx1.sendIdx["should:raise:"]=33;
  59084. $self._should_raise_((function(){
  59085. return $core.withContext(function($ctx2) {
  59086. return (16)._rw();
  59087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  59088. }),$globals.MessageNotUnderstood);
  59089. $ctx1.sendIdx["should:raise:"]=34;
  59090. $self._should_raise_((function(){
  59091. return $core.withContext(function($ctx2) {
  59092. return (16)._rX();
  59093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  59094. }),$globals.MessageNotUnderstood);
  59095. $ctx1.sendIdx["should:raise:"]=35;
  59096. $self._should_raise_((function(){
  59097. return $core.withContext(function($ctx2) {
  59098. return (16)._rx();
  59099. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  59100. }),$globals.MessageNotUnderstood);
  59101. $ctx1.sendIdx["should:raise:"]=36;
  59102. $self._should_raise_((function(){
  59103. return $core.withContext(function($ctx2) {
  59104. return (16)._rY();
  59105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  59106. }),$globals.MessageNotUnderstood);
  59107. $ctx1.sendIdx["should:raise:"]=37;
  59108. $self._should_raise_((function(){
  59109. return $core.withContext(function($ctx2) {
  59110. return (16)._ry();
  59111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  59112. }),$globals.MessageNotUnderstood);
  59113. $ctx1.sendIdx["should:raise:"]=38;
  59114. $self._should_raise_((function(){
  59115. return $core.withContext(function($ctx2) {
  59116. return (16)._rZ();
  59117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  59118. }),$globals.MessageNotUnderstood);
  59119. $ctx1.sendIdx["should:raise:"]=39;
  59120. $self._should_raise_((function(){
  59121. return $core.withContext(function($ctx2) {
  59122. return (16)._rz();
  59123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  59124. }),$globals.MessageNotUnderstood);
  59125. $ctx1.sendIdx["should:raise:"]=40;
  59126. $self._should_raise_((function(){
  59127. return $core.withContext(function($ctx2) {
  59128. return (11259375)._Z();
  59129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  59130. }),$globals.MessageNotUnderstood);
  59131. return self;
  59132. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  59133. },
  59134. args: [],
  59135. 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.",
  59136. referencedClasses: ["MessageNotUnderstood"],
  59137. 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"]
  59138. }),
  59139. $globals.NumberTest);
  59140. $core.addMethod(
  59141. $core.method({
  59142. selector: "testLog",
  59143. protocol: "tests",
  59144. fn: function (){
  59145. var self=this,$self=this;
  59146. return $core.withContext(function($ctx1) {
  59147. $self._assert_equals_((10000)._log(),(4));
  59148. $ctx1.sendIdx["assert:equals:"]=1;
  59149. $self._assert_equals_((512)._log_((2)),(9));
  59150. $ctx1.sendIdx["assert:equals:"]=2;
  59151. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  59152. return self;
  59153. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  59154. },
  59155. args: [],
  59156. 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.",
  59157. referencedClasses: ["Number"],
  59158. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  59159. }),
  59160. $globals.NumberTest);
  59161. $core.addMethod(
  59162. $core.method({
  59163. selector: "testMinMax",
  59164. protocol: "tests",
  59165. fn: function (){
  59166. var self=this,$self=this;
  59167. return $core.withContext(function($ctx1) {
  59168. var $1,$2;
  59169. $self._assert_equals_((2)._max_((5)),(5));
  59170. $ctx1.sendIdx["assert:equals:"]=1;
  59171. $self._assert_equals_((2)._min_((5)),(2));
  59172. $ctx1.sendIdx["assert:equals:"]=2;
  59173. $1=(2)._min_max_((5),(3));
  59174. $ctx1.sendIdx["min:max:"]=1;
  59175. $self._assert_equals_($1,(3));
  59176. $ctx1.sendIdx["assert:equals:"]=3;
  59177. $2=(7)._min_max_((5),(3));
  59178. $ctx1.sendIdx["min:max:"]=2;
  59179. $self._assert_equals_($2,(5));
  59180. $ctx1.sendIdx["assert:equals:"]=4;
  59181. $self._assert_equals_((4)._min_max_((5),(3)),(4));
  59182. return self;
  59183. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  59184. },
  59185. args: [],
  59186. 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.",
  59187. referencedClasses: [],
  59188. messageSends: ["assert:equals:", "max:", "min:", "min:max:"]
  59189. }),
  59190. $globals.NumberTest);
  59191. $core.addMethod(
  59192. $core.method({
  59193. selector: "testNegated",
  59194. protocol: "tests",
  59195. fn: function (){
  59196. var self=this,$self=this;
  59197. return $core.withContext(function($ctx1) {
  59198. var $1;
  59199. $1=(3)._negated();
  59200. $ctx1.sendIdx["negated"]=1;
  59201. $self._assert_equals_($1,(-3));
  59202. $ctx1.sendIdx["assert:equals:"]=1;
  59203. $self._assert_equals_((-3)._negated(),(3));
  59204. return self;
  59205. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  59206. },
  59207. args: [],
  59208. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  59209. referencedClasses: [],
  59210. messageSends: ["assert:equals:", "negated"]
  59211. }),
  59212. $globals.NumberTest);
  59213. $core.addMethod(
  59214. $core.method({
  59215. selector: "testPrintShowingDecimalPlaces",
  59216. protocol: "tests",
  59217. fn: function (){
  59218. var self=this,$self=this;
  59219. return $core.withContext(function($ctx1) {
  59220. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  59221. $1=(23)._printShowingDecimalPlaces_((2));
  59222. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  59223. $self._assert_equals_($1,"23.00");
  59224. $ctx1.sendIdx["assert:equals:"]=1;
  59225. $2=(23.5698)._printShowingDecimalPlaces_((2));
  59226. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  59227. $self._assert_equals_($2,"23.57");
  59228. $ctx1.sendIdx["assert:equals:"]=2;
  59229. $4=(234.567)._negated();
  59230. $ctx1.sendIdx["negated"]=1;
  59231. $3=$recv($4)._printShowingDecimalPlaces_((5));
  59232. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  59233. $self._assert_equals_($3,"-234.56700");
  59234. $ctx1.sendIdx["assert:equals:"]=3;
  59235. $5=(23.4567)._printShowingDecimalPlaces_((0));
  59236. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  59237. $self._assert_equals_($5,"23");
  59238. $ctx1.sendIdx["assert:equals:"]=4;
  59239. $6=(23.5567)._printShowingDecimalPlaces_((0));
  59240. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  59241. $self._assert_equals_($6,"24");
  59242. $ctx1.sendIdx["assert:equals:"]=5;
  59243. $8=(23.4567)._negated();
  59244. $ctx1.sendIdx["negated"]=2;
  59245. $7=$recv($8)._printShowingDecimalPlaces_((0));
  59246. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  59247. $self._assert_equals_($7,"-23");
  59248. $ctx1.sendIdx["assert:equals:"]=6;
  59249. $10=(23.5567)._negated();
  59250. $ctx1.sendIdx["negated"]=3;
  59251. $9=$recv($10)._printShowingDecimalPlaces_((0));
  59252. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  59253. $self._assert_equals_($9,"-24");
  59254. $ctx1.sendIdx["assert:equals:"]=7;
  59255. $11=(100000000)._printShowingDecimalPlaces_((1));
  59256. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  59257. $self._assert_equals_($11,"100000000.0");
  59258. $ctx1.sendIdx["assert:equals:"]=8;
  59259. $12=(0.98)._printShowingDecimalPlaces_((5));
  59260. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  59261. $self._assert_equals_($12,"0.98000");
  59262. $ctx1.sendIdx["assert:equals:"]=9;
  59263. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  59264. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  59265. $self._assert_equals_($13,"-0.98");
  59266. $ctx1.sendIdx["assert:equals:"]=10;
  59267. $14=(2.567)._printShowingDecimalPlaces_((2));
  59268. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  59269. $self._assert_equals_($14,"2.57");
  59270. $ctx1.sendIdx["assert:equals:"]=11;
  59271. $15=(-2.567)._printShowingDecimalPlaces_((2));
  59272. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  59273. $self._assert_equals_($15,"-2.57");
  59274. $ctx1.sendIdx["assert:equals:"]=12;
  59275. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  59276. return self;
  59277. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  59278. },
  59279. args: [],
  59280. 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'.",
  59281. referencedClasses: [],
  59282. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  59283. }),
  59284. $globals.NumberTest);
  59285. $core.addMethod(
  59286. $core.method({
  59287. selector: "testPrintStringBase",
  59288. protocol: "tests",
  59289. fn: function (){
  59290. var self=this,$self=this;
  59291. return $core.withContext(function($ctx1) {
  59292. var $1,$2,$3;
  59293. $1=(15)._printStringBase_((2));
  59294. $ctx1.sendIdx["printStringBase:"]=1;
  59295. $self._assert_equals_($1,"1111");
  59296. $ctx1.sendIdx["assert:equals:"]=1;
  59297. $2=(15)._printStringBase_((16));
  59298. $ctx1.sendIdx["printStringBase:"]=2;
  59299. $self._assert_equals_($2,"f");
  59300. $ctx1.sendIdx["assert:equals:"]=2;
  59301. $3=(256)._printStringBase_((16));
  59302. $ctx1.sendIdx["printStringBase:"]=3;
  59303. $self._assert_equals_($3,"100");
  59304. $ctx1.sendIdx["assert:equals:"]=3;
  59305. $self._assert_equals_((256)._printStringBase_((2)),"100000000");
  59306. return self;
  59307. }, function($ctx1) {$ctx1.fill(self,"testPrintStringBase",{},$globals.NumberTest)});
  59308. },
  59309. args: [],
  59310. source: "testPrintStringBase\x0a\x09self assert: (15 printStringBase: 2) equals: '1111'.\x0a\x09self assert: (15 printStringBase: 16) equals: 'f'.\x0a\x09self assert: (256 printStringBase: 16) equals: '100'.\x0a\x09self assert: (256 printStringBase: 2) equals: '100000000'",
  59311. referencedClasses: [],
  59312. messageSends: ["assert:equals:", "printStringBase:"]
  59313. }),
  59314. $globals.NumberTest);
  59315. $core.addMethod(
  59316. $core.method({
  59317. selector: "testRadiansToDegrees",
  59318. protocol: "tests",
  59319. fn: function (){
  59320. var self=this,$self=this;
  59321. return $core.withContext(function($ctx1) {
  59322. $self._assert_($recv($recv($recv($recv($recv($globals.Number)._pi())._radiansToDegrees()).__minus((180)))._abs()).__lt_eq((0.01)));
  59323. return self;
  59324. }, function($ctx1) {$ctx1.fill(self,"testRadiansToDegrees",{},$globals.NumberTest)});
  59325. },
  59326. args: [],
  59327. source: "testRadiansToDegrees\x0a\x09self assert: (Number pi radiansToDegrees - 180) abs <= 0.01.",
  59328. referencedClasses: ["Number"],
  59329. messageSends: ["assert:", "<=", "abs", "-", "radiansToDegrees", "pi"]
  59330. }),
  59331. $globals.NumberTest);
  59332. $core.addMethod(
  59333. $core.method({
  59334. selector: "testRaisedTo",
  59335. protocol: "tests",
  59336. fn: function (){
  59337. var self=this,$self=this;
  59338. return $core.withContext(function($ctx1) {
  59339. var $1,$2,$3;
  59340. $1=(2)._raisedTo_((4));
  59341. $ctx1.sendIdx["raisedTo:"]=1;
  59342. $self._assert_equals_($1,(16));
  59343. $ctx1.sendIdx["assert:equals:"]=1;
  59344. $2=(2)._raisedTo_((0));
  59345. $ctx1.sendIdx["raisedTo:"]=2;
  59346. $self._assert_equals_($2,(1));
  59347. $ctx1.sendIdx["assert:equals:"]=2;
  59348. $3=(2)._raisedTo_((-3));
  59349. $ctx1.sendIdx["raisedTo:"]=3;
  59350. $self._assert_equals_($3,(0.125));
  59351. $ctx1.sendIdx["assert:equals:"]=3;
  59352. $self._assert_equals_((4)._raisedTo_((0.5)),(2));
  59353. $ctx1.sendIdx["assert:equals:"]=4;
  59354. $self._assert_equals_((2).__star_star((4)),(16));
  59355. return self;
  59356. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  59357. },
  59358. args: [],
  59359. 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.",
  59360. referencedClasses: [],
  59361. messageSends: ["assert:equals:", "raisedTo:", "**"]
  59362. }),
  59363. $globals.NumberTest);
  59364. $core.addMethod(
  59365. $core.method({
  59366. selector: "testRounded",
  59367. protocol: "tests",
  59368. fn: function (){
  59369. var self=this,$self=this;
  59370. return $core.withContext(function($ctx1) {
  59371. var $1,$2;
  59372. $1=(3)._rounded();
  59373. $ctx1.sendIdx["rounded"]=1;
  59374. $self._assert_equals_($1,(3));
  59375. $ctx1.sendIdx["assert:equals:"]=1;
  59376. $2=(3.212)._rounded();
  59377. $ctx1.sendIdx["rounded"]=2;
  59378. $self._assert_equals_($2,(3));
  59379. $ctx1.sendIdx["assert:equals:"]=2;
  59380. $self._assert_equals_((3.51)._rounded(),(4));
  59381. return self;
  59382. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  59383. },
  59384. args: [],
  59385. 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",
  59386. referencedClasses: [],
  59387. messageSends: ["assert:equals:", "rounded"]
  59388. }),
  59389. $globals.NumberTest);
  59390. $core.addMethod(
  59391. $core.method({
  59392. selector: "testSign",
  59393. protocol: "tests",
  59394. fn: function (){
  59395. var self=this,$self=this;
  59396. return $core.withContext(function($ctx1) {
  59397. var $1,$2;
  59398. $1=(5)._sign();
  59399. $ctx1.sendIdx["sign"]=1;
  59400. $self._assert_equals_($1,(1));
  59401. $ctx1.sendIdx["assert:equals:"]=1;
  59402. $2=(0)._sign();
  59403. $ctx1.sendIdx["sign"]=2;
  59404. $self._assert_equals_($2,(0));
  59405. $ctx1.sendIdx["assert:equals:"]=2;
  59406. $self._assert_equals_((-1.4)._sign(),(-1));
  59407. return self;
  59408. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  59409. },
  59410. args: [],
  59411. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  59412. referencedClasses: [],
  59413. messageSends: ["assert:equals:", "sign"]
  59414. }),
  59415. $globals.NumberTest);
  59416. $core.addMethod(
  59417. $core.method({
  59418. selector: "testSqrt",
  59419. protocol: "tests",
  59420. fn: function (){
  59421. var self=this,$self=this;
  59422. return $core.withContext(function($ctx1) {
  59423. var $1;
  59424. $1=(4)._sqrt();
  59425. $ctx1.sendIdx["sqrt"]=1;
  59426. $self._assert_equals_($1,(2));
  59427. $ctx1.sendIdx["assert:equals:"]=1;
  59428. $self._assert_equals_((16)._sqrt(),(4));
  59429. return self;
  59430. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  59431. },
  59432. args: [],
  59433. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  59434. referencedClasses: [],
  59435. messageSends: ["assert:equals:", "sqrt"]
  59436. }),
  59437. $globals.NumberTest);
  59438. $core.addMethod(
  59439. $core.method({
  59440. selector: "testSquared",
  59441. protocol: "tests",
  59442. fn: function (){
  59443. var self=this,$self=this;
  59444. return $core.withContext(function($ctx1) {
  59445. $self._assert_equals_((4)._squared(),(16));
  59446. return self;
  59447. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  59448. },
  59449. args: [],
  59450. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  59451. referencedClasses: [],
  59452. messageSends: ["assert:equals:", "squared"]
  59453. }),
  59454. $globals.NumberTest);
  59455. $core.addMethod(
  59456. $core.method({
  59457. selector: "testTimesRepeat",
  59458. protocol: "tests",
  59459. fn: function (){
  59460. var self=this,$self=this;
  59461. var i;
  59462. return $core.withContext(function($ctx1) {
  59463. i=(0);
  59464. (0)._timesRepeat_((function(){
  59465. return $core.withContext(function($ctx2) {
  59466. i=$recv(i).__plus((1));
  59467. $ctx2.sendIdx["+"]=1;
  59468. return i;
  59469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59470. }));
  59471. $ctx1.sendIdx["timesRepeat:"]=1;
  59472. $self._assert_equals_(i,(0));
  59473. $ctx1.sendIdx["assert:equals:"]=1;
  59474. (5)._timesRepeat_((function(){
  59475. return $core.withContext(function($ctx2) {
  59476. i=$recv(i).__plus((1));
  59477. return i;
  59478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59479. }));
  59480. $self._assert_equals_(i,(5));
  59481. return self;
  59482. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  59483. },
  59484. args: [],
  59485. 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",
  59486. referencedClasses: [],
  59487. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  59488. }),
  59489. $globals.NumberTest);
  59490. $core.addMethod(
  59491. $core.method({
  59492. selector: "testTo",
  59493. protocol: "tests",
  59494. fn: function (){
  59495. var self=this,$self=this;
  59496. return $core.withContext(function($ctx1) {
  59497. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  59498. return self;
  59499. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  59500. },
  59501. args: [],
  59502. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  59503. referencedClasses: [],
  59504. messageSends: ["assert:equals:", "to:"]
  59505. }),
  59506. $globals.NumberTest);
  59507. $core.addMethod(
  59508. $core.method({
  59509. selector: "testToBy",
  59510. protocol: "tests",
  59511. fn: function (){
  59512. var self=this,$self=this;
  59513. return $core.withContext(function($ctx1) {
  59514. var $1;
  59515. $1=(0)._to_by_((6),(2));
  59516. $ctx1.sendIdx["to:by:"]=1;
  59517. $self._assert_equals_($1,[(0), (2), (4), (6)]);
  59518. $self._should_raise_((function(){
  59519. return $core.withContext(function($ctx2) {
  59520. return (1)._to_by_((4),(0));
  59521. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59522. }),$globals.Error);
  59523. return self;
  59524. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  59525. },
  59526. args: [],
  59527. 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",
  59528. referencedClasses: ["Error"],
  59529. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  59530. }),
  59531. $globals.NumberTest);
  59532. $core.addMethod(
  59533. $core.method({
  59534. selector: "testTrigonometry",
  59535. protocol: "tests",
  59536. fn: function (){
  59537. var self=this,$self=this;
  59538. return $core.withContext(function($ctx1) {
  59539. var $1;
  59540. $self._assert_equals_((0)._cos(),(1));
  59541. $ctx1.sendIdx["assert:equals:"]=1;
  59542. $self._assert_equals_((0)._sin(),(0));
  59543. $ctx1.sendIdx["assert:equals:"]=2;
  59544. $self._assert_equals_((0)._tan(),(0));
  59545. $ctx1.sendIdx["assert:equals:"]=3;
  59546. $self._assert_equals_((1)._arcCos(),(0));
  59547. $ctx1.sendIdx["assert:equals:"]=4;
  59548. $self._assert_equals_((0)._arcSin(),(0));
  59549. $ctx1.sendIdx["assert:equals:"]=5;
  59550. $self._assert_equals_((0)._arcTan(),(0));
  59551. $ctx1.sendIdx["assert:equals:"]=6;
  59552. $1=(0)._arcTan_((1));
  59553. $ctx1.sendIdx["arcTan:"]=1;
  59554. $self._assert_equals_($1,(0));
  59555. $ctx1.sendIdx["assert:equals:"]=7;
  59556. $self._assert_equals_((1)._arcTan_((0)),$recv($recv($globals.Number)._pi()).__slash((2)));
  59557. return self;
  59558. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  59559. },
  59560. args: [],
  59561. 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)",
  59562. referencedClasses: ["Number"],
  59563. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan", "arcTan:", "/", "pi"]
  59564. }),
  59565. $globals.NumberTest);
  59566. $core.addMethod(
  59567. $core.method({
  59568. selector: "testTruncated",
  59569. protocol: "tests",
  59570. fn: function (){
  59571. var self=this,$self=this;
  59572. return $core.withContext(function($ctx1) {
  59573. var $1,$2;
  59574. $1=(3)._truncated();
  59575. $ctx1.sendIdx["truncated"]=1;
  59576. $self._assert_equals_($1,(3));
  59577. $ctx1.sendIdx["assert:equals:"]=1;
  59578. $2=(3.212)._truncated();
  59579. $ctx1.sendIdx["truncated"]=2;
  59580. $self._assert_equals_($2,(3));
  59581. $ctx1.sendIdx["assert:equals:"]=2;
  59582. $self._assert_equals_((3.51)._truncated(),(3));
  59583. return self;
  59584. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  59585. },
  59586. args: [],
  59587. 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",
  59588. referencedClasses: [],
  59589. messageSends: ["assert:equals:", "truncated"]
  59590. }),
  59591. $globals.NumberTest);
  59592. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  59593. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  59594. $core.addMethod(
  59595. $core.method({
  59596. selector: "foo",
  59597. protocol: "not yet classified",
  59598. fn: function (){
  59599. var self=this,$self=this;
  59600. return $self["@foo"];
  59601. },
  59602. args: [],
  59603. source: "foo\x0a\x09^ foo",
  59604. referencedClasses: [],
  59605. messageSends: []
  59606. }),
  59607. $globals.ObjectMock);
  59608. $core.addMethod(
  59609. $core.method({
  59610. selector: "foo:",
  59611. protocol: "not yet classified",
  59612. fn: function (anObject){
  59613. var self=this,$self=this;
  59614. $self["@foo"]=anObject;
  59615. return self;
  59616. },
  59617. args: ["anObject"],
  59618. source: "foo: anObject\x0a\x09foo := anObject",
  59619. referencedClasses: [],
  59620. messageSends: []
  59621. }),
  59622. $globals.ObjectMock);
  59623. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  59624. $core.addMethod(
  59625. $core.method({
  59626. selector: "notDefined",
  59627. protocol: "tests",
  59628. fn: function (){
  59629. var self=this,$self=this;
  59630. return $core.withContext(function($ctx1) {
  59631. return void 0;;
  59632. return self;
  59633. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  59634. },
  59635. args: [],
  59636. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  59637. referencedClasses: [],
  59638. messageSends: []
  59639. }),
  59640. $globals.ObjectTest);
  59641. $core.addMethod(
  59642. $core.method({
  59643. selector: "testBasicAccess",
  59644. protocol: "tests",
  59645. fn: function (){
  59646. var self=this,$self=this;
  59647. var o;
  59648. return $core.withContext(function($ctx1) {
  59649. var $1;
  59650. o=$recv($globals.Object)._new();
  59651. $recv(o)._basicAt_put_("a",(1));
  59652. $1=$recv(o)._basicAt_("a");
  59653. $ctx1.sendIdx["basicAt:"]=1;
  59654. $self._assert_equals_($1,(1));
  59655. $ctx1.sendIdx["assert:equals:"]=1;
  59656. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  59657. return self;
  59658. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  59659. },
  59660. args: [],
  59661. 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",
  59662. referencedClasses: ["Object"],
  59663. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  59664. }),
  59665. $globals.ObjectTest);
  59666. $core.addMethod(
  59667. $core.method({
  59668. selector: "testBasicPerform",
  59669. protocol: "tests",
  59670. fn: function (){
  59671. var self=this,$self=this;
  59672. var o;
  59673. return $core.withContext(function($ctx1) {
  59674. o=$recv($globals.Object)._new();
  59675. $recv(o)._basicAt_put_("func",(function(){
  59676. return "hello";
  59677. }));
  59678. $ctx1.sendIdx["basicAt:put:"]=1;
  59679. $recv(o)._basicAt_put_("func2",(function(a){
  59680. return $core.withContext(function($ctx2) {
  59681. return $recv(a).__plus((1));
  59682. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  59683. }));
  59684. $self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  59685. $ctx1.sendIdx["assert:equals:"]=1;
  59686. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  59687. return self;
  59688. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  59689. },
  59690. args: [],
  59691. 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",
  59692. referencedClasses: ["Object"],
  59693. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  59694. }),
  59695. $globals.ObjectTest);
  59696. $core.addMethod(
  59697. $core.method({
  59698. selector: "testDNU",
  59699. protocol: "tests",
  59700. fn: function (){
  59701. var self=this,$self=this;
  59702. return $core.withContext(function($ctx1) {
  59703. $self._should_raise_((function(){
  59704. return $core.withContext(function($ctx2) {
  59705. return $recv($recv($globals.Object)._new())._foo();
  59706. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59707. }),$globals.MessageNotUnderstood);
  59708. return self;
  59709. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  59710. },
  59711. args: [],
  59712. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  59713. referencedClasses: ["Object", "MessageNotUnderstood"],
  59714. messageSends: ["should:raise:", "foo", "new"]
  59715. }),
  59716. $globals.ObjectTest);
  59717. $core.addMethod(
  59718. $core.method({
  59719. selector: "testEquality",
  59720. protocol: "tests",
  59721. fn: function (){
  59722. var self=this,$self=this;
  59723. var o;
  59724. return $core.withContext(function($ctx1) {
  59725. var $1,$2,$4,$3;
  59726. o=$recv($globals.Object)._new();
  59727. $ctx1.sendIdx["new"]=1;
  59728. $1=$recv(o).__eq($recv($globals.Object)._new());
  59729. $ctx1.sendIdx["="]=1;
  59730. $self._deny_($1);
  59731. $2=$recv(o).__eq(o);
  59732. $ctx1.sendIdx["="]=2;
  59733. $self._assert_($2);
  59734. $ctx1.sendIdx["assert:"]=1;
  59735. $4=$recv(o)._yourself();
  59736. $ctx1.sendIdx["yourself"]=1;
  59737. $3=$recv($4).__eq(o);
  59738. $ctx1.sendIdx["="]=3;
  59739. $self._assert_($3);
  59740. $ctx1.sendIdx["assert:"]=2;
  59741. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  59742. return self;
  59743. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  59744. },
  59745. args: [],
  59746. 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)",
  59747. referencedClasses: ["Object"],
  59748. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  59749. }),
  59750. $globals.ObjectTest);
  59751. $core.addMethod(
  59752. $core.method({
  59753. selector: "testHalt",
  59754. protocol: "tests",
  59755. fn: function (){
  59756. var self=this,$self=this;
  59757. return $core.withContext(function($ctx1) {
  59758. $self._should_raise_((function(){
  59759. return $core.withContext(function($ctx2) {
  59760. return $recv($recv($globals.Object)._new())._halt();
  59761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59762. }),$globals.Error);
  59763. return self;
  59764. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  59765. },
  59766. args: [],
  59767. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  59768. referencedClasses: ["Object", "Error"],
  59769. messageSends: ["should:raise:", "halt", "new"]
  59770. }),
  59771. $globals.ObjectTest);
  59772. $core.addMethod(
  59773. $core.method({
  59774. selector: "testIdentity",
  59775. protocol: "tests",
  59776. fn: function (){
  59777. var self=this,$self=this;
  59778. var o;
  59779. return $core.withContext(function($ctx1) {
  59780. var $1,$2,$4,$3;
  59781. o=$recv($globals.Object)._new();
  59782. $ctx1.sendIdx["new"]=1;
  59783. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  59784. $ctx1.sendIdx["=="]=1;
  59785. $self._deny_($1);
  59786. $2=$recv(o).__eq_eq(o);
  59787. $ctx1.sendIdx["=="]=2;
  59788. $self._assert_($2);
  59789. $ctx1.sendIdx["assert:"]=1;
  59790. $4=$recv(o)._yourself();
  59791. $ctx1.sendIdx["yourself"]=1;
  59792. $3=$recv($4).__eq_eq(o);
  59793. $ctx1.sendIdx["=="]=3;
  59794. $self._assert_($3);
  59795. $ctx1.sendIdx["assert:"]=2;
  59796. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  59797. return self;
  59798. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  59799. },
  59800. args: [],
  59801. 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",
  59802. referencedClasses: ["Object"],
  59803. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  59804. }),
  59805. $globals.ObjectTest);
  59806. $core.addMethod(
  59807. $core.method({
  59808. selector: "testIfNil",
  59809. protocol: "tests",
  59810. fn: function (){
  59811. var self=this,$self=this;
  59812. return $core.withContext(function($ctx1) {
  59813. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  59814. $2=$recv($globals.Object)._new();
  59815. $ctx1.sendIdx["new"]=1;
  59816. $1=$recv($2)._isNil();
  59817. $self._deny_($1);
  59818. $ctx1.sendIdx["deny:"]=1;
  59819. $5=$recv($globals.Object)._new();
  59820. $ctx1.sendIdx["new"]=2;
  59821. if(($receiver = $5) == null || $receiver.a$nil){
  59822. $4=true;
  59823. } else {
  59824. $4=$5;
  59825. }
  59826. $3=$recv($4).__eq(true);
  59827. $self._deny_($3);
  59828. $7=$recv($globals.Object)._new();
  59829. $ctx1.sendIdx["new"]=3;
  59830. if(($receiver = $7) == null || $receiver.a$nil){
  59831. $6=$7;
  59832. } else {
  59833. $6=true;
  59834. }
  59835. $self._assert_equals_($6,true);
  59836. $ctx1.sendIdx["assert:equals:"]=1;
  59837. $9=$recv($globals.Object)._new();
  59838. $ctx1.sendIdx["new"]=4;
  59839. if(($receiver = $9) == null || $receiver.a$nil){
  59840. $8=false;
  59841. } else {
  59842. $8=true;
  59843. }
  59844. $self._assert_equals_($8,true);
  59845. $ctx1.sendIdx["assert:equals:"]=2;
  59846. $11=$recv($globals.Object)._new();
  59847. if(($receiver = $11) == null || $receiver.a$nil){
  59848. $10=false;
  59849. } else {
  59850. $10=true;
  59851. }
  59852. $self._assert_equals_($10,true);
  59853. return self;
  59854. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  59855. },
  59856. args: [],
  59857. 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",
  59858. referencedClasses: ["Object"],
  59859. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  59860. }),
  59861. $globals.ObjectTest);
  59862. $core.addMethod(
  59863. $core.method({
  59864. selector: "testInstVars",
  59865. protocol: "tests",
  59866. fn: function (){
  59867. var self=this,$self=this;
  59868. var o;
  59869. return $core.withContext(function($ctx1) {
  59870. var $1,$2;
  59871. o=$recv($globals.ObjectMock)._new();
  59872. $1=$recv(o)._instVarAt_("foo");
  59873. $ctx1.sendIdx["instVarAt:"]=1;
  59874. $self._assert_equals_($1,nil);
  59875. $ctx1.sendIdx["assert:equals:"]=1;
  59876. $recv(o)._instVarAt_put_("foo",(1));
  59877. $2=$recv(o)._instVarAt_("foo");
  59878. $ctx1.sendIdx["instVarAt:"]=2;
  59879. $self._assert_equals_($2,(1));
  59880. $ctx1.sendIdx["assert:equals:"]=2;
  59881. $self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  59882. return self;
  59883. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  59884. },
  59885. args: [],
  59886. 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",
  59887. referencedClasses: ["ObjectMock"],
  59888. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  59889. }),
  59890. $globals.ObjectTest);
  59891. $core.addMethod(
  59892. $core.method({
  59893. selector: "testNilUndefined",
  59894. protocol: "tests",
  59895. fn: function (){
  59896. var self=this,$self=this;
  59897. return $core.withContext(function($ctx1) {
  59898. $self._assert_equals_($self._notDefined(),nil);
  59899. return self;
  59900. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  59901. },
  59902. args: [],
  59903. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  59904. referencedClasses: [],
  59905. messageSends: ["assert:equals:", "notDefined"]
  59906. }),
  59907. $globals.ObjectTest);
  59908. $core.addMethod(
  59909. $core.method({
  59910. selector: "testYourself",
  59911. protocol: "tests",
  59912. fn: function (){
  59913. var self=this,$self=this;
  59914. var o;
  59915. return $core.withContext(function($ctx1) {
  59916. o=$recv($globals.ObjectMock)._new();
  59917. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  59918. return self;
  59919. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  59920. },
  59921. args: [],
  59922. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  59923. referencedClasses: ["ObjectMock"],
  59924. messageSends: ["new", "assert:", "==", "yourself"]
  59925. }),
  59926. $globals.ObjectTest);
  59927. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  59928. $core.addMethod(
  59929. $core.method({
  59930. selector: "testAccessing",
  59931. protocol: "tests",
  59932. fn: function (){
  59933. var self=this,$self=this;
  59934. return $core.withContext(function($ctx1) {
  59935. var $2,$1,$3,$6,$5,$4;
  59936. $2=$recv($globals.Point)._x_y_((3),(4));
  59937. $ctx1.sendIdx["x:y:"]=1;
  59938. $1=$recv($2)._x();
  59939. $ctx1.sendIdx["x"]=1;
  59940. $self._assert_equals_($1,(3));
  59941. $ctx1.sendIdx["assert:equals:"]=1;
  59942. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  59943. $ctx1.sendIdx["y"]=1;
  59944. $self._assert_equals_($3,(4));
  59945. $ctx1.sendIdx["assert:equals:"]=2;
  59946. $6=$recv($globals.Point)._new();
  59947. $ctx1.sendIdx["new"]=1;
  59948. $5=$recv($6)._x_((3));
  59949. $4=$recv($5)._x();
  59950. $self._assert_equals_($4,(3));
  59951. $ctx1.sendIdx["assert:equals:"]=3;
  59952. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  59953. return self;
  59954. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  59955. },
  59956. args: [],
  59957. 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",
  59958. referencedClasses: ["Point"],
  59959. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  59960. }),
  59961. $globals.PointTest);
  59962. $core.addMethod(
  59963. $core.method({
  59964. selector: "testAngle",
  59965. protocol: "tests",
  59966. fn: function (){
  59967. var self=this,$self=this;
  59968. return $core.withContext(function($ctx1) {
  59969. $self._assert_equals_($recv((-1).__at((0)))._angle(),$recv($globals.Number)._pi());
  59970. return self;
  59971. }, function($ctx1) {$ctx1.fill(self,"testAngle",{},$globals.PointTest)});
  59972. },
  59973. args: [],
  59974. source: "testAngle\x0a\x09self assert: (-1@0) angle equals: Number pi",
  59975. referencedClasses: ["Number"],
  59976. messageSends: ["assert:equals:", "angle", "@", "pi"]
  59977. }),
  59978. $globals.PointTest);
  59979. $core.addMethod(
  59980. $core.method({
  59981. selector: "testArithmetic",
  59982. protocol: "tests",
  59983. fn: function (){
  59984. var self=this,$self=this;
  59985. return $core.withContext(function($ctx1) {
  59986. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  59987. $2=(3).__at((4));
  59988. $ctx1.sendIdx["@"]=1;
  59989. $3=(3).__at((4));
  59990. $ctx1.sendIdx["@"]=2;
  59991. $1=$recv($2).__star($3);
  59992. $4=$recv($globals.Point)._x_y_((9),(16));
  59993. $ctx1.sendIdx["x:y:"]=1;
  59994. $self._assert_equals_($1,$4);
  59995. $ctx1.sendIdx["assert:equals:"]=1;
  59996. $6=(3).__at((4));
  59997. $ctx1.sendIdx["@"]=3;
  59998. $7=(3).__at((4));
  59999. $ctx1.sendIdx["@"]=4;
  60000. $5=$recv($6).__plus($7);
  60001. $8=$recv($globals.Point)._x_y_((6),(8));
  60002. $ctx1.sendIdx["x:y:"]=2;
  60003. $self._assert_equals_($5,$8);
  60004. $ctx1.sendIdx["assert:equals:"]=2;
  60005. $10=(3).__at((4));
  60006. $ctx1.sendIdx["@"]=5;
  60007. $11=(3).__at((4));
  60008. $ctx1.sendIdx["@"]=6;
  60009. $9=$recv($10).__minus($11);
  60010. $12=$recv($globals.Point)._x_y_((0),(0));
  60011. $ctx1.sendIdx["x:y:"]=3;
  60012. $self._assert_equals_($9,$12);
  60013. $ctx1.sendIdx["assert:equals:"]=3;
  60014. $14=(6).__at((8));
  60015. $ctx1.sendIdx["@"]=7;
  60016. $13=$recv($14).__slash((3).__at((4)));
  60017. $self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  60018. return self;
  60019. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  60020. },
  60021. args: [],
  60022. 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)",
  60023. referencedClasses: ["Point"],
  60024. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  60025. }),
  60026. $globals.PointTest);
  60027. $core.addMethod(
  60028. $core.method({
  60029. selector: "testAt",
  60030. protocol: "tests",
  60031. fn: function (){
  60032. var self=this,$self=this;
  60033. return $core.withContext(function($ctx1) {
  60034. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  60035. return self;
  60036. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  60037. },
  60038. args: [],
  60039. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  60040. referencedClasses: ["Point"],
  60041. messageSends: ["assert:equals:", "@", "x:y:"]
  60042. }),
  60043. $globals.PointTest);
  60044. $core.addMethod(
  60045. $core.method({
  60046. selector: "testComparison",
  60047. protocol: "tests",
  60048. fn: function (){
  60049. var self=this,$self=this;
  60050. return $core.withContext(function($ctx1) {
  60051. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  60052. $2=(3).__at((4));
  60053. $ctx1.sendIdx["@"]=1;
  60054. $3=(4).__at((5));
  60055. $ctx1.sendIdx["@"]=2;
  60056. $1=$recv($2).__lt($3);
  60057. $ctx1.sendIdx["<"]=1;
  60058. $self._assert_($1);
  60059. $ctx1.sendIdx["assert:"]=1;
  60060. $5=(3).__at((4));
  60061. $ctx1.sendIdx["@"]=3;
  60062. $6=(4).__at((4));
  60063. $ctx1.sendIdx["@"]=4;
  60064. $4=$recv($5).__lt($6);
  60065. $self._deny_($4);
  60066. $ctx1.sendIdx["deny:"]=1;
  60067. $8=(4).__at((5));
  60068. $ctx1.sendIdx["@"]=5;
  60069. $9=(4).__at((5));
  60070. $ctx1.sendIdx["@"]=6;
  60071. $7=$recv($8).__lt_eq($9);
  60072. $ctx1.sendIdx["<="]=1;
  60073. $self._assert_($7);
  60074. $ctx1.sendIdx["assert:"]=2;
  60075. $11=(4).__at((5));
  60076. $ctx1.sendIdx["@"]=7;
  60077. $12=(3).__at((5));
  60078. $ctx1.sendIdx["@"]=8;
  60079. $10=$recv($11).__lt_eq($12);
  60080. $self._deny_($10);
  60081. $ctx1.sendIdx["deny:"]=2;
  60082. $14=(5).__at((6));
  60083. $ctx1.sendIdx["@"]=9;
  60084. $15=(4).__at((5));
  60085. $ctx1.sendIdx["@"]=10;
  60086. $13=$recv($14).__gt($15);
  60087. $ctx1.sendIdx[">"]=1;
  60088. $self._assert_($13);
  60089. $ctx1.sendIdx["assert:"]=3;
  60090. $17=(5).__at((6));
  60091. $ctx1.sendIdx["@"]=11;
  60092. $18=(6).__at((6));
  60093. $ctx1.sendIdx["@"]=12;
  60094. $16=$recv($17).__gt($18);
  60095. $self._deny_($16);
  60096. $ctx1.sendIdx["deny:"]=3;
  60097. $20=(4).__at((5));
  60098. $ctx1.sendIdx["@"]=13;
  60099. $21=(4).__at((5));
  60100. $ctx1.sendIdx["@"]=14;
  60101. $19=$recv($20).__gt_eq($21);
  60102. $ctx1.sendIdx[">="]=1;
  60103. $self._assert_($19);
  60104. $23=(4).__at((5));
  60105. $ctx1.sendIdx["@"]=15;
  60106. $22=$recv($23).__gt_eq((5).__at((5)));
  60107. $self._deny_($22);
  60108. return self;
  60109. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  60110. },
  60111. args: [],
  60112. 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)",
  60113. referencedClasses: [],
  60114. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  60115. }),
  60116. $globals.PointTest);
  60117. $core.addMethod(
  60118. $core.method({
  60119. selector: "testDotProduct",
  60120. protocol: "tests",
  60121. fn: function (){
  60122. var self=this,$self=this;
  60123. return $core.withContext(function($ctx1) {
  60124. var $2,$1;
  60125. $2=(2).__at((3));
  60126. $ctx1.sendIdx["@"]=1;
  60127. $1=$recv($2)._dotProduct_((3).__at((7)));
  60128. $self._assert_equals_($1,(27));
  60129. return self;
  60130. }, function($ctx1) {$ctx1.fill(self,"testDotProduct",{},$globals.PointTest)});
  60131. },
  60132. args: [],
  60133. source: "testDotProduct\x0a\x09self assert: (2@3 dotProduct: 3@7) equals: 27",
  60134. referencedClasses: [],
  60135. messageSends: ["assert:equals:", "dotProduct:", "@"]
  60136. }),
  60137. $globals.PointTest);
  60138. $core.addMethod(
  60139. $core.method({
  60140. selector: "testEgality",
  60141. protocol: "tests",
  60142. fn: function (){
  60143. var self=this,$self=this;
  60144. return $core.withContext(function($ctx1) {
  60145. var $2,$3,$1,$5,$4;
  60146. $2=(3).__at((4));
  60147. $ctx1.sendIdx["@"]=1;
  60148. $3=(3).__at((4));
  60149. $ctx1.sendIdx["@"]=2;
  60150. $1=$recv($2).__eq($3);
  60151. $ctx1.sendIdx["="]=1;
  60152. $self._assert_($1);
  60153. $5=(3).__at((5));
  60154. $ctx1.sendIdx["@"]=3;
  60155. $4=$recv($5).__eq((3).__at((6)));
  60156. $self._deny_($4);
  60157. return self;
  60158. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  60159. },
  60160. args: [],
  60161. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  60162. referencedClasses: [],
  60163. messageSends: ["assert:", "=", "@", "deny:"]
  60164. }),
  60165. $globals.PointTest);
  60166. $core.addMethod(
  60167. $core.method({
  60168. selector: "testNew",
  60169. protocol: "tests",
  60170. fn: function (){
  60171. var self=this,$self=this;
  60172. return $core.withContext(function($ctx1) {
  60173. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  60174. $3=$recv($globals.Point)._new();
  60175. $ctx1.sendIdx["new"]=1;
  60176. $2=$recv($3)._x_((3));
  60177. $ctx1.sendIdx["x:"]=1;
  60178. $1=$recv($2)._y();
  60179. $ctx1.sendIdx["y"]=1;
  60180. $self._assert_equals_($1,nil);
  60181. $ctx1.sendIdx["assert:equals:"]=1;
  60182. $7=$recv($globals.Point)._new();
  60183. $ctx1.sendIdx["new"]=2;
  60184. $6=$recv($7)._x_((3));
  60185. $5=$recv($6)._x();
  60186. $ctx1.sendIdx["x"]=1;
  60187. $4=$recv($5).__eq((0));
  60188. $ctx1.sendIdx["="]=1;
  60189. $self._deny_($4);
  60190. $ctx1.sendIdx["deny:"]=1;
  60191. $10=$recv($globals.Point)._new();
  60192. $ctx1.sendIdx["new"]=3;
  60193. $9=$recv($10)._y_((4));
  60194. $ctx1.sendIdx["y:"]=1;
  60195. $8=$recv($9)._x();
  60196. $self._assert_equals_($8,nil);
  60197. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  60198. return self;
  60199. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  60200. },
  60201. args: [],
  60202. 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",
  60203. referencedClasses: ["Point"],
  60204. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  60205. }),
  60206. $globals.PointTest);
  60207. $core.addMethod(
  60208. $core.method({
  60209. selector: "testNormal",
  60210. protocol: "tests",
  60211. fn: function (){
  60212. var self=this,$self=this;
  60213. return $core.withContext(function($ctx1) {
  60214. var $2,$1;
  60215. $2=(1).__at((0));
  60216. $ctx1.sendIdx["@"]=1;
  60217. $1=$recv($2)._normal();
  60218. $self._assert_equals_($1,(0).__at((1)));
  60219. return self;
  60220. }, function($ctx1) {$ctx1.fill(self,"testNormal",{},$globals.PointTest)});
  60221. },
  60222. args: [],
  60223. source: "testNormal\x0a\x09self assert: (1@0) normal equals: 0@1",
  60224. referencedClasses: [],
  60225. messageSends: ["assert:equals:", "normal", "@"]
  60226. }),
  60227. $globals.PointTest);
  60228. $core.addMethod(
  60229. $core.method({
  60230. selector: "testNormalized",
  60231. protocol: "tests",
  60232. fn: function (){
  60233. var self=this,$self=this;
  60234. return $core.withContext(function($ctx1) {
  60235. var $2,$1,$3,$5,$4;
  60236. $2=(0).__at((2));
  60237. $ctx1.sendIdx["@"]=1;
  60238. $1=$recv($2)._normalized();
  60239. $ctx1.sendIdx["normalized"]=1;
  60240. $3=(0).__at((1));
  60241. $ctx1.sendIdx["@"]=2;
  60242. $self._assert_equals_($1,$3);
  60243. $ctx1.sendIdx["assert:equals:"]=1;
  60244. $5=(0).__at((0));
  60245. $ctx1.sendIdx["@"]=3;
  60246. $4=$recv($5)._normalized();
  60247. $self._assert_equals_($4,(0).__at((0)));
  60248. return self;
  60249. }, function($ctx1) {$ctx1.fill(self,"testNormalized",{},$globals.PointTest)});
  60250. },
  60251. args: [],
  60252. source: "testNormalized\x0a\x09self assert: (0@2) normalized equals: 0@1.\x0a\x09self assert: (0@0) normalized equals: 0@0.",
  60253. referencedClasses: [],
  60254. messageSends: ["assert:equals:", "normalized", "@"]
  60255. }),
  60256. $globals.PointTest);
  60257. $core.addMethod(
  60258. $core.method({
  60259. selector: "testPolarCoordinates",
  60260. protocol: "tests",
  60261. fn: function (){
  60262. var self=this,$self=this;
  60263. return $core.withContext(function($ctx1) {
  60264. var $2,$1;
  60265. $2=(1).__at((0));
  60266. $ctx1.sendIdx["@"]=1;
  60267. $1=$recv($2)._r();
  60268. $ctx1.sendIdx["r"]=1;
  60269. $self._assert_equals_($1,(1));
  60270. $ctx1.sendIdx["assert:equals:"]=1;
  60271. $self._assert_equals_($recv((0).__at((0)))._r(),(0));
  60272. return self;
  60273. }, function($ctx1) {$ctx1.fill(self,"testPolarCoordinates",{},$globals.PointTest)});
  60274. },
  60275. args: [],
  60276. source: "testPolarCoordinates\x0a\x09self assert: (1@0) r equals: 1.\x0a\x09self assert: (0@0) r equals: 0.",
  60277. referencedClasses: [],
  60278. messageSends: ["assert:equals:", "r", "@"]
  60279. }),
  60280. $globals.PointTest);
  60281. $core.addMethod(
  60282. $core.method({
  60283. selector: "testRectangleCreation",
  60284. protocol: "tests",
  60285. fn: function (){
  60286. var self=this,$self=this;
  60287. return $core.withContext(function($ctx1) {
  60288. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$16;
  60289. $2=(1).__at((1));
  60290. $ctx1.sendIdx["@"]=1;
  60291. $3=(2).__at((2));
  60292. $ctx1.sendIdx["@"]=2;
  60293. $1=$recv($2)._corner_($3);
  60294. $5=(1).__at((1));
  60295. $ctx1.sendIdx["@"]=3;
  60296. $6=(2).__at((2));
  60297. $ctx1.sendIdx["@"]=4;
  60298. $4=$recv($globals.Rectangle)._origin_corner_($5,$6);
  60299. $self._assert_equals_($1,$4);
  60300. $ctx1.sendIdx["assert:equals:"]=1;
  60301. $8=(1).__at((1));
  60302. $ctx1.sendIdx["@"]=5;
  60303. $9=(2).__at((2));
  60304. $ctx1.sendIdx["@"]=6;
  60305. $7=$recv($8)._rectangle_($9);
  60306. $11=(1).__at((1));
  60307. $ctx1.sendIdx["@"]=7;
  60308. $12=(2).__at((2));
  60309. $ctx1.sendIdx["@"]=8;
  60310. $10=$recv($globals.Rectangle)._point_point_($11,$12);
  60311. $self._assert_equals_($7,$10);
  60312. $ctx1.sendIdx["assert:equals:"]=2;
  60313. $14=(1).__at((1));
  60314. $ctx1.sendIdx["@"]=9;
  60315. $15=(2).__at((2));
  60316. $ctx1.sendIdx["@"]=10;
  60317. $13=$recv($14)._extent_($15);
  60318. $17=(1).__at((1));
  60319. $ctx1.sendIdx["@"]=11;
  60320. $16=$recv($globals.Rectangle)._origin_extent_($17,(2).__at((2)));
  60321. $self._assert_equals_($13,$16);
  60322. return self;
  60323. }, function($ctx1) {$ctx1.fill(self,"testRectangleCreation",{},$globals.PointTest)});
  60324. },
  60325. args: [],
  60326. 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)",
  60327. referencedClasses: ["Rectangle"],
  60328. messageSends: ["assert:equals:", "corner:", "@", "origin:corner:", "rectangle:", "point:point:", "extent:", "origin:extent:"]
  60329. }),
  60330. $globals.PointTest);
  60331. $core.addMethod(
  60332. $core.method({
  60333. selector: "testTranslateBy",
  60334. protocol: "tests",
  60335. fn: function (){
  60336. var self=this,$self=this;
  60337. return $core.withContext(function($ctx1) {
  60338. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  60339. $2=(3).__at((3));
  60340. $ctx1.sendIdx["@"]=1;
  60341. $3=(0).__at((1));
  60342. $ctx1.sendIdx["@"]=2;
  60343. $1=$recv($2)._translateBy_($3);
  60344. $ctx1.sendIdx["translateBy:"]=1;
  60345. $4=(3).__at((4));
  60346. $ctx1.sendIdx["@"]=3;
  60347. $self._assert_equals_($1,$4);
  60348. $ctx1.sendIdx["assert:equals:"]=1;
  60349. $6=(3).__at((3));
  60350. $ctx1.sendIdx["@"]=4;
  60351. $8=(1)._negated();
  60352. $ctx1.sendIdx["negated"]=1;
  60353. $7=(0).__at($8);
  60354. $ctx1.sendIdx["@"]=5;
  60355. $5=$recv($6)._translateBy_($7);
  60356. $ctx1.sendIdx["translateBy:"]=2;
  60357. $9=(3).__at((2));
  60358. $ctx1.sendIdx["@"]=6;
  60359. $self._assert_equals_($5,$9);
  60360. $ctx1.sendIdx["assert:equals:"]=2;
  60361. $11=(3).__at((3));
  60362. $ctx1.sendIdx["@"]=7;
  60363. $12=(2).__at((3));
  60364. $ctx1.sendIdx["@"]=8;
  60365. $10=$recv($11)._translateBy_($12);
  60366. $ctx1.sendIdx["translateBy:"]=3;
  60367. $13=(5).__at((6));
  60368. $ctx1.sendIdx["@"]=9;
  60369. $self._assert_equals_($10,$13);
  60370. $ctx1.sendIdx["assert:equals:"]=3;
  60371. $15=(3).__at((3));
  60372. $ctx1.sendIdx["@"]=10;
  60373. $16=$recv((3)._negated()).__at((0));
  60374. $ctx1.sendIdx["@"]=11;
  60375. $14=$recv($15)._translateBy_($16);
  60376. $self._assert_equals_($14,(0).__at((3)));
  60377. return self;
  60378. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  60379. },
  60380. args: [],
  60381. 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.",
  60382. referencedClasses: [],
  60383. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  60384. }),
  60385. $globals.PointTest);
  60386. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  60387. $core.addMethod(
  60388. $core.method({
  60389. selector: "testNextIfAbsent",
  60390. protocol: "tests",
  60391. fn: function (){
  60392. var self=this,$self=this;
  60393. var queue;
  60394. return $core.withContext(function($ctx1) {
  60395. var $2,$1;
  60396. queue=$recv($globals.Queue)._new();
  60397. $recv(queue)._nextPut_("index1");
  60398. $2=$recv(queue)._nextIfAbsent_("empty");
  60399. $ctx1.sendIdx["nextIfAbsent:"]=1;
  60400. $1=$recv($2).__eq("index1");
  60401. $ctx1.sendIdx["="]=1;
  60402. $self._assert_($1);
  60403. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  60404. return self;
  60405. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  60406. },
  60407. args: [],
  60408. 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'",
  60409. referencedClasses: ["Queue"],
  60410. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  60411. }),
  60412. $globals.QueueTest);
  60413. $core.addMethod(
  60414. $core.method({
  60415. selector: "testQueueNext",
  60416. protocol: "tests",
  60417. fn: function (){
  60418. var self=this,$self=this;
  60419. var queue;
  60420. return $core.withContext(function($ctx1) {
  60421. var $1,$3,$2,$5,$4;
  60422. queue=$recv($globals.Queue)._new();
  60423. $1=queue;
  60424. $recv($1)._nextPut_("index1");
  60425. $ctx1.sendIdx["nextPut:"]=1;
  60426. $recv($1)._nextPut_("index2");
  60427. $3=$recv(queue)._next();
  60428. $ctx1.sendIdx["next"]=1;
  60429. $2=$recv($3).__eq("index1");
  60430. $ctx1.sendIdx["="]=1;
  60431. $self._assert_($2);
  60432. $5=$recv(queue)._next();
  60433. $ctx1.sendIdx["next"]=2;
  60434. $4=$recv($5).__eq("index");
  60435. $self._deny_($4);
  60436. $self._should_raise_((function(){
  60437. return $core.withContext(function($ctx2) {
  60438. return $recv(queue)._next();
  60439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60440. }),$globals.Error);
  60441. return self;
  60442. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  60443. },
  60444. args: [],
  60445. 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",
  60446. referencedClasses: ["Queue", "Error"],
  60447. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  60448. }),
  60449. $globals.QueueTest);
  60450. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  60451. $core.addMethod(
  60452. $core.method({
  60453. selector: "testAtRandomNumber",
  60454. protocol: "tests",
  60455. fn: function (){
  60456. var self=this,$self=this;
  60457. var val;
  60458. return $core.withContext(function($ctx1) {
  60459. (100)._timesRepeat_((function(){
  60460. return $core.withContext(function($ctx2) {
  60461. val=(10)._atRandom();
  60462. $self._assert_($recv(val).__gt((0)));
  60463. $ctx2.sendIdx["assert:"]=1;
  60464. return $self._assert_($recv(val).__lt((11)));
  60465. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60466. }));
  60467. return self;
  60468. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  60469. },
  60470. args: [],
  60471. 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]",
  60472. referencedClasses: [],
  60473. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  60474. }),
  60475. $globals.RandomTest);
  60476. $core.addMethod(
  60477. $core.method({
  60478. selector: "testAtRandomSequenceableCollection",
  60479. protocol: "tests",
  60480. fn: function (){
  60481. var self=this,$self=this;
  60482. var val;
  60483. return $core.withContext(function($ctx1) {
  60484. var $3,$4,$2,$1;
  60485. (100)._timesRepeat_((function(){
  60486. return $core.withContext(function($ctx2) {
  60487. val="abc"._atRandom();
  60488. $3=$recv(val).__eq("a");
  60489. $ctx2.sendIdx["="]=1;
  60490. $4=$recv(val).__eq("b");
  60491. $ctx2.sendIdx["="]=2;
  60492. $2=$recv($3).__or($4);
  60493. $1=$recv($2).__or($recv(val).__eq("c"));
  60494. $ctx2.sendIdx["|"]=1;
  60495. return $self._assert_($1);
  60496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60497. }));
  60498. return self;
  60499. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  60500. },
  60501. args: [],
  60502. 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].",
  60503. referencedClasses: [],
  60504. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  60505. }),
  60506. $globals.RandomTest);
  60507. $core.addMethod(
  60508. $core.method({
  60509. selector: "textNext",
  60510. protocol: "tests",
  60511. fn: function (){
  60512. var self=this,$self=this;
  60513. return $core.withContext(function($ctx1) {
  60514. var $1;
  60515. (10000)._timesRepeat_((function(){
  60516. var current,next;
  60517. return $core.withContext(function($ctx2) {
  60518. next=$recv($recv($globals.Random)._new())._next();
  60519. $self._assert_($recv(next).__gt_eq((0)));
  60520. $ctx2.sendIdx["assert:"]=1;
  60521. $self._assert_($recv(next).__lt((1)));
  60522. $1=$recv(current).__eq(next);
  60523. $ctx2.sendIdx["="]=1;
  60524. $self._deny_($1);
  60525. return $recv(next).__eq(current);
  60526. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  60527. }));
  60528. return self;
  60529. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  60530. },
  60531. args: [],
  60532. 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 ]",
  60533. referencedClasses: ["Random"],
  60534. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  60535. }),
  60536. $globals.RandomTest);
  60537. $core.addClass("RectangleTest", $globals.TestCase, [], "Kernel-Tests");
  60538. $core.addMethod(
  60539. $core.method({
  60540. selector: "testContainsPoint",
  60541. protocol: "tests",
  60542. fn: function (){
  60543. var self=this,$self=this;
  60544. var rect;
  60545. return $core.withContext(function($ctx1) {
  60546. var $1,$2,$4,$5,$3;
  60547. $1=(0).__at((0));
  60548. $ctx1.sendIdx["@"]=1;
  60549. $2=(4).__at((4));
  60550. $ctx1.sendIdx["@"]=2;
  60551. rect=$recv($globals.Rectangle)._origin_corner_($1,$2);
  60552. $4=rect;
  60553. $5=(1).__at((2));
  60554. $ctx1.sendIdx["@"]=3;
  60555. $3=$recv($4)._containsPoint_($5);
  60556. $ctx1.sendIdx["containsPoint:"]=1;
  60557. $self._assert_($3);
  60558. $ctx1.sendIdx["assert:"]=1;
  60559. $self._assert_($recv($recv(rect)._containsPoint_((5).__at((4))))._not());
  60560. return self;
  60561. }, function($ctx1) {$ctx1.fill(self,"testContainsPoint",{rect:rect},$globals.RectangleTest)});
  60562. },
  60563. args: [],
  60564. 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.",
  60565. referencedClasses: ["Rectangle"],
  60566. messageSends: ["origin:corner:", "@", "assert:", "containsPoint:", "not"]
  60567. }),
  60568. $globals.RectangleTest);
  60569. $core.addMethod(
  60570. $core.method({
  60571. selector: "testContainsRect",
  60572. protocol: "tests",
  60573. fn: function (){
  60574. var self=this,$self=this;
  60575. return $core.withContext(function($ctx1) {
  60576. var $3,$4,$2,$6,$7,$5,$1,$11,$12,$10,$14,$13,$9,$8;
  60577. $3=(0).__at((0));
  60578. $ctx1.sendIdx["@"]=1;
  60579. $4=(6).__at((6));
  60580. $ctx1.sendIdx["@"]=2;
  60581. $2=$recv($globals.Rectangle)._origin_corner_($3,$4);
  60582. $ctx1.sendIdx["origin:corner:"]=1;
  60583. $6=(1).__at((1));
  60584. $ctx1.sendIdx["@"]=3;
  60585. $7=(5).__at((5));
  60586. $ctx1.sendIdx["@"]=4;
  60587. $5=$recv($globals.Rectangle)._origin_corner_($6,$7);
  60588. $ctx1.sendIdx["origin:corner:"]=2;
  60589. $1=$recv($2)._containsRect_($5);
  60590. $ctx1.sendIdx["containsRect:"]=1;
  60591. $self._assert_($1);
  60592. $ctx1.sendIdx["assert:"]=1;
  60593. $11=(0).__at((0));
  60594. $ctx1.sendIdx["@"]=5;
  60595. $12=(6).__at((6));
  60596. $ctx1.sendIdx["@"]=6;
  60597. $10=$recv($globals.Rectangle)._origin_corner_($11,$12);
  60598. $ctx1.sendIdx["origin:corner:"]=3;
  60599. $14=(1).__at((-1));
  60600. $ctx1.sendIdx["@"]=7;
  60601. $13=$recv($globals.Rectangle)._origin_corner_($14,(5).__at((5)));
  60602. $9=$recv($10)._containsRect_($13);
  60603. $8=$recv($9)._not();
  60604. $self._assert_($8);
  60605. return self;
  60606. }, function($ctx1) {$ctx1.fill(self,"testContainsRect",{},$globals.RectangleTest)});
  60607. },
  60608. args: [],
  60609. 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.",
  60610. referencedClasses: ["Rectangle"],
  60611. messageSends: ["assert:", "containsRect:", "origin:corner:", "@", "not"]
  60612. }),
  60613. $globals.RectangleTest);
  60614. $core.addMethod(
  60615. $core.method({
  60616. selector: "testOriginExtent",
  60617. protocol: "tests",
  60618. fn: function (){
  60619. var self=this,$self=this;
  60620. var rectangle;
  60621. return $core.withContext(function($ctx1) {
  60622. var $1,$2,$3,$4;
  60623. $1=(3).__at((4));
  60624. $ctx1.sendIdx["@"]=1;
  60625. $2=(7).__at((8));
  60626. $ctx1.sendIdx["@"]=2;
  60627. rectangle=$recv($globals.Rectangle)._origin_extent_($1,$2);
  60628. $3=$recv(rectangle)._origin();
  60629. $4=(3).__at((4));
  60630. $ctx1.sendIdx["@"]=3;
  60631. $self._assert_equals_($3,$4);
  60632. $ctx1.sendIdx["assert:equals:"]=1;
  60633. $self._assert_equals_($recv(rectangle)._corner(),(10).__at((12)));
  60634. return self;
  60635. }, function($ctx1) {$ctx1.fill(self,"testOriginExtent",{rectangle:rectangle},$globals.RectangleTest)});
  60636. },
  60637. args: [],
  60638. 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.",
  60639. referencedClasses: ["Rectangle"],
  60640. messageSends: ["origin:extent:", "@", "assert:equals:", "origin", "corner"]
  60641. }),
  60642. $globals.RectangleTest);
  60643. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  60644. $core.addMethod(
  60645. $core.method({
  60646. selector: "collectionClass",
  60647. protocol: "accessing",
  60648. fn: function (){
  60649. var self=this,$self=this;
  60650. return $core.withContext(function($ctx1) {
  60651. return $recv($self._class())._collectionClass();
  60652. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  60653. },
  60654. args: [],
  60655. source: "collectionClass\x0a\x09^ self class collectionClass",
  60656. referencedClasses: [],
  60657. messageSends: ["collectionClass", "class"]
  60658. }),
  60659. $globals.StreamTest);
  60660. $core.addMethod(
  60661. $core.method({
  60662. selector: "newCollection",
  60663. protocol: "accessing",
  60664. fn: function (){
  60665. var self=this,$self=this;
  60666. return $core.withContext(function($ctx1) {
  60667. return $recv($self._collectionClass())._new();
  60668. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  60669. },
  60670. args: [],
  60671. source: "newCollection\x0a\x09^ self collectionClass new",
  60672. referencedClasses: [],
  60673. messageSends: ["new", "collectionClass"]
  60674. }),
  60675. $globals.StreamTest);
  60676. $core.addMethod(
  60677. $core.method({
  60678. selector: "newStream",
  60679. protocol: "accessing",
  60680. fn: function (){
  60681. var self=this,$self=this;
  60682. return $core.withContext(function($ctx1) {
  60683. return $recv($recv($self._collectionClass())._new())._stream();
  60684. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  60685. },
  60686. args: [],
  60687. source: "newStream\x0a\x09^ self collectionClass new stream",
  60688. referencedClasses: [],
  60689. messageSends: ["stream", "new", "collectionClass"]
  60690. }),
  60691. $globals.StreamTest);
  60692. $core.addMethod(
  60693. $core.method({
  60694. selector: "testAtStartAtEnd",
  60695. protocol: "tests",
  60696. fn: function (){
  60697. var self=this,$self=this;
  60698. var stream;
  60699. return $core.withContext(function($ctx1) {
  60700. var $1,$2,$3,$4;
  60701. stream=$self._newStream();
  60702. $1=$recv(stream)._atStart();
  60703. $ctx1.sendIdx["atStart"]=1;
  60704. $self._assert_($1);
  60705. $ctx1.sendIdx["assert:"]=1;
  60706. $2=$recv(stream)._atEnd();
  60707. $ctx1.sendIdx["atEnd"]=1;
  60708. $self._assert_($2);
  60709. $ctx1.sendIdx["assert:"]=2;
  60710. $recv(stream)._nextPutAll_($self._newCollection());
  60711. $3=$recv(stream)._atEnd();
  60712. $ctx1.sendIdx["atEnd"]=2;
  60713. $self._assert_($3);
  60714. $4=$recv(stream)._atStart();
  60715. $ctx1.sendIdx["atStart"]=2;
  60716. $self._deny_($4);
  60717. $ctx1.sendIdx["deny:"]=1;
  60718. $recv(stream)._position_((1));
  60719. $self._deny_($recv(stream)._atEnd());
  60720. $ctx1.sendIdx["deny:"]=2;
  60721. $self._deny_($recv(stream)._atStart());
  60722. return self;
  60723. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  60724. },
  60725. args: [],
  60726. 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",
  60727. referencedClasses: [],
  60728. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  60729. }),
  60730. $globals.StreamTest);
  60731. $core.addMethod(
  60732. $core.method({
  60733. selector: "testContents",
  60734. protocol: "tests",
  60735. fn: function (){
  60736. var self=this,$self=this;
  60737. var stream;
  60738. return $core.withContext(function($ctx1) {
  60739. var $1,$2;
  60740. stream=$self._newStream();
  60741. $1=stream;
  60742. $2=$self._newCollection();
  60743. $ctx1.sendIdx["newCollection"]=1;
  60744. $recv($1)._nextPutAll_($2);
  60745. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  60746. return self;
  60747. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  60748. },
  60749. args: [],
  60750. 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",
  60751. referencedClasses: [],
  60752. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  60753. }),
  60754. $globals.StreamTest);
  60755. $core.addMethod(
  60756. $core.method({
  60757. selector: "testIsEmpty",
  60758. protocol: "tests",
  60759. fn: function (){
  60760. var self=this,$self=this;
  60761. var stream;
  60762. return $core.withContext(function($ctx1) {
  60763. var $1;
  60764. stream=$self._newStream();
  60765. $1=$recv(stream)._isEmpty();
  60766. $ctx1.sendIdx["isEmpty"]=1;
  60767. $self._assert_($1);
  60768. $recv(stream)._nextPutAll_($self._newCollection());
  60769. $self._deny_($recv(stream)._isEmpty());
  60770. return self;
  60771. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  60772. },
  60773. args: [],
  60774. 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",
  60775. referencedClasses: [],
  60776. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  60777. }),
  60778. $globals.StreamTest);
  60779. $core.addMethod(
  60780. $core.method({
  60781. selector: "testPosition",
  60782. protocol: "tests",
  60783. fn: function (){
  60784. var self=this,$self=this;
  60785. var collection,stream;
  60786. return $core.withContext(function($ctx1) {
  60787. var $1,$2,$3;
  60788. collection=$self._newCollection();
  60789. stream=$self._newStream();
  60790. $recv(stream)._nextPutAll_(collection);
  60791. $1=$recv(stream)._position();
  60792. $ctx1.sendIdx["position"]=1;
  60793. $self._assert_equals_($1,$recv(collection)._size());
  60794. $ctx1.sendIdx["assert:equals:"]=1;
  60795. $recv(stream)._position_((0));
  60796. $2=$recv(stream)._position();
  60797. $ctx1.sendIdx["position"]=2;
  60798. $self._assert_equals_($2,(0));
  60799. $ctx1.sendIdx["assert:equals:"]=2;
  60800. $recv(stream)._next();
  60801. $ctx1.sendIdx["next"]=1;
  60802. $3=$recv(stream)._position();
  60803. $ctx1.sendIdx["position"]=3;
  60804. $self._assert_equals_($3,(1));
  60805. $ctx1.sendIdx["assert:equals:"]=3;
  60806. $recv(stream)._next();
  60807. $self._assert_equals_($recv(stream)._position(),(2));
  60808. return self;
  60809. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  60810. },
  60811. args: [],
  60812. 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",
  60813. referencedClasses: [],
  60814. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  60815. }),
  60816. $globals.StreamTest);
  60817. $core.addMethod(
  60818. $core.method({
  60819. selector: "testReading",
  60820. protocol: "tests",
  60821. fn: function (){
  60822. var self=this,$self=this;
  60823. var stream,collection;
  60824. return $core.withContext(function($ctx1) {
  60825. var $1,$2;
  60826. collection=$self._newCollection();
  60827. stream=$self._newStream();
  60828. $1=stream;
  60829. $recv($1)._nextPutAll_(collection);
  60830. $recv($1)._position_((0));
  60831. $recv(collection)._do_((function(each){
  60832. return $core.withContext(function($ctx2) {
  60833. $2=$recv(stream)._next();
  60834. $ctx2.sendIdx["next"]=1;
  60835. return $self._assert_equals_($2,each);
  60836. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60837. }));
  60838. $self._assert_($recv($recv(stream)._next())._isNil());
  60839. return self;
  60840. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  60841. },
  60842. args: [],
  60843. 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",
  60844. referencedClasses: [],
  60845. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  60846. }),
  60847. $globals.StreamTest);
  60848. $core.addMethod(
  60849. $core.method({
  60850. selector: "testStreamContents",
  60851. protocol: "tests",
  60852. fn: function (){
  60853. var self=this,$self=this;
  60854. return self;
  60855. },
  60856. args: [],
  60857. source: "testStreamContents",
  60858. referencedClasses: [],
  60859. messageSends: []
  60860. }),
  60861. $globals.StreamTest);
  60862. $core.addMethod(
  60863. $core.method({
  60864. selector: "testWrite",
  60865. protocol: "tests",
  60866. fn: function (){
  60867. var self=this,$self=this;
  60868. var stream,collection;
  60869. return $core.withContext(function($ctx1) {
  60870. collection=$self._newCollection();
  60871. stream=$self._newStream();
  60872. $recv(collection)._do_((function(each){
  60873. return $core.withContext(function($ctx2) {
  60874. return $recv(stream).__lt_lt(each);
  60875. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60876. }));
  60877. $self._assert_equals_($recv(stream)._contents(),collection);
  60878. return self;
  60879. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  60880. },
  60881. args: [],
  60882. 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",
  60883. referencedClasses: [],
  60884. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  60885. }),
  60886. $globals.StreamTest);
  60887. $core.addMethod(
  60888. $core.method({
  60889. selector: "testWriting",
  60890. protocol: "tests",
  60891. fn: function (){
  60892. var self=this,$self=this;
  60893. var stream,collection;
  60894. return $core.withContext(function($ctx1) {
  60895. var $1;
  60896. collection=$self._newCollection();
  60897. stream=$self._newStream();
  60898. $ctx1.sendIdx["newStream"]=1;
  60899. $recv(collection)._do_((function(each){
  60900. return $core.withContext(function($ctx2) {
  60901. return $recv(stream)._nextPut_(each);
  60902. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60903. }));
  60904. $1=$recv(stream)._contents();
  60905. $ctx1.sendIdx["contents"]=1;
  60906. $self._assert_equals_($1,collection);
  60907. $ctx1.sendIdx["assert:equals:"]=1;
  60908. stream=$self._newStream();
  60909. $recv(stream)._nextPutAll_(collection);
  60910. $self._assert_equals_($recv(stream)._contents(),collection);
  60911. return self;
  60912. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  60913. },
  60914. args: [],
  60915. 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",
  60916. referencedClasses: [],
  60917. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  60918. }),
  60919. $globals.StreamTest);
  60920. $core.addMethod(
  60921. $core.method({
  60922. selector: "collectionClass",
  60923. protocol: "accessing",
  60924. fn: function (){
  60925. var self=this,$self=this;
  60926. return nil;
  60927. },
  60928. args: [],
  60929. source: "collectionClass\x0a\x09^ nil",
  60930. referencedClasses: [],
  60931. messageSends: []
  60932. }),
  60933. $globals.StreamTest.a$cls);
  60934. $core.addMethod(
  60935. $core.method({
  60936. selector: "isAbstract",
  60937. protocol: "testing",
  60938. fn: function (){
  60939. var self=this,$self=this;
  60940. return $core.withContext(function($ctx1) {
  60941. return $recv($self._collectionClass())._isNil();
  60942. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.a$cls)});
  60943. },
  60944. args: [],
  60945. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  60946. referencedClasses: [],
  60947. messageSends: ["isNil", "collectionClass"]
  60948. }),
  60949. $globals.StreamTest.a$cls);
  60950. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  60951. $core.addMethod(
  60952. $core.method({
  60953. selector: "newCollection",
  60954. protocol: "accessing",
  60955. fn: function (){
  60956. var self=this,$self=this;
  60957. return $core.withContext(function($ctx1) {
  60958. return [true,(1),(3).__at((4)),"foo"];
  60959. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  60960. },
  60961. args: [],
  60962. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  60963. referencedClasses: [],
  60964. messageSends: ["@"]
  60965. }),
  60966. $globals.ArrayStreamTest);
  60967. $core.addMethod(
  60968. $core.method({
  60969. selector: "collectionClass",
  60970. protocol: "accessing",
  60971. fn: function (){
  60972. var self=this,$self=this;
  60973. return $globals.Array;
  60974. },
  60975. args: [],
  60976. source: "collectionClass\x0a\x09^ Array",
  60977. referencedClasses: ["Array"],
  60978. messageSends: []
  60979. }),
  60980. $globals.ArrayStreamTest.a$cls);
  60981. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  60982. $core.addMethod(
  60983. $core.method({
  60984. selector: "newCollection",
  60985. protocol: "accessing",
  60986. fn: function (){
  60987. var self=this,$self=this;
  60988. return "hello world";
  60989. },
  60990. args: [],
  60991. source: "newCollection\x0a\x09^ 'hello world'",
  60992. referencedClasses: [],
  60993. messageSends: []
  60994. }),
  60995. $globals.StringStreamTest);
  60996. $core.addMethod(
  60997. $core.method({
  60998. selector: "collectionClass",
  60999. protocol: "accessing",
  61000. fn: function (){
  61001. var self=this,$self=this;
  61002. return $globals.String;
  61003. },
  61004. args: [],
  61005. source: "collectionClass\x0a\x09^ String",
  61006. referencedClasses: ["String"],
  61007. messageSends: []
  61008. }),
  61009. $globals.StringStreamTest.a$cls);
  61010. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  61011. $core.addMethod(
  61012. $core.method({
  61013. selector: "testCopying",
  61014. protocol: "tests",
  61015. fn: function (){
  61016. var self=this,$self=this;
  61017. return $core.withContext(function($ctx1) {
  61018. $self._assert_equals_(nil._copy(),nil);
  61019. return self;
  61020. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  61021. },
  61022. args: [],
  61023. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  61024. referencedClasses: [],
  61025. messageSends: ["assert:equals:", "copy"]
  61026. }),
  61027. $globals.UndefinedTest);
  61028. $core.addMethod(
  61029. $core.method({
  61030. selector: "testDeepCopy",
  61031. protocol: "tests",
  61032. fn: function (){
  61033. var self=this,$self=this;
  61034. return $core.withContext(function($ctx1) {
  61035. $self._assert_($recv(nil._deepCopy()).__eq(nil));
  61036. return self;
  61037. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  61038. },
  61039. args: [],
  61040. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  61041. referencedClasses: [],
  61042. messageSends: ["assert:", "=", "deepCopy"]
  61043. }),
  61044. $globals.UndefinedTest);
  61045. $core.addMethod(
  61046. $core.method({
  61047. selector: "testIfNil",
  61048. protocol: "tests",
  61049. fn: function (){
  61050. var self=this,$self=this;
  61051. return $core.withContext(function($ctx1) {
  61052. var $1,$3,$2,$4,$6,$5,$receiver;
  61053. if(($receiver = nil) == null || $receiver.a$nil){
  61054. $1=true;
  61055. } else {
  61056. $1=nil;
  61057. }
  61058. $self._assert_equals_($1,true);
  61059. $ctx1.sendIdx["assert:equals:"]=1;
  61060. if(($receiver = nil) == null || $receiver.a$nil){
  61061. $3=nil;
  61062. } else {
  61063. $3=true;
  61064. }
  61065. $2=$recv($3).__eq(true);
  61066. $ctx1.sendIdx["="]=1;
  61067. $self._deny_($2);
  61068. $ctx1.sendIdx["deny:"]=1;
  61069. if(($receiver = nil) == null || $receiver.a$nil){
  61070. $4=true;
  61071. } else {
  61072. $4=false;
  61073. }
  61074. $self._assert_equals_($4,true);
  61075. if(($receiver = nil) == null || $receiver.a$nil){
  61076. $6=false;
  61077. } else {
  61078. $6=true;
  61079. }
  61080. $5=$recv($6).__eq(true);
  61081. $self._deny_($5);
  61082. return self;
  61083. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  61084. },
  61085. args: [],
  61086. 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",
  61087. referencedClasses: [],
  61088. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  61089. }),
  61090. $globals.UndefinedTest);
  61091. $core.addMethod(
  61092. $core.method({
  61093. selector: "testIsNil",
  61094. protocol: "tests",
  61095. fn: function (){
  61096. var self=this,$self=this;
  61097. return $core.withContext(function($ctx1) {
  61098. $self._assert_(nil._isNil());
  61099. $self._deny_(nil._notNil());
  61100. return self;
  61101. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  61102. },
  61103. args: [],
  61104. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  61105. referencedClasses: [],
  61106. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  61107. }),
  61108. $globals.UndefinedTest);
  61109. });
  61110. define('amber_core/Platform-DOM-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  61111. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61112. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61113. $core.addPackage("Platform-DOM-Tests");
  61114. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].innerEval = function (expr) { return eval(expr); };
  61115. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61116. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  61117. $core.addMethod(
  61118. $core.method({
  61119. selector: "testEntityConversion",
  61120. protocol: "testing",
  61121. fn: function (){
  61122. var self=this,$self=this;
  61123. return $core.withContext(function($ctx1) {
  61124. var $1;
  61125. $1=$recv($globals.PlatformDom)._isFeasible();
  61126. if($core.assert($1)){
  61127. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  61128. }
  61129. return self;
  61130. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  61131. },
  61132. args: [],
  61133. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  61134. referencedClasses: ["PlatformDom"],
  61135. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  61136. }),
  61137. $globals.PlatformDomTest);
  61138. $core.addMethod(
  61139. $core.method({
  61140. selector: "testTextContentDoesNotRunScript",
  61141. protocol: "testing",
  61142. fn: function (){
  61143. var self=this,$self=this;
  61144. return $core.withContext(function($ctx1) {
  61145. var $1;
  61146. $1=$recv($globals.PlatformDom)._isFeasible();
  61147. if($core.assert($1)){
  61148. $self._shouldnt_raise_((function(){
  61149. return $core.withContext(function($ctx2) {
  61150. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  61151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61152. }),$globals.Error);
  61153. }
  61154. return self;
  61155. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  61156. },
  61157. args: [],
  61158. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  61159. referencedClasses: ["PlatformDom", "Error"],
  61160. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  61161. }),
  61162. $globals.PlatformDomTest);
  61163. });
  61164. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  61165. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61166. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61167. $core.addPackage("SUnit-Tests");
  61168. ($core.packageDescriptors||$core.packages)["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  61169. ($core.packageDescriptors||$core.packages)["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61170. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  61171. $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.";
  61172. $core.addMethod(
  61173. $core.method({
  61174. selector: "setUp",
  61175. protocol: "running",
  61176. fn: function (){
  61177. var self=this,$self=this;
  61178. return $core.withContext(function($ctx1) {
  61179. $self["@empty"]=$recv($globals.Set)._new();
  61180. $self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  61181. return self;
  61182. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  61183. },
  61184. args: [],
  61185. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  61186. referencedClasses: ["Set"],
  61187. messageSends: ["new", "with:with:"]
  61188. }),
  61189. $globals.ExampleSetTest);
  61190. $core.addMethod(
  61191. $core.method({
  61192. selector: "testAdd",
  61193. protocol: "tests",
  61194. fn: function (){
  61195. var self=this,$self=this;
  61196. return $core.withContext(function($ctx1) {
  61197. $recv($self["@empty"])._add_((5));
  61198. $self._assert_($recv($self["@empty"])._includes_((5)));
  61199. return self;
  61200. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  61201. },
  61202. args: [],
  61203. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  61204. referencedClasses: [],
  61205. messageSends: ["add:", "assert:", "includes:"]
  61206. }),
  61207. $globals.ExampleSetTest);
  61208. $core.addMethod(
  61209. $core.method({
  61210. selector: "testGrow",
  61211. protocol: "tests",
  61212. fn: function (){
  61213. var self=this,$self=this;
  61214. return $core.withContext(function($ctx1) {
  61215. $recv($self["@empty"])._addAll_((1)._to_((100)));
  61216. $self._assert_equals_($recv($self["@empty"])._size(),(100));
  61217. return self;
  61218. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  61219. },
  61220. args: [],
  61221. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  61222. referencedClasses: [],
  61223. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  61224. }),
  61225. $globals.ExampleSetTest);
  61226. $core.addMethod(
  61227. $core.method({
  61228. selector: "testIllegal",
  61229. protocol: "tests",
  61230. fn: function (){
  61231. var self=this,$self=this;
  61232. return $core.withContext(function($ctx1) {
  61233. $self._should_raise_((function(){
  61234. return $core.withContext(function($ctx2) {
  61235. return $recv($self["@empty"])._at_((5));
  61236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61237. }),$globals.Error);
  61238. $ctx1.sendIdx["should:raise:"]=1;
  61239. $self._should_raise_((function(){
  61240. return $core.withContext(function($ctx2) {
  61241. return $recv($self["@empty"])._at_put_((5),"abc");
  61242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61243. }),$globals.Error);
  61244. return self;
  61245. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  61246. },
  61247. args: [],
  61248. 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",
  61249. referencedClasses: ["Error"],
  61250. messageSends: ["should:raise:", "at:", "at:put:"]
  61251. }),
  61252. $globals.ExampleSetTest);
  61253. $core.addMethod(
  61254. $core.method({
  61255. selector: "testIncludes",
  61256. protocol: "tests",
  61257. fn: function (){
  61258. var self=this,$self=this;
  61259. return $core.withContext(function($ctx1) {
  61260. var $1;
  61261. $1=$recv($self["@full"])._includes_((5));
  61262. $ctx1.sendIdx["includes:"]=1;
  61263. $self._assert_($1);
  61264. $ctx1.sendIdx["assert:"]=1;
  61265. $self._assert_($recv($self["@full"])._includes_("abc"));
  61266. return self;
  61267. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  61268. },
  61269. args: [],
  61270. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  61271. referencedClasses: [],
  61272. messageSends: ["assert:", "includes:"]
  61273. }),
  61274. $globals.ExampleSetTest);
  61275. $core.addMethod(
  61276. $core.method({
  61277. selector: "testOccurrences",
  61278. protocol: "tests",
  61279. fn: function (){
  61280. var self=this,$self=this;
  61281. return $core.withContext(function($ctx1) {
  61282. var $1,$2;
  61283. $1=$recv($self["@empty"])._occurrencesOf_((0));
  61284. $ctx1.sendIdx["occurrencesOf:"]=1;
  61285. $self._assert_equals_($1,(0));
  61286. $ctx1.sendIdx["assert:equals:"]=1;
  61287. $2=$recv($self["@full"])._occurrencesOf_((5));
  61288. $ctx1.sendIdx["occurrencesOf:"]=2;
  61289. $self._assert_equals_($2,(1));
  61290. $ctx1.sendIdx["assert:equals:"]=2;
  61291. $recv($self["@full"])._add_((5));
  61292. $self._assert_equals_($recv($self["@full"])._occurrencesOf_((5)),(1));
  61293. return self;
  61294. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  61295. },
  61296. args: [],
  61297. 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",
  61298. referencedClasses: [],
  61299. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  61300. }),
  61301. $globals.ExampleSetTest);
  61302. $core.addMethod(
  61303. $core.method({
  61304. selector: "testRemove",
  61305. protocol: "tests",
  61306. fn: function (){
  61307. var self=this,$self=this;
  61308. return $core.withContext(function($ctx1) {
  61309. var $1;
  61310. $recv($self["@full"])._remove_((5));
  61311. $1=$recv($self["@full"])._includes_("abc");
  61312. $ctx1.sendIdx["includes:"]=1;
  61313. $self._assert_($1);
  61314. $self._deny_($recv($self["@full"])._includes_((5)));
  61315. return self;
  61316. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  61317. },
  61318. args: [],
  61319. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  61320. referencedClasses: [],
  61321. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  61322. }),
  61323. $globals.ExampleSetTest);
  61324. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  61325. $core.addMethod(
  61326. $core.method({
  61327. selector: "fakeError",
  61328. protocol: "helpers",
  61329. fn: function (){
  61330. var self=this,$self=this;
  61331. return $core.withContext(function($ctx1) {
  61332. $self["@flag"]="bad";
  61333. $self._timeout_((30));
  61334. $self["@flag"]=$recv($self._async_((function(){
  61335. return $core.withContext(function($ctx2) {
  61336. $self["@flag"]="ok";
  61337. return $self._error_("Intentional");
  61338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61339. })))._valueWithTimeout_((20));
  61340. return self;
  61341. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  61342. },
  61343. args: [],
  61344. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  61345. referencedClasses: [],
  61346. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61347. }),
  61348. $globals.SUnitAsyncTest);
  61349. $core.addMethod(
  61350. $core.method({
  61351. selector: "fakeErrorFailingInTearDown",
  61352. protocol: "helpers",
  61353. fn: function (){
  61354. var self=this,$self=this;
  61355. return $core.withContext(function($ctx1) {
  61356. $self["@flag"]="bad";
  61357. $self._timeout_((30));
  61358. $self["@flag"]=$recv($self._async_((function(){
  61359. return $core.withContext(function($ctx2) {
  61360. return $self._error_("Intentional");
  61361. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61362. })))._valueWithTimeout_((20));
  61363. return self;
  61364. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  61365. },
  61366. args: [],
  61367. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  61368. referencedClasses: [],
  61369. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61370. }),
  61371. $globals.SUnitAsyncTest);
  61372. $core.addMethod(
  61373. $core.method({
  61374. selector: "fakeFailure",
  61375. protocol: "helpers",
  61376. fn: function (){
  61377. var self=this,$self=this;
  61378. return $core.withContext(function($ctx1) {
  61379. $self["@flag"]="bad";
  61380. $self._timeout_((30));
  61381. $self["@flag"]=$recv($self._async_((function(){
  61382. return $core.withContext(function($ctx2) {
  61383. $self["@flag"]="ok";
  61384. return $self._assert_(false);
  61385. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61386. })))._valueWithTimeout_((20));
  61387. return self;
  61388. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  61389. },
  61390. args: [],
  61391. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  61392. referencedClasses: [],
  61393. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  61394. }),
  61395. $globals.SUnitAsyncTest);
  61396. $core.addMethod(
  61397. $core.method({
  61398. selector: "fakeMultipleTimeoutFailing",
  61399. protocol: "helpers",
  61400. fn: function (){
  61401. var self=this,$self=this;
  61402. return $core.withContext(function($ctx1) {
  61403. var $1;
  61404. $self._timeout_((100));
  61405. $ctx1.sendIdx["timeout:"]=1;
  61406. $1=$self._async_((function(){
  61407. return $core.withContext(function($ctx2) {
  61408. $self._timeout_((20));
  61409. return $recv($self._async_((function(){
  61410. return $core.withContext(function($ctx3) {
  61411. return $self._finished();
  61412. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61413. })))._valueWithTimeout_((30));
  61414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61415. }));
  61416. $ctx1.sendIdx["async:"]=1;
  61417. $recv($1)._valueWithTimeout_((20));
  61418. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61419. return self;
  61420. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  61421. },
  61422. args: [],
  61423. 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",
  61424. referencedClasses: [],
  61425. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61426. }),
  61427. $globals.SUnitAsyncTest);
  61428. $core.addMethod(
  61429. $core.method({
  61430. selector: "fakeMultipleTimeoutPassing",
  61431. protocol: "helpers",
  61432. fn: function (){
  61433. var self=this,$self=this;
  61434. return $core.withContext(function($ctx1) {
  61435. var $1;
  61436. $self._timeout_((20));
  61437. $ctx1.sendIdx["timeout:"]=1;
  61438. $1=$self._async_((function(){
  61439. return $core.withContext(function($ctx2) {
  61440. $self._timeout_((40));
  61441. return $recv($self._async_((function(){
  61442. return $core.withContext(function($ctx3) {
  61443. return $self._finished();
  61444. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61445. })))._valueWithTimeout_((20));
  61446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61447. }));
  61448. $ctx1.sendIdx["async:"]=1;
  61449. $recv($1)._valueWithTimeout_((10));
  61450. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61451. return self;
  61452. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  61453. },
  61454. args: [],
  61455. 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",
  61456. referencedClasses: [],
  61457. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61458. }),
  61459. $globals.SUnitAsyncTest);
  61460. $core.addMethod(
  61461. $core.method({
  61462. selector: "fakeTimeout",
  61463. protocol: "helpers",
  61464. fn: function (){
  61465. var self=this,$self=this;
  61466. return $core.withContext(function($ctx1) {
  61467. $self._timeout_((10));
  61468. $recv($self._async_((function(){
  61469. return $core.withContext(function($ctx2) {
  61470. return $self._finished();
  61471. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61472. })))._valueWithTimeout_((20));
  61473. return self;
  61474. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  61475. },
  61476. args: [],
  61477. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  61478. referencedClasses: [],
  61479. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61480. }),
  61481. $globals.SUnitAsyncTest);
  61482. $core.addMethod(
  61483. $core.method({
  61484. selector: "selectorSetOf:",
  61485. protocol: "private",
  61486. fn: function (aCollection){
  61487. var self=this,$self=this;
  61488. return $core.withContext(function($ctx1) {
  61489. return $recv($recv(aCollection)._collect_((function(each){
  61490. return $core.withContext(function($ctx2) {
  61491. return $recv(each)._selector();
  61492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61493. })))._asSet();
  61494. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  61495. },
  61496. args: ["aCollection"],
  61497. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  61498. referencedClasses: [],
  61499. messageSends: ["asSet", "collect:", "selector"]
  61500. }),
  61501. $globals.SUnitAsyncTest);
  61502. $core.addMethod(
  61503. $core.method({
  61504. selector: "setUp",
  61505. protocol: "running",
  61506. fn: function (){
  61507. var self=this,$self=this;
  61508. $self["@flag"]="ok";
  61509. return self;
  61510. },
  61511. args: [],
  61512. source: "setUp\x0a\x09flag := 'ok'",
  61513. referencedClasses: [],
  61514. messageSends: []
  61515. }),
  61516. $globals.SUnitAsyncTest);
  61517. $core.addMethod(
  61518. $core.method({
  61519. selector: "tearDown",
  61520. protocol: "running",
  61521. fn: function (){
  61522. var self=this,$self=this;
  61523. return $core.withContext(function($ctx1) {
  61524. $self._assert_equals_("ok",$self["@flag"]);
  61525. return self;
  61526. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  61527. },
  61528. args: [],
  61529. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  61530. referencedClasses: [],
  61531. messageSends: ["assert:equals:"]
  61532. }),
  61533. $globals.SUnitAsyncTest);
  61534. $core.addMethod(
  61535. $core.method({
  61536. selector: "testAsyncErrorsAndFailures",
  61537. protocol: "tests",
  61538. fn: function (){
  61539. var self=this,$self=this;
  61540. var suite,runner,result,assertBlock;
  61541. return $core.withContext(function($ctx1) {
  61542. var $1,$2,$3,$4;
  61543. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  61544. return $core.withContext(function($ctx2) {
  61545. return $recv($self._class())._selector_(each);
  61546. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61547. }));
  61548. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61549. $self._timeout_((200));
  61550. result=$recv(runner)._result();
  61551. $ctx1.sendIdx["result"]=1;
  61552. assertBlock=$self._async_((function(){
  61553. return $core.withContext(function($ctx2) {
  61554. $1=$self._selectorSetOf_($recv(result)._errors());
  61555. $ctx2.sendIdx["selectorSetOf:"]=1;
  61556. $2=["fakeError"]._asSet();
  61557. $ctx2.sendIdx["asSet"]=1;
  61558. $self._assert_equals_($1,$2);
  61559. $ctx2.sendIdx["assert:equals:"]=1;
  61560. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  61561. return $self._finished();
  61562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61563. }));
  61564. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61565. return $core.withContext(function($ctx2) {
  61566. $3=$recv($recv(ann)._result()).__eq_eq(result);
  61567. if($core.assert($3)){
  61568. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61569. return $recv($4)._ifTrue_(assertBlock);
  61570. }
  61571. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61572. }));
  61573. $recv(runner)._run();
  61574. return self;
  61575. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61576. },
  61577. args: [],
  61578. 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",
  61579. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  61580. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61581. }),
  61582. $globals.SUnitAsyncTest);
  61583. $core.addMethod(
  61584. $core.method({
  61585. selector: "testAsyncNeedsTimeout",
  61586. protocol: "tests",
  61587. fn: function (){
  61588. var self=this,$self=this;
  61589. return $core.withContext(function($ctx1) {
  61590. $self._should_raise_((function(){
  61591. return $core.withContext(function($ctx2) {
  61592. return $self._async_((function(){
  61593. }));
  61594. $ctx2.sendIdx["async:"]=1;
  61595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61596. }),$globals.Error);
  61597. $self._timeout_((0));
  61598. $self._shouldnt_raise_((function(){
  61599. return $core.withContext(function($ctx2) {
  61600. return $self._async_((function(){
  61601. }));
  61602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61603. }),$globals.Error);
  61604. $self._finished();
  61605. return self;
  61606. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61607. },
  61608. args: [],
  61609. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  61610. referencedClasses: ["Error"],
  61611. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  61612. }),
  61613. $globals.SUnitAsyncTest);
  61614. $core.addMethod(
  61615. $core.method({
  61616. selector: "testFinishedNeedsTimeout",
  61617. protocol: "tests",
  61618. fn: function (){
  61619. var self=this,$self=this;
  61620. return $core.withContext(function($ctx1) {
  61621. $self._should_raise_((function(){
  61622. return $core.withContext(function($ctx2) {
  61623. return $self._finished();
  61624. $ctx2.sendIdx["finished"]=1;
  61625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61626. }),$globals.Error);
  61627. $self._timeout_((0));
  61628. $self._shouldnt_raise_((function(){
  61629. return $core.withContext(function($ctx2) {
  61630. return $self._finished();
  61631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61632. }),$globals.Error);
  61633. return self;
  61634. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61635. },
  61636. args: [],
  61637. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  61638. referencedClasses: ["Error"],
  61639. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  61640. }),
  61641. $globals.SUnitAsyncTest);
  61642. $core.addMethod(
  61643. $core.method({
  61644. selector: "testIsAsyncReturnsCorrectValues",
  61645. protocol: "tests",
  61646. fn: function (){
  61647. var self=this,$self=this;
  61648. return $core.withContext(function($ctx1) {
  61649. var $1,$2;
  61650. $1=$self._isAsync();
  61651. $ctx1.sendIdx["isAsync"]=1;
  61652. $self._deny_($1);
  61653. $ctx1.sendIdx["deny:"]=1;
  61654. $self._timeout_((0));
  61655. $2=$self._isAsync();
  61656. $ctx1.sendIdx["isAsync"]=2;
  61657. $self._assert_($2);
  61658. $self._finished();
  61659. $self._deny_($self._isAsync());
  61660. return self;
  61661. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  61662. },
  61663. args: [],
  61664. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  61665. referencedClasses: [],
  61666. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  61667. }),
  61668. $globals.SUnitAsyncTest);
  61669. $core.addMethod(
  61670. $core.method({
  61671. selector: "testPass",
  61672. protocol: "tests",
  61673. fn: function (){
  61674. var self=this,$self=this;
  61675. return $core.withContext(function($ctx1) {
  61676. $self["@flag"]="bad";
  61677. $self._timeout_((10));
  61678. $self["@flag"]=$recv($self._async_((function(){
  61679. return $core.withContext(function($ctx2) {
  61680. $self._assert_(true);
  61681. $self._finished();
  61682. $self["@flag"]="ok";
  61683. return $self["@flag"];
  61684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61685. })))._valueWithTimeout_((5));
  61686. return self;
  61687. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  61688. },
  61689. args: [],
  61690. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  61691. referencedClasses: [],
  61692. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  61693. }),
  61694. $globals.SUnitAsyncTest);
  61695. $core.addMethod(
  61696. $core.method({
  61697. selector: "testTimeouts",
  61698. protocol: "tests",
  61699. fn: function (){
  61700. var self=this,$self=this;
  61701. var suite,runner,result,assertBlock;
  61702. return $core.withContext(function($ctx1) {
  61703. var $1,$2,$3;
  61704. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  61705. return $core.withContext(function($ctx2) {
  61706. return $recv($self._class())._selector_(each);
  61707. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61708. }));
  61709. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61710. $self._timeout_((200));
  61711. result=$recv(runner)._result();
  61712. $ctx1.sendIdx["result"]=1;
  61713. assertBlock=$self._async_((function(){
  61714. return $core.withContext(function($ctx2) {
  61715. $1=$self._selectorSetOf_($recv(result)._errors());
  61716. $ctx2.sendIdx["selectorSetOf:"]=1;
  61717. $self._assert_equals_($1,$recv($globals.Set)._new());
  61718. $ctx2.sendIdx["assert:equals:"]=1;
  61719. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  61720. return $self._finished();
  61721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61722. }));
  61723. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61724. return $core.withContext(function($ctx2) {
  61725. $2=$recv($recv(ann)._result()).__eq_eq(result);
  61726. if($core.assert($2)){
  61727. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61728. return $recv($3)._ifTrue_(assertBlock);
  61729. }
  61730. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61731. }));
  61732. $recv(runner)._run();
  61733. return self;
  61734. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61735. },
  61736. args: [],
  61737. 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",
  61738. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  61739. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61740. }),
  61741. $globals.SUnitAsyncTest);
  61742. $core.addMethod(
  61743. $core.method({
  61744. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  61745. protocol: "tests",
  61746. fn: function (){
  61747. var self=this,$self=this;
  61748. var x;
  61749. return $core.withContext(function($ctx1) {
  61750. var $1;
  61751. $self["@flag"]="bad";
  61752. $self._timeout_((10));
  61753. x=(0);
  61754. $1=$self._async_((function(){
  61755. return $core.withContext(function($ctx2) {
  61756. $self._finished();
  61757. $ctx2.sendIdx["finished"]=1;
  61758. $self["@flag"]="ok";
  61759. x=$recv(x).__plus((1));
  61760. $ctx2.sendIdx["+"]=1;
  61761. return $self._assert_equals_(x,(1));
  61762. $ctx2.sendIdx["assert:equals:"]=1;
  61763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61764. }));
  61765. $ctx1.sendIdx["async:"]=1;
  61766. $self["@flag"]=$recv($1)._valueWithTimeout_((0));
  61767. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61768. $self["@flag"]=$recv($self._async_((function(){
  61769. return $core.withContext(function($ctx2) {
  61770. $self._finished();
  61771. $self["@flag"]="ok";
  61772. x=$recv(x).__plus((1));
  61773. return $self._assert_equals_(x,(1));
  61774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61775. })))._valueWithTimeout_((0));
  61776. return self;
  61777. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  61778. },
  61779. args: [],
  61780. 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.",
  61781. referencedClasses: [],
  61782. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  61783. }),
  61784. $globals.SUnitAsyncTest);
  61785. });
  61786. define('amber/devel',[
  61787. './lang',
  61788. './brikz', // pre-fetch, dep of ./boot
  61789. './kernel-checks', // pre-fetch, dep of ./boot
  61790. './kernel-fundamentals', // pre-fetch, dep of ./boot
  61791. './kernel-language', // pre-fetch, dep of ./boot
  61792. './boot', // pre-fetch, class loader
  61793. './deploy', // pre-fetch, dep of ./lang
  61794. // --- packages of the development only Amber begin here ---
  61795. 'amber_core/Platform-DOM',
  61796. 'amber_core/SUnit',
  61797. 'amber_core/Compiler-Tests',
  61798. 'amber_core/Kernel-Tests',
  61799. 'amber_core/Platform-DOM-Tests',
  61800. 'amber_core/SUnit-Tests'
  61801. // --- packages of the development only Amber end here ---
  61802. ], function (amber) {
  61803. return amber;
  61804. });
  61805. define('amber_core/Platform-Node',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61806. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61807. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61808. $core.addPackage("Platform-Node");
  61809. ($core.packageDescriptors||$core.packages)["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  61810. ($core.packageDescriptors||$core.packages)["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61811. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  61812. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  61813. $core.addMethod(
  61814. $core.method({
  61815. selector: "globals",
  61816. protocol: "accessing",
  61817. fn: function (){
  61818. var self=this,$self=this;
  61819. return global;
  61820. },
  61821. args: [],
  61822. source: "globals\x0a\x09^ global",
  61823. referencedClasses: [],
  61824. messageSends: []
  61825. }),
  61826. $globals.NodePlatform);
  61827. $core.addMethod(
  61828. $core.method({
  61829. selector: "newXhr",
  61830. protocol: "accessing",
  61831. fn: function (){
  61832. var self=this,$self=this;
  61833. return $core.withContext(function($ctx1) {
  61834. var $receiver;
  61835. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.a$nil){
  61836. $self._error_("XMLHttpRequest not available.");
  61837. } else {
  61838. return $recv($globals.XMLHttpRequest)._new();
  61839. }
  61840. return self;
  61841. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  61842. },
  61843. args: [],
  61844. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  61845. referencedClasses: ["XMLHttpRequest"],
  61846. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  61847. }),
  61848. $globals.NodePlatform);
  61849. $core.addMethod(
  61850. $core.method({
  61851. selector: "initialize",
  61852. protocol: "testing",
  61853. fn: function (){
  61854. var self=this,$self=this;
  61855. return $core.withContext(function($ctx1) {
  61856. var $1;
  61857. $1=$self._isFeasible();
  61858. if($core.assert($1)){
  61859. $recv($globals.Platform)._registerIfNone_($self._new());
  61860. }
  61861. return self;
  61862. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.a$cls)});
  61863. },
  61864. args: [],
  61865. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  61866. referencedClasses: ["Platform"],
  61867. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  61868. }),
  61869. $globals.NodePlatform.a$cls);
  61870. $core.addMethod(
  61871. $core.method({
  61872. selector: "isFeasible",
  61873. protocol: "testing",
  61874. fn: function (){
  61875. var self=this,$self=this;
  61876. return $core.withContext(function($ctx1) {
  61877. return typeof global !== "undefined";
  61878. return self;
  61879. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.a$cls)});
  61880. },
  61881. args: [],
  61882. source: "isFeasible\x0a<inlineJS: 'return typeof global !== \x22undefined\x22'>",
  61883. referencedClasses: [],
  61884. messageSends: []
  61885. }),
  61886. $globals.NodePlatform.a$cls);
  61887. });
  61888. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61889. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61890. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61891. $core.addPackage("AmberCli");
  61892. ($core.packageDescriptors||$core.packages)["AmberCli"].innerEval = function (expr) { return eval(expr); };
  61893. ($core.packageDescriptors||$core.packages)["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  61894. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  61895. $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.";
  61896. $core.addMethod(
  61897. $core.method({
  61898. selector: "commandLineSwitches",
  61899. protocol: "commandline",
  61900. fn: function (){
  61901. var self=this,$self=this;
  61902. var switches;
  61903. return $core.withContext(function($ctx1) {
  61904. switches=$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  61905. return $core.withContext(function($ctx2) {
  61906. return $recv(each)._selector();
  61907. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61908. }));
  61909. $ctx1.sendIdx["collect:"]=1;
  61910. switches=$recv(switches)._select_((function(each){
  61911. return $core.withContext(function($ctx2) {
  61912. return $recv(each)._match_("^[^:]*:$");
  61913. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61914. }));
  61915. switches=$recv(switches)._collect_((function(each){
  61916. return $core.withContext(function($ctx2) {
  61917. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  61918. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  61919. }));
  61920. return switches;
  61921. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.a$cls)});
  61922. },
  61923. args: [],
  61924. 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",
  61925. referencedClasses: [],
  61926. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  61927. }),
  61928. $globals.AmberCli.a$cls);
  61929. $core.addMethod(
  61930. $core.method({
  61931. selector: "config:",
  61932. protocol: "commands",
  61933. fn: function (args){
  61934. var self=this,$self=this;
  61935. return $core.withContext(function($ctx1) {
  61936. $recv($recv($globals.Configurator)._new())._start();
  61937. return self;
  61938. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.a$cls)});
  61939. },
  61940. args: ["args"],
  61941. source: "config: args\x0a\x09Configurator new start",
  61942. referencedClasses: ["Configurator"],
  61943. messageSends: ["start", "new"]
  61944. }),
  61945. $globals.AmberCli.a$cls);
  61946. $core.addMethod(
  61947. $core.method({
  61948. selector: "handleArguments:",
  61949. protocol: "commandline",
  61950. fn: function (args){
  61951. var self=this,$self=this;
  61952. var selector;
  61953. return $core.withContext(function($ctx1) {
  61954. var $1;
  61955. $1=$recv(args)._first();
  61956. $ctx1.sendIdx["first"]=1;
  61957. selector=$self._selectorForCommandLineSwitch_($1);
  61958. $recv(args)._remove_($recv(args)._first());
  61959. $self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  61960. return self;
  61961. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.a$cls)});
  61962. },
  61963. args: ["args"],
  61964. 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)",
  61965. referencedClasses: ["Array"],
  61966. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  61967. }),
  61968. $globals.AmberCli.a$cls);
  61969. $core.addMethod(
  61970. $core.method({
  61971. selector: "help:",
  61972. protocol: "commands",
  61973. fn: function (args){
  61974. var self=this,$self=this;
  61975. return $core.withContext(function($ctx1) {
  61976. $recv($globals.Transcript)._show_("Available commands");
  61977. $recv($self._commandLineSwitches())._do_((function(each){
  61978. return $core.withContext(function($ctx2) {
  61979. return $recv(console)._log_(each);
  61980. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61981. }));
  61982. return self;
  61983. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.a$cls)});
  61984. },
  61985. args: ["args"],
  61986. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  61987. referencedClasses: ["Transcript"],
  61988. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  61989. }),
  61990. $globals.AmberCli.a$cls);
  61991. $core.addMethod(
  61992. $core.method({
  61993. selector: "init:",
  61994. protocol: "commands",
  61995. fn: function (args){
  61996. var self=this,$self=this;
  61997. return $core.withContext(function($ctx1) {
  61998. $recv($recv($globals.Initer)._new())._start();
  61999. return self;
  62000. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.a$cls)});
  62001. },
  62002. args: ["args"],
  62003. source: "init: args\x0a\x09Initer new start",
  62004. referencedClasses: ["Initer"],
  62005. messageSends: ["start", "new"]
  62006. }),
  62007. $globals.AmberCli.a$cls);
  62008. $core.addMethod(
  62009. $core.method({
  62010. selector: "main",
  62011. protocol: "startup",
  62012. fn: function (){
  62013. var self=this,$self=this;
  62014. var args,packageJSON;
  62015. return $core.withContext(function($ctx1) {
  62016. var $7,$6,$5,$4,$3,$2,$1;
  62017. var $early={};
  62018. try {
  62019. packageJSON=$recv(require)._value_("../package.json");
  62020. $7=$recv(packageJSON)._version();
  62021. $ctx1.sendIdx["version"]=1;
  62022. $6="Welcome to Amber CLI version ".__comma($7);
  62023. $5=$recv($6).__comma(" (Amber ");
  62024. $ctx1.sendIdx[","]=5;
  62025. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  62026. $ctx1.sendIdx[","]=4;
  62027. $3=$recv($4).__comma(", NodeJS ");
  62028. $ctx1.sendIdx[","]=3;
  62029. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  62030. $ctx1.sendIdx[","]=2;
  62031. $1=$recv($2).__comma(").");
  62032. $ctx1.sendIdx[","]=1;
  62033. $recv($globals.Transcript)._show_($1);
  62034. args=$recv(process)._argv();
  62035. $recv(args)._removeFrom_to_((1),(2));
  62036. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  62037. return $core.withContext(function($ctx2) {
  62038. return $self._help_(nil);
  62039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62040. }),(function(){
  62041. return $core.withContext(function($ctx2) {
  62042. throw $early=[$self._handleArguments_(args)];
  62043. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  62044. }));
  62045. return self;
  62046. }
  62047. catch(e) {if(e===$early)return e[0]; throw e}
  62048. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.a$cls)});
  62049. },
  62050. args: [],
  62051. 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]",
  62052. referencedClasses: ["Transcript", "Smalltalk"],
  62053. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  62054. }),
  62055. $globals.AmberCli.a$cls);
  62056. $core.addMethod(
  62057. $core.method({
  62058. selector: "repl:",
  62059. protocol: "commands",
  62060. fn: function (args){
  62061. var self=this,$self=this;
  62062. return $core.withContext(function($ctx1) {
  62063. return $recv($recv($globals.Repl)._new())._createInterface();
  62064. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.a$cls)});
  62065. },
  62066. args: ["args"],
  62067. source: "repl: args\x0a\x09^ Repl new createInterface",
  62068. referencedClasses: ["Repl"],
  62069. messageSends: ["createInterface", "new"]
  62070. }),
  62071. $globals.AmberCli.a$cls);
  62072. $core.addMethod(
  62073. $core.method({
  62074. selector: "selectorForCommandLineSwitch:",
  62075. protocol: "commandline",
  62076. fn: function (aSwitch){
  62077. var self=this,$self=this;
  62078. var command,selector;
  62079. return $core.withContext(function($ctx1) {
  62080. var $1;
  62081. $1=$recv($self._commandLineSwitches())._includes_(aSwitch);
  62082. if($core.assert($1)){
  62083. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  62084. return $core.withContext(function($ctx2) {
  62085. return $recv($recv(each)._second())._asUppercase();
  62086. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  62087. }))).__comma(":");
  62088. selector;
  62089. } else {
  62090. selector="help:";
  62091. selector;
  62092. }
  62093. return selector;
  62094. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.a$cls)});
  62095. },
  62096. args: ["aSwitch"],
  62097. 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",
  62098. referencedClasses: [],
  62099. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  62100. }),
  62101. $globals.AmberCli.a$cls);
  62102. $core.addMethod(
  62103. $core.method({
  62104. selector: "serve:",
  62105. protocol: "commands",
  62106. fn: function (args){
  62107. var self=this,$self=this;
  62108. return $core.withContext(function($ctx1) {
  62109. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  62110. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.a$cls)});
  62111. },
  62112. args: ["args"],
  62113. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  62114. referencedClasses: ["FileServer"],
  62115. messageSends: ["start", "createServerWithArguments:"]
  62116. }),
  62117. $globals.AmberCli.a$cls);
  62118. $core.addMethod(
  62119. $core.method({
  62120. selector: "version:",
  62121. protocol: "commands",
  62122. fn: function (arguments_){
  62123. var self=this,$self=this;
  62124. return self;
  62125. },
  62126. args: ["arguments"],
  62127. source: "version: arguments",
  62128. referencedClasses: [],
  62129. messageSends: []
  62130. }),
  62131. $globals.AmberCli.a$cls);
  62132. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  62133. $core.addMethod(
  62134. $core.method({
  62135. selector: "dirname",
  62136. protocol: "private",
  62137. fn: function (){
  62138. var self=this,$self=this;
  62139. return $core.withContext(function($ctx1) {
  62140. return __dirname;
  62141. return self;
  62142. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  62143. },
  62144. args: [],
  62145. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  62146. referencedClasses: [],
  62147. messageSends: []
  62148. }),
  62149. $globals.BaseFileManipulator);
  62150. $core.addMethod(
  62151. $core.method({
  62152. selector: "initialize",
  62153. protocol: "initialization",
  62154. fn: function (){
  62155. var self=this,$self=this;
  62156. return $core.withContext(function($ctx1) {
  62157. (
  62158. $ctx1.supercall = true,
  62159. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62160. $ctx1.supercall = false;
  62161. $self["@path"]=$recv(require)._value_("path");
  62162. $ctx1.sendIdx["value:"]=1;
  62163. $self["@fs"]=$recv(require)._value_("fs");
  62164. return self;
  62165. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  62166. },
  62167. args: [],
  62168. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  62169. referencedClasses: [],
  62170. messageSends: ["initialize", "value:"]
  62171. }),
  62172. $globals.BaseFileManipulator);
  62173. $core.addMethod(
  62174. $core.method({
  62175. selector: "rootDirname",
  62176. protocol: "private",
  62177. fn: function (){
  62178. var self=this,$self=this;
  62179. return $core.withContext(function($ctx1) {
  62180. return $recv($self["@path"])._join_with_($self._dirname(),"..");
  62181. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  62182. },
  62183. args: [],
  62184. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  62185. referencedClasses: [],
  62186. messageSends: ["join:with:", "dirname"]
  62187. }),
  62188. $globals.BaseFileManipulator);
  62189. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  62190. $core.addMethod(
  62191. $core.method({
  62192. selector: "initialize",
  62193. protocol: "initialization",
  62194. fn: function (){
  62195. var self=this,$self=this;
  62196. return $core.withContext(function($ctx1) {
  62197. (
  62198. $ctx1.supercall = true,
  62199. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62200. $ctx1.supercall = false;
  62201. return self;
  62202. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  62203. },
  62204. args: [],
  62205. source: "initialize\x0a\x09super initialize",
  62206. referencedClasses: [],
  62207. messageSends: ["initialize"]
  62208. }),
  62209. $globals.Configurator);
  62210. $core.addMethod(
  62211. $core.method({
  62212. selector: "start",
  62213. protocol: "action",
  62214. fn: function (){
  62215. var self=this,$self=this;
  62216. return $core.withContext(function($ctx1) {
  62217. var $receiver;
  62218. $self._writeConfigThenDo_((function(err){
  62219. return $core.withContext(function($ctx2) {
  62220. if(($receiver = err) == null || $receiver.a$nil){
  62221. return $recv(process)._exit();
  62222. } else {
  62223. return $recv(process)._exit_((111));
  62224. }
  62225. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  62226. }));
  62227. return self;
  62228. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  62229. },
  62230. args: [],
  62231. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  62232. referencedClasses: [],
  62233. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  62234. }),
  62235. $globals.Configurator);
  62236. $core.addMethod(
  62237. $core.method({
  62238. selector: "writeConfigThenDo:",
  62239. protocol: "action",
  62240. fn: function (aBlock){
  62241. var self=this,$self=this;
  62242. return $core.withContext(function($ctx1) {
  62243. $recv($recv($recv(require)._value_("@ambers/sdk"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  62244. return self;
  62245. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  62246. },
  62247. args: ["aBlock"],
  62248. source: "writeConfigThenDo: aBlock\x0a\x09(require value: '@ambers/sdk') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  62249. referencedClasses: [],
  62250. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  62251. }),
  62252. $globals.Configurator);
  62253. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  62254. $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.";
  62255. $core.addMethod(
  62256. $core.method({
  62257. selector: "base64Decode:",
  62258. protocol: "private",
  62259. fn: function (aString){
  62260. var self=this,$self=this;
  62261. return $core.withContext(function($ctx1) {
  62262. return (new Buffer(aString, "base64").toString());
  62263. return self;
  62264. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  62265. },
  62266. args: ["aString"],
  62267. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  62268. referencedClasses: [],
  62269. messageSends: []
  62270. }),
  62271. $globals.FileServer);
  62272. $core.addMethod(
  62273. $core.method({
  62274. selector: "basePath",
  62275. protocol: "accessing",
  62276. fn: function (){
  62277. var self=this,$self=this;
  62278. return $core.withContext(function($ctx1) {
  62279. var $1,$receiver;
  62280. $1=$self["@basePath"];
  62281. if(($receiver = $1) == null || $receiver.a$nil){
  62282. return $recv($self._class())._defaultBasePath();
  62283. } else {
  62284. return $1;
  62285. }
  62286. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  62287. },
  62288. args: [],
  62289. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  62290. referencedClasses: [],
  62291. messageSends: ["ifNil:", "defaultBasePath", "class"]
  62292. }),
  62293. $globals.FileServer);
  62294. $core.addMethod(
  62295. $core.method({
  62296. selector: "basePath:",
  62297. protocol: "accessing",
  62298. fn: function (aString){
  62299. var self=this,$self=this;
  62300. return $core.withContext(function($ctx1) {
  62301. $self["@basePath"]=aString;
  62302. $self._validateBasePath();
  62303. return self;
  62304. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  62305. },
  62306. args: ["aString"],
  62307. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  62308. referencedClasses: [],
  62309. messageSends: ["validateBasePath"]
  62310. }),
  62311. $globals.FileServer);
  62312. $core.addMethod(
  62313. $core.method({
  62314. selector: "checkDirectoryLayout",
  62315. protocol: "initialization",
  62316. fn: function (){
  62317. var self=this,$self=this;
  62318. return $core.withContext(function($ctx1) {
  62319. var $1;
  62320. $1=$recv($self["@fs"])._existsSync_($self._withBasePath_("index.html"));
  62321. if(!$core.assert($1)){
  62322. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  62323. $ctx1.sendIdx["warn:"]=1;
  62324. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  62325. $ctx1.sendIdx["warn:"]=2;
  62326. $recv(console)._warn_(" You can also specify a page to be served by default,");
  62327. $ctx1.sendIdx["warn:"]=3;
  62328. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  62329. }
  62330. return self;
  62331. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  62332. },
  62333. args: [],
  62334. 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.'].",
  62335. referencedClasses: [],
  62336. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  62337. }),
  62338. $globals.FileServer);
  62339. $core.addMethod(
  62340. $core.method({
  62341. selector: "fallbackPage",
  62342. protocol: "accessing",
  62343. fn: function (){
  62344. var self=this,$self=this;
  62345. return $self["@fallbackPage"];
  62346. },
  62347. args: [],
  62348. source: "fallbackPage\x0a\x09^ fallbackPage",
  62349. referencedClasses: [],
  62350. messageSends: []
  62351. }),
  62352. $globals.FileServer);
  62353. $core.addMethod(
  62354. $core.method({
  62355. selector: "fallbackPage:",
  62356. protocol: "accessing",
  62357. fn: function (aString){
  62358. var self=this,$self=this;
  62359. $self["@fallbackPage"]=aString;
  62360. return self;
  62361. },
  62362. args: ["aString"],
  62363. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  62364. referencedClasses: [],
  62365. messageSends: []
  62366. }),
  62367. $globals.FileServer);
  62368. $core.addMethod(
  62369. $core.method({
  62370. selector: "handleGETRequest:respondTo:",
  62371. protocol: "request handling",
  62372. fn: function (aRequest,aResponse){
  62373. var self=this,$self=this;
  62374. var uri,filename;
  62375. return $core.withContext(function($ctx1) {
  62376. var $1;
  62377. uri=$recv($self["@url"])._parse_($recv(aRequest)._url());
  62378. filename=$recv($self["@path"])._join_with_($self._basePath(),$recv(uri)._pathname());
  62379. $recv($self["@fs"])._exists_do_(filename,(function(aBoolean){
  62380. return $core.withContext(function($ctx2) {
  62381. if($core.assert(aBoolean)){
  62382. $1=$recv($recv($self["@fs"])._statSync_(filename))._isDirectory();
  62383. if($core.assert($1)){
  62384. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  62385. } else {
  62386. return $self._respondFileNamed_to_(filename,aResponse);
  62387. }
  62388. } else {
  62389. return $self._respondNotFoundTo_(aResponse);
  62390. }
  62391. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  62392. }));
  62393. return self;
  62394. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  62395. },
  62396. args: ["aRequest", "aResponse"],
  62397. 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]]]",
  62398. referencedClasses: [],
  62399. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  62400. }),
  62401. $globals.FileServer);
  62402. $core.addMethod(
  62403. $core.method({
  62404. selector: "handleOPTIONSRequest:respondTo:",
  62405. protocol: "request handling",
  62406. fn: function (aRequest,aResponse){
  62407. var self=this,$self=this;
  62408. return $core.withContext(function($ctx1) {
  62409. $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)]));
  62410. $recv(aResponse)._end();
  62411. return self;
  62412. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62413. },
  62414. args: ["aRequest", "aResponse"],
  62415. 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",
  62416. referencedClasses: [],
  62417. messageSends: ["writeHead:options:", "end"]
  62418. }),
  62419. $globals.FileServer);
  62420. $core.addMethod(
  62421. $core.method({
  62422. selector: "handlePUTRequest:respondTo:",
  62423. protocol: "request handling",
  62424. fn: function (aRequest,aResponse){
  62425. var self=this,$self=this;
  62426. var file,stream;
  62427. return $core.withContext(function($ctx1) {
  62428. var $1,$2,$3,$4;
  62429. $1=$self._isAuthenticated_(aRequest);
  62430. if(!$core.assert($1)){
  62431. $self._respondAuthenticationRequiredTo_(aResponse);
  62432. return nil;
  62433. }
  62434. file=".".__comma($recv(aRequest)._url());
  62435. $ctx1.sendIdx[","]=1;
  62436. stream=$recv($self["@fs"])._createWriteStream_(file);
  62437. $recv(stream)._on_do_("error",(function(error){
  62438. return $core.withContext(function($ctx2) {
  62439. $2=console;
  62440. $3="Error creating WriteStream for file ".__comma(file);
  62441. $ctx2.sendIdx[","]=2;
  62442. $recv($2)._warn_($3);
  62443. $ctx2.sendIdx["warn:"]=1;
  62444. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  62445. $ctx2.sendIdx["warn:"]=2;
  62446. $recv(console)._warn_(" The exact error is: ".__comma(error));
  62447. return $self._respondNotCreatedTo_(aResponse);
  62448. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62449. }));
  62450. $ctx1.sendIdx["on:do:"]=1;
  62451. $recv(stream)._on_do_("close",(function(){
  62452. return $core.withContext(function($ctx2) {
  62453. return $self._respondCreatedTo_(aResponse);
  62454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62455. }));
  62456. $ctx1.sendIdx["on:do:"]=2;
  62457. $recv(aRequest)._setEncoding_("utf8");
  62458. $recv(aRequest)._on_do_("data",(function(data){
  62459. return $core.withContext(function($ctx2) {
  62460. return $recv(stream)._write_(data);
  62461. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  62462. }));
  62463. $ctx1.sendIdx["on:do:"]=3;
  62464. $recv(aRequest)._on_do_("end",(function(){
  62465. return $core.withContext(function($ctx2) {
  62466. $4=$recv(stream)._writable();
  62467. if($core.assert($4)){
  62468. return $recv(stream)._end();
  62469. }
  62470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62471. }));
  62472. return self;
  62473. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  62474. },
  62475. args: ["aRequest", "aResponse"],
  62476. 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]]",
  62477. referencedClasses: [],
  62478. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  62479. }),
  62480. $globals.FileServer);
  62481. $core.addMethod(
  62482. $core.method({
  62483. selector: "handleRequest:respondTo:",
  62484. protocol: "request handling",
  62485. fn: function (aRequest,aResponse){
  62486. var self=this,$self=this;
  62487. return $core.withContext(function($ctx1) {
  62488. var $2,$1,$4,$3,$5;
  62489. $2=$recv(aRequest)._method();
  62490. $ctx1.sendIdx["method"]=1;
  62491. $1=$recv($2).__eq("PUT");
  62492. $ctx1.sendIdx["="]=1;
  62493. if($core.assert($1)){
  62494. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  62495. }
  62496. $4=$recv(aRequest)._method();
  62497. $ctx1.sendIdx["method"]=2;
  62498. $3=$recv($4).__eq("GET");
  62499. $ctx1.sendIdx["="]=2;
  62500. if($core.assert($3)){
  62501. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  62502. }
  62503. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  62504. if($core.assert($5)){
  62505. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  62506. }
  62507. return self;
  62508. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62509. },
  62510. args: ["aRequest", "aResponse"],
  62511. 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]",
  62512. referencedClasses: [],
  62513. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  62514. }),
  62515. $globals.FileServer);
  62516. $core.addMethod(
  62517. $core.method({
  62518. selector: "host",
  62519. protocol: "accessing",
  62520. fn: function (){
  62521. var self=this,$self=this;
  62522. return $self["@host"];
  62523. },
  62524. args: [],
  62525. source: "host\x0a\x09^ host",
  62526. referencedClasses: [],
  62527. messageSends: []
  62528. }),
  62529. $globals.FileServer);
  62530. $core.addMethod(
  62531. $core.method({
  62532. selector: "host:",
  62533. protocol: "accessing",
  62534. fn: function (hostname){
  62535. var self=this,$self=this;
  62536. $self["@host"]=hostname;
  62537. return self;
  62538. },
  62539. args: ["hostname"],
  62540. source: "host: hostname\x0a\x09host := hostname",
  62541. referencedClasses: [],
  62542. messageSends: []
  62543. }),
  62544. $globals.FileServer);
  62545. $core.addMethod(
  62546. $core.method({
  62547. selector: "initialize",
  62548. protocol: "initialization",
  62549. fn: function (){
  62550. var self=this,$self=this;
  62551. return $core.withContext(function($ctx1) {
  62552. var $1;
  62553. (
  62554. $ctx1.supercall = true,
  62555. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62556. $ctx1.supercall = false;
  62557. $self["@http"]=$self._require_("http");
  62558. $ctx1.sendIdx["require:"]=1;
  62559. $self["@util"]=$self._require_("util");
  62560. $ctx1.sendIdx["require:"]=2;
  62561. $self["@url"]=$self._require_("url");
  62562. $1=$self._class();
  62563. $ctx1.sendIdx["class"]=1;
  62564. $self["@host"]=$recv($1)._defaultHost();
  62565. $self["@port"]=$recv($self._class())._defaultPort();
  62566. $self["@username"]=nil;
  62567. $self["@password"]=nil;
  62568. $self["@fallbackPage"]=nil;
  62569. return self;
  62570. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  62571. },
  62572. args: [],
  62573. 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.",
  62574. referencedClasses: [],
  62575. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  62576. }),
  62577. $globals.FileServer);
  62578. $core.addMethod(
  62579. $core.method({
  62580. selector: "isAuthenticated:",
  62581. protocol: "private",
  62582. fn: function (aRequest){
  62583. var self=this,$self=this;
  62584. var header,token,auth,parts;
  62585. return $core.withContext(function($ctx1) {
  62586. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  62587. var $early={};
  62588. try {
  62589. $2=$recv($self["@username"])._isNil();
  62590. $ctx1.sendIdx["isNil"]=1;
  62591. $1=$recv($2)._and_((function(){
  62592. return $core.withContext(function($ctx2) {
  62593. return $recv($self["@password"])._isNil();
  62594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62595. }));
  62596. $ctx1.sendIdx["and:"]=1;
  62597. if($core.assert($1)){
  62598. return true;
  62599. }
  62600. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  62601. $ctx1.sendIdx["at:"]=1;
  62602. if(($receiver = $3) == null || $receiver.a$nil){
  62603. header="";
  62604. } else {
  62605. header=$3;
  62606. }
  62607. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  62608. throw $early=[false];
  62609. }),(function(){
  62610. return $core.withContext(function($ctx2) {
  62611. $4=$recv(header)._tokenize_(" ");
  62612. $ctx2.sendIdx["tokenize:"]=1;
  62613. if(($receiver = $4) == null || $receiver.a$nil){
  62614. token="";
  62615. } else {
  62616. token=$4;
  62617. }
  62618. $5=$recv(token)._at_((2));
  62619. $ctx2.sendIdx["at:"]=2;
  62620. auth=$self._base64Decode_($5);
  62621. parts=$recv(auth)._tokenize_(":");
  62622. $8=$self["@username"];
  62623. $9=$recv(parts)._at_((1));
  62624. $ctx2.sendIdx["at:"]=3;
  62625. $7=$recv($8).__eq($9);
  62626. $ctx2.sendIdx["="]=1;
  62627. $6=$recv($7)._and_((function(){
  62628. return $core.withContext(function($ctx3) {
  62629. return $recv($self["@password"]).__eq($recv(parts)._at_((2)));
  62630. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  62631. }));
  62632. if($core.assert($6)){
  62633. throw $early=[true];
  62634. } else {
  62635. throw $early=[false];
  62636. }
  62637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62638. }));
  62639. return self;
  62640. }
  62641. catch(e) {if(e===$early)return e[0]; throw e}
  62642. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  62643. },
  62644. args: ["aRequest"],
  62645. 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].",
  62646. referencedClasses: [],
  62647. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  62648. }),
  62649. $globals.FileServer);
  62650. $core.addMethod(
  62651. $core.method({
  62652. selector: "password:",
  62653. protocol: "accessing",
  62654. fn: function (aPassword){
  62655. var self=this,$self=this;
  62656. $self["@password"]=aPassword;
  62657. return self;
  62658. },
  62659. args: ["aPassword"],
  62660. source: "password: aPassword\x0a\x09password := aPassword.",
  62661. referencedClasses: [],
  62662. messageSends: []
  62663. }),
  62664. $globals.FileServer);
  62665. $core.addMethod(
  62666. $core.method({
  62667. selector: "port",
  62668. protocol: "accessing",
  62669. fn: function (){
  62670. var self=this,$self=this;
  62671. return $self["@port"];
  62672. },
  62673. args: [],
  62674. source: "port\x0a\x09^ port",
  62675. referencedClasses: [],
  62676. messageSends: []
  62677. }),
  62678. $globals.FileServer);
  62679. $core.addMethod(
  62680. $core.method({
  62681. selector: "port:",
  62682. protocol: "accessing",
  62683. fn: function (aNumber){
  62684. var self=this,$self=this;
  62685. $self["@port"]=aNumber;
  62686. return self;
  62687. },
  62688. args: ["aNumber"],
  62689. source: "port: aNumber\x0a\x09port := aNumber",
  62690. referencedClasses: [],
  62691. messageSends: []
  62692. }),
  62693. $globals.FileServer);
  62694. $core.addMethod(
  62695. $core.method({
  62696. selector: "require:",
  62697. protocol: "private",
  62698. fn: function (aModuleString){
  62699. var self=this,$self=this;
  62700. return $core.withContext(function($ctx1) {
  62701. return $recv(require)._value_(aModuleString);
  62702. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  62703. },
  62704. args: ["aModuleString"],
  62705. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  62706. referencedClasses: [],
  62707. messageSends: ["value:"]
  62708. }),
  62709. $globals.FileServer);
  62710. $core.addMethod(
  62711. $core.method({
  62712. selector: "respondAuthenticationRequiredTo:",
  62713. protocol: "request handling",
  62714. fn: function (aResponse){
  62715. var self=this,$self=this;
  62716. return $core.withContext(function($ctx1) {
  62717. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  62718. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  62719. $recv(aResponse)._end();
  62720. return self;
  62721. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  62722. },
  62723. args: ["aResponse"],
  62724. 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.",
  62725. referencedClasses: [],
  62726. messageSends: ["writeHead:options:", "write:", "end"]
  62727. }),
  62728. $globals.FileServer);
  62729. $core.addMethod(
  62730. $core.method({
  62731. selector: "respondCreatedTo:",
  62732. protocol: "request handling",
  62733. fn: function (aResponse){
  62734. var self=this,$self=this;
  62735. return $core.withContext(function($ctx1) {
  62736. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62737. $recv(aResponse)._end();
  62738. return self;
  62739. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62740. },
  62741. args: ["aResponse"],
  62742. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62743. referencedClasses: [],
  62744. messageSends: ["writeHead:options:", "end"]
  62745. }),
  62746. $globals.FileServer);
  62747. $core.addMethod(
  62748. $core.method({
  62749. selector: "respondDirectoryNamed:from:to:",
  62750. protocol: "request handling",
  62751. fn: function (aDirname,aUrl,aResponse){
  62752. var self=this,$self=this;
  62753. return $core.withContext(function($ctx1) {
  62754. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  62755. $2=$recv(aUrl)._pathname();
  62756. $ctx1.sendIdx["pathname"]=1;
  62757. $1=$recv($2)._endsWith_("/");
  62758. if($core.assert($1)){
  62759. $3=$recv(aDirname).__comma("index.html");
  62760. $ctx1.sendIdx[","]=1;
  62761. $self._respondFileNamed_to_($3,aResponse);
  62762. } else {
  62763. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  62764. $7=$recv(aUrl)._search();
  62765. if(($receiver = $7) == null || $receiver.a$nil){
  62766. $6="";
  62767. } else {
  62768. $6=$7;
  62769. }
  62770. $4=$recv($5).__comma($6);
  62771. $ctx1.sendIdx[","]=2;
  62772. $self._respondRedirect_to_($4,aResponse);
  62773. }
  62774. return self;
  62775. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  62776. },
  62777. args: ["aDirname", "aUrl", "aResponse"],
  62778. 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]",
  62779. referencedClasses: [],
  62780. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  62781. }),
  62782. $globals.FileServer);
  62783. $core.addMethod(
  62784. $core.method({
  62785. selector: "respondFileNamed:to:",
  62786. protocol: "request handling",
  62787. fn: function (aFilename,aResponse){
  62788. var self=this,$self=this;
  62789. var type,filename;
  62790. return $core.withContext(function($ctx1) {
  62791. var $1,$2,$3,$4;
  62792. filename=aFilename;
  62793. $recv($self["@fs"])._readFile_do_(filename,(function(ex,file){
  62794. return $core.withContext(function($ctx2) {
  62795. $1=$recv(ex)._notNil();
  62796. if($core.assert($1)){
  62797. $2=console;
  62798. $3=$recv(filename).__comma(" does not exist");
  62799. $ctx2.sendIdx[","]=1;
  62800. $recv($2)._log_($3);
  62801. return $self._respondNotFoundTo_(aResponse);
  62802. } else {
  62803. type=$recv($self._class())._mimeTypeFor_(filename);
  62804. $4=$recv(type).__eq("application/javascript");
  62805. if($core.assert($4)){
  62806. type=$recv(type).__comma(";charset=utf-8");
  62807. type;
  62808. }
  62809. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  62810. $recv(aResponse)._write_encoding_(file,"binary");
  62811. return $recv(aResponse)._end();
  62812. }
  62813. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  62814. }));
  62815. return self;
  62816. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  62817. },
  62818. args: ["aFilename", "aResponse"],
  62819. 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]]",
  62820. referencedClasses: [],
  62821. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  62822. }),
  62823. $globals.FileServer);
  62824. $core.addMethod(
  62825. $core.method({
  62826. selector: "respondInternalErrorTo:",
  62827. protocol: "request handling",
  62828. fn: function (aResponse){
  62829. var self=this,$self=this;
  62830. return $core.withContext(function($ctx1) {
  62831. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62832. $recv(aResponse)._write_("500 Internal server error");
  62833. $recv(aResponse)._end();
  62834. return self;
  62835. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  62836. },
  62837. args: ["aResponse"],
  62838. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  62839. referencedClasses: [],
  62840. messageSends: ["writeHead:options:", "write:", "end"]
  62841. }),
  62842. $globals.FileServer);
  62843. $core.addMethod(
  62844. $core.method({
  62845. selector: "respondNotCreatedTo:",
  62846. protocol: "request handling",
  62847. fn: function (aResponse){
  62848. var self=this,$self=this;
  62849. return $core.withContext(function($ctx1) {
  62850. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62851. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  62852. $recv(aResponse)._end();
  62853. return self;
  62854. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62855. },
  62856. args: ["aResponse"],
  62857. 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.",
  62858. referencedClasses: [],
  62859. messageSends: ["writeHead:options:", "write:", "end"]
  62860. }),
  62861. $globals.FileServer);
  62862. $core.addMethod(
  62863. $core.method({
  62864. selector: "respondNotFoundTo:",
  62865. protocol: "request handling",
  62866. fn: function (aResponse){
  62867. var self=this,$self=this;
  62868. return $core.withContext(function($ctx1) {
  62869. var $2,$1;
  62870. $2=$self._fallbackPage();
  62871. $ctx1.sendIdx["fallbackPage"]=1;
  62872. $1=$recv($2)._isNil();
  62873. if(!$core.assert($1)){
  62874. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  62875. }
  62876. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  62877. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  62878. $ctx1.sendIdx["write:"]=1;
  62879. $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>");
  62880. $ctx1.sendIdx["write:"]=2;
  62881. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  62882. $ctx1.sendIdx["write:"]=3;
  62883. $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>");
  62884. $ctx1.sendIdx["write:"]=4;
  62885. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  62886. $ctx1.sendIdx["write:"]=5;
  62887. $recv(aResponse)._write_("</ul></p></body></html>");
  62888. $recv(aResponse)._end();
  62889. return self;
  62890. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  62891. },
  62892. args: ["aResponse"],
  62893. 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",
  62894. referencedClasses: [],
  62895. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  62896. }),
  62897. $globals.FileServer);
  62898. $core.addMethod(
  62899. $core.method({
  62900. selector: "respondOKTo:",
  62901. protocol: "request handling",
  62902. fn: function (aResponse){
  62903. var self=this,$self=this;
  62904. return $core.withContext(function($ctx1) {
  62905. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62906. $recv(aResponse)._end();
  62907. return self;
  62908. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  62909. },
  62910. args: ["aResponse"],
  62911. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62912. referencedClasses: [],
  62913. messageSends: ["writeHead:options:", "end"]
  62914. }),
  62915. $globals.FileServer);
  62916. $core.addMethod(
  62917. $core.method({
  62918. selector: "respondRedirect:to:",
  62919. protocol: "request handling",
  62920. fn: function (aString,aResponse){
  62921. var self=this,$self=this;
  62922. return $core.withContext(function($ctx1) {
  62923. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  62924. $recv(aResponse)._end();
  62925. return self;
  62926. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  62927. },
  62928. args: ["aString", "aResponse"],
  62929. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  62930. referencedClasses: [],
  62931. messageSends: ["writeHead:options:", "end"]
  62932. }),
  62933. $globals.FileServer);
  62934. $core.addMethod(
  62935. $core.method({
  62936. selector: "start",
  62937. protocol: "starting",
  62938. fn: function (){
  62939. var self=this,$self=this;
  62940. return $core.withContext(function($ctx1) {
  62941. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  62942. $self._checkDirectoryLayout();
  62943. $1=$recv($self["@http"])._createServer_((function(request,response){
  62944. return $core.withContext(function($ctx2) {
  62945. return $self._handleRequest_respondTo_(request,response);
  62946. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  62947. }));
  62948. $recv($1)._on_do_("error",(function(error){
  62949. return $core.withContext(function($ctx2) {
  62950. $2=console;
  62951. $3="Error starting server: ".__comma(error);
  62952. $ctx2.sendIdx[","]=1;
  62953. return $recv($2)._log_($3);
  62954. $ctx2.sendIdx["log:"]=1;
  62955. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62956. }));
  62957. $ctx1.sendIdx["on:do:"]=1;
  62958. $recv($1)._on_do_("listening",(function(){
  62959. return $core.withContext(function($ctx2) {
  62960. $4=console;
  62961. $8=$self._host();
  62962. $ctx2.sendIdx["host"]=1;
  62963. $7="Starting file server on http://".__comma($8);
  62964. $6=$recv($7).__comma(":");
  62965. $ctx2.sendIdx[","]=3;
  62966. $10=$self._port();
  62967. $ctx2.sendIdx["port"]=1;
  62968. $9=$recv($10)._asString();
  62969. $5=$recv($6).__comma($9);
  62970. $ctx2.sendIdx[","]=2;
  62971. return $recv($4)._log_($5);
  62972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62973. }));
  62974. $recv($1)._listen_host_($self._port(),$self._host());
  62975. return self;
  62976. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  62977. },
  62978. args: [],
  62979. 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.",
  62980. referencedClasses: [],
  62981. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  62982. }),
  62983. $globals.FileServer);
  62984. $core.addMethod(
  62985. $core.method({
  62986. selector: "startOn:",
  62987. protocol: "starting",
  62988. fn: function (aPort){
  62989. var self=this,$self=this;
  62990. return $core.withContext(function($ctx1) {
  62991. $self._port_(aPort);
  62992. $self._start();
  62993. return self;
  62994. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  62995. },
  62996. args: ["aPort"],
  62997. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  62998. referencedClasses: [],
  62999. messageSends: ["port:", "start"]
  63000. }),
  63001. $globals.FileServer);
  63002. $core.addMethod(
  63003. $core.method({
  63004. selector: "username:",
  63005. protocol: "accessing",
  63006. fn: function (aUsername){
  63007. var self=this,$self=this;
  63008. $self["@username"]=aUsername;
  63009. return self;
  63010. },
  63011. args: ["aUsername"],
  63012. source: "username: aUsername\x0a\x09username := aUsername.",
  63013. referencedClasses: [],
  63014. messageSends: []
  63015. }),
  63016. $globals.FileServer);
  63017. $core.addMethod(
  63018. $core.method({
  63019. selector: "validateBasePath",
  63020. protocol: "private",
  63021. fn: function (){
  63022. var self=this,$self=this;
  63023. return $core.withContext(function($ctx1) {
  63024. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  63025. $1=$self["@fs"];
  63026. $2=$self._basePath();
  63027. $ctx1.sendIdx["basePath"]=1;
  63028. $recv($1)._stat_then_($2,(function(err,stat){
  63029. return $core.withContext(function($ctx2) {
  63030. if(($receiver = err) == null || $receiver.a$nil){
  63031. $3=$recv(stat)._isDirectory();
  63032. if(!$core.assert($3)){
  63033. $4=console;
  63034. $7=$self._basePath();
  63035. $ctx2.sendIdx["basePath"]=2;
  63036. $6="Warning: --base-path parameter ".__comma($7);
  63037. $ctx2.sendIdx[","]=2;
  63038. $5=$recv($6).__comma(" is not a directory.");
  63039. $ctx2.sendIdx[","]=1;
  63040. return $recv($4)._warn_($5);
  63041. $ctx2.sendIdx["warn:"]=1;
  63042. }
  63043. } else {
  63044. $8=console;
  63045. $9=$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.");
  63046. $ctx2.sendIdx[","]=3;
  63047. return $recv($8)._warn_($9);
  63048. }
  63049. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  63050. }));
  63051. return self;
  63052. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  63053. },
  63054. args: [],
  63055. 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.' ]].",
  63056. referencedClasses: [],
  63057. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  63058. }),
  63059. $globals.FileServer);
  63060. $core.addMethod(
  63061. $core.method({
  63062. selector: "withBasePath:",
  63063. protocol: "private",
  63064. fn: function (aBaseRelativePath){
  63065. var self=this,$self=this;
  63066. return $core.withContext(function($ctx1) {
  63067. return $recv($self["@path"])._join_with_($self._basePath(),aBaseRelativePath);
  63068. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  63069. },
  63070. args: ["aBaseRelativePath"],
  63071. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  63072. referencedClasses: [],
  63073. messageSends: ["join:with:", "basePath"]
  63074. }),
  63075. $globals.FileServer);
  63076. $core.addMethod(
  63077. $core.method({
  63078. selector: "writeData:toFileNamed:",
  63079. protocol: "private",
  63080. fn: function (data,aFilename){
  63081. var self=this,$self=this;
  63082. return $core.withContext(function($ctx1) {
  63083. $recv(console)._log_(aFilename);
  63084. return self;
  63085. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  63086. },
  63087. args: ["data", "aFilename"],
  63088. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  63089. referencedClasses: [],
  63090. messageSends: ["log:"]
  63091. }),
  63092. $globals.FileServer);
  63093. $globals.FileServer.a$cls.iVarNames = ["mimeTypes"];
  63094. $core.addMethod(
  63095. $core.method({
  63096. selector: "commandLineSwitches",
  63097. protocol: "accessing",
  63098. fn: function (){
  63099. var self=this,$self=this;
  63100. var switches;
  63101. return $core.withContext(function($ctx1) {
  63102. switches=$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  63103. return $core.withContext(function($ctx2) {
  63104. return $recv(each)._selector();
  63105. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63106. }));
  63107. $ctx1.sendIdx["collect:"]=1;
  63108. switches=$recv(switches)._select_((function(each){
  63109. return $core.withContext(function($ctx2) {
  63110. return $recv(each)._match_("^[^:]*:$");
  63111. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  63112. }));
  63113. switches=$recv(switches)._collect_((function(each){
  63114. return $core.withContext(function($ctx2) {
  63115. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  63116. $ctx2.sendIdx["replace:with:"]=1;
  63117. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  63118. }));
  63119. return switches;
  63120. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.a$cls)});
  63121. },
  63122. args: [],
  63123. 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",
  63124. referencedClasses: [],
  63125. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  63126. }),
  63127. $globals.FileServer.a$cls);
  63128. $core.addMethod(
  63129. $core.method({
  63130. selector: "createServerWithArguments:",
  63131. protocol: "initialization",
  63132. fn: function (options){
  63133. var self=this,$self=this;
  63134. var server,popFront,front,optionName,optionValue,switches;
  63135. return $core.withContext(function($ctx1) {
  63136. var $1,$2,$3,$4,$5,$6,$7,$8;
  63137. var $early={};
  63138. try {
  63139. switches=$self._commandLineSwitches();
  63140. server=$self._new();
  63141. $recv(options)._ifEmpty_((function(){
  63142. throw $early=[server];
  63143. }));
  63144. $1=$recv($recv(options)._size())._even();
  63145. if(!$core.assert($1)){
  63146. $recv(console)._log_("Using default parameters.");
  63147. $ctx1.sendIdx["log:"]=1;
  63148. $2=console;
  63149. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  63150. $ctx1.sendIdx[","]=1;
  63151. $recv($2)._log_($3);
  63152. $ctx1.sendIdx["log:"]=2;
  63153. $4=console;
  63154. $5="Use any of the following ones: ".__comma(switches);
  63155. $ctx1.sendIdx[","]=2;
  63156. $recv($4)._log_($5);
  63157. $ctx1.sendIdx["log:"]=3;
  63158. return server;
  63159. }
  63160. popFront=(function(args){
  63161. return $core.withContext(function($ctx2) {
  63162. front=$recv(args)._first();
  63163. $recv(args)._remove_(front);
  63164. return front;
  63165. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  63166. });
  63167. $recv((function(){
  63168. return $core.withContext(function($ctx2) {
  63169. return $recv(options)._notEmpty();
  63170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  63171. }))._whileTrue_((function(){
  63172. return $core.withContext(function($ctx2) {
  63173. optionName=$recv(popFront)._value_(options);
  63174. $ctx2.sendIdx["value:"]=1;
  63175. optionValue=$recv(popFront)._value_(options);
  63176. $6=$recv(switches)._includes_(optionName);
  63177. if($core.assert($6)){
  63178. optionName=$self._selectorForCommandLineSwitch_(optionName);
  63179. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  63180. } else {
  63181. $7=console;
  63182. $8=$recv(optionName).__comma(" is not a valid commandline option");
  63183. $ctx2.sendIdx[","]=3;
  63184. $recv($7)._log_($8);
  63185. $ctx2.sendIdx["log:"]=4;
  63186. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  63187. }
  63188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  63189. }));
  63190. return server;
  63191. }
  63192. catch(e) {if(e===$early)return e[0]; throw e}
  63193. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.a$cls)});
  63194. },
  63195. args: ["options"],
  63196. 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.",
  63197. referencedClasses: ["Array"],
  63198. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  63199. }),
  63200. $globals.FileServer.a$cls);
  63201. $core.addMethod(
  63202. $core.method({
  63203. selector: "defaultBasePath",
  63204. protocol: "accessing",
  63205. fn: function (){
  63206. var self=this,$self=this;
  63207. return "./";
  63208. },
  63209. args: [],
  63210. source: "defaultBasePath\x0a\x09^ './'",
  63211. referencedClasses: [],
  63212. messageSends: []
  63213. }),
  63214. $globals.FileServer.a$cls);
  63215. $core.addMethod(
  63216. $core.method({
  63217. selector: "defaultHost",
  63218. protocol: "accessing",
  63219. fn: function (){
  63220. var self=this,$self=this;
  63221. return "127.0.0.1";
  63222. },
  63223. args: [],
  63224. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  63225. referencedClasses: [],
  63226. messageSends: []
  63227. }),
  63228. $globals.FileServer.a$cls);
  63229. $core.addMethod(
  63230. $core.method({
  63231. selector: "defaultMimeTypes",
  63232. protocol: "accessing",
  63233. fn: function (){
  63234. var self=this,$self=this;
  63235. 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"]);
  63236. },
  63237. args: [],
  63238. 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}",
  63239. referencedClasses: [],
  63240. messageSends: []
  63241. }),
  63242. $globals.FileServer.a$cls);
  63243. $core.addMethod(
  63244. $core.method({
  63245. selector: "defaultPort",
  63246. protocol: "accessing",
  63247. fn: function (){
  63248. var self=this,$self=this;
  63249. return (4000);
  63250. },
  63251. args: [],
  63252. source: "defaultPort\x0a\x09^ 4000",
  63253. referencedClasses: [],
  63254. messageSends: []
  63255. }),
  63256. $globals.FileServer.a$cls);
  63257. $core.addMethod(
  63258. $core.method({
  63259. selector: "main",
  63260. protocol: "initialization",
  63261. fn: function (){
  63262. var self=this,$self=this;
  63263. var fileServer,args;
  63264. return $core.withContext(function($ctx1) {
  63265. var $1;
  63266. var $early={};
  63267. try {
  63268. args=$recv(process)._argv();
  63269. $recv(args)._removeFrom_to_((1),(3));
  63270. $recv(args)._detect_ifNone_((function(each){
  63271. return $core.withContext(function($ctx2) {
  63272. $1=$recv(each).__eq("--help");
  63273. if($core.assert($1)){
  63274. return $recv($globals.FileServer)._printHelp();
  63275. }
  63276. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63277. }),(function(){
  63278. return $core.withContext(function($ctx2) {
  63279. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  63280. throw $early=[$recv(fileServer)._start()];
  63281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63282. }));
  63283. return self;
  63284. }
  63285. catch(e) {if(e===$early)return e[0]; throw e}
  63286. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.a$cls)});
  63287. },
  63288. args: [],
  63289. 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]",
  63290. referencedClasses: ["FileServer"],
  63291. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  63292. }),
  63293. $globals.FileServer.a$cls);
  63294. $core.addMethod(
  63295. $core.method({
  63296. selector: "mimeTypeFor:",
  63297. protocol: "accessing",
  63298. fn: function (aString){
  63299. var self=this,$self=this;
  63300. return $core.withContext(function($ctx1) {
  63301. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  63302. return "text/plain";
  63303. }));
  63304. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.a$cls)});
  63305. },
  63306. args: ["aString"],
  63307. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  63308. referencedClasses: [],
  63309. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  63310. }),
  63311. $globals.FileServer.a$cls);
  63312. $core.addMethod(
  63313. $core.method({
  63314. selector: "mimeTypes",
  63315. protocol: "accessing",
  63316. fn: function (){
  63317. var self=this,$self=this;
  63318. return $core.withContext(function($ctx1) {
  63319. var $1,$receiver;
  63320. $1=$self["@mimeTypes"];
  63321. if(($receiver = $1) == null || $receiver.a$nil){
  63322. $self["@mimeTypes"]=$self._defaultMimeTypes();
  63323. return $self["@mimeTypes"];
  63324. } else {
  63325. return $1;
  63326. }
  63327. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.a$cls)});
  63328. },
  63329. args: [],
  63330. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  63331. referencedClasses: [],
  63332. messageSends: ["ifNil:", "defaultMimeTypes"]
  63333. }),
  63334. $globals.FileServer.a$cls);
  63335. $core.addMethod(
  63336. $core.method({
  63337. selector: "printHelp",
  63338. protocol: "accessing",
  63339. fn: function (){
  63340. var self=this,$self=this;
  63341. return $core.withContext(function($ctx1) {
  63342. $recv(console)._log_("Available commandline options are:");
  63343. $ctx1.sendIdx["log:"]=1;
  63344. $recv(console)._log_("--help");
  63345. $ctx1.sendIdx["log:"]=2;
  63346. $recv($self._commandLineSwitches())._do_((function(each){
  63347. return $core.withContext(function($ctx2) {
  63348. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  63349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63350. }));
  63351. return self;
  63352. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.a$cls)});
  63353. },
  63354. args: [],
  63355. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  63356. referencedClasses: [],
  63357. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  63358. }),
  63359. $globals.FileServer.a$cls);
  63360. $core.addMethod(
  63361. $core.method({
  63362. selector: "selectorForCommandLineSwitch:",
  63363. protocol: "accessing",
  63364. fn: function (aSwitch){
  63365. var self=this,$self=this;
  63366. return $core.withContext(function($ctx1) {
  63367. var $1;
  63368. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  63369. return $core.withContext(function($ctx2) {
  63370. return $recv($recv(each)._second())._asUppercase();
  63371. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63372. }));
  63373. $ctx1.sendIdx["replace:with:"]=1;
  63374. return $recv($1).__comma(":");
  63375. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.a$cls)});
  63376. },
  63377. args: ["aSwitch"],
  63378. 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 ]), ':'",
  63379. referencedClasses: [],
  63380. messageSends: [",", "replace:with:", "asUppercase", "second"]
  63381. }),
  63382. $globals.FileServer.a$cls);
  63383. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  63384. $core.addMethod(
  63385. $core.method({
  63386. selector: "finishMessage",
  63387. protocol: "action",
  63388. fn: function (){
  63389. var self=this,$self=this;
  63390. return $core.withContext(function($ctx1) {
  63391. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  63392. $recv((function(){
  63393. }))._valueWithTimeout_((600));
  63394. return self;
  63395. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  63396. },
  63397. args: [],
  63398. 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",
  63399. referencedClasses: ["String"],
  63400. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  63401. }),
  63402. $globals.Initer);
  63403. $core.addMethod(
  63404. $core.method({
  63405. selector: "gruntInitThenDo:",
  63406. protocol: "action",
  63407. fn: function (aBlock){
  63408. var self=this,$self=this;
  63409. var child,sanitizedTemplatePath;
  63410. return $core.withContext(function($ctx1) {
  63411. var $1,$3,$2;
  63412. sanitizedTemplatePath=$recv($recv($recv($self["@path"])._join_with_($self["@nmPath"],"@ambers/grunt-init-amber-project"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  63413. $ctx1.sendIdx["replace:with:"]=1;
  63414. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  63415. $1=child;
  63416. $recv($1)._on_do_("error",aBlock);
  63417. $ctx1.sendIdx["on:do:"]=1;
  63418. $recv($1)._on_do_("close",(function(code){
  63419. return $core.withContext(function($ctx2) {
  63420. $3=$recv(code).__eq((0));
  63421. if($core.assert($3)){
  63422. $2=nil;
  63423. } else {
  63424. $2=code;
  63425. }
  63426. return $recv(aBlock)._value_($2);
  63427. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63428. }));
  63429. return self;
  63430. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  63431. },
  63432. args: ["aBlock"],
  63433. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: '@ambers/grunt-init-amber-project')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  63434. referencedClasses: [],
  63435. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63436. }),
  63437. $globals.Initer);
  63438. $core.addMethod(
  63439. $core.method({
  63440. selector: "initProjectThenDo:",
  63441. protocol: "action",
  63442. fn: function (aBlock){
  63443. var self=this,$self=this;
  63444. var child;
  63445. return $core.withContext(function($ctx1) {
  63446. var $1;
  63447. child=$recv($self["@childProcess"])._exec_thenDo_("npm run init",aBlock);
  63448. $1=$recv(child)._stdout();
  63449. $ctx1.sendIdx["stdout"]=1;
  63450. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  63451. return self;
  63452. }, function($ctx1) {$ctx1.fill(self,"initProjectThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63453. },
  63454. args: ["aBlock"],
  63455. source: "initProjectThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: 'npm run init'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  63456. referencedClasses: [],
  63457. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  63458. }),
  63459. $globals.Initer);
  63460. $core.addMethod(
  63461. $core.method({
  63462. selector: "initialize",
  63463. protocol: "initialization",
  63464. fn: function (){
  63465. var self=this,$self=this;
  63466. return $core.withContext(function($ctx1) {
  63467. (
  63468. $ctx1.supercall = true,
  63469. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63470. $ctx1.supercall = false;
  63471. $self["@childProcess"]=$recv(require)._value_("child_process");
  63472. $self["@nmPath"]=$recv($self["@path"])._join_with_($self._rootDirname(),"node_modules");
  63473. return self;
  63474. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  63475. },
  63476. args: [],
  63477. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  63478. referencedClasses: [],
  63479. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  63480. }),
  63481. $globals.Initer);
  63482. $core.addMethod(
  63483. $core.method({
  63484. selector: "npmScriptForModule:named:",
  63485. protocol: "npm",
  63486. fn: function (aString,anotherString){
  63487. var self=this,$self=this;
  63488. var modulePath,packageJson,binSection,scriptPath;
  63489. return $core.withContext(function($ctx1) {
  63490. var $1,$3,$4,$2,$5;
  63491. $1=$self["@path"];
  63492. $3=$recv(require)._provided();
  63493. $4=$recv(aString).__comma("/package.json");
  63494. $ctx1.sendIdx[","]=1;
  63495. $2=$recv($3)._resolve_($4);
  63496. modulePath=$recv($1)._dirname_($2);
  63497. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  63498. binSection=$recv(packageJson)._at_("bin");
  63499. $ctx1.sendIdx["at:"]=1;
  63500. $5=$recv(binSection)._isString();
  63501. if($core.assert($5)){
  63502. scriptPath=binSection;
  63503. } else {
  63504. scriptPath=$recv(binSection)._at_(anotherString);
  63505. }
  63506. return $recv($self["@path"])._join_with_(modulePath,scriptPath);
  63507. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  63508. },
  63509. args: ["aString", "anotherString"],
  63510. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09require provided resolve: aString, '/package.json').\x0a\x09packageJson := Smalltalk readJSObject: (\x0a\x09\x09require value: aString, '/package.json').\x0a\x09binSection := packageJson at: 'bin'.\x0a\x09scriptPath := binSection isString\x0a\x09\x09ifTrue: [ binSection ]\x0a\x09\x09ifFalse: [ binSection at: anotherString ].\x0a\x09^ path join: modulePath with: scriptPath",
  63511. referencedClasses: ["Smalltalk"],
  63512. messageSends: ["dirname:", "resolve:", "provided", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  63513. }),
  63514. $globals.Initer);
  63515. $core.addMethod(
  63516. $core.method({
  63517. selector: "start",
  63518. protocol: "action",
  63519. fn: function (){
  63520. var self=this,$self=this;
  63521. return $core.withContext(function($ctx1) {
  63522. var $1,$2,$3,$receiver;
  63523. $self._gruntInitThenDo_((function(error){
  63524. return $core.withContext(function($ctx2) {
  63525. if(($receiver = error) == null || $receiver.a$nil){
  63526. return $self._initProjectThenDo_((function(error2){
  63527. return $core.withContext(function($ctx3) {
  63528. if(($receiver = error2) == null || $receiver.a$nil){
  63529. $self._finishMessage();
  63530. return $recv(process)._exit();
  63531. } else {
  63532. $3=console;
  63533. $recv($3)._log_("npm run init exec error:");
  63534. $ctx3.sendIdx["log:"]=3;
  63535. $recv($3)._log_(error2);
  63536. return $recv(process)._exit_((105));
  63537. }
  63538. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  63539. }));
  63540. } else {
  63541. $1=console;
  63542. $recv($1)._log_("grunt-init exec error:");
  63543. $ctx2.sendIdx["log:"]=1;
  63544. $2=$recv($1)._log_(error);
  63545. $ctx2.sendIdx["log:"]=2;
  63546. return $recv(process)._exit_((101));
  63547. $ctx2.sendIdx["exit:"]=1;
  63548. }
  63549. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  63550. }));
  63551. return self;
  63552. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  63553. },
  63554. args: [],
  63555. 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 initProjectThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm run init exec error:'; log: error2.\x0a\x09\x09process exit: 105 ]\x0a\x09ifNil: [\x0a\x0a\x09self finishMessage.\x0a\x09process exit ]]]]",
  63556. referencedClasses: [],
  63557. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "initProjectThenDo:", "finishMessage", "exit"]
  63558. }),
  63559. $globals.Initer);
  63560. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  63561. $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.";
  63562. $core.addMethod(
  63563. $core.method({
  63564. selector: "addVariableNamed:to:",
  63565. protocol: "private",
  63566. fn: function (aString,anObject){
  63567. var self=this,$self=this;
  63568. var newClass,newObject;
  63569. return $core.withContext(function($ctx1) {
  63570. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  63571. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  63572. newObject=$recv(newClass)._new();
  63573. $self._setPreviousVariablesFor_from_(newObject,anObject);
  63574. return newObject;
  63575. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  63576. },
  63577. args: ["aString", "anObject"],
  63578. 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",
  63579. referencedClasses: [],
  63580. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  63581. }),
  63582. $globals.Repl);
  63583. $core.addMethod(
  63584. $core.method({
  63585. selector: "assignNewVariable:do:",
  63586. protocol: "private",
  63587. fn: function (buffer,aBlock){
  63588. var self=this,$self=this;
  63589. return $core.withContext(function($ctx1) {
  63590. var $2,$3,$1,$receiver;
  63591. return $self._parseAssignment_do_(buffer,(function(name,expr){
  63592. var varName,value;
  63593. return $core.withContext(function($ctx2) {
  63594. if(($receiver = name) == null || $receiver.a$nil){
  63595. varName=$self._nextResultName();
  63596. } else {
  63597. varName=name;
  63598. }
  63599. $self["@session"]=$self._addVariableNamed_to_(varName,$self["@session"]);
  63600. $recv((function(){
  63601. return $core.withContext(function($ctx3) {
  63602. $2=$recv(varName).__comma(" := ");
  63603. if(($receiver = expr) == null || $receiver.a$nil){
  63604. $3=buffer;
  63605. } else {
  63606. $3=expr;
  63607. }
  63608. $1=$recv($2).__comma($3);
  63609. $ctx3.sendIdx[","]=1;
  63610. value=$self._eval_on_($1,$self["@session"]);
  63611. return value;
  63612. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63613. }))._on_do_($globals.Error,(function(e){
  63614. return $core.withContext(function($ctx3) {
  63615. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  63616. value=nil;
  63617. return value;
  63618. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  63619. }));
  63620. return $recv(aBlock)._value_value_(varName,value);
  63621. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  63622. }));
  63623. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  63624. },
  63625. args: ["buffer", "aBlock"],
  63626. 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]",
  63627. referencedClasses: ["Error", "ConsoleErrorHandler"],
  63628. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  63629. }),
  63630. $globals.Repl);
  63631. $core.addMethod(
  63632. $core.method({
  63633. selector: "clearScreen",
  63634. protocol: "actions",
  63635. fn: function (){
  63636. var self=this,$self=this;
  63637. var esc,cls;
  63638. return $core.withContext(function($ctx1) {
  63639. var $1;
  63640. esc=$recv($globals.String)._fromCharCode_((27));
  63641. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  63642. $ctx1.sendIdx[","]=2;
  63643. cls=$recv($1).__comma("[0;0f");
  63644. $ctx1.sendIdx[","]=1;
  63645. $recv($recv(process)._stdout())._write_(cls);
  63646. $recv($self["@interface"])._prompt();
  63647. return self;
  63648. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  63649. },
  63650. args: [],
  63651. 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",
  63652. referencedClasses: ["String"],
  63653. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  63654. }),
  63655. $globals.Repl);
  63656. $core.addMethod(
  63657. $core.method({
  63658. selector: "close",
  63659. protocol: "actions",
  63660. fn: function (){
  63661. var self=this,$self=this;
  63662. return $core.withContext(function($ctx1) {
  63663. $recv($recv(process)._stdin())._destroy();
  63664. return self;
  63665. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  63666. },
  63667. args: [],
  63668. source: "close\x0a\x09process stdin destroy",
  63669. referencedClasses: [],
  63670. messageSends: ["destroy", "stdin"]
  63671. }),
  63672. $globals.Repl);
  63673. $core.addMethod(
  63674. $core.method({
  63675. selector: "commands",
  63676. protocol: "accessing",
  63677. fn: function (){
  63678. var self=this,$self=this;
  63679. return $self["@commands"];
  63680. },
  63681. args: [],
  63682. source: "commands\x0a\x09^ commands",
  63683. referencedClasses: [],
  63684. messageSends: []
  63685. }),
  63686. $globals.Repl);
  63687. $core.addMethod(
  63688. $core.method({
  63689. selector: "createInterface",
  63690. protocol: "actions",
  63691. fn: function (){
  63692. var self=this,$self=this;
  63693. return $core.withContext(function($ctx1) {
  63694. $self["@interface"]=$recv($self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  63695. $recv($self["@interface"])._on_do_("line",(function(buffer){
  63696. return $core.withContext(function($ctx2) {
  63697. return $self._processLine_(buffer);
  63698. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  63699. }));
  63700. $ctx1.sendIdx["on:do:"]=1;
  63701. $recv($self["@interface"])._on_do_("close",(function(){
  63702. return $core.withContext(function($ctx2) {
  63703. return $self._close();
  63704. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63705. }));
  63706. $self._printWelcome();
  63707. $self._setupHotkeys();
  63708. $self._setPrompt();
  63709. $recv($self["@interface"])._prompt();
  63710. return self;
  63711. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  63712. },
  63713. args: [],
  63714. 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",
  63715. referencedClasses: [],
  63716. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  63717. }),
  63718. $globals.Repl);
  63719. $core.addMethod(
  63720. $core.method({
  63721. selector: "encapsulateVariable:withValue:in:",
  63722. protocol: "private",
  63723. fn: function (aString,anObject,aClass){
  63724. var self=this,$self=this;
  63725. var compiler;
  63726. return $core.withContext(function($ctx1) {
  63727. var $1,$4,$3,$2,$5,$6;
  63728. compiler=$recv($globals.Compiler)._new();
  63729. $1=compiler;
  63730. $4=$recv(aString).__comma(": anObject ^ ");
  63731. $ctx1.sendIdx[","]=3;
  63732. $3=$recv($4).__comma(aString);
  63733. $ctx1.sendIdx[","]=2;
  63734. $2=$recv($3).__comma(" := anObject");
  63735. $ctx1.sendIdx[","]=1;
  63736. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  63737. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  63738. $5=compiler;
  63739. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  63740. $ctx1.sendIdx[","]=4;
  63741. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  63742. return self;
  63743. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  63744. },
  63745. args: ["aString", "anObject", "aClass"],
  63746. 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'.",
  63747. referencedClasses: ["Compiler"],
  63748. messageSends: ["new", "install:forClass:protocol:", ","]
  63749. }),
  63750. $globals.Repl);
  63751. $core.addMethod(
  63752. $core.method({
  63753. selector: "eval:",
  63754. protocol: "actions",
  63755. fn: function (buffer){
  63756. var self=this,$self=this;
  63757. return $core.withContext(function($ctx1) {
  63758. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  63759. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  63760. },
  63761. args: ["buffer"],
  63762. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  63763. referencedClasses: ["DoIt"],
  63764. messageSends: ["eval:on:", "new"]
  63765. }),
  63766. $globals.Repl);
  63767. $core.addMethod(
  63768. $core.method({
  63769. selector: "eval:on:",
  63770. protocol: "actions",
  63771. fn: function (buffer,anObject){
  63772. var self=this,$self=this;
  63773. var result;
  63774. return $core.withContext(function($ctx1) {
  63775. var $1;
  63776. $recv(buffer)._ifNotEmpty_((function(){
  63777. return $core.withContext(function($ctx2) {
  63778. return $recv((function(){
  63779. return $core.withContext(function($ctx3) {
  63780. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  63781. return result;
  63782. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63783. }))._tryCatch_((function(e){
  63784. return $core.withContext(function($ctx3) {
  63785. $1=$recv(e)._isSmalltalkError();
  63786. if($core.assert($1)){
  63787. return $recv(e)._pass();
  63788. } else {
  63789. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  63790. }
  63791. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  63792. }));
  63793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63794. }));
  63795. return result;
  63796. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  63797. },
  63798. args: ["buffer", "anObject"],
  63799. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer ifNotEmpty: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09\x09ifTrue: [ e pass ]\x0a\x09\x09\x09\x09\x09ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  63800. referencedClasses: ["Compiler"],
  63801. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "pass", "write:", "stdout", "jsStack"]
  63802. }),
  63803. $globals.Repl);
  63804. $core.addMethod(
  63805. $core.method({
  63806. selector: "executeCommand:",
  63807. protocol: "private",
  63808. fn: function (aString){
  63809. var self=this,$self=this;
  63810. return $core.withContext(function($ctx1) {
  63811. var $1;
  63812. var $early={};
  63813. try {
  63814. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  63815. return $core.withContext(function($ctx2) {
  63816. $1=$recv(names)._includes_(aString);
  63817. if($core.assert($1)){
  63818. $recv(cmd)._value();
  63819. throw $early=[true];
  63820. }
  63821. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  63822. }));
  63823. return false;
  63824. }
  63825. catch(e) {if(e===$early)return e[0]; throw e}
  63826. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  63827. },
  63828. args: ["aString"],
  63829. 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",
  63830. referencedClasses: [],
  63831. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  63832. }),
  63833. $globals.Repl);
  63834. $core.addMethod(
  63835. $core.method({
  63836. selector: "initialize",
  63837. protocol: "initialization",
  63838. fn: function (){
  63839. var self=this,$self=this;
  63840. return $core.withContext(function($ctx1) {
  63841. (
  63842. $ctx1.supercall = true,
  63843. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63844. $ctx1.supercall = false;
  63845. $self["@session"]=$recv($globals.DoIt)._new();
  63846. $self["@readline"]=$recv(require)._value_("readline");
  63847. $ctx1.sendIdx["value:"]=1;
  63848. $self["@util"]=$recv(require)._value_("util");
  63849. $self._setupCommands();
  63850. return self;
  63851. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  63852. },
  63853. args: [],
  63854. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  63855. referencedClasses: ["DoIt"],
  63856. messageSends: ["initialize", "new", "value:", "setupCommands"]
  63857. }),
  63858. $globals.Repl);
  63859. $core.addMethod(
  63860. $core.method({
  63861. selector: "instanceVariableNamesFor:",
  63862. protocol: "private",
  63863. fn: function (aClass){
  63864. var self=this,$self=this;
  63865. return $core.withContext(function($ctx1) {
  63866. var $1,$2,$receiver;
  63867. $1=$recv(aClass)._superclass();
  63868. $ctx1.sendIdx["superclass"]=1;
  63869. if(($receiver = $1) == null || $receiver.a$nil){
  63870. return $recv(aClass)._instanceVariableNames();
  63871. } else {
  63872. $2=$recv(aClass)._instanceVariableNames();
  63873. $ctx1.sendIdx["instanceVariableNames"]=1;
  63874. return $recv($2)._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  63875. }
  63876. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  63877. },
  63878. args: ["aClass"],
  63879. 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]",
  63880. referencedClasses: [],
  63881. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  63882. }),
  63883. $globals.Repl);
  63884. $core.addMethod(
  63885. $core.method({
  63886. selector: "isIdentifier:",
  63887. protocol: "private",
  63888. fn: function (aString){
  63889. var self=this,$self=this;
  63890. return $core.withContext(function($ctx1) {
  63891. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  63892. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  63893. },
  63894. args: ["aString"],
  63895. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  63896. referencedClasses: [],
  63897. messageSends: ["match:", "asRegexp"]
  63898. }),
  63899. $globals.Repl);
  63900. $core.addMethod(
  63901. $core.method({
  63902. selector: "isVariableDefined:",
  63903. protocol: "private",
  63904. fn: function (aString){
  63905. var self=this,$self=this;
  63906. return $core.withContext(function($ctx1) {
  63907. return $recv($self._instanceVariableNamesFor_($recv($self["@session"])._class()))._includes_(aString);
  63908. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  63909. },
  63910. args: ["aString"],
  63911. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  63912. referencedClasses: [],
  63913. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  63914. }),
  63915. $globals.Repl);
  63916. $core.addMethod(
  63917. $core.method({
  63918. selector: "nextResultName",
  63919. protocol: "private",
  63920. fn: function (){
  63921. var self=this,$self=this;
  63922. return $core.withContext(function($ctx1) {
  63923. var $1,$receiver;
  63924. $1=$self["@resultCount"];
  63925. if(($receiver = $1) == null || $receiver.a$nil){
  63926. $self["@resultCount"]=(1);
  63927. } else {
  63928. $self["@resultCount"]=$recv($self["@resultCount"]).__plus((1));
  63929. }
  63930. return "res".__comma($recv($self["@resultCount"])._asString());
  63931. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  63932. },
  63933. args: [],
  63934. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  63935. referencedClasses: [],
  63936. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  63937. }),
  63938. $globals.Repl);
  63939. $core.addMethod(
  63940. $core.method({
  63941. selector: "onKeyPress:",
  63942. protocol: "private",
  63943. fn: function (key){
  63944. var self=this,$self=this;
  63945. return $core.withContext(function($ctx1) {
  63946. var $1;
  63947. $1=$recv($recv(key)._ctrl())._and_((function(){
  63948. return $core.withContext(function($ctx2) {
  63949. return $recv($recv(key)._name()).__eq("l");
  63950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63951. }));
  63952. if($core.assert($1)){
  63953. $self._clearScreen();
  63954. }
  63955. return self;
  63956. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  63957. },
  63958. args: ["key"],
  63959. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  63960. referencedClasses: [],
  63961. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  63962. }),
  63963. $globals.Repl);
  63964. $core.addMethod(
  63965. $core.method({
  63966. selector: "parseAssignment:do:",
  63967. protocol: "private",
  63968. fn: function (aString,aBlock){
  63969. var self=this,$self=this;
  63970. var assignment;
  63971. return $core.withContext(function($ctx1) {
  63972. var $2,$1;
  63973. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  63974. return $core.withContext(function($ctx2) {
  63975. return $recv(s)._trimBoth();
  63976. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  63977. }));
  63978. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  63979. return $core.withContext(function($ctx2) {
  63980. $2=$recv(assignment)._first();
  63981. $ctx2.sendIdx["first"]=1;
  63982. return $self._isIdentifier_($2);
  63983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63984. }));
  63985. if($core.assert($1)){
  63986. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  63987. $ctx1.sendIdx["value:value:"]=1;
  63988. } else {
  63989. return $recv(aBlock)._value_value_(nil,nil);
  63990. }
  63991. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  63992. },
  63993. args: ["aString", "aBlock"],
  63994. 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 ]",
  63995. referencedClasses: [],
  63996. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  63997. }),
  63998. $globals.Repl);
  63999. $core.addMethod(
  64000. $core.method({
  64001. selector: "presentResultNamed:withValue:",
  64002. protocol: "private",
  64003. fn: function (varName,value){
  64004. var self=this,$self=this;
  64005. return $core.withContext(function($ctx1) {
  64006. var $3,$2,$1;
  64007. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  64008. $ctx1.sendIdx[","]=3;
  64009. $2=$recv($3).__comma(" = ");
  64010. $ctx1.sendIdx[","]=2;
  64011. $1=$recv($2).__comma($recv(value)._asString());
  64012. $ctx1.sendIdx[","]=1;
  64013. $recv($globals.Transcript)._show_($1);
  64014. $recv($globals.Transcript)._cr();
  64015. $recv($self["@interface"])._prompt();
  64016. return self;
  64017. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  64018. },
  64019. args: ["varName", "value"],
  64020. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  64021. referencedClasses: ["Transcript"],
  64022. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  64023. }),
  64024. $globals.Repl);
  64025. $core.addMethod(
  64026. $core.method({
  64027. selector: "printWelcome",
  64028. protocol: "actions",
  64029. fn: function (){
  64030. var self=this,$self=this;
  64031. return $core.withContext(function($ctx1) {
  64032. $recv($globals.Transcript)._show_("Type :q to exit.");
  64033. $recv($globals.Transcript)._cr();
  64034. return self;
  64035. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  64036. },
  64037. args: [],
  64038. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  64039. referencedClasses: ["Transcript"],
  64040. messageSends: ["show:", "cr"]
  64041. }),
  64042. $globals.Repl);
  64043. $core.addMethod(
  64044. $core.method({
  64045. selector: "processLine:",
  64046. protocol: "private",
  64047. fn: function (buffer){
  64048. var self=this,$self=this;
  64049. var show;
  64050. return $core.withContext(function($ctx1) {
  64051. var $1,$2;
  64052. show=(function(varName,value){
  64053. return $core.withContext(function($ctx2) {
  64054. return $self._presentResultNamed_withValue_(varName,value);
  64055. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  64056. });
  64057. $1=$self._executeCommand_(buffer);
  64058. if(!$core.assert($1)){
  64059. $2=$self._isVariableDefined_(buffer);
  64060. if($core.assert($2)){
  64061. $recv(show)._value_value_(buffer,$recv($self["@session"])._perform_(buffer));
  64062. } else {
  64063. $self._assignNewVariable_do_(buffer,show);
  64064. }
  64065. }
  64066. return self;
  64067. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  64068. },
  64069. args: ["buffer"],
  64070. 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]]",
  64071. referencedClasses: [],
  64072. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  64073. }),
  64074. $globals.Repl);
  64075. $core.addMethod(
  64076. $core.method({
  64077. selector: "prompt",
  64078. protocol: "accessing",
  64079. fn: function (){
  64080. var self=this,$self=this;
  64081. return "amber >> ";
  64082. },
  64083. args: [],
  64084. source: "prompt\x0a\x09^ 'amber >> '",
  64085. referencedClasses: [],
  64086. messageSends: []
  64087. }),
  64088. $globals.Repl);
  64089. $core.addMethod(
  64090. $core.method({
  64091. selector: "setPreviousVariablesFor:from:",
  64092. protocol: "private",
  64093. fn: function (newObject,oldObject){
  64094. var self=this,$self=this;
  64095. return $core.withContext(function($ctx1) {
  64096. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  64097. return $core.withContext(function($ctx2) {
  64098. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  64099. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64100. }));
  64101. return self;
  64102. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  64103. },
  64104. args: ["newObject", "oldObject"],
  64105. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  64106. referencedClasses: [],
  64107. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  64108. }),
  64109. $globals.Repl);
  64110. $core.addMethod(
  64111. $core.method({
  64112. selector: "setPrompt",
  64113. protocol: "actions",
  64114. fn: function (){
  64115. var self=this,$self=this;
  64116. return $core.withContext(function($ctx1) {
  64117. $recv($self["@interface"])._setPrompt_($self._prompt());
  64118. return self;
  64119. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  64120. },
  64121. args: [],
  64122. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  64123. referencedClasses: [],
  64124. messageSends: ["setPrompt:", "prompt"]
  64125. }),
  64126. $globals.Repl);
  64127. $core.addMethod(
  64128. $core.method({
  64129. selector: "setupCommands",
  64130. protocol: "initialization",
  64131. fn: function (){
  64132. var self=this,$self=this;
  64133. return $core.withContext(function($ctx1) {
  64134. var $2,$1;
  64135. $2=$recv([":q"]).__minus_gt((function(){
  64136. return $core.withContext(function($ctx2) {
  64137. return $recv(process)._exit();
  64138. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64139. }));
  64140. $ctx1.sendIdx["->"]=1;
  64141. $1=[$2,$recv([""]).__minus_gt((function(){
  64142. return $core.withContext(function($ctx2) {
  64143. return $recv($self["@interface"])._prompt();
  64144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64145. }))];
  64146. $self["@commands"]=$recv($globals.Dictionary)._from_($1);
  64147. return self;
  64148. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  64149. },
  64150. args: [],
  64151. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  64152. referencedClasses: ["Dictionary"],
  64153. messageSends: ["from:", "->", "exit", "prompt"]
  64154. }),
  64155. $globals.Repl);
  64156. $core.addMethod(
  64157. $core.method({
  64158. selector: "setupHotkeys",
  64159. protocol: "initialization",
  64160. fn: function (){
  64161. var self=this,$self=this;
  64162. return $core.withContext(function($ctx1) {
  64163. var $receiver;
  64164. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  64165. return $core.withContext(function($ctx2) {
  64166. if(($receiver = key) == null || $receiver.a$nil){
  64167. return key;
  64168. } else {
  64169. return $self._onKeyPress_(key);
  64170. }
  64171. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  64172. }));
  64173. return self;
  64174. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  64175. },
  64176. args: [],
  64177. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  64178. referencedClasses: [],
  64179. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  64180. }),
  64181. $globals.Repl);
  64182. $core.addMethod(
  64183. $core.method({
  64184. selector: "subclass:withVariable:",
  64185. protocol: "private",
  64186. fn: function (aClass,varName){
  64187. var self=this,$self=this;
  64188. return $core.withContext(function($ctx1) {
  64189. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  64190. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  64191. },
  64192. args: ["aClass", "varName"],
  64193. 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'",
  64194. referencedClasses: ["ClassBuilder"],
  64195. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  64196. }),
  64197. $globals.Repl);
  64198. $core.addMethod(
  64199. $core.method({
  64200. selector: "subclassNameFor:",
  64201. protocol: "private",
  64202. fn: function (aClass){
  64203. var self=this,$self=this;
  64204. return $core.withContext(function($ctx1) {
  64205. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  64206. $2=$recv(aClass)._name();
  64207. $ctx1.sendIdx["name"]=1;
  64208. $1=$recv($2)._matchesOf_("\x5cd+$");
  64209. $ctx1.sendIdx["matchesOf:"]=1;
  64210. if(($receiver = $1) == null || $receiver.a$nil){
  64211. return $recv($recv(aClass)._name()).__comma("2");
  64212. } else {
  64213. var counter;
  64214. $6=$recv(aClass)._name();
  64215. $ctx1.sendIdx["name"]=2;
  64216. $5=$recv($6)._matchesOf_("\x5cd+$");
  64217. $4=$recv($5)._first();
  64218. $3=$recv($4)._asNumber();
  64219. counter=$recv($3).__plus((1));
  64220. $7=$recv(aClass)._name();
  64221. $ctx1.sendIdx["name"]=3;
  64222. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  64223. }
  64224. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  64225. },
  64226. args: ["aClass"],
  64227. 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'].",
  64228. referencedClasses: [],
  64229. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  64230. }),
  64231. $globals.Repl);
  64232. $core.addMethod(
  64233. $core.method({
  64234. selector: "main",
  64235. protocol: "initialization",
  64236. fn: function (){
  64237. var self=this,$self=this;
  64238. return $core.withContext(function($ctx1) {
  64239. $recv($self._new())._createInterface();
  64240. return self;
  64241. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.a$cls)});
  64242. },
  64243. args: [],
  64244. source: "main\x0a\x09self new createInterface",
  64245. referencedClasses: [],
  64246. messageSends: ["createInterface", "new"]
  64247. }),
  64248. $globals.Repl.a$cls);
  64249. });
  64250. (function () {
  64251. define('__app__',["amber/devel", "amber_core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
  64252. amber.initialize().then(function () {
  64253. amber.globals.AmberCli._main();
  64254. });
  64255. });
  64256. }());
  64257. require(["app"]);
  64258. });
  64259. define.require('__wrap__');
  64260. }((function amdefine(module, requireFn) {
  64261. 'use strict';
  64262. var defineCache = {},
  64263. loaderCache = {},
  64264. alreadyCalled = false,
  64265. path = require('path'),
  64266. makeRequire, stringRequire;
  64267. /**
  64268. * Trims the . and .. from an array of path segments.
  64269. * It will keep a leading path segment if a .. will become
  64270. * the first path segment, to help with module name lookups,
  64271. * which act like paths, but can be remapped. But the end result,
  64272. * all paths that use this function should look normalized.
  64273. * NOTE: this method MODIFIES the input array.
  64274. * @param {Array} ary the array of path segments.
  64275. */
  64276. function trimDots(ary) {
  64277. var i, part;
  64278. for (i = 0; ary[i]; i+= 1) {
  64279. part = ary[i];
  64280. if (part === '.') {
  64281. ary.splice(i, 1);
  64282. i -= 1;
  64283. } else if (part === '..') {
  64284. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  64285. //End of the line. Keep at least one non-dot
  64286. //path segment at the front so it can be mapped
  64287. //correctly to disk. Otherwise, there is likely
  64288. //no path mapping for a path starting with '..'.
  64289. //This can still fail, but catches the most reasonable
  64290. //uses of ..
  64291. break;
  64292. } else if (i > 0) {
  64293. ary.splice(i - 1, 2);
  64294. i -= 2;
  64295. }
  64296. }
  64297. }
  64298. }
  64299. function normalize(name, baseName) {
  64300. var baseParts;
  64301. //Adjust any relative paths.
  64302. if (name && name.charAt(0) === '.') {
  64303. //If have a base name, try to normalize against it,
  64304. //otherwise, assume it is a top-level require that will
  64305. //be relative to baseUrl in the end.
  64306. if (baseName) {
  64307. baseParts = baseName.split('/');
  64308. baseParts = baseParts.slice(0, baseParts.length - 1);
  64309. baseParts = baseParts.concat(name.split('/'));
  64310. trimDots(baseParts);
  64311. name = baseParts.join('/');
  64312. }
  64313. }
  64314. return name;
  64315. }
  64316. /**
  64317. * Create the normalize() function passed to a loader plugin's
  64318. * normalize method.
  64319. */
  64320. function makeNormalize(relName) {
  64321. return function (name) {
  64322. return normalize(name, relName);
  64323. };
  64324. }
  64325. function makeLoad(id) {
  64326. function load(value) {
  64327. loaderCache[id] = value;
  64328. }
  64329. load.fromText = function (id, text) {
  64330. //This one is difficult because the text can/probably uses
  64331. //define, and any relative paths and requires should be relative
  64332. //to that id was it would be found on disk. But this would require
  64333. //bootstrapping a module/require fairly deeply from node core.
  64334. //Not sure how best to go about that yet.
  64335. throw new Error('amdefine does not implement load.fromText');
  64336. };
  64337. return load;
  64338. }
  64339. makeRequire = function (systemRequire, exports, module, relId) {
  64340. function amdRequire(deps, callback) {
  64341. if (typeof deps === 'string') {
  64342. //Synchronous, single module require('')
  64343. return stringRequire(systemRequire, exports, module, deps, relId);
  64344. } else {
  64345. //Array of dependencies with a callback.
  64346. //Convert the dependencies to modules.
  64347. deps = deps.map(function (depName) {
  64348. return stringRequire(systemRequire, exports, module, depName, relId);
  64349. });
  64350. //Wait for next tick to call back the require call.
  64351. if (callback) {
  64352. process.nextTick(function () {
  64353. callback.apply(null, deps);
  64354. });
  64355. }
  64356. }
  64357. }
  64358. amdRequire.toUrl = function (filePath) {
  64359. if (filePath.indexOf('.') === 0) {
  64360. return normalize(filePath, path.dirname(module.filename));
  64361. } else {
  64362. return filePath;
  64363. }
  64364. };
  64365. return amdRequire;
  64366. };
  64367. //Favor explicit value, passed in if the module wants to support Node 0.4.
  64368. requireFn = requireFn || function req() {
  64369. return module.require.apply(module, arguments);
  64370. };
  64371. function runFactory(id, deps, factory) {
  64372. var r, e, m, result;
  64373. if (id) {
  64374. e = loaderCache[id] = {};
  64375. m = {
  64376. id: id,
  64377. uri: __filename,
  64378. exports: e
  64379. };
  64380. r = makeRequire(requireFn, e, m, id);
  64381. } else {
  64382. //Only support one define call per file
  64383. if (alreadyCalled) {
  64384. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  64385. }
  64386. alreadyCalled = true;
  64387. //Use the real variables from node
  64388. //Use module.exports for exports, since
  64389. //the exports in here is amdefine exports.
  64390. e = module.exports;
  64391. m = module;
  64392. r = makeRequire(requireFn, e, m, module.id);
  64393. }
  64394. //If there are dependencies, they are strings, so need
  64395. //to convert them to dependency values.
  64396. if (deps) {
  64397. deps = deps.map(function (depName) {
  64398. return r(depName);
  64399. });
  64400. }
  64401. //Call the factory with the right dependencies.
  64402. if (typeof factory === 'function') {
  64403. result = factory.apply(m.exports, deps);
  64404. } else {
  64405. result = factory;
  64406. }
  64407. if (result !== undefined) {
  64408. m.exports = result;
  64409. if (id) {
  64410. loaderCache[id] = m.exports;
  64411. }
  64412. }
  64413. }
  64414. stringRequire = function (systemRequire, exports, module, id, relId) {
  64415. //Split the ID by a ! so that
  64416. var index = id.indexOf('!'),
  64417. originalId = id,
  64418. prefix, plugin;
  64419. if (index === -1) {
  64420. id = normalize(id, relId);
  64421. //Straight module lookup. If it is one of the special dependencies,
  64422. //deal with it, otherwise, delegate to node.
  64423. if (id === 'require') {
  64424. return makeRequire(systemRequire, exports, module, relId);
  64425. } else if (id === 'exports') {
  64426. return exports;
  64427. } else if (id === 'module') {
  64428. return module;
  64429. } else if (loaderCache.hasOwnProperty(id)) {
  64430. return loaderCache[id];
  64431. } else if (defineCache[id]) {
  64432. runFactory.apply(null, defineCache[id]);
  64433. return loaderCache[id];
  64434. } else {
  64435. if(systemRequire) {
  64436. return systemRequire(originalId);
  64437. } else {
  64438. throw new Error('No module with ID: ' + id);
  64439. }
  64440. }
  64441. } else {
  64442. //There is a plugin in play.
  64443. prefix = id.substring(0, index);
  64444. id = id.substring(index + 1, id.length);
  64445. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  64446. if (plugin.normalize) {
  64447. id = plugin.normalize(id, makeNormalize(relId));
  64448. } else {
  64449. //Normalize the ID normally.
  64450. id = normalize(id, relId);
  64451. }
  64452. if (loaderCache[id]) {
  64453. return loaderCache[id];
  64454. } else {
  64455. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  64456. return loaderCache[id];
  64457. }
  64458. }
  64459. };
  64460. //Create a define function specific to the module asking for amdefine.
  64461. function define(id, deps, factory) {
  64462. if (Array.isArray(id)) {
  64463. factory = deps;
  64464. deps = id;
  64465. id = undefined;
  64466. } else if (typeof id !== 'string') {
  64467. factory = id;
  64468. id = deps = undefined;
  64469. }
  64470. if (deps && !Array.isArray(deps)) {
  64471. factory = deps;
  64472. deps = undefined;
  64473. }
  64474. if (!deps) {
  64475. deps = ['require', 'exports', 'module'];
  64476. }
  64477. //Set up properties for this module. If an ID, then use
  64478. //internal cache. If no ID, then use the external variables
  64479. //for this node module.
  64480. if (id) {
  64481. //Put the module in deep freeze until there is a
  64482. //require call for it.
  64483. defineCache[id] = [id, deps, factory];
  64484. } else {
  64485. runFactory(id, deps, factory);
  64486. }
  64487. }
  64488. //define.require, which has access to all the values in the
  64489. //cache. Useful for AMD modules that all have IDs in the file,
  64490. //but need to finally export a value to node based on one of those
  64491. //IDs.
  64492. define.require = function (id) {
  64493. if (loaderCache[id]) {
  64494. return loaderCache[id];
  64495. }
  64496. if (defineCache[id]) {
  64497. runFactory.apply(null, defineCache[id]);
  64498. return loaderCache[id];
  64499. }
  64500. };
  64501. define.amd = {};
  64502. return define;
  64503. }(module)), require));