amber-cli.js 2.2 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define('__wrap__', function (requirejs) {
  4. var module = void 0; // Bad UMDs workaround
  5. requirejs.resolve = require.resolve;
  6. require = requirejs;
  7. /*!
  8. * @overview es6-promise - a tiny implementation of Promises/A+.
  9. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  10. * @license Licensed under MIT license
  11. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  12. * @version 3.3.1
  13. */
  14. (function (global, factory) {
  15. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  16. typeof define === 'function' && define.amd ? define('amber/es6-promise',factory) :
  17. (global.ES6Promise = factory());
  18. }(this, (function () { 'use strict';
  19. function objectOrFunction(x) {
  20. return typeof x === 'function' || typeof x === 'object' && x !== null;
  21. }
  22. function isFunction(x) {
  23. return typeof x === 'function';
  24. }
  25. var _isArray = undefined;
  26. if (!Array.isArray) {
  27. _isArray = function (x) {
  28. return Object.prototype.toString.call(x) === '[object Array]';
  29. };
  30. } else {
  31. _isArray = Array.isArray;
  32. }
  33. var isArray = _isArray;
  34. var len = 0;
  35. var vertxNext = undefined;
  36. var customSchedulerFn = undefined;
  37. var asap = function asap(callback, arg) {
  38. queue[len] = callback;
  39. queue[len + 1] = arg;
  40. len += 2;
  41. if (len === 2) {
  42. // If len is 2, that means that we need to schedule an async flush.
  43. // If additional callbacks are queued before the queue is flushed, they
  44. // will be processed by this flush that we are scheduling.
  45. if (customSchedulerFn) {
  46. customSchedulerFn(flush);
  47. } else {
  48. scheduleFlush();
  49. }
  50. }
  51. };
  52. function setScheduler(scheduleFn) {
  53. customSchedulerFn = scheduleFn;
  54. }
  55. function setAsap(asapFn) {
  56. asap = asapFn;
  57. }
  58. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  59. var browserGlobal = browserWindow || {};
  60. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  61. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
  62. // test for web worker but not in IE10
  63. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  64. // node
  65. function useNextTick() {
  66. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  67. // see https://github.com/cujojs/when/issues/410 for details
  68. return function () {
  69. return process.nextTick(flush);
  70. };
  71. }
  72. // vertx
  73. function useVertxTimer() {
  74. return function () {
  75. vertxNext(flush);
  76. };
  77. }
  78. function useMutationObserver() {
  79. var iterations = 0;
  80. var observer = new BrowserMutationObserver(flush);
  81. var node = document.createTextNode('');
  82. observer.observe(node, { characterData: true });
  83. return function () {
  84. node.data = iterations = ++iterations % 2;
  85. };
  86. }
  87. // web worker
  88. function useMessageChannel() {
  89. var channel = new MessageChannel();
  90. channel.port1.onmessage = flush;
  91. return function () {
  92. return channel.port2.postMessage(0);
  93. };
  94. }
  95. function useSetTimeout() {
  96. // Store setTimeout reference so es6-promise will be unaffected by
  97. // other code modifying setTimeout (like sinon.useFakeTimers())
  98. var globalSetTimeout = setTimeout;
  99. return function () {
  100. return globalSetTimeout(flush, 1);
  101. };
  102. }
  103. var queue = new Array(1000);
  104. function flush() {
  105. for (var i = 0; i < len; i += 2) {
  106. var callback = queue[i];
  107. var arg = queue[i + 1];
  108. callback(arg);
  109. queue[i] = undefined;
  110. queue[i + 1] = undefined;
  111. }
  112. len = 0;
  113. }
  114. function attemptVertx() {
  115. try {
  116. var r = require;
  117. var vertx = r('vertx');
  118. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  119. return useVertxTimer();
  120. } catch (e) {
  121. return useSetTimeout();
  122. }
  123. }
  124. var scheduleFlush = undefined;
  125. // Decide what async method to use to triggering processing of queued callbacks:
  126. if (isNode) {
  127. scheduleFlush = useNextTick();
  128. } else if (BrowserMutationObserver) {
  129. scheduleFlush = useMutationObserver();
  130. } else if (isWorker) {
  131. scheduleFlush = useMessageChannel();
  132. } else if (browserWindow === undefined && typeof require === 'function') {
  133. scheduleFlush = attemptVertx();
  134. } else {
  135. scheduleFlush = useSetTimeout();
  136. }
  137. function then(onFulfillment, onRejection) {
  138. var _arguments = arguments;
  139. var parent = this;
  140. var child = new this.constructor(noop);
  141. if (child[PROMISE_ID] === undefined) {
  142. makePromise(child);
  143. }
  144. var _state = parent._state;
  145. if (_state) {
  146. (function () {
  147. var callback = _arguments[_state - 1];
  148. asap(function () {
  149. return invokeCallback(_state, child, callback, parent._result);
  150. });
  151. })();
  152. } else {
  153. subscribe(parent, child, onFulfillment, onRejection);
  154. }
  155. return child;
  156. }
  157. /**
  158. `Promise.resolve` returns a promise that will become resolved with the
  159. passed `value`. It is shorthand for the following:
  160. ```javascript
  161. let promise = new Promise(function(resolve, reject){
  162. resolve(1);
  163. });
  164. promise.then(function(value){
  165. // value === 1
  166. });
  167. ```
  168. Instead of writing the above, your code now simply becomes the following:
  169. ```javascript
  170. let promise = Promise.resolve(1);
  171. promise.then(function(value){
  172. // value === 1
  173. });
  174. ```
  175. @method resolve
  176. @static
  177. @param {Any} value value that the returned promise will be resolved with
  178. Useful for tooling.
  179. @return {Promise} a promise that will become fulfilled with the given
  180. `value`
  181. */
  182. function resolve(object) {
  183. /*jshint validthis:true */
  184. var Constructor = this;
  185. if (object && typeof object === 'object' && object.constructor === Constructor) {
  186. return object;
  187. }
  188. var promise = new Constructor(noop);
  189. _resolve(promise, object);
  190. return promise;
  191. }
  192. var PROMISE_ID = Math.random().toString(36).substring(16);
  193. function noop() {}
  194. var PENDING = void 0;
  195. var FULFILLED = 1;
  196. var REJECTED = 2;
  197. var GET_THEN_ERROR = new ErrorObject();
  198. function selfFulfillment() {
  199. return new TypeError("You cannot resolve a promise with itself");
  200. }
  201. function cannotReturnOwn() {
  202. return new TypeError('A promises callback cannot return that same promise.');
  203. }
  204. function getThen(promise) {
  205. try {
  206. return promise.then;
  207. } catch (error) {
  208. GET_THEN_ERROR.error = error;
  209. return GET_THEN_ERROR;
  210. }
  211. }
  212. function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  213. try {
  214. then.call(value, fulfillmentHandler, rejectionHandler);
  215. } catch (e) {
  216. return e;
  217. }
  218. }
  219. function handleForeignThenable(promise, thenable, then) {
  220. asap(function (promise) {
  221. var sealed = false;
  222. var error = tryThen(then, thenable, function (value) {
  223. if (sealed) {
  224. return;
  225. }
  226. sealed = true;
  227. if (thenable !== value) {
  228. _resolve(promise, value);
  229. } else {
  230. fulfill(promise, value);
  231. }
  232. }, function (reason) {
  233. if (sealed) {
  234. return;
  235. }
  236. sealed = true;
  237. _reject(promise, reason);
  238. }, 'Settle: ' + (promise._label || ' unknown promise'));
  239. if (!sealed && error) {
  240. sealed = true;
  241. _reject(promise, error);
  242. }
  243. }, promise);
  244. }
  245. function handleOwnThenable(promise, thenable) {
  246. if (thenable._state === FULFILLED) {
  247. fulfill(promise, thenable._result);
  248. } else if (thenable._state === REJECTED) {
  249. _reject(promise, thenable._result);
  250. } else {
  251. subscribe(thenable, undefined, function (value) {
  252. return _resolve(promise, value);
  253. }, function (reason) {
  254. return _reject(promise, reason);
  255. });
  256. }
  257. }
  258. function handleMaybeThenable(promise, maybeThenable, then$$) {
  259. if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
  260. handleOwnThenable(promise, maybeThenable);
  261. } else {
  262. if (then$$ === GET_THEN_ERROR) {
  263. _reject(promise, GET_THEN_ERROR.error);
  264. } else if (then$$ === undefined) {
  265. fulfill(promise, maybeThenable);
  266. } else if (isFunction(then$$)) {
  267. handleForeignThenable(promise, maybeThenable, then$$);
  268. } else {
  269. fulfill(promise, maybeThenable);
  270. }
  271. }
  272. }
  273. function _resolve(promise, value) {
  274. if (promise === value) {
  275. _reject(promise, selfFulfillment());
  276. } else if (objectOrFunction(value)) {
  277. handleMaybeThenable(promise, value, getThen(value));
  278. } else {
  279. fulfill(promise, value);
  280. }
  281. }
  282. function publishRejection(promise) {
  283. if (promise._onerror) {
  284. promise._onerror(promise._result);
  285. }
  286. publish(promise);
  287. }
  288. function fulfill(promise, value) {
  289. if (promise._state !== PENDING) {
  290. return;
  291. }
  292. promise._result = value;
  293. promise._state = FULFILLED;
  294. if (promise._subscribers.length !== 0) {
  295. asap(publish, promise);
  296. }
  297. }
  298. function _reject(promise, reason) {
  299. if (promise._state !== PENDING) {
  300. return;
  301. }
  302. promise._state = REJECTED;
  303. promise._result = reason;
  304. asap(publishRejection, promise);
  305. }
  306. function subscribe(parent, child, onFulfillment, onRejection) {
  307. var _subscribers = parent._subscribers;
  308. var length = _subscribers.length;
  309. parent._onerror = null;
  310. _subscribers[length] = child;
  311. _subscribers[length + FULFILLED] = onFulfillment;
  312. _subscribers[length + REJECTED] = onRejection;
  313. if (length === 0 && parent._state) {
  314. asap(publish, parent);
  315. }
  316. }
  317. function publish(promise) {
  318. var subscribers = promise._subscribers;
  319. var settled = promise._state;
  320. if (subscribers.length === 0) {
  321. return;
  322. }
  323. var child = undefined,
  324. callback = undefined,
  325. detail = promise._result;
  326. for (var i = 0; i < subscribers.length; i += 3) {
  327. child = subscribers[i];
  328. callback = subscribers[i + settled];
  329. if (child) {
  330. invokeCallback(settled, child, callback, detail);
  331. } else {
  332. callback(detail);
  333. }
  334. }
  335. promise._subscribers.length = 0;
  336. }
  337. function ErrorObject() {
  338. this.error = null;
  339. }
  340. var TRY_CATCH_ERROR = new ErrorObject();
  341. function tryCatch(callback, detail) {
  342. try {
  343. return callback(detail);
  344. } catch (e) {
  345. TRY_CATCH_ERROR.error = e;
  346. return TRY_CATCH_ERROR;
  347. }
  348. }
  349. function invokeCallback(settled, promise, callback, detail) {
  350. var hasCallback = isFunction(callback),
  351. value = undefined,
  352. error = undefined,
  353. succeeded = undefined,
  354. failed = undefined;
  355. if (hasCallback) {
  356. value = tryCatch(callback, detail);
  357. if (value === TRY_CATCH_ERROR) {
  358. failed = true;
  359. error = value.error;
  360. value = null;
  361. } else {
  362. succeeded = true;
  363. }
  364. if (promise === value) {
  365. _reject(promise, cannotReturnOwn());
  366. return;
  367. }
  368. } else {
  369. value = detail;
  370. succeeded = true;
  371. }
  372. if (promise._state !== PENDING) {
  373. // noop
  374. } else if (hasCallback && succeeded) {
  375. _resolve(promise, value);
  376. } else if (failed) {
  377. _reject(promise, error);
  378. } else if (settled === FULFILLED) {
  379. fulfill(promise, value);
  380. } else if (settled === REJECTED) {
  381. _reject(promise, value);
  382. }
  383. }
  384. function initializePromise(promise, resolver) {
  385. try {
  386. resolver(function resolvePromise(value) {
  387. _resolve(promise, value);
  388. }, function rejectPromise(reason) {
  389. _reject(promise, reason);
  390. });
  391. } catch (e) {
  392. _reject(promise, e);
  393. }
  394. }
  395. var id = 0;
  396. function nextId() {
  397. return id++;
  398. }
  399. function makePromise(promise) {
  400. promise[PROMISE_ID] = id++;
  401. promise._state = undefined;
  402. promise._result = undefined;
  403. promise._subscribers = [];
  404. }
  405. function Enumerator(Constructor, input) {
  406. this._instanceConstructor = Constructor;
  407. this.promise = new Constructor(noop);
  408. if (!this.promise[PROMISE_ID]) {
  409. makePromise(this.promise);
  410. }
  411. if (isArray(input)) {
  412. this._input = input;
  413. this.length = input.length;
  414. this._remaining = input.length;
  415. this._result = new Array(this.length);
  416. if (this.length === 0) {
  417. fulfill(this.promise, this._result);
  418. } else {
  419. this.length = this.length || 0;
  420. this._enumerate();
  421. if (this._remaining === 0) {
  422. fulfill(this.promise, this._result);
  423. }
  424. }
  425. } else {
  426. _reject(this.promise, validationError());
  427. }
  428. }
  429. function validationError() {
  430. return new Error('Array Methods must be provided an Array');
  431. };
  432. Enumerator.prototype._enumerate = function () {
  433. var length = this.length;
  434. var _input = this._input;
  435. for (var i = 0; this._state === PENDING && i < length; i++) {
  436. this._eachEntry(_input[i], i);
  437. }
  438. };
  439. Enumerator.prototype._eachEntry = function (entry, i) {
  440. var c = this._instanceConstructor;
  441. var resolve$$ = c.resolve;
  442. if (resolve$$ === resolve) {
  443. var _then = getThen(entry);
  444. if (_then === then && entry._state !== PENDING) {
  445. this._settledAt(entry._state, i, entry._result);
  446. } else if (typeof _then !== 'function') {
  447. this._remaining--;
  448. this._result[i] = entry;
  449. } else if (c === Promise) {
  450. var promise = new c(noop);
  451. handleMaybeThenable(promise, entry, _then);
  452. this._willSettleAt(promise, i);
  453. } else {
  454. this._willSettleAt(new c(function (resolve$$) {
  455. return resolve$$(entry);
  456. }), i);
  457. }
  458. } else {
  459. this._willSettleAt(resolve$$(entry), i);
  460. }
  461. };
  462. Enumerator.prototype._settledAt = function (state, i, value) {
  463. var promise = this.promise;
  464. if (promise._state === PENDING) {
  465. this._remaining--;
  466. if (state === REJECTED) {
  467. _reject(promise, value);
  468. } else {
  469. this._result[i] = value;
  470. }
  471. }
  472. if (this._remaining === 0) {
  473. fulfill(promise, this._result);
  474. }
  475. };
  476. Enumerator.prototype._willSettleAt = function (promise, i) {
  477. var enumerator = this;
  478. subscribe(promise, undefined, function (value) {
  479. return enumerator._settledAt(FULFILLED, i, value);
  480. }, function (reason) {
  481. return enumerator._settledAt(REJECTED, i, reason);
  482. });
  483. };
  484. /**
  485. `Promise.all` accepts an array of promises, and returns a new promise which
  486. is fulfilled with an array of fulfillment values for the passed promises, or
  487. rejected with the reason of the first passed promise to be rejected. It casts all
  488. elements of the passed iterable to promises as it runs this algorithm.
  489. Example:
  490. ```javascript
  491. let promise1 = resolve(1);
  492. let promise2 = resolve(2);
  493. let promise3 = resolve(3);
  494. let promises = [ promise1, promise2, promise3 ];
  495. Promise.all(promises).then(function(array){
  496. // The array here would be [ 1, 2, 3 ];
  497. });
  498. ```
  499. If any of the `promises` given to `all` are rejected, the first promise
  500. that is rejected will be given as an argument to the returned promises's
  501. rejection handler. For example:
  502. Example:
  503. ```javascript
  504. let promise1 = resolve(1);
  505. let promise2 = reject(new Error("2"));
  506. let promise3 = reject(new Error("3"));
  507. let promises = [ promise1, promise2, promise3 ];
  508. Promise.all(promises).then(function(array){
  509. // Code here never runs because there are rejected promises!
  510. }, function(error) {
  511. // error.message === "2"
  512. });
  513. ```
  514. @method all
  515. @static
  516. @param {Array} entries array of promises
  517. @param {String} label optional string for labeling the promise.
  518. Useful for tooling.
  519. @return {Promise} promise that is fulfilled when all `promises` have been
  520. fulfilled, or rejected if any of them become rejected.
  521. @static
  522. */
  523. function all(entries) {
  524. return new Enumerator(this, entries).promise;
  525. }
  526. /**
  527. `Promise.race` returns a new promise which is settled in the same way as the
  528. first passed promise to settle.
  529. Example:
  530. ```javascript
  531. let promise1 = new Promise(function(resolve, reject){
  532. setTimeout(function(){
  533. resolve('promise 1');
  534. }, 200);
  535. });
  536. let promise2 = new Promise(function(resolve, reject){
  537. setTimeout(function(){
  538. resolve('promise 2');
  539. }, 100);
  540. });
  541. Promise.race([promise1, promise2]).then(function(result){
  542. // result === 'promise 2' because it was resolved before promise1
  543. // was resolved.
  544. });
  545. ```
  546. `Promise.race` is deterministic in that only the state of the first
  547. settled promise matters. For example, even if other promises given to the
  548. `promises` array argument are resolved, but the first settled promise has
  549. become rejected before the other promises became fulfilled, the returned
  550. promise will become rejected:
  551. ```javascript
  552. let promise1 = new Promise(function(resolve, reject){
  553. setTimeout(function(){
  554. resolve('promise 1');
  555. }, 200);
  556. });
  557. let promise2 = new Promise(function(resolve, reject){
  558. setTimeout(function(){
  559. reject(new Error('promise 2'));
  560. }, 100);
  561. });
  562. Promise.race([promise1, promise2]).then(function(result){
  563. // Code here never runs
  564. }, function(reason){
  565. // reason.message === 'promise 2' because promise 2 became rejected before
  566. // promise 1 became fulfilled
  567. });
  568. ```
  569. An example real-world use case is implementing timeouts:
  570. ```javascript
  571. Promise.race([ajax('foo.json'), timeout(5000)])
  572. ```
  573. @method race
  574. @static
  575. @param {Array} promises array of promises to observe
  576. Useful for tooling.
  577. @return {Promise} a promise which settles in the same way as the first passed
  578. promise to settle.
  579. */
  580. function race(entries) {
  581. /*jshint validthis:true */
  582. var Constructor = this;
  583. if (!isArray(entries)) {
  584. return new Constructor(function (_, reject) {
  585. return reject(new TypeError('You must pass an array to race.'));
  586. });
  587. } else {
  588. return new Constructor(function (resolve, reject) {
  589. var length = entries.length;
  590. for (var i = 0; i < length; i++) {
  591. Constructor.resolve(entries[i]).then(resolve, reject);
  592. }
  593. });
  594. }
  595. }
  596. /**
  597. `Promise.reject` returns a promise rejected with the passed `reason`.
  598. It is shorthand for the following:
  599. ```javascript
  600. let promise = new Promise(function(resolve, reject){
  601. reject(new Error('WHOOPS'));
  602. });
  603. promise.then(function(value){
  604. // Code here doesn't run because the promise is rejected!
  605. }, function(reason){
  606. // reason.message === 'WHOOPS'
  607. });
  608. ```
  609. Instead of writing the above, your code now simply becomes the following:
  610. ```javascript
  611. let promise = Promise.reject(new Error('WHOOPS'));
  612. promise.then(function(value){
  613. // Code here doesn't run because the promise is rejected!
  614. }, function(reason){
  615. // reason.message === 'WHOOPS'
  616. });
  617. ```
  618. @method reject
  619. @static
  620. @param {Any} reason value that the returned promise will be rejected with.
  621. Useful for tooling.
  622. @return {Promise} a promise rejected with the given `reason`.
  623. */
  624. function reject(reason) {
  625. /*jshint validthis:true */
  626. var Constructor = this;
  627. var promise = new Constructor(noop);
  628. _reject(promise, reason);
  629. return promise;
  630. }
  631. function needsResolver() {
  632. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  633. }
  634. function needsNew() {
  635. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  636. }
  637. /**
  638. Promise objects represent the eventual result of an asynchronous operation. The
  639. primary way of interacting with a promise is through its `then` method, which
  640. registers callbacks to receive either a promise's eventual value or the reason
  641. why the promise cannot be fulfilled.
  642. Terminology
  643. -----------
  644. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  645. - `thenable` is an object or function that defines a `then` method.
  646. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  647. - `exception` is a value that is thrown using the throw statement.
  648. - `reason` is a value that indicates why a promise was rejected.
  649. - `settled` the final resting state of a promise, fulfilled or rejected.
  650. A promise can be in one of three states: pending, fulfilled, or rejected.
  651. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  652. state. Promises that are rejected have a rejection reason and are in the
  653. rejected state. A fulfillment value is never a thenable.
  654. Promises can also be said to *resolve* a value. If this value is also a
  655. promise, then the original promise's settled state will match the value's
  656. settled state. So a promise that *resolves* a promise that rejects will
  657. itself reject, and a promise that *resolves* a promise that fulfills will
  658. itself fulfill.
  659. Basic Usage:
  660. ------------
  661. ```js
  662. let promise = new Promise(function(resolve, reject) {
  663. // on success
  664. resolve(value);
  665. // on failure
  666. reject(reason);
  667. });
  668. promise.then(function(value) {
  669. // on fulfillment
  670. }, function(reason) {
  671. // on rejection
  672. });
  673. ```
  674. Advanced Usage:
  675. ---------------
  676. Promises shine when abstracting away asynchronous interactions such as
  677. `XMLHttpRequest`s.
  678. ```js
  679. function getJSON(url) {
  680. return new Promise(function(resolve, reject){
  681. let xhr = new XMLHttpRequest();
  682. xhr.open('GET', url);
  683. xhr.onreadystatechange = handler;
  684. xhr.responseType = 'json';
  685. xhr.setRequestHeader('Accept', 'application/json');
  686. xhr.send();
  687. function handler() {
  688. if (this.readyState === this.DONE) {
  689. if (this.status === 200) {
  690. resolve(this.response);
  691. } else {
  692. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  693. }
  694. }
  695. };
  696. });
  697. }
  698. getJSON('/posts.json').then(function(json) {
  699. // on fulfillment
  700. }, function(reason) {
  701. // on rejection
  702. });
  703. ```
  704. Unlike callbacks, promises are great composable primitives.
  705. ```js
  706. Promise.all([
  707. getJSON('/posts'),
  708. getJSON('/comments')
  709. ]).then(function(values){
  710. values[0] // => postsJSON
  711. values[1] // => commentsJSON
  712. return values;
  713. });
  714. ```
  715. @class Promise
  716. @param {function} resolver
  717. Useful for tooling.
  718. @constructor
  719. */
  720. function Promise(resolver) {
  721. this[PROMISE_ID] = nextId();
  722. this._result = this._state = undefined;
  723. this._subscribers = [];
  724. if (noop !== resolver) {
  725. typeof resolver !== 'function' && needsResolver();
  726. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  727. }
  728. }
  729. Promise.all = all;
  730. Promise.race = race;
  731. Promise.resolve = resolve;
  732. Promise.reject = reject;
  733. Promise._setScheduler = setScheduler;
  734. Promise._setAsap = setAsap;
  735. Promise._asap = asap;
  736. Promise.prototype = {
  737. constructor: Promise,
  738. /**
  739. The primary way of interacting with a promise is through its `then` method,
  740. which registers callbacks to receive either a promise's eventual value or the
  741. reason why the promise cannot be fulfilled.
  742. ```js
  743. findUser().then(function(user){
  744. // user is available
  745. }, function(reason){
  746. // user is unavailable, and you are given the reason why
  747. });
  748. ```
  749. Chaining
  750. --------
  751. The return value of `then` is itself a promise. This second, 'downstream'
  752. promise is resolved with the return value of the first promise's fulfillment
  753. or rejection handler, or rejected if the handler throws an exception.
  754. ```js
  755. findUser().then(function (user) {
  756. return user.name;
  757. }, function (reason) {
  758. return 'default name';
  759. }).then(function (userName) {
  760. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  761. // will be `'default name'`
  762. });
  763. findUser().then(function (user) {
  764. throw new Error('Found user, but still unhappy');
  765. }, function (reason) {
  766. throw new Error('`findUser` rejected and we're unhappy');
  767. }).then(function (value) {
  768. // never reached
  769. }, function (reason) {
  770. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  771. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  772. });
  773. ```
  774. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  775. ```js
  776. findUser().then(function (user) {
  777. throw new PedagogicalException('Upstream error');
  778. }).then(function (value) {
  779. // never reached
  780. }).then(function (value) {
  781. // never reached
  782. }, function (reason) {
  783. // The `PedgagocialException` is propagated all the way down to here
  784. });
  785. ```
  786. Assimilation
  787. ------------
  788. Sometimes the value you want to propagate to a downstream promise can only be
  789. retrieved asynchronously. This can be achieved by returning a promise in the
  790. fulfillment or rejection handler. The downstream promise will then be pending
  791. until the returned promise is settled. This is called *assimilation*.
  792. ```js
  793. findUser().then(function (user) {
  794. return findCommentsByAuthor(user);
  795. }).then(function (comments) {
  796. // The user's comments are now available
  797. });
  798. ```
  799. If the assimliated promise rejects, then the downstream promise will also reject.
  800. ```js
  801. findUser().then(function (user) {
  802. return findCommentsByAuthor(user);
  803. }).then(function (comments) {
  804. // If `findCommentsByAuthor` fulfills, we'll have the value here
  805. }, function (reason) {
  806. // If `findCommentsByAuthor` rejects, we'll have the reason here
  807. });
  808. ```
  809. Simple Example
  810. --------------
  811. Synchronous Example
  812. ```javascript
  813. let result;
  814. try {
  815. result = findResult();
  816. // success
  817. } catch(reason) {
  818. // failure
  819. }
  820. ```
  821. Errback Example
  822. ```js
  823. findResult(function(result, err){
  824. if (err) {
  825. // failure
  826. } else {
  827. // success
  828. }
  829. });
  830. ```
  831. Promise Example;
  832. ```javascript
  833. findResult().then(function(result){
  834. // success
  835. }, function(reason){
  836. // failure
  837. });
  838. ```
  839. Advanced Example
  840. --------------
  841. Synchronous Example
  842. ```javascript
  843. let author, books;
  844. try {
  845. author = findAuthor();
  846. books = findBooksByAuthor(author);
  847. // success
  848. } catch(reason) {
  849. // failure
  850. }
  851. ```
  852. Errback Example
  853. ```js
  854. function foundBooks(books) {
  855. }
  856. function failure(reason) {
  857. }
  858. findAuthor(function(author, err){
  859. if (err) {
  860. failure(err);
  861. // failure
  862. } else {
  863. try {
  864. findBoooksByAuthor(author, function(books, err) {
  865. if (err) {
  866. failure(err);
  867. } else {
  868. try {
  869. foundBooks(books);
  870. } catch(reason) {
  871. failure(reason);
  872. }
  873. }
  874. });
  875. } catch(error) {
  876. failure(err);
  877. }
  878. // success
  879. }
  880. });
  881. ```
  882. Promise Example;
  883. ```javascript
  884. findAuthor().
  885. then(findBooksByAuthor).
  886. then(function(books){
  887. // found books
  888. }).catch(function(reason){
  889. // something went wrong
  890. });
  891. ```
  892. @method then
  893. @param {Function} onFulfilled
  894. @param {Function} onRejected
  895. Useful for tooling.
  896. @return {Promise}
  897. */
  898. then: then,
  899. /**
  900. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  901. as the catch block of a try/catch statement.
  902. ```js
  903. function findAuthor(){
  904. throw new Error('couldn't find that author');
  905. }
  906. // synchronous
  907. try {
  908. findAuthor();
  909. } catch(reason) {
  910. // something went wrong
  911. }
  912. // async with promises
  913. findAuthor().catch(function(reason){
  914. // something went wrong
  915. });
  916. ```
  917. @method catch
  918. @param {Function} onRejection
  919. Useful for tooling.
  920. @return {Promise}
  921. */
  922. 'catch': function _catch(onRejection) {
  923. return this.then(null, onRejection);
  924. }
  925. };
  926. function polyfill() {
  927. var local = undefined;
  928. if (typeof global !== 'undefined') {
  929. local = global;
  930. } else if (typeof self !== 'undefined') {
  931. local = self;
  932. } else {
  933. try {
  934. local = Function('return this')();
  935. } catch (e) {
  936. throw new Error('polyfill failed because global object is unavailable in this environment');
  937. }
  938. }
  939. var P = local.Promise;
  940. if (P) {
  941. var promiseToString = null;
  942. try {
  943. promiseToString = Object.prototype.toString.call(P.resolve());
  944. } catch (e) {
  945. // silently ignored
  946. }
  947. if (promiseToString === '[object Promise]' && !P.cast) {
  948. return;
  949. }
  950. }
  951. local.Promise = Promise;
  952. }
  953. polyfill();
  954. // Strange compat..
  955. Promise.polyfill = polyfill;
  956. Promise.Promise = Promise;
  957. return Promise;
  958. })));
  959. //# sourceMappingURL=es6-promise.map;
  960. define('amber/es2015-polyfills',['amber/es6-promise'], function (promiseLib) {
  961. promiseLib.polyfill();
  962. });
  963. (function () {
  964. define('app',["require", "amber/es2015-polyfills"], function (require) {
  965. require(["__app__"]);
  966. });
  967. }());
  968. //jshint eqnull:true
  969. define('amber/kernel-runtime',[],function () {
  970. "use strict";
  971. function defineMethod (klass, name, method) {
  972. Object.defineProperty(klass.prototype, name, {
  973. value: method,
  974. enumerable: false, configurable: true, writable: true
  975. });
  976. }
  977. DNUBrik.deps = ["selectors", "smalltalkGlobals", "manipulation", "classes"];
  978. function DNUBrik (brikz, st) {
  979. var selectorsBrik = brikz.selectors;
  980. var globals = brikz.smalltalkGlobals.globals;
  981. var installJSMethod = brikz.manipulation.installJSMethod;
  982. var nilAsClass = brikz.classes.nilAsClass;
  983. /* Method not implemented handlers */
  984. function makeDnuHandler (pair, targetClasses) {
  985. var jsSelector = pair.js;
  986. var fn = createHandler(pair.st);
  987. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  988. targetClasses.forEach(function (target) {
  989. installJSMethod(target.fn.prototype, jsSelector, fn);
  990. });
  991. }
  992. this.makeDnuHandler = makeDnuHandler;
  993. /* Dnu handler method */
  994. function createHandler (stSelector) {
  995. return function () {
  996. return globals.Message._selector_arguments_notUnderstoodBy_(
  997. stSelector, [].slice.call(arguments), this
  998. );
  999. };
  1000. }
  1001. selectorsBrik.selectorPairs.forEach(function (pair) {
  1002. makeDnuHandler(pair, []);
  1003. });
  1004. }
  1005. function ManipulationBrik (brikz, st) {
  1006. function installJSMethod (obj, jsSelector, fn) {
  1007. Object.defineProperty(obj, jsSelector, {
  1008. value: fn,
  1009. enumerable: false, configurable: true, writable: true
  1010. });
  1011. }
  1012. function installMethod (method, klass) {
  1013. installJSMethod(klass.fn.prototype, method.jsSelector, method.fn);
  1014. }
  1015. this.installMethod = installMethod;
  1016. this.installJSMethod = installJSMethod;
  1017. }
  1018. RuntimeClassesBrik.deps = ["selectors", "dnu", "behaviors", "classes", "manipulation"];
  1019. function RuntimeClassesBrik (brikz, st) {
  1020. var selectors = brikz.selectors;
  1021. var classes = brikz.behaviors.classes;
  1022. var wireKlass = brikz.classes.wireKlass;
  1023. var installMethod = brikz.manipulation.installMethod;
  1024. var installJSMethod = brikz.manipulation.installJSMethod;
  1025. var detachedRootClasses = [];
  1026. function markClassDetachedRoot (klass) {
  1027. klass.detachedRoot = true;
  1028. detachedRootClasses = classes().filter(function (klass) {
  1029. return klass.detachedRoot;
  1030. });
  1031. }
  1032. this.detachedRootClasses = function () {
  1033. return detachedRootClasses;
  1034. };
  1035. /* Initialize a class in its class hierarchy. Handle both classes and
  1036. metaclasses. */
  1037. function initClassAndMetaclass (klass) {
  1038. initClass(klass);
  1039. if (klass.a$cls && !klass.meta) {
  1040. initClass(klass.a$cls);
  1041. }
  1042. }
  1043. classes().forEach(function (traitOrClass) {
  1044. if (!traitOrClass.trait) initClassAndMetaclass(traitOrClass);
  1045. });
  1046. st._classAdded = function (klass) {
  1047. initClassAndMetaclass(klass);
  1048. klass._enterOrganization();
  1049. };
  1050. st._traitAdded = function (trait) {
  1051. trait._enterOrganization();
  1052. };
  1053. st._classRemoved = function (klass) {
  1054. klass._leaveOrganization();
  1055. };
  1056. st._traitRemoved = function (trait) {
  1057. trait._leaveOrganization();
  1058. };
  1059. function initClass (klass) {
  1060. wireKlass(klass);
  1061. if (klass.detachedRoot) {
  1062. copySuperclass(klass);
  1063. }
  1064. installMethods(klass);
  1065. }
  1066. function copySuperclass (klass) {
  1067. var myproto = klass.fn.prototype,
  1068. superproto = klass.superclass.fn.prototype;
  1069. selectors.selectorPairs.forEach(function (selectorPair) {
  1070. var jsSelector = selectorPair.js;
  1071. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  1072. });
  1073. }
  1074. function installMethods (klass) {
  1075. var methods = klass.methods;
  1076. Object.keys(methods).forEach(function (selector) {
  1077. installMethod(methods[selector], klass);
  1078. });
  1079. }
  1080. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  1081. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  1082. markClassDetachedRoot(klass);
  1083. klass.fn = constructor;
  1084. initClass(klass);
  1085. };
  1086. }
  1087. FrameBindingBrik.deps = ["smalltalkGlobals", "runtimeClasses"];
  1088. function FrameBindingBrik (brikz, st) {
  1089. var globals = brikz.smalltalkGlobals.globals;
  1090. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1091. setClassConstructor(globals.Number, Number);
  1092. setClassConstructor(globals.BlockClosure, Function);
  1093. setClassConstructor(globals.Boolean, Boolean);
  1094. setClassConstructor(globals.Date, Date);
  1095. setClassConstructor(globals.String, String);
  1096. setClassConstructor(globals.Array, Array);
  1097. setClassConstructor(globals.RegularExpression, RegExp);
  1098. setClassConstructor(globals.Error, Error);
  1099. setClassConstructor(globals.Promise, Promise);
  1100. this.__init__ = function () {
  1101. st.alias(globals.Array, "OrderedCollection");
  1102. st.alias(globals.Date, "Time");
  1103. }
  1104. }
  1105. RuntimeMethodsBrik.deps = ["manipulation", "dnu", "runtimeClasses"];
  1106. function RuntimeMethodsBrik (brikz, st) {
  1107. var installMethod = brikz.manipulation.installMethod;
  1108. var installJSMethod = brikz.manipulation.installJSMethod;
  1109. var makeDnuHandler = brikz.dnu.makeDnuHandler;
  1110. var detachedRootClasses = brikz.runtimeClasses.detachedRootClasses;
  1111. st._behaviorMethodAdded = function (method, klass) {
  1112. installMethod(method, klass);
  1113. propagateMethodChange(klass, method, klass);
  1114. };
  1115. st._selectorsAdded = function (newSelectors) {
  1116. var targetClasses = detachedRootClasses();
  1117. newSelectors.forEach(function (pair) {
  1118. makeDnuHandler(pair, targetClasses);
  1119. });
  1120. };
  1121. st._behaviorMethodRemoved = function (method, klass) {
  1122. delete klass.fn.prototype[method.jsSelector];
  1123. propagateMethodChange(klass, method, null);
  1124. };
  1125. st._methodReplaced = function (newMethod, oldMethod, traitOrBehavior) {
  1126. traitOrBehavior._methodOrganizationEnter_andLeave_(newMethod, oldMethod);
  1127. };
  1128. function propagateMethodChange (klass, method, exclude) {
  1129. var selector = method.selector;
  1130. var jsSelector = method.jsSelector;
  1131. st.traverseClassTree(klass, function (subclass, sentinel) {
  1132. if (subclass !== exclude) {
  1133. if (initMethodInClass(subclass, selector, jsSelector)) return sentinel;
  1134. }
  1135. });
  1136. }
  1137. function initMethodInClass (klass, selector, jsSelector) {
  1138. if (klass.methods[selector]) return true;
  1139. if (klass.detachedRoot) {
  1140. installJSMethod(klass.fn.prototype, jsSelector, klass.superclass.fn.prototype[jsSelector]);
  1141. }
  1142. }
  1143. }
  1144. PrimitivesBrik.deps = ["smalltalkGlobals"];
  1145. function PrimitivesBrik (brikz, st) {
  1146. var globals = brikz.smalltalkGlobals.globals;
  1147. var oid = 0;
  1148. /* Unique ID number generator */
  1149. st.nextId = function () {
  1150. console.warn("$core.nextId() deprecated. Use your own unique counter.");
  1151. oid += 1;
  1152. return oid;
  1153. };
  1154. /* Converts a JavaScript object to valid Smalltalk Object */
  1155. st.readJSObject = function (js) {
  1156. if (js == null) return null;
  1157. else if (Array.isArray(js)) return js.map(st.readJSObject);
  1158. else if (js.constructor !== Object) return js;
  1159. var pairs = [];
  1160. for (var i in js) {
  1161. pairs.push(i, st.readJSObject(js[i]));
  1162. }
  1163. return globals.Dictionary._newFromPairs_(pairs);
  1164. };
  1165. /* Boolean assertion */
  1166. st.assert = function (shouldBeBoolean) {
  1167. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1168. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  1169. shouldBeBoolean = shouldBeBoolean.valueOf();
  1170. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1171. }
  1172. globals.NonBooleanReceiver._signalOn_(shouldBeBoolean);
  1173. };
  1174. // TODO remove
  1175. st.globalJsVariables = [];
  1176. }
  1177. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  1178. function RuntimeBrik (brikz, st) {
  1179. var globals = brikz.smalltalkGlobals.globals;
  1180. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1181. function SmalltalkMethodContext (home, setup) {
  1182. // TODO lazy fill of .sendIdx
  1183. this.sendIdx = {};
  1184. // TODO very likely .senderContext, not .homeContext here
  1185. this.homeContext = home;
  1186. this.setup = setup;
  1187. }
  1188. // Fallbacks
  1189. SmalltalkMethodContext.prototype.supercall = false;
  1190. SmalltalkMethodContext.prototype.locals = Object.freeze({});
  1191. SmalltalkMethodContext.prototype.receiver = null;
  1192. SmalltalkMethodContext.prototype.selector = null;
  1193. SmalltalkMethodContext.prototype.lookupClass = null;
  1194. SmalltalkMethodContext.prototype.outerContext = null;
  1195. SmalltalkMethodContext.prototype.index = 0;
  1196. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals, lookupClass) {
  1197. this.receiver = receiver;
  1198. this.selector = selector;
  1199. if (locals != null) this.locals = locals;
  1200. this.lookupClass = lookupClass;
  1201. if (this.homeContext) {
  1202. this.homeContext.evaluatedSelector = selector;
  1203. }
  1204. });
  1205. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  1206. if (locals != null) this.locals = locals;
  1207. this.outerContext = ctx;
  1208. if (index) this.index = index;
  1209. });
  1210. defineMethod(SmalltalkMethodContext, "init", function () {
  1211. var frame = this;
  1212. while (frame) {
  1213. if (frame.init !== this.init) return frame.init();
  1214. frame.setup(frame);
  1215. frame = frame.homeContext;
  1216. }
  1217. });
  1218. defineMethod(SmalltalkMethodContext, "method", function () {
  1219. var method;
  1220. var lookup = this.lookupClass || this.receiver.a$cls;
  1221. while (!method && lookup) {
  1222. method = lookup.methods[st.js2st(this.selector)];
  1223. lookup = lookup.superclass;
  1224. }
  1225. return method;
  1226. });
  1227. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  1228. /* This is the current call context object.
  1229. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  1230. In JS code, use api.getThisContext() (see below).
  1231. */
  1232. var thisContext = null;
  1233. st.withContext = inContext;
  1234. /*
  1235. Runs worker function so that error handler is not set up
  1236. if there isn't one. This is accomplished by unconditional
  1237. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  1238. which then stops error handler setup (see st.withContext above).
  1239. The effect is, $core.seamless(fn)'s exceptions are not
  1240. handed into ST error handler and caller should process them.
  1241. */
  1242. st.seamless = function inContext (worker) {
  1243. var oldContext = thisContext;
  1244. thisContext = new SmalltalkMethodContext(thisContext, function (ctx) {
  1245. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  1246. });
  1247. var result = worker(thisContext);
  1248. thisContext = oldContext;
  1249. return result;
  1250. };
  1251. function resultWithErrorHandling (worker) {
  1252. try {
  1253. return worker(thisContext);
  1254. } catch (error) {
  1255. globals.ErrorHandler._handleError_(error);
  1256. thisContext = null;
  1257. // Rethrow the error in any case.
  1258. throw error;
  1259. }
  1260. }
  1261. function inContext (worker, setup) {
  1262. var oldContext = thisContext;
  1263. thisContext = new SmalltalkMethodContext(thisContext, setup);
  1264. var result = oldContext == null ? resultWithErrorHandling(worker) : worker(thisContext);
  1265. thisContext = oldContext;
  1266. return result;
  1267. }
  1268. /* Handle thisContext pseudo variable */
  1269. st.getThisContext = function () {
  1270. if (thisContext) {
  1271. thisContext.init();
  1272. return thisContext;
  1273. } else {
  1274. return null;
  1275. }
  1276. };
  1277. }
  1278. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  1279. function MessageSendBrik (brikz, st) {
  1280. var globals = brikz.smalltalkGlobals.globals;
  1281. var nilAsReceiver = brikz.root.nilAsReceiver;
  1282. /* Send message programmatically. Used to implement #perform: & Co. */
  1283. st.send2 = function (self, selector, args, klass) {
  1284. if (self == null) {
  1285. self = nilAsReceiver;
  1286. }
  1287. var method = klass ? klass.fn.prototype[st.st2js(selector)] : self.a$cls && self[st.st2js(selector)];
  1288. return method != null ?
  1289. method.apply(self, args || []) :
  1290. globals.Message._selector_arguments_notUnderstoodBy_(
  1291. selector, [].slice.call(args), self.a$cls ? self : wrapJavaScript(self)
  1292. );
  1293. };
  1294. function wrapJavaScript (o) {
  1295. return globals.JSObjectProxy._on_(o);
  1296. }
  1297. st.wrapJavaScript = wrapJavaScript;
  1298. /* If the object property is a function, then call it, except if it starts with
  1299. an uppercase character (we probably want to answer the function itself in this
  1300. case and send it #new from Amber).
  1301. */
  1302. st.accessJavaScript = function accessJavaScript (self, propertyName, args) {
  1303. var propertyValue = self[propertyName];
  1304. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  1305. return propertyValue.apply(self, args || []);
  1306. } else if (args.length === 0) {
  1307. return propertyValue;
  1308. } else {
  1309. self[propertyName] = args[0];
  1310. return self;
  1311. }
  1312. };
  1313. }
  1314. StartImageBrik.deps = ["smalltalkGlobals"];
  1315. function StartImageBrik (brikz, st) {
  1316. var globals = brikz.smalltalkGlobals.globals;
  1317. this.run = function () {
  1318. globals.AmberBootstrapInitialization._run();
  1319. };
  1320. }
  1321. /* Making smalltalk that can run */
  1322. function configureWithRuntime (brikz) {
  1323. brikz.dnu = DNUBrik;
  1324. brikz.manipulation = ManipulationBrik;
  1325. brikz.runtimeClasses = RuntimeClassesBrik;
  1326. brikz.frameBinding = FrameBindingBrik;
  1327. brikz.runtimeMethods = RuntimeMethodsBrik;
  1328. brikz.messageSend = MessageSendBrik;
  1329. brikz.runtime = RuntimeBrik;
  1330. brikz.primitives = PrimitivesBrik;
  1331. brikz.startImage = StartImageBrik;
  1332. brikz.rebuild();
  1333. }
  1334. return configureWithRuntime;
  1335. });
  1336. // Depend on each module that is loaded lazily.
  1337. // Add to packager tasks as dependency,
  1338. // so the lazy-loaded modules are included.
  1339. define('amber/lazypack',['./kernel-runtime'], {});
  1340. //jshint eqnull:true
  1341. define('amber/kernel-checks',[],function () {
  1342. "use strict";
  1343. function assert (fn) {
  1344. try {
  1345. if (fn()) return;
  1346. } catch (ex) {
  1347. throw new Error("Error:\n" + ex + "in assertion:\n" + fn);
  1348. }
  1349. throw new Error("Assertion failed:\n" + fn);
  1350. }
  1351. assert(function () {
  1352. return !("hasOwnProperty" in Object.create(null));
  1353. });
  1354. assert(function () {
  1355. return new Function("return this")().Object === Object;
  1356. });
  1357. assert(function () {
  1358. return Object.create(new Function("return this")()).Object === Object;
  1359. });
  1360. assert(function () {
  1361. return (function () {
  1362. return this;
  1363. }).apply(void 0) === void 0;
  1364. });
  1365. assert(function () {
  1366. return (function () {
  1367. return this;
  1368. }).apply(null) === null;
  1369. });
  1370. assert(function () {
  1371. return (function () {
  1372. return this;
  1373. }).apply(3) === 3;
  1374. });
  1375. assert(function () {
  1376. return (function () {
  1377. return this;
  1378. }).apply("foo") === "foo";
  1379. });
  1380. assert(function () {
  1381. return (function () {
  1382. return this;
  1383. }).apply(true) === true;
  1384. });
  1385. assert(function () {
  1386. var o = Object.freeze({});
  1387. try {
  1388. o.foo = "bar";
  1389. } catch (ex) {
  1390. }
  1391. return o.foo == null;
  1392. });
  1393. assert(function () {
  1394. return typeof Promise === "function";
  1395. });
  1396. assert(function () {
  1397. return typeof Promise.resolve === "function";
  1398. });
  1399. assert(function () {
  1400. return typeof Promise.reject === "function";
  1401. });
  1402. assert(function () {
  1403. return typeof new Promise(function () {
  1404. }).then === "function";
  1405. });
  1406. });
  1407. define('amber/brikz',[], function () {
  1408. return function Brikz(api, apiKey, initKey) {
  1409. "use strict";
  1410. //jshint eqnull:true
  1411. var brikz = this,
  1412. backup = {};
  1413. apiKey = apiKey || 'exports';
  1414. initKey = initKey || '__init__';
  1415. function mixin(src, target, what) {
  1416. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  1417. if (src == null) {
  1418. target[keys[i]] = undefined;
  1419. } else {
  1420. var value = src[keys[i]];
  1421. if (typeof value !== "undefined") {
  1422. target[keys[i]] = value;
  1423. }
  1424. }
  1425. }
  1426. return target;
  1427. }
  1428. Object.defineProperties(this, {
  1429. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  1430. });
  1431. var exclude = mixin(this, {});
  1432. this.rebuild = function () {
  1433. Object.keys(backup).forEach(function (key) {
  1434. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  1435. });
  1436. var oapi = mixin(api, {}),
  1437. order = [],
  1438. chk = {};
  1439. function ensure(key) {
  1440. if (key in exclude) {
  1441. return null;
  1442. }
  1443. var b = brikz[key],
  1444. bak = backup[key];
  1445. mixin(null, api, api);
  1446. while (typeof b === "function") {
  1447. (b.deps || []).forEach(ensure);
  1448. b = new b(brikz, api, bak);
  1449. }
  1450. brikz[key] = b;
  1451. if (b && !chk[key]) {
  1452. chk[key] = true;
  1453. order.push(b);
  1454. }
  1455. if (b && !b[apiKey]) {
  1456. b[apiKey] = mixin(api, {});
  1457. }
  1458. }
  1459. Object.keys(brikz).forEach(ensure);
  1460. mixin(oapi, mixin(null, api, api));
  1461. order.forEach(function (brik) {
  1462. mixin(brik[apiKey] || {}, api);
  1463. });
  1464. order.forEach(function (brik) {
  1465. if (brik[initKey]) {
  1466. brik[initKey]();
  1467. if (brik[initKey].once) {
  1468. delete brik[initKey];
  1469. }
  1470. }
  1471. });
  1472. backup = mixin(brikz, {});
  1473. };
  1474. };
  1475. });
  1476. /* stub */;
  1477. define("amber/compatibility", function(){});
  1478. /* ====================================================================
  1479. |
  1480. | Amber Smalltalk
  1481. | http://amber-lang.net
  1482. |
  1483. ======================================================================
  1484. ======================================================================
  1485. |
  1486. | Copyright (c) 2010-2014
  1487. | Nicolas Petton <petton.nicolas@gmail.com>
  1488. |
  1489. | Copyright (c) 2012-2017
  1490. | The Amber team https://lolg.it/org/amber/members
  1491. | Amber contributors (see /CONTRIBUTORS)
  1492. |
  1493. | Amber is released under the MIT license
  1494. |
  1495. | Permission is hereby granted, free of charge, to any person obtaining
  1496. | a copy of this software and associated documentation files (the
  1497. | 'Software'), to deal in the Software without restriction, including
  1498. | without limitation the rights to use, copy, modify, merge, publish,
  1499. | distribute, sublicense, and/or sell copies of the Software, and to
  1500. | permit persons to whom the Software is furnished to do so, subject to
  1501. | the following conditions:
  1502. |
  1503. | The above copyright notice and this permission notice shall be
  1504. | included in all copies or substantial portions of the Software.
  1505. |
  1506. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1507. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1508. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1509. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1510. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1511. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1512. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1513. |
  1514. ==================================================================== */
  1515. //jshint eqnull:true
  1516. define('amber/kernel-fundamentals',['./compatibility' /* TODO remove */], function () {
  1517. "use strict";
  1518. function inherits (child, parent) {
  1519. child.prototype = Object.create(parent.prototype, {
  1520. constructor: {
  1521. value: child,
  1522. enumerable: false, configurable: true, writable: true
  1523. }
  1524. });
  1525. return child;
  1526. }
  1527. function SmalltalkGlobalsBrik (brikz, st) {
  1528. // jshint evil:true
  1529. var jsGlobals = new Function("return this")();
  1530. var globals = Object.create(jsGlobals);
  1531. globals.SmalltalkSettings = {};
  1532. this.globals = globals;
  1533. }
  1534. // TODO kernel announcer instead of st._eventFooHappened(...args)
  1535. function RootBrik (brikz, st) {
  1536. /* Smalltalk foundational objects */
  1537. var coreFns = this.coreFns = {};
  1538. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1539. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1540. Detached roots (eg. wrapped JS classes like Number or Date)
  1541. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1542. function SmalltalkRoot () {
  1543. }
  1544. function SmalltalkProtoObject () {
  1545. }
  1546. function SmalltalkObject () {
  1547. }
  1548. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1549. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1550. this.Root = SmalltalkRoot;
  1551. this.Object = SmalltalkObject;
  1552. }
  1553. SelectorsBrik.deps = ["selectorConversion"];
  1554. function SelectorsBrik (brikz, st) {
  1555. var selectorSet = Object.create(null);
  1556. var selectors = this.selectors = [];
  1557. var selectorPairs = this.selectorPairs = [];
  1558. this.registerSelector = function (stSelector) {
  1559. if (selectorSet[stSelector]) return null;
  1560. var jsSelector = st.st2js(stSelector);
  1561. selectorSet[stSelector] = true;
  1562. selectors.push(stSelector);
  1563. var pair = {st: stSelector, js: jsSelector};
  1564. selectorPairs.push(pair);
  1565. return pair;
  1566. };
  1567. st.allSelectors = function () {
  1568. return selectors;
  1569. };
  1570. }
  1571. function PackagesBrik (brikz, st) {
  1572. // TODO remove .packages, have .packageDescriptors
  1573. st.packages = {};
  1574. /* Add a package load descriptor to the system */
  1575. st.addPackage = function (pkgName, properties) {
  1576. if (!pkgName) return null;
  1577. return st.packages[pkgName] = {
  1578. // TODO remove .pkgName, have .name
  1579. pkgName: pkgName,
  1580. properties: properties
  1581. };
  1582. };
  1583. }
  1584. BehaviorsBrik.deps = ["root", "smalltalkGlobals", "arraySet"];
  1585. function BehaviorsBrik (brikz, st) {
  1586. var globals = brikz.smalltalkGlobals.globals;
  1587. var addElement = brikz.arraySet.addElement;
  1588. var removeElement = brikz.arraySet.removeElement;
  1589. /* Smalltalk classes */
  1590. var classes = [];
  1591. this.buildTraitOrClass = function (pkgName, builder) {
  1592. // TODO remove .className, have .name
  1593. var traitOrClass = globals.hasOwnProperty(builder.className) && globals[builder.className];
  1594. if (traitOrClass) {
  1595. // TODO remove .pkg, have .pkgName
  1596. if (!traitOrClass.pkg) throw new Error("Updated trait or class must have package: " + traitOrClass.className);
  1597. // if (traitOrClass.pkg.pkgName !== pkgName) throw new Error("Incompatible cross-package update of trait or class: " + traitOrClass.className);
  1598. builder.updateExisting(traitOrClass);
  1599. } else {
  1600. traitOrClass = builder.make();
  1601. traitOrClass.pkg = pkgName;
  1602. addTraitOrClass(traitOrClass);
  1603. }
  1604. return traitOrClass;
  1605. };
  1606. function addTraitOrClass (traitOrClass) {
  1607. globals[traitOrClass.className] = traitOrClass;
  1608. addElement(classes, traitOrClass);
  1609. traitOrClass.added();
  1610. }
  1611. function removeTraitOrClass (traitOrClass) {
  1612. traitOrClass.removed();
  1613. removeElement(classes, traitOrClass);
  1614. delete globals[traitOrClass.className];
  1615. }
  1616. this.removeTraitOrClass = removeTraitOrClass;
  1617. /* Create an alias for an existing class */
  1618. st.alias = function (traitOrClass, alias) {
  1619. globals[alias] = traitOrClass;
  1620. };
  1621. /* Answer all registered Smalltalk classes */
  1622. //TODO: remove the function and make smalltalk.classes an array
  1623. // TODO: remove .classes, have .traitsOrClasses
  1624. st.classes = this.classes = function () {
  1625. return classes;
  1626. };
  1627. }
  1628. MethodsBrik.deps = ["behaviorProviders", "selectors", "root", "selectorConversion"];
  1629. function MethodsBrik (brikz, st) {
  1630. var registerSelector = brikz.selectors.registerSelector;
  1631. var updateMethod = brikz.behaviorProviders.updateMethod;
  1632. var SmalltalkObject = brikz.root.Object;
  1633. var coreFns = brikz.root.coreFns;
  1634. function SmalltalkMethod () {
  1635. }
  1636. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1637. /* Smalltalk method object. To add a method to a class,
  1638. use api.addMethod() */
  1639. st.method = function (spec) {
  1640. var that = new SmalltalkMethod();
  1641. var selector = spec.selector;
  1642. that.selector = selector;
  1643. that.jsSelector = st.st2js(selector);
  1644. that.args = spec.args || {};
  1645. that.protocol = spec.protocol;
  1646. that.source = spec.source;
  1647. that.messageSends = spec.messageSends || [];
  1648. // TODO remove .referencedClasses, have .referencedGlobals
  1649. that.referencedClasses = spec.referencedClasses || [];
  1650. that.fn = spec.fn;
  1651. return that;
  1652. };
  1653. /* Add/remove a method to/from a class */
  1654. st.addMethod = function (method, traitOrBehavior) {
  1655. // TODO remove .methodClass, have .owner
  1656. if (method.methodClass != null) {
  1657. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.methodClass);
  1658. }
  1659. method.methodClass = traitOrBehavior;
  1660. registerNewSelectors(method);
  1661. traitOrBehavior.localMethods[method.selector] = method;
  1662. updateMethod(method.selector, traitOrBehavior);
  1663. };
  1664. function registerNewSelectors (method) {
  1665. var newSelectors = [];
  1666. function selectorInUse (stSelector) {
  1667. var pair = registerSelector(stSelector);
  1668. if (pair) {
  1669. newSelectors.push(pair);
  1670. }
  1671. }
  1672. selectorInUse(method.selector);
  1673. method.messageSends.forEach(selectorInUse);
  1674. if (st._selectorsAdded) st._selectorsAdded(newSelectors);
  1675. }
  1676. st.removeMethod = function (method, traitOrBehavior) {
  1677. if (traitOrBehavior.localMethods[method.selector] !== method) return;
  1678. delete traitOrBehavior.localMethods[method.selector];
  1679. updateMethod(method.selector, traitOrBehavior);
  1680. };
  1681. }
  1682. function BehaviorProvidersBrik (brikz, st) {
  1683. this.setupMethods = function (traitOrBehavior) {
  1684. traitOrBehavior.localMethods = Object.create(null);
  1685. traitOrBehavior.methods = Object.create(null);
  1686. };
  1687. this.updateMethod = function (selector, traitOrBehavior) {
  1688. var oldMethod = traitOrBehavior.methods[selector],
  1689. newMethod = traitOrBehavior.localMethods[selector];
  1690. if (oldMethod == null && newMethod == null) {
  1691. console.warn("Removal of nonexistent method " + traitOrBehavior + " >> " + selector);
  1692. return;
  1693. }
  1694. if (newMethod === oldMethod) return;
  1695. if (newMethod != null) {
  1696. traitOrBehavior.methods[selector] = newMethod;
  1697. traitOrBehavior.methodAdded(newMethod);
  1698. } else {
  1699. delete traitOrBehavior.methods[selector];
  1700. traitOrBehavior.methodRemoved(oldMethod);
  1701. }
  1702. if (st._methodReplaced) st._methodReplaced(newMethod, oldMethod, traitOrBehavior);
  1703. };
  1704. }
  1705. function ArraySetBrik (brikz, st) {
  1706. st.addElement = this.addElement = function (array, el) {
  1707. if (typeof el === 'undefined') {
  1708. return;
  1709. }
  1710. if (array.indexOf(el) === -1) {
  1711. array.push(el);
  1712. }
  1713. };
  1714. st.removeElement = this.removeElement = function (array, el) {
  1715. var i = array.indexOf(el);
  1716. if (i !== -1) {
  1717. array.splice(i, 1);
  1718. }
  1719. };
  1720. }
  1721. function SelectorConversionBrik (brikz, st) {
  1722. /* Convert a Smalltalk selector into a JS selector */
  1723. st.st2js = function (string) {
  1724. return '_' + string
  1725. .replace(/:/g, '_')
  1726. .replace(/[\&]/g, '_and')
  1727. .replace(/[\|]/g, '_or')
  1728. .replace(/[+]/g, '_plus')
  1729. .replace(/-/g, '_minus')
  1730. .replace(/[*]/g, '_star')
  1731. .replace(/[\/]/g, '_slash')
  1732. .replace(/[\\]/g, '_backslash')
  1733. .replace(/[\~]/g, '_tild')
  1734. .replace(/%/g, '_percent')
  1735. .replace(/>/g, '_gt')
  1736. .replace(/</g, '_lt')
  1737. .replace(/=/g, '_eq')
  1738. .replace(/,/g, '_comma')
  1739. .replace(/[@]/g, '_at');
  1740. };
  1741. /* Convert a string to a valid smalltalk selector.
  1742. if you modify the following functions, also change st2js
  1743. accordingly */
  1744. st.js2st = function (selector) {
  1745. if (selector.match(/^__/)) {
  1746. return binaryJsToSt(selector);
  1747. } else {
  1748. return keywordJsToSt(selector);
  1749. }
  1750. };
  1751. function keywordJsToSt (selector) {
  1752. return selector.replace(/^_/, '').replace(/_/g, ':');
  1753. }
  1754. function binaryJsToSt (selector) {
  1755. return selector
  1756. .replace(/^_/, '')
  1757. .replace(/_and/g, '&')
  1758. .replace(/_or/g, '|')
  1759. .replace(/_plus/g, '+')
  1760. .replace(/_minus/g, '-')
  1761. .replace(/_star/g, '*')
  1762. .replace(/_slash/g, '/')
  1763. .replace(/_backslash/g, '\\')
  1764. .replace(/_tild/g, '~')
  1765. .replace(/_percent/g, '%')
  1766. .replace(/_gt/g, '>')
  1767. .replace(/_lt/g, '<')
  1768. .replace(/_eq/g, '=')
  1769. .replace(/_comma/g, ',')
  1770. .replace(/_at/g, '@');
  1771. }
  1772. st.st2prop = function (stSelector) {
  1773. var colonPosition = stSelector.indexOf(':');
  1774. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1775. };
  1776. }
  1777. NilBrik.deps = ["root"];
  1778. function NilBrik (brikz, st) {
  1779. var SmalltalkObject = brikz.root.Object;
  1780. var coreFns = brikz.root.coreFns;
  1781. function SmalltalkNil () {
  1782. }
  1783. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1784. this.nilAsReceiver = new SmalltalkNil();
  1785. this.nilAsValue = this.nilAsReceiver; // TODO null
  1786. // Adds an `a$nil` (and legacy `isNil`) property to the `nil` object. When sending
  1787. // nil objects from one environment to another, doing
  1788. // `anObject == nil` (in JavaScript) does not always answer
  1789. // true as the referenced nil object might come from the other
  1790. // environment.
  1791. Object.defineProperty(this.nilAsReceiver, 'a$nil', {
  1792. value: true,
  1793. enumerable: false, configurable: false, writable: false
  1794. });
  1795. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1796. value: true,
  1797. enumerable: false, configurable: false, writable: false
  1798. });
  1799. }
  1800. /* Making smalltalk that has basic building blocks */
  1801. function configureWithFundamentals (brikz) {
  1802. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1803. brikz.root = RootBrik;
  1804. brikz.nil = NilBrik;
  1805. brikz.arraySet = ArraySetBrik;
  1806. brikz.selectorConversion = SelectorConversionBrik;
  1807. brikz.selectors = SelectorsBrik;
  1808. brikz.packages = PackagesBrik;
  1809. brikz.behaviorProviders = BehaviorProvidersBrik;
  1810. brikz.behaviors = BehaviorsBrik;
  1811. brikz.methods = MethodsBrik;
  1812. brikz.rebuild();
  1813. }
  1814. return configureWithFundamentals;
  1815. });
  1816. /* ====================================================================
  1817. |
  1818. | Amber Smalltalk
  1819. | http://amber-lang.net
  1820. |
  1821. ======================================================================
  1822. ======================================================================
  1823. |
  1824. | Copyright (c) 2010-2014
  1825. | Nicolas Petton <petton.nicolas@gmail.com>
  1826. |
  1827. | Copyright (c) 2012-2017
  1828. | The Amber team https://lolg.it/org/amber/members
  1829. | Amber contributors (see /CONTRIBUTORS)
  1830. |
  1831. | Amber is released under the MIT license
  1832. |
  1833. | Permission is hereby granted, free of charge, to any person obtaining
  1834. | a copy of this software and associated documentation files (the
  1835. | 'Software'), to deal in the Software without restriction, including
  1836. | without limitation the rights to use, copy, modify, merge, publish,
  1837. | distribute, sublicense, and/or sell copies of the Software, and to
  1838. | permit persons to whom the Software is furnished to do so, subject to
  1839. | the following conditions:
  1840. |
  1841. | The above copyright notice and this permission notice shall be
  1842. | included in all copies or substantial portions of the Software.
  1843. |
  1844. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1845. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1846. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1847. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1848. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1849. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1850. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1851. |
  1852. ==================================================================== */
  1853. //jshint eqnull:true
  1854. define('amber/kernel-language',['./compatibility' /* TODO remove */], function () {
  1855. "use strict";
  1856. function inherits (child, parent) {
  1857. child.prototype = Object.create(parent.prototype, {
  1858. constructor: {
  1859. value: child,
  1860. enumerable: false, configurable: true, writable: true
  1861. }
  1862. });
  1863. return child;
  1864. }
  1865. function defineMethod (klass, name, method) {
  1866. Object.defineProperty(klass.prototype, name, {
  1867. value: method,
  1868. enumerable: false, configurable: true, writable: true
  1869. });
  1870. }
  1871. TraitsBrik.deps = ["behaviors", "behaviorProviders", "composition", "arraySet", "root"];
  1872. function TraitsBrik (brikz, st) {
  1873. var coreFns = brikz.root.coreFns;
  1874. var SmalltalkObject = brikz.root.Object;
  1875. var setupMethods = brikz.behaviorProviders.setupMethods;
  1876. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1877. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1878. var addElement = brikz.arraySet.addElement;
  1879. var removeElement = brikz.arraySet.removeElement;
  1880. function SmalltalkTrait () {
  1881. }
  1882. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkObject);
  1883. SmalltalkTrait.prototype.trait = true;
  1884. defineMethod(SmalltalkTrait, "toString", function () {
  1885. return 'Smalltalk Trait ' + this.className;
  1886. });
  1887. defineMethod(SmalltalkTrait, "added", function () {
  1888. if (st._traitAdded) st._traitAdded(this);
  1889. });
  1890. defineMethod(SmalltalkTrait, "removed", function () {
  1891. if (st._traitRemoved) st._traitRemoved(this);
  1892. });
  1893. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1894. var self = this;
  1895. this.traitUsers.forEach(function (each) {
  1896. traitMethodChanged(method.selector, method, self, each);
  1897. });
  1898. if (st._traitMethodAdded) st._traitMethodAdded(method, this);
  1899. });
  1900. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1901. var self = this;
  1902. this.traitUsers.forEach(function (each) {
  1903. traitMethodChanged(method.selector, null, self, each);
  1904. });
  1905. if (st._traitMethodRemoved) st._traitMethodRemoved(method, this);
  1906. });
  1907. defineMethod(SmalltalkTrait, "addUser", function (traitOrBehavior) {
  1908. addElement(this.traitUsers, traitOrBehavior);
  1909. });
  1910. defineMethod(SmalltalkTrait, "removeUser", function (traitOrBehavior) {
  1911. removeElement(this.traitUsers, traitOrBehavior);
  1912. });
  1913. function traitBuilder (className) {
  1914. return {
  1915. className: className,
  1916. make: function () {
  1917. var that = new SmalltalkTrait();
  1918. that.className = className;
  1919. that.traitUsers = [];
  1920. setupMethods(that);
  1921. return that;
  1922. },
  1923. updateExisting: function (trait) {
  1924. }
  1925. };
  1926. }
  1927. st.addTrait = function (className, pkgName) {
  1928. return buildTraitOrClass(pkgName, traitBuilder(className));
  1929. };
  1930. }
  1931. MethodCompositionBrik.deps = ["behaviorProviders"];
  1932. function MethodCompositionBrik (brikz, st) {
  1933. var updateMethod = brikz.behaviorProviders.updateMethod;
  1934. function aliased (selector, method) {
  1935. if (method.selector === selector) return method;
  1936. var result = st.method({
  1937. selector: selector,
  1938. args: method.args,
  1939. protocol: method.protocol,
  1940. source: '"Aliased as ' + selector + '"\n' + method.source,
  1941. messageSends: method.messageSends,
  1942. referencesClasses: method.referencedClasses,
  1943. fn: method.fn
  1944. });
  1945. result.methodClass = method.methodClass;
  1946. return result;
  1947. }
  1948. function deleteKeysFrom (keys, obj) {
  1949. keys.forEach(function (each) {
  1950. delete obj[each];
  1951. });
  1952. }
  1953. function fillTraitTransformation (traitTransformation, obj) {
  1954. // assert(Object.getOwnProperties(obj).length === 0)
  1955. var traitMethods = traitTransformation.trait.methods;
  1956. Object.keys(traitMethods).forEach(function (selector) {
  1957. obj[selector] = traitMethods[selector];
  1958. });
  1959. var traitAliases = traitTransformation.aliases;
  1960. if (traitAliases) {
  1961. Object.keys(traitAliases).forEach(function (aliasSelector) {
  1962. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  1963. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  1964. // else delete obj[aliasSelector]; // semantically correct; optimized away
  1965. });
  1966. }
  1967. var traitExclusions = traitTransformation.exclusions;
  1968. if (traitExclusions) {
  1969. deleteKeysFrom(traitExclusions, obj);
  1970. }
  1971. return obj;
  1972. }
  1973. function buildCompositionChain (traitComposition) {
  1974. return traitComposition.reduce(function (soFar, each) {
  1975. return fillTraitTransformation(each, Object.create(soFar));
  1976. }, null);
  1977. }
  1978. st.setTraitComposition = function (traitComposition, traitOrBehavior) {
  1979. var oldLocalMethods = traitOrBehavior.localMethods,
  1980. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  1981. Object.keys(oldLocalMethods).forEach(function (selector) {
  1982. newLocalMethods[selector] = oldLocalMethods[selector];
  1983. });
  1984. var selector;
  1985. traitOrBehavior.localMethods = newLocalMethods;
  1986. for (selector in newLocalMethods) {
  1987. updateMethod(selector, traitOrBehavior);
  1988. }
  1989. for (selector in oldLocalMethods) {
  1990. updateMethod(selector, traitOrBehavior);
  1991. }
  1992. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  1993. each.trait.removeUser(traitOrBehavior);
  1994. });
  1995. traitOrBehavior.traitComposition = traitComposition && traitComposition.length ? traitComposition : null;
  1996. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  1997. each.trait.addUser(traitOrBehavior);
  1998. });
  1999. };
  2000. function aliasesOfSelector (selector, traitAliases) {
  2001. if (!traitAliases) return [selector];
  2002. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  2003. return traitAliases[aliasSelector] === selector
  2004. });
  2005. if (!traitAliases[selector]) result.push(selector);
  2006. return result;
  2007. }
  2008. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  2009. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2010. changes.forEach(function (aliasSelector) {
  2011. obj[aliasSelector] = aliased(aliasSelector, method);
  2012. });
  2013. var traitExclusions = traitTransformation.exclusions;
  2014. if (traitExclusions) {
  2015. deleteKeysFrom(traitExclusions, obj);
  2016. }
  2017. return changes;
  2018. }
  2019. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  2020. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2021. deleteKeysFrom(changes, obj);
  2022. return changes;
  2023. }
  2024. function traitMethodChanged (selector, method, trait, traitOrBehavior) {
  2025. var traitComposition = traitOrBehavior.traitComposition,
  2026. chain = traitOrBehavior.localMethods,
  2027. changes = [];
  2028. for (var i = traitComposition.length - 1; i >= 0; --i) {
  2029. chain = Object.getPrototypeOf(chain);
  2030. var traitTransformation = traitComposition[i];
  2031. if (traitTransformation.trait !== trait) continue;
  2032. changes.push.apply(changes, method ?
  2033. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  2034. applyTraitMethodDeletion(selector, traitTransformation, chain));
  2035. }
  2036. // assert(chain === null);
  2037. changes.forEach(function (each) {
  2038. updateMethod(each, traitOrBehavior);
  2039. });
  2040. }
  2041. this.traitMethodChanged = traitMethodChanged;
  2042. }
  2043. ClassesBrik.deps = ["root", "behaviors", "behaviorProviders", "arraySet", "smalltalkGlobals"];
  2044. function ClassesBrik (brikz, st) {
  2045. var SmalltalkRoot = brikz.root.Root;
  2046. var coreFns = brikz.root.coreFns;
  2047. var globals = brikz.smalltalkGlobals.globals;
  2048. var SmalltalkObject = brikz.root.Object;
  2049. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  2050. var setupMethods = brikz.behaviorProviders.setupMethods;
  2051. var removeTraitOrClass = brikz.behaviors.removeTraitOrClass;
  2052. var addElement = brikz.arraySet.addElement;
  2053. var removeElement = brikz.arraySet.removeElement;
  2054. function SmalltalkBehavior () {
  2055. }
  2056. function SmalltalkClass () {
  2057. }
  2058. function SmalltalkMetaclass () {
  2059. }
  2060. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkObject);
  2061. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  2062. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  2063. // Fake root class of the system.
  2064. // Effective superclass of all classes created with `nil subclass: ...`.
  2065. var nilAsClass = this.nilAsClass = {
  2066. fn: SmalltalkRoot,
  2067. a$cls: {fn: SmalltalkClass},
  2068. klass: {fn: SmalltalkClass}
  2069. };
  2070. SmalltalkMetaclass.prototype.meta = true;
  2071. defineMethod(SmalltalkClass, "toString", function () {
  2072. return 'Smalltalk ' + this.className;
  2073. });
  2074. defineMethod(SmalltalkMetaclass, "toString", function () {
  2075. return 'Smalltalk Metaclass ' + this.instanceClass.className;
  2076. });
  2077. defineMethod(SmalltalkClass, "added", function () {
  2078. addSubclass(this);
  2079. if (st._classAdded) st._classAdded(this);
  2080. });
  2081. defineMethod(SmalltalkClass, "removed", function () {
  2082. if (st._classRemoved) st._classRemoved(this);
  2083. removeSubclass(this);
  2084. });
  2085. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  2086. if (st._behaviorMethodAdded) st._behaviorMethodAdded(method, this);
  2087. });
  2088. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  2089. if (st._behaviorMethodRemoved) st._behaviorMethodRemoved(method, this);
  2090. });
  2091. this.bootstrapHierarchy = function () {
  2092. var nilSubclasses = [globals.ProtoObject];
  2093. nilAsClass.a$cls = nilAsClass.klass = globals.Class;
  2094. nilSubclasses.forEach(function (each) {
  2095. each.a$cls.superclass = globals.Class;
  2096. addSubclass(each.a$cls);
  2097. });
  2098. };
  2099. /* Smalltalk class creation. A class is an instance of an automatically
  2100. created metaclass object. Newly created classes (not their metaclass)
  2101. should be added to the system, see smalltalk.addClass().
  2102. Superclass linking is *not* handled here, see api.initialize() */
  2103. function classBuilder (className, superclass, iVarNames, fn) {
  2104. var logicalSuperclass = superclass;
  2105. if (superclass == null || superclass.a$nil) {
  2106. superclass = nilAsClass;
  2107. logicalSuperclass = null;
  2108. }
  2109. function klass () {
  2110. var that = metaclass().instanceClass;
  2111. that.superclass = logicalSuperclass;
  2112. that.fn = fn || inherits(function () {
  2113. }, superclass.fn);
  2114. that.iVarNames = iVarNames || [];
  2115. that.className = className;
  2116. that.subclasses = [];
  2117. setupMethods(that);
  2118. return that;
  2119. }
  2120. function metaclass () {
  2121. var that = new SmalltalkMetaclass();
  2122. that.superclass = superclass.a$cls;
  2123. that.fn = inherits(function () {
  2124. }, that.superclass.fn);
  2125. that.iVarNames = [];
  2126. that.instanceClass = new that.fn();
  2127. wireKlass(that);
  2128. setupMethods(that);
  2129. return that;
  2130. }
  2131. return {
  2132. className: className,
  2133. make: klass,
  2134. updateExisting: function (klass) {
  2135. if (klass.superclass == logicalSuperclass && (!fn || fn === klass.fn)) {
  2136. if (iVarNames) klass.iVarNames = iVarNames;
  2137. } else throw new Error("Incompatible change of class: " + klass.className);
  2138. }
  2139. };
  2140. }
  2141. function wireKlass (klass) {
  2142. Object.defineProperty(klass.fn.prototype, "a$cls", {
  2143. value: klass,
  2144. enumerable: false, configurable: true, writable: true
  2145. });
  2146. Object.defineProperty(klass.fn.prototype, "klass", {
  2147. value: klass,
  2148. enumerable: false, configurable: true, writable: true
  2149. });
  2150. }
  2151. this.wireKlass = wireKlass;
  2152. /* Add a class to the system, creating a new one if needed.
  2153. A Package is lazily created if one with given name does not exist. */
  2154. st.addClass = function (className, superclass, iVarNames, pkgName) {
  2155. // While subclassing nil is allowed, it might be an error, so
  2156. // warn about it.
  2157. if (typeof superclass === 'undefined' || superclass && superclass.a$nil) {
  2158. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  2159. }
  2160. return buildTraitOrClass(pkgName, classBuilder(className, superclass, iVarNames, coreFns[className]));
  2161. };
  2162. st.removeClass = removeTraitOrClass;
  2163. function addSubclass (klass) {
  2164. if (klass.superclass) {
  2165. addElement(klass.superclass.subclasses, klass);
  2166. }
  2167. }
  2168. function removeSubclass (klass) {
  2169. if (klass.superclass) {
  2170. removeElement(klass.superclass.subclasses, klass);
  2171. }
  2172. }
  2173. function metaSubclasses (metaclass) {
  2174. return metaclass.instanceClass.subclasses
  2175. .filter(function (each) {
  2176. return !each.meta;
  2177. })
  2178. .map(function (each) {
  2179. return each.a$cls;
  2180. });
  2181. }
  2182. st.metaSubclasses = metaSubclasses;
  2183. st.traverseClassTree = function (klass, fn) {
  2184. var queue = [klass], sentinel = {};
  2185. for (var i = 0; i < queue.length; ++i) {
  2186. var item = queue[i];
  2187. if (fn(item, sentinel) === sentinel) continue;
  2188. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  2189. queue.push.apply(queue, subclasses);
  2190. }
  2191. };
  2192. }
  2193. /* Making smalltalk that can load */
  2194. function configureWithHierarchy (brikz) {
  2195. brikz.traits = TraitsBrik;
  2196. brikz.composition = MethodCompositionBrik;
  2197. brikz.classes = ClassesBrik;
  2198. brikz.rebuild();
  2199. }
  2200. return configureWithHierarchy;
  2201. });
  2202. /* ====================================================================
  2203. |
  2204. | Amber Smalltalk
  2205. | http://amber-lang.net
  2206. |
  2207. ======================================================================
  2208. ======================================================================
  2209. |
  2210. | Copyright (c) 2010-2014
  2211. | Nicolas Petton <petton.nicolas@gmail.com>
  2212. |
  2213. | Copyright (c) 2012-2017
  2214. | The Amber team https://lolg.it/org/amber/members
  2215. | Amber contributors (see /CONTRIBUTORS)
  2216. |
  2217. | Amber is released under the MIT license
  2218. |
  2219. | Permission is hereby granted, free of charge, to any person obtaining
  2220. | a copy of this software and associated documentation files (the
  2221. | 'Software'), to deal in the Software without restriction, including
  2222. | without limitation the rights to use, copy, modify, merge, publish,
  2223. | distribute, sublicense, and/or sell copies of the Software, and to
  2224. | permit persons to whom the Software is furnished to do so, subject to
  2225. | the following conditions:
  2226. |
  2227. | The above copyright notice and this permission notice shall be
  2228. | included in all copies or substantial portions of the Software.
  2229. |
  2230. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  2231. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2232. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  2233. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  2234. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  2235. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  2236. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  2237. |
  2238. ==================================================================== */
  2239. //jshint eqnull:true
  2240. define('amber/boot',[
  2241. 'require', './kernel-checks', './brikz', './kernel-fundamentals', './kernel-language', './compatibility' /* TODO remove */
  2242. ], function (require, _, Brikz, configureWithFundamentals, configureWithHierarchy) {
  2243. "use strict";
  2244. require(['./kernel-runtime']); // preload
  2245. function SmalltalkInitBrik (brikz, st) {
  2246. var initialized = false;
  2247. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  2248. require(['./kernel-runtime'], resolve, reject);
  2249. });
  2250. /* Smalltalk initialization. Called on page load */
  2251. st.initialize = function () {
  2252. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  2253. if (initialized) return;
  2254. brikz.classes.bootstrapHierarchy();
  2255. configureWithRuntime(brikz);
  2256. brikz.startImage.run();
  2257. initialized = true;
  2258. });
  2259. };
  2260. }
  2261. /* Adds AMD and requirejs related methods to the api */
  2262. function AMDBrik (brikz, st) {
  2263. st.amdRequire = require;
  2264. st.defaultTransportType = st.defaultTransportType || "amd";
  2265. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  2266. }
  2267. /* Defines asReceiver to be present at load time */
  2268. /* (logically it belongs more to PrimitiveBrik) */
  2269. AsReceiverBrik.deps = ["nil"];
  2270. function AsReceiverBrik (brikz, st) {
  2271. var nilAsReceiver = brikz.nil.nilAsReceiver;
  2272. /**
  2273. * This function is used all over the compiled amber code.
  2274. * It takes any value (JavaScript or Smalltalk)
  2275. * and returns a proper Amber Smalltalk receiver.
  2276. *
  2277. * null or undefined -> nilAsReceiver,
  2278. * object having Smalltalk signature -> unchanged,
  2279. * otherwise wrapped foreign (JS) object
  2280. */
  2281. this.asReceiver = function (o) {
  2282. if (o == null) return nilAsReceiver;
  2283. else if (o.a$cls != null) return o;
  2284. else return st.wrapJavaScript(o);
  2285. };
  2286. }
  2287. var api = {};
  2288. var brikz = new Brikz(api);
  2289. configureWithFundamentals(brikz);
  2290. configureWithHierarchy(brikz);
  2291. brikz.asReceiver = AsReceiverBrik;
  2292. brikz.stInit = SmalltalkInitBrik;
  2293. brikz.amd = AMDBrik;
  2294. brikz.rebuild();
  2295. return {
  2296. api: api,
  2297. nil/* TODO deprecate */: brikz.nil.nilAsReceiver,
  2298. nilAsReceiver: brikz.nil.nilAsReceiver,
  2299. nilAsValue: brikz.nil.nilAsValue,
  2300. dnu/* TODO deprecate */: brikz.classes.nilAsClass,
  2301. nilAsClass: brikz.classes.nilAsClass,
  2302. globals: brikz.smalltalkGlobals.globals,
  2303. asReceiver: brikz.asReceiver.asReceiver
  2304. };
  2305. });
  2306. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  2307. var globals = boot.globals,
  2308. exports = {},
  2309. api = boot.api,
  2310. nil = boot.nilAsReceiver;
  2311. // API
  2312. exports.popupHelios = function () {
  2313. require(['helios/index'], function (helios) {
  2314. helios.popup();
  2315. }, function (err) {
  2316. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  2317. });
  2318. };
  2319. Object.defineProperty(exports, "api", {
  2320. value: api,
  2321. enumerable: true, configurable: true, writable: false
  2322. });
  2323. Object.defineProperty(exports, "globals", {
  2324. value: globals,
  2325. enumerable: true, configurable: true, writable: false
  2326. });
  2327. Object.defineProperty(exports, "nil", {
  2328. value: nil,
  2329. enumerable: true, configurable: true, writable: false
  2330. });
  2331. function mixinToSettings (source) {
  2332. var settings = globals.SmalltalkSettings;
  2333. Object.keys(source).forEach(function (key) {
  2334. settings[key] = source[key];
  2335. });
  2336. }
  2337. function settingsInLocalStorage () {
  2338. //jshint evil:true
  2339. var global = new Function('return this')(),
  2340. storage = 'localStorage' in global && global.localStorage;
  2341. if (storage) {
  2342. var fromStorage;
  2343. try {
  2344. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  2345. } catch (ex) {
  2346. // pass
  2347. }
  2348. mixinToSettings(fromStorage || {});
  2349. if (typeof window !== "undefined") {
  2350. requirejs(['jquery'], function ($) {
  2351. $(window).on('beforeunload', function () {
  2352. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  2353. });
  2354. });
  2355. }
  2356. }
  2357. }
  2358. exports.initialize = function (options) {
  2359. return Promise.resolve()
  2360. .then(function () {
  2361. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  2362. })
  2363. .then(settingsInLocalStorage)
  2364. .then(function () {
  2365. return options || {};
  2366. })
  2367. .then(mixinToSettings)
  2368. .then(function () {
  2369. return api.initialize();
  2370. });
  2371. };
  2372. // Exports
  2373. return exports;
  2374. });
  2375. define('amber_core/Kernel-Helpers',["amber/boot"], function($boot){"use strict";
  2376. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  2377. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2378. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2379. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  2380. $core.addPackage("Kernel-Helpers");
  2381. $core.packages["Kernel-Helpers"].innerEval = function (expr) { return eval(expr); };
  2382. $core.packages["Kernel-Helpers"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2383. $core.addTrait("TSubclassable", "Kernel-Helpers");
  2384. $core.addMethod(
  2385. $core.method({
  2386. selector: "subclass:",
  2387. protocol: "class creation",
  2388. fn: function (aString){
  2389. var self=this,$self=this;
  2390. return $core.withContext(function($ctx1) {
  2391. return $self._subclass_instanceVariableNames_package_(aString,"",nil);
  2392. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.TSubclassable)});
  2393. },
  2394. args: ["aString"],
  2395. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  2396. referencedClasses: [],
  2397. messageSends: ["subclass:instanceVariableNames:package:"]
  2398. }),
  2399. $globals.TSubclassable);
  2400. $core.addMethod(
  2401. $core.method({
  2402. selector: "subclass:instanceVariableNames:",
  2403. protocol: "class creation",
  2404. fn: function (aString,anotherString){
  2405. var self=this,$self=this;
  2406. return $core.withContext(function($ctx1) {
  2407. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  2408. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.TSubclassable)});
  2409. },
  2410. args: ["aString", "anotherString"],
  2411. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  2412. referencedClasses: [],
  2413. messageSends: ["subclass:instanceVariableNames:package:"]
  2414. }),
  2415. $globals.TSubclassable);
  2416. $core.addMethod(
  2417. $core.method({
  2418. selector: "subclass:instanceVariableNames:category:",
  2419. protocol: "class creation",
  2420. fn: function (aString,aString2,aString3){
  2421. var self=this,$self=this;
  2422. return $core.withContext(function($ctx1) {
  2423. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2424. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2425. },
  2426. args: ["aString", "aString2", "aString3"],
  2427. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2428. referencedClasses: [],
  2429. messageSends: ["subclass:instanceVariableNames:package:"]
  2430. }),
  2431. $globals.TSubclassable);
  2432. $core.addMethod(
  2433. $core.method({
  2434. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2435. protocol: "class creation",
  2436. fn: function (aString,aString2,classVars,pools,aString3){
  2437. var self=this,$self=this;
  2438. return $core.withContext(function($ctx1) {
  2439. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2440. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2441. },
  2442. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  2443. 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",
  2444. referencedClasses: [],
  2445. messageSends: ["subclass:instanceVariableNames:package:"]
  2446. }),
  2447. $globals.TSubclassable);
  2448. $core.addMethod(
  2449. $core.method({
  2450. selector: "subclass:instanceVariableNames:package:",
  2451. protocol: "class creation",
  2452. fn: function (aString,aString2,aString3){
  2453. var self=this,$self=this;
  2454. return $core.withContext(function($ctx1) {
  2455. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  2456. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2457. },
  2458. args: ["aString", "aString2", "aString3"],
  2459. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  2460. referencedClasses: ["ClassBuilder"],
  2461. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  2462. }),
  2463. $globals.TSubclassable);
  2464. $core.addMethod(
  2465. $core.method({
  2466. selector: "subclass:uses:",
  2467. protocol: "class creation",
  2468. fn: function (aString,aTraitCompositionDescription){
  2469. var self=this,$self=this;
  2470. return $core.withContext(function($ctx1) {
  2471. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  2472. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.TSubclassable)});
  2473. },
  2474. args: ["aString", "aTraitCompositionDescription"],
  2475. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  2476. referencedClasses: [],
  2477. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2478. }),
  2479. $globals.TSubclassable);
  2480. $core.addMethod(
  2481. $core.method({
  2482. selector: "subclass:uses:instanceVariableNames:",
  2483. protocol: "class creation",
  2484. fn: function (aString,aTraitCompositionDescription,anotherString){
  2485. var self=this,$self=this;
  2486. return $core.withContext(function($ctx1) {
  2487. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  2488. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.TSubclassable)});
  2489. },
  2490. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  2491. 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",
  2492. referencedClasses: [],
  2493. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2494. }),
  2495. $globals.TSubclassable);
  2496. $core.addMethod(
  2497. $core.method({
  2498. selector: "subclass:uses:instanceVariableNames:category:",
  2499. protocol: "class creation",
  2500. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2501. var self=this,$self=this;
  2502. return $core.withContext(function($ctx1) {
  2503. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2504. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2505. },
  2506. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2507. 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",
  2508. referencedClasses: [],
  2509. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2510. }),
  2511. $globals.TSubclassable);
  2512. $core.addMethod(
  2513. $core.method({
  2514. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2515. protocol: "class creation",
  2516. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  2517. var self=this,$self=this;
  2518. return $core.withContext(function($ctx1) {
  2519. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2520. }, 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)});
  2521. },
  2522. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  2523. 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",
  2524. referencedClasses: [],
  2525. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2526. }),
  2527. $globals.TSubclassable);
  2528. $core.addMethod(
  2529. $core.method({
  2530. selector: "subclass:uses:instanceVariableNames:package:",
  2531. protocol: "class creation",
  2532. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2533. var self=this,$self=this;
  2534. var cls;
  2535. return $core.withContext(function($ctx1) {
  2536. cls=$self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2537. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  2538. return cls;
  2539. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.TSubclassable)});
  2540. },
  2541. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2542. 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",
  2543. referencedClasses: [],
  2544. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  2545. }),
  2546. $globals.TSubclassable);
  2547. });
  2548. define('amber_core/Kernel-Objects',["amber/boot", "amber_core/Kernel-Helpers"], function($boot){"use strict";
  2549. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  2550. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2551. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2552. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  2553. $core.addPackage("Kernel-Objects");
  2554. $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  2555. $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2556. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2557. $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.";
  2558. $core.addMethod(
  2559. $core.method({
  2560. selector: "=",
  2561. protocol: "comparing",
  2562. fn: function (anObject){
  2563. var self=this,$self=this;
  2564. return $core.withContext(function($ctx1) {
  2565. return $self.__eq_eq(anObject);
  2566. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  2567. },
  2568. args: ["anObject"],
  2569. source: "= anObject\x0a\x09^ self == anObject",
  2570. referencedClasses: [],
  2571. messageSends: ["=="]
  2572. }),
  2573. $globals.ProtoObject);
  2574. $core.addMethod(
  2575. $core.method({
  2576. selector: "==",
  2577. protocol: "comparing",
  2578. fn: function (anObject){
  2579. var self=this,$self=this;
  2580. return $core.withContext(function($ctx1) {
  2581. return self === anObject;
  2582. return self;
  2583. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  2584. },
  2585. args: ["anObject"],
  2586. source: "== anObject\x0a<inlineJS: 'return self === anObject'>",
  2587. referencedClasses: [],
  2588. messageSends: []
  2589. }),
  2590. $globals.ProtoObject);
  2591. $core.addMethod(
  2592. $core.method({
  2593. selector: "asJSON",
  2594. protocol: "converting",
  2595. fn: function (){
  2596. var self=this,$self=this;
  2597. return $core.withContext(function($ctx1) {
  2598. $self._deprecatedAPI_("Use #asJavaScriptObject instead.");
  2599. return $self._asJavaScriptObject();
  2600. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.ProtoObject)});
  2601. },
  2602. args: [],
  2603. source: "asJSON\x0a\x09self deprecatedAPI: 'Use #asJavaScriptObject instead.'.\x0a\x09^ self asJavaScriptObject",
  2604. referencedClasses: [],
  2605. messageSends: ["deprecatedAPI:", "asJavaScriptObject"]
  2606. }),
  2607. $globals.ProtoObject);
  2608. $core.addMethod(
  2609. $core.method({
  2610. selector: "asJavascript",
  2611. protocol: "converting",
  2612. fn: function (){
  2613. var self=this,$self=this;
  2614. return $core.withContext(function($ctx1) {
  2615. $self._deprecatedAPI_("Use #asJavaScriptSource instead.");
  2616. return $self._asJavaScriptSource();
  2617. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.ProtoObject)});
  2618. },
  2619. args: [],
  2620. source: "asJavascript\x0a\x09self deprecatedAPI: 'Use #asJavaScriptSource instead.'.\x0a\x09^ self asJavaScriptSource",
  2621. referencedClasses: [],
  2622. messageSends: ["deprecatedAPI:", "asJavaScriptSource"]
  2623. }),
  2624. $globals.ProtoObject);
  2625. $core.addMethod(
  2626. $core.method({
  2627. selector: "asString",
  2628. protocol: "converting",
  2629. fn: function (){
  2630. var self=this,$self=this;
  2631. return $core.withContext(function($ctx1) {
  2632. return $self._printString();
  2633. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  2634. },
  2635. args: [],
  2636. source: "asString\x0a\x09^ self printString",
  2637. referencedClasses: [],
  2638. messageSends: ["printString"]
  2639. }),
  2640. $globals.ProtoObject);
  2641. $core.addMethod(
  2642. $core.method({
  2643. selector: "class",
  2644. protocol: "accessing",
  2645. fn: function (){
  2646. var self=this,$self=this;
  2647. return $core.withContext(function($ctx1) {
  2648. return $self.a$cls;
  2649. return self;
  2650. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  2651. },
  2652. args: [],
  2653. source: "class\x0a\x09<inlineJS: 'return $self.a$cls'>",
  2654. referencedClasses: [],
  2655. messageSends: []
  2656. }),
  2657. $globals.ProtoObject);
  2658. $core.addMethod(
  2659. $core.method({
  2660. selector: "doesNotUnderstand:",
  2661. protocol: "error handling",
  2662. fn: function (aMessage){
  2663. var self=this,$self=this;
  2664. return $core.withContext(function($ctx1) {
  2665. var $1;
  2666. $1=$recv($globals.MessageNotUnderstood)._new();
  2667. $recv($1)._receiver_(self);
  2668. $recv($1)._message_(aMessage);
  2669. $recv($1)._signal();
  2670. return self;
  2671. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  2672. },
  2673. args: ["aMessage"],
  2674. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2675. referencedClasses: ["MessageNotUnderstood"],
  2676. messageSends: ["receiver:", "new", "message:", "signal"]
  2677. }),
  2678. $globals.ProtoObject);
  2679. $core.addMethod(
  2680. $core.method({
  2681. selector: "evaluate:on:",
  2682. protocol: "evaluating",
  2683. fn: function (aString,anEvaluator){
  2684. var self=this,$self=this;
  2685. return $core.withContext(function($ctx1) {
  2686. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2687. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  2688. },
  2689. args: ["aString", "anEvaluator"],
  2690. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2691. referencedClasses: [],
  2692. messageSends: ["evaluate:receiver:"]
  2693. }),
  2694. $globals.ProtoObject);
  2695. $core.addMethod(
  2696. $core.method({
  2697. selector: "identityHash",
  2698. protocol: "accessing",
  2699. fn: function (){
  2700. var self=this,$self=this;
  2701. return $core.withContext(function($ctx1) {
  2702. self._deprecatedAPI();
  2703. var hash=self.identityHash;
  2704. if (hash) return hash;
  2705. hash=$core.nextId();
  2706. Object.defineProperty(self, 'identityHash', {value:hash});
  2707. return hash;
  2708. ;
  2709. return self;
  2710. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  2711. },
  2712. args: [],
  2713. 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'>",
  2714. referencedClasses: [],
  2715. messageSends: []
  2716. }),
  2717. $globals.ProtoObject);
  2718. $core.addMethod(
  2719. $core.method({
  2720. selector: "ifNil:",
  2721. protocol: "testing",
  2722. fn: function (aBlock){
  2723. var self=this,$self=this;
  2724. return self;
  2725. },
  2726. args: ["aBlock"],
  2727. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2728. referencedClasses: [],
  2729. messageSends: []
  2730. }),
  2731. $globals.ProtoObject);
  2732. $core.addMethod(
  2733. $core.method({
  2734. selector: "ifNil:ifNotNil:",
  2735. protocol: "testing",
  2736. fn: function (aBlock,anotherBlock){
  2737. var self=this,$self=this;
  2738. return $core.withContext(function($ctx1) {
  2739. return $recv(anotherBlock)._value_(self);
  2740. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2741. },
  2742. args: ["aBlock", "anotherBlock"],
  2743. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2744. referencedClasses: [],
  2745. messageSends: ["value:"]
  2746. }),
  2747. $globals.ProtoObject);
  2748. $core.addMethod(
  2749. $core.method({
  2750. selector: "ifNotNil:",
  2751. protocol: "testing",
  2752. fn: function (aBlock){
  2753. var self=this,$self=this;
  2754. return $core.withContext(function($ctx1) {
  2755. return $recv(aBlock)._value_(self);
  2756. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  2757. },
  2758. args: ["aBlock"],
  2759. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2760. referencedClasses: [],
  2761. messageSends: ["value:"]
  2762. }),
  2763. $globals.ProtoObject);
  2764. $core.addMethod(
  2765. $core.method({
  2766. selector: "ifNotNil:ifNil:",
  2767. protocol: "testing",
  2768. fn: function (aBlock,anotherBlock){
  2769. var self=this,$self=this;
  2770. return $core.withContext(function($ctx1) {
  2771. return $recv(aBlock)._value_(self);
  2772. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2773. },
  2774. args: ["aBlock", "anotherBlock"],
  2775. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2776. referencedClasses: [],
  2777. messageSends: ["value:"]
  2778. }),
  2779. $globals.ProtoObject);
  2780. $core.addMethod(
  2781. $core.method({
  2782. selector: "initialize",
  2783. protocol: "initialization",
  2784. fn: function (){
  2785. var self=this,$self=this;
  2786. return self;
  2787. },
  2788. args: [],
  2789. source: "initialize",
  2790. referencedClasses: [],
  2791. messageSends: []
  2792. }),
  2793. $globals.ProtoObject);
  2794. $core.addMethod(
  2795. $core.method({
  2796. selector: "inspect",
  2797. protocol: "inspecting",
  2798. fn: function (){
  2799. var self=this,$self=this;
  2800. return $core.withContext(function($ctx1) {
  2801. $recv($globals.Inspector)._inspect_(self);
  2802. return self;
  2803. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  2804. },
  2805. args: [],
  2806. source: "inspect\x0a\x09Inspector inspect: self",
  2807. referencedClasses: ["Inspector"],
  2808. messageSends: ["inspect:"]
  2809. }),
  2810. $globals.ProtoObject);
  2811. $core.addMethod(
  2812. $core.method({
  2813. selector: "inspectOn:",
  2814. protocol: "inspecting",
  2815. fn: function (anInspector){
  2816. var self=this,$self=this;
  2817. return self;
  2818. },
  2819. args: ["anInspector"],
  2820. source: "inspectOn: anInspector",
  2821. referencedClasses: [],
  2822. messageSends: []
  2823. }),
  2824. $globals.ProtoObject);
  2825. $core.addMethod(
  2826. $core.method({
  2827. selector: "instVarAt:",
  2828. protocol: "accessing",
  2829. fn: function (aString){
  2830. var self=this,$self=this;
  2831. return $core.withContext(function($ctx1) {
  2832. return $self['@'+aString];
  2833. return self;
  2834. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  2835. },
  2836. args: ["aString"],
  2837. source: "instVarAt: aString\x0a\x09<inlineJS: 'return $self[''@''+aString]'>",
  2838. referencedClasses: [],
  2839. messageSends: []
  2840. }),
  2841. $globals.ProtoObject);
  2842. $core.addMethod(
  2843. $core.method({
  2844. selector: "instVarAt:put:",
  2845. protocol: "accessing",
  2846. fn: function (aString,anObject){
  2847. var self=this,$self=this;
  2848. return $core.withContext(function($ctx1) {
  2849. $self['@' + aString] = anObject;
  2850. return self;
  2851. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  2852. },
  2853. args: ["aString", "anObject"],
  2854. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: '$self[''@'' + aString] = anObject'>",
  2855. referencedClasses: [],
  2856. messageSends: []
  2857. }),
  2858. $globals.ProtoObject);
  2859. $core.addMethod(
  2860. $core.method({
  2861. selector: "isKindOf:",
  2862. protocol: "testing",
  2863. fn: function (aClass){
  2864. var self=this,$self=this;
  2865. return $core.withContext(function($ctx1) {
  2866. var $1;
  2867. $1=$self._isMemberOf_(aClass);
  2868. if($core.assert($1)){
  2869. return true;
  2870. } else {
  2871. return $recv($self._class())._inheritsFrom_(aClass);
  2872. }
  2873. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  2874. },
  2875. args: ["aClass"],
  2876. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  2877. referencedClasses: [],
  2878. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  2879. }),
  2880. $globals.ProtoObject);
  2881. $core.addMethod(
  2882. $core.method({
  2883. selector: "isNil",
  2884. protocol: "testing",
  2885. fn: function (){
  2886. var self=this,$self=this;
  2887. return false;
  2888. },
  2889. args: [],
  2890. source: "isNil\x0a\x09^ false",
  2891. referencedClasses: [],
  2892. messageSends: []
  2893. }),
  2894. $globals.ProtoObject);
  2895. $core.addMethod(
  2896. $core.method({
  2897. selector: "notNil",
  2898. protocol: "testing",
  2899. fn: function (){
  2900. var self=this,$self=this;
  2901. return $core.withContext(function($ctx1) {
  2902. return $recv($self._isNil())._not();
  2903. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2904. },
  2905. args: [],
  2906. source: "notNil\x0a\x09^ self isNil not",
  2907. referencedClasses: [],
  2908. messageSends: ["not", "isNil"]
  2909. }),
  2910. $globals.ProtoObject);
  2911. $core.addMethod(
  2912. $core.method({
  2913. selector: "perform:",
  2914. protocol: "message handling",
  2915. fn: function (aString){
  2916. var self=this,$self=this;
  2917. return $core.withContext(function($ctx1) {
  2918. return $self._perform_withArguments_(aString,[]);
  2919. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2920. },
  2921. args: ["aString"],
  2922. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2923. referencedClasses: [],
  2924. messageSends: ["perform:withArguments:"]
  2925. }),
  2926. $globals.ProtoObject);
  2927. $core.addMethod(
  2928. $core.method({
  2929. selector: "perform:withArguments:",
  2930. protocol: "message handling",
  2931. fn: function (aString,aCollection){
  2932. var self=this,$self=this;
  2933. return $core.withContext(function($ctx1) {
  2934. return $core.send2(self, aString, aCollection);
  2935. return self;
  2936. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2937. },
  2938. args: ["aString", "aCollection"],
  2939. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  2940. referencedClasses: [],
  2941. messageSends: []
  2942. }),
  2943. $globals.ProtoObject);
  2944. $core.addMethod(
  2945. $core.method({
  2946. selector: "printOn:",
  2947. protocol: "printing",
  2948. fn: function (aStream){
  2949. var self=this,$self=this;
  2950. return $core.withContext(function($ctx1) {
  2951. var $5,$4,$3,$2,$1;
  2952. $5=$self._class();
  2953. $ctx1.sendIdx["class"]=1;
  2954. $4=$recv($5)._name();
  2955. $ctx1.sendIdx["name"]=1;
  2956. $3=$recv($4)._first();
  2957. $2=$recv($3)._isVowel();
  2958. if($core.assert($2)){
  2959. $1="an ";
  2960. } else {
  2961. $1="a ";
  2962. }
  2963. $recv(aStream)._nextPutAll_($1);
  2964. $ctx1.sendIdx["nextPutAll:"]=1;
  2965. $recv(aStream)._nextPutAll_($recv($self._class())._name());
  2966. return self;
  2967. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  2968. },
  2969. args: ["aStream"],
  2970. 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",
  2971. referencedClasses: [],
  2972. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  2973. }),
  2974. $globals.ProtoObject);
  2975. $core.addMethod(
  2976. $core.method({
  2977. selector: "printString",
  2978. protocol: "printing",
  2979. fn: function (){
  2980. var self=this,$self=this;
  2981. return $core.withContext(function($ctx1) {
  2982. return $recv($globals.String)._streamContents_((function(str){
  2983. return $core.withContext(function($ctx2) {
  2984. return $self._printOn_(str);
  2985. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  2986. }));
  2987. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  2988. },
  2989. args: [],
  2990. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  2991. referencedClasses: ["String"],
  2992. messageSends: ["streamContents:", "printOn:"]
  2993. }),
  2994. $globals.ProtoObject);
  2995. $core.addMethod(
  2996. $core.method({
  2997. selector: "yourself",
  2998. protocol: "accessing",
  2999. fn: function (){
  3000. var self=this,$self=this;
  3001. return self;
  3002. },
  3003. args: [],
  3004. source: "yourself\x0a\x09^ self",
  3005. referencedClasses: [],
  3006. messageSends: []
  3007. }),
  3008. $globals.ProtoObject);
  3009. $core.addMethod(
  3010. $core.method({
  3011. selector: "~=",
  3012. protocol: "comparing",
  3013. fn: function (anObject){
  3014. var self=this,$self=this;
  3015. return $core.withContext(function($ctx1) {
  3016. var $1;
  3017. $1=$recv($self.__eq(anObject)).__eq(false);
  3018. $ctx1.sendIdx["="]=1;
  3019. return $1;
  3020. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  3021. },
  3022. args: ["anObject"],
  3023. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  3024. referencedClasses: [],
  3025. messageSends: ["="]
  3026. }),
  3027. $globals.ProtoObject);
  3028. $core.addMethod(
  3029. $core.method({
  3030. selector: "~~",
  3031. protocol: "comparing",
  3032. fn: function (anObject){
  3033. var self=this,$self=this;
  3034. return $core.withContext(function($ctx1) {
  3035. return $recv($self.__eq_eq(anObject)).__eq(false);
  3036. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  3037. },
  3038. args: ["anObject"],
  3039. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  3040. referencedClasses: [],
  3041. messageSends: ["=", "=="]
  3042. }),
  3043. $globals.ProtoObject);
  3044. $core.addMethod(
  3045. $core.method({
  3046. selector: "initialize",
  3047. protocol: "initialization",
  3048. fn: function (){
  3049. var self=this,$self=this;
  3050. return self;
  3051. },
  3052. args: [],
  3053. source: "initialize",
  3054. referencedClasses: [],
  3055. messageSends: []
  3056. }),
  3057. $globals.ProtoObject.a$cls);
  3058. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  3059. $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.";
  3060. $core.addMethod(
  3061. $core.method({
  3062. selector: "->",
  3063. protocol: "converting",
  3064. fn: function (anObject){
  3065. var self=this,$self=this;
  3066. return $core.withContext(function($ctx1) {
  3067. return $recv($globals.Association)._key_value_(self,anObject);
  3068. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  3069. },
  3070. args: ["anObject"],
  3071. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  3072. referencedClasses: ["Association"],
  3073. messageSends: ["key:value:"]
  3074. }),
  3075. $globals.Object);
  3076. $core.addMethod(
  3077. $core.method({
  3078. selector: "asJSONString",
  3079. protocol: "converting",
  3080. fn: function (){
  3081. var self=this,$self=this;
  3082. return $core.withContext(function($ctx1) {
  3083. return $recv($globals.JSON)._stringify_($self._asJavaScriptObject());
  3084. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  3085. },
  3086. args: [],
  3087. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  3088. referencedClasses: ["JSON"],
  3089. messageSends: ["stringify:", "asJavaScriptObject"]
  3090. }),
  3091. $globals.Object);
  3092. $core.addMethod(
  3093. $core.method({
  3094. selector: "asJavaScriptObject",
  3095. protocol: "converting",
  3096. fn: function (){
  3097. var self=this,$self=this;
  3098. var variables;
  3099. return $core.withContext(function($ctx1) {
  3100. variables=$recv($globals.HashedCollection)._new();
  3101. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  3102. return $core.withContext(function($ctx2) {
  3103. return $recv(variables)._at_put_(each,$recv($self._instVarAt_(each))._asJavaScriptObject());
  3104. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3105. }));
  3106. return variables;
  3107. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables},$globals.Object)});
  3108. },
  3109. args: [],
  3110. 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",
  3111. referencedClasses: ["HashedCollection"],
  3112. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarAt:"]
  3113. }),
  3114. $globals.Object);
  3115. $core.addMethod(
  3116. $core.method({
  3117. selector: "asJavaScriptSource",
  3118. protocol: "converting",
  3119. fn: function (){
  3120. var self=this,$self=this;
  3121. return $core.withContext(function($ctx1) {
  3122. return $self._asString();
  3123. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Object)});
  3124. },
  3125. args: [],
  3126. source: "asJavaScriptSource\x0a\x09^ self asString",
  3127. referencedClasses: [],
  3128. messageSends: ["asString"]
  3129. }),
  3130. $globals.Object);
  3131. $core.addMethod(
  3132. $core.method({
  3133. selector: "basicAt:",
  3134. protocol: "accessing",
  3135. fn: function (aString){
  3136. var self=this,$self=this;
  3137. return $core.withContext(function($ctx1) {
  3138. return self[aString];
  3139. return self;
  3140. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  3141. },
  3142. args: ["aString"],
  3143. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  3144. referencedClasses: [],
  3145. messageSends: []
  3146. }),
  3147. $globals.Object);
  3148. $core.addMethod(
  3149. $core.method({
  3150. selector: "basicAt:put:",
  3151. protocol: "accessing",
  3152. fn: function (aString,anObject){
  3153. var self=this,$self=this;
  3154. return $core.withContext(function($ctx1) {
  3155. return self[aString] = anObject;
  3156. return self;
  3157. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  3158. },
  3159. args: ["aString", "anObject"],
  3160. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  3161. referencedClasses: [],
  3162. messageSends: []
  3163. }),
  3164. $globals.Object);
  3165. $core.addMethod(
  3166. $core.method({
  3167. selector: "basicDelete:",
  3168. protocol: "accessing",
  3169. fn: function (aString){
  3170. var self=this,$self=this;
  3171. return $core.withContext(function($ctx1) {
  3172. delete self[aString]; return aString;
  3173. return self;
  3174. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  3175. },
  3176. args: ["aString"],
  3177. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  3178. referencedClasses: [],
  3179. messageSends: []
  3180. }),
  3181. $globals.Object);
  3182. $core.addMethod(
  3183. $core.method({
  3184. selector: "basicPerform:",
  3185. protocol: "message handling",
  3186. fn: function (aString){
  3187. var self=this,$self=this;
  3188. return $core.withContext(function($ctx1) {
  3189. return $self._basicPerform_withArguments_(aString,[]);
  3190. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  3191. },
  3192. args: ["aString"],
  3193. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  3194. referencedClasses: [],
  3195. messageSends: ["basicPerform:withArguments:"]
  3196. }),
  3197. $globals.Object);
  3198. $core.addMethod(
  3199. $core.method({
  3200. selector: "basicPerform:withArguments:",
  3201. protocol: "message handling",
  3202. fn: function (aString,aCollection){
  3203. var self=this,$self=this;
  3204. return $core.withContext(function($ctx1) {
  3205. return self[aString].apply(self, aCollection);;
  3206. return self;
  3207. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  3208. },
  3209. args: ["aString", "aCollection"],
  3210. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  3211. referencedClasses: [],
  3212. messageSends: []
  3213. }),
  3214. $globals.Object);
  3215. $core.addMethod(
  3216. $core.method({
  3217. selector: "browse",
  3218. protocol: "browsing",
  3219. fn: function (){
  3220. var self=this,$self=this;
  3221. return $core.withContext(function($ctx1) {
  3222. $recv($globals.Finder)._findClass_($self._class());
  3223. return self;
  3224. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  3225. },
  3226. args: [],
  3227. source: "browse\x0a\x09Finder findClass: self class",
  3228. referencedClasses: ["Finder"],
  3229. messageSends: ["findClass:", "class"]
  3230. }),
  3231. $globals.Object);
  3232. $core.addMethod(
  3233. $core.method({
  3234. selector: "copy",
  3235. protocol: "copying",
  3236. fn: function (){
  3237. var self=this,$self=this;
  3238. return $core.withContext(function($ctx1) {
  3239. return $recv($self._shallowCopy())._postCopy();
  3240. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  3241. },
  3242. args: [],
  3243. source: "copy\x0a\x09^ self shallowCopy postCopy",
  3244. referencedClasses: [],
  3245. messageSends: ["postCopy", "shallowCopy"]
  3246. }),
  3247. $globals.Object);
  3248. $core.addMethod(
  3249. $core.method({
  3250. selector: "deepCopy",
  3251. protocol: "copying",
  3252. fn: function (){
  3253. var self=this,$self=this;
  3254. return $core.withContext(function($ctx1) {
  3255. var copy = self.a$cls._new();
  3256. Object.keys(self).forEach(function (i) {
  3257. if(/^@.+/.test(i)) {
  3258. copy[i] = $recv(self[i])._deepCopy();
  3259. }
  3260. });
  3261. return copy;
  3262. ;
  3263. return self;
  3264. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  3265. },
  3266. args: [],
  3267. 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'>",
  3268. referencedClasses: [],
  3269. messageSends: []
  3270. }),
  3271. $globals.Object);
  3272. $core.addMethod(
  3273. $core.method({
  3274. selector: "deprecatedAPI",
  3275. protocol: "error handling",
  3276. fn: function (){
  3277. var self=this,$self=this;
  3278. return $core.withContext(function($ctx1) {
  3279. var $1,$6,$5,$4,$8,$7,$3,$2;
  3280. $1=console;
  3281. $6=$core.getThisContext()._home();
  3282. $ctx1.sendIdx["home"]=1;
  3283. $5=$recv($6)._asString();
  3284. $ctx1.sendIdx["asString"]=1;
  3285. $4=$recv($5).__comma(" is deprecated! (in ");
  3286. $8=$recv($core.getThisContext()._home())._home();
  3287. $ctx1.sendIdx["home"]=2;
  3288. $7=$recv($8)._asString();
  3289. $3=$recv($4).__comma($7);
  3290. $ctx1.sendIdx[","]=2;
  3291. $2=$recv($3).__comma(")");
  3292. $ctx1.sendIdx[","]=1;
  3293. $recv($1)._warn_($2);
  3294. return self;
  3295. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  3296. },
  3297. args: [],
  3298. 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, ')'.",
  3299. referencedClasses: [],
  3300. messageSends: ["warn:", ",", "asString", "home"]
  3301. }),
  3302. $globals.Object);
  3303. $core.addMethod(
  3304. $core.method({
  3305. selector: "deprecatedAPI:",
  3306. protocol: "error handling",
  3307. fn: function (aString){
  3308. var self=this,$self=this;
  3309. return $core.withContext(function($ctx1) {
  3310. var $1,$6,$5,$4,$8,$7,$3,$2;
  3311. $1=console;
  3312. $6=$core.getThisContext()._home();
  3313. $ctx1.sendIdx["home"]=1;
  3314. $5=$recv($6)._asString();
  3315. $ctx1.sendIdx["asString"]=1;
  3316. $4=$recv($5).__comma(" is deprecated! (in ");
  3317. $8=$recv($core.getThisContext()._home())._home();
  3318. $ctx1.sendIdx["home"]=2;
  3319. $7=$recv($8)._asString();
  3320. $3=$recv($4).__comma($7);
  3321. $ctx1.sendIdx[","]=2;
  3322. $2=$recv($3).__comma(")");
  3323. $ctx1.sendIdx[","]=1;
  3324. $recv($1)._warn_($2);
  3325. $ctx1.sendIdx["warn:"]=1;
  3326. $recv(console)._warn_(aString);
  3327. return self;
  3328. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  3329. },
  3330. args: ["aString"],
  3331. 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",
  3332. referencedClasses: [],
  3333. messageSends: ["warn:", ",", "asString", "home"]
  3334. }),
  3335. $globals.Object);
  3336. $core.addMethod(
  3337. $core.method({
  3338. selector: "error:",
  3339. protocol: "error handling",
  3340. fn: function (aString){
  3341. var self=this,$self=this;
  3342. return $core.withContext(function($ctx1) {
  3343. $recv($globals.Error)._signal_(aString);
  3344. return self;
  3345. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  3346. },
  3347. args: ["aString"],
  3348. source: "error: aString\x0a\x09Error signal: aString",
  3349. referencedClasses: ["Error"],
  3350. messageSends: ["signal:"]
  3351. }),
  3352. $globals.Object);
  3353. $core.addMethod(
  3354. $core.method({
  3355. selector: "halt",
  3356. protocol: "error handling",
  3357. fn: function (){
  3358. var self=this,$self=this;
  3359. return $core.withContext(function($ctx1) {
  3360. $recv($globals.Halt)._signal();
  3361. return self;
  3362. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  3363. },
  3364. args: [],
  3365. source: "halt\x0a\x09Halt signal",
  3366. referencedClasses: ["Halt"],
  3367. messageSends: ["signal"]
  3368. }),
  3369. $globals.Object);
  3370. $core.addMethod(
  3371. $core.method({
  3372. selector: "in:",
  3373. protocol: "evaluating",
  3374. fn: function (aValuable){
  3375. var self=this,$self=this;
  3376. return $core.withContext(function($ctx1) {
  3377. return $recv(aValuable)._value_(self);
  3378. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  3379. },
  3380. args: ["aValuable"],
  3381. source: "in: aValuable\x0a\x09^ aValuable value: self",
  3382. referencedClasses: [],
  3383. messageSends: ["value:"]
  3384. }),
  3385. $globals.Object);
  3386. $core.addMethod(
  3387. $core.method({
  3388. selector: "isBehavior",
  3389. protocol: "testing",
  3390. fn: function (){
  3391. var self=this,$self=this;
  3392. return false;
  3393. },
  3394. args: [],
  3395. source: "isBehavior\x0a\x09^ false",
  3396. referencedClasses: [],
  3397. messageSends: []
  3398. }),
  3399. $globals.Object);
  3400. $core.addMethod(
  3401. $core.method({
  3402. selector: "isBoolean",
  3403. protocol: "testing",
  3404. fn: function (){
  3405. var self=this,$self=this;
  3406. return false;
  3407. },
  3408. args: [],
  3409. source: "isBoolean\x0a\x09^ false",
  3410. referencedClasses: [],
  3411. messageSends: []
  3412. }),
  3413. $globals.Object);
  3414. $core.addMethod(
  3415. $core.method({
  3416. selector: "isClass",
  3417. protocol: "testing",
  3418. fn: function (){
  3419. var self=this,$self=this;
  3420. return false;
  3421. },
  3422. args: [],
  3423. source: "isClass\x0a\x09^ false",
  3424. referencedClasses: [],
  3425. messageSends: []
  3426. }),
  3427. $globals.Object);
  3428. $core.addMethod(
  3429. $core.method({
  3430. selector: "isCompiledMethod",
  3431. protocol: "testing",
  3432. fn: function (){
  3433. var self=this,$self=this;
  3434. return false;
  3435. },
  3436. args: [],
  3437. source: "isCompiledMethod\x0a\x09^ false",
  3438. referencedClasses: [],
  3439. messageSends: []
  3440. }),
  3441. $globals.Object);
  3442. $core.addMethod(
  3443. $core.method({
  3444. selector: "isImmutable",
  3445. protocol: "testing",
  3446. fn: function (){
  3447. var self=this,$self=this;
  3448. return false;
  3449. },
  3450. args: [],
  3451. source: "isImmutable\x0a\x09^ false",
  3452. referencedClasses: [],
  3453. messageSends: []
  3454. }),
  3455. $globals.Object);
  3456. $core.addMethod(
  3457. $core.method({
  3458. selector: "isMemberOf:",
  3459. protocol: "testing",
  3460. fn: function (aClass){
  3461. var self=this,$self=this;
  3462. return $core.withContext(function($ctx1) {
  3463. return $recv($self._class()).__eq(aClass);
  3464. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  3465. },
  3466. args: ["aClass"],
  3467. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  3468. referencedClasses: [],
  3469. messageSends: ["=", "class"]
  3470. }),
  3471. $globals.Object);
  3472. $core.addMethod(
  3473. $core.method({
  3474. selector: "isMetaclass",
  3475. protocol: "testing",
  3476. fn: function (){
  3477. var self=this,$self=this;
  3478. return false;
  3479. },
  3480. args: [],
  3481. source: "isMetaclass\x0a\x09^ false",
  3482. referencedClasses: [],
  3483. messageSends: []
  3484. }),
  3485. $globals.Object);
  3486. $core.addMethod(
  3487. $core.method({
  3488. selector: "isNumber",
  3489. protocol: "testing",
  3490. fn: function (){
  3491. var self=this,$self=this;
  3492. return false;
  3493. },
  3494. args: [],
  3495. source: "isNumber\x0a\x09^ false",
  3496. referencedClasses: [],
  3497. messageSends: []
  3498. }),
  3499. $globals.Object);
  3500. $core.addMethod(
  3501. $core.method({
  3502. selector: "isPackage",
  3503. protocol: "testing",
  3504. fn: function (){
  3505. var self=this,$self=this;
  3506. return false;
  3507. },
  3508. args: [],
  3509. source: "isPackage\x0a\x09^ false",
  3510. referencedClasses: [],
  3511. messageSends: []
  3512. }),
  3513. $globals.Object);
  3514. $core.addMethod(
  3515. $core.method({
  3516. selector: "isParseFailure",
  3517. protocol: "testing",
  3518. fn: function (){
  3519. var self=this,$self=this;
  3520. return false;
  3521. },
  3522. args: [],
  3523. source: "isParseFailure\x0a\x09^ false",
  3524. referencedClasses: [],
  3525. messageSends: []
  3526. }),
  3527. $globals.Object);
  3528. $core.addMethod(
  3529. $core.method({
  3530. selector: "isString",
  3531. protocol: "testing",
  3532. fn: function (){
  3533. var self=this,$self=this;
  3534. return false;
  3535. },
  3536. args: [],
  3537. source: "isString\x0a\x09^ false",
  3538. referencedClasses: [],
  3539. messageSends: []
  3540. }),
  3541. $globals.Object);
  3542. $core.addMethod(
  3543. $core.method({
  3544. selector: "isSymbol",
  3545. protocol: "testing",
  3546. fn: function (){
  3547. var self=this,$self=this;
  3548. return false;
  3549. },
  3550. args: [],
  3551. source: "isSymbol\x0a\x09^ false",
  3552. referencedClasses: [],
  3553. messageSends: []
  3554. }),
  3555. $globals.Object);
  3556. $core.addMethod(
  3557. $core.method({
  3558. selector: "postCopy",
  3559. protocol: "copying",
  3560. fn: function (){
  3561. var self=this,$self=this;
  3562. return self;
  3563. },
  3564. args: [],
  3565. source: "postCopy",
  3566. referencedClasses: [],
  3567. messageSends: []
  3568. }),
  3569. $globals.Object);
  3570. $core.addMethod(
  3571. $core.method({
  3572. selector: "putOn:",
  3573. protocol: "streaming",
  3574. fn: function (aStream){
  3575. var self=this,$self=this;
  3576. return $core.withContext(function($ctx1) {
  3577. $recv(aStream)._nextPut_(self);
  3578. return self;
  3579. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  3580. },
  3581. args: ["aStream"],
  3582. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3583. referencedClasses: [],
  3584. messageSends: ["nextPut:"]
  3585. }),
  3586. $globals.Object);
  3587. $core.addMethod(
  3588. $core.method({
  3589. selector: "respondsTo:",
  3590. protocol: "testing",
  3591. fn: function (aSelector){
  3592. var self=this,$self=this;
  3593. return $core.withContext(function($ctx1) {
  3594. return $recv($self._class())._canUnderstand_(aSelector);
  3595. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  3596. },
  3597. args: ["aSelector"],
  3598. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3599. referencedClasses: [],
  3600. messageSends: ["canUnderstand:", "class"]
  3601. }),
  3602. $globals.Object);
  3603. $core.addMethod(
  3604. $core.method({
  3605. selector: "shallowCopy",
  3606. protocol: "copying",
  3607. fn: function (){
  3608. var self=this,$self=this;
  3609. return $core.withContext(function($ctx1) {
  3610. var copy = self.a$cls._new();
  3611. Object.keys(self).forEach(function(i) {
  3612. if(/^@.+/.test(i)) {
  3613. copy[i] = self[i];
  3614. }
  3615. });
  3616. return copy;
  3617. ;
  3618. return self;
  3619. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  3620. },
  3621. args: [],
  3622. 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'>",
  3623. referencedClasses: [],
  3624. messageSends: []
  3625. }),
  3626. $globals.Object);
  3627. $core.addMethod(
  3628. $core.method({
  3629. selector: "shouldNotImplement",
  3630. protocol: "error handling",
  3631. fn: function (){
  3632. var self=this,$self=this;
  3633. return $core.withContext(function($ctx1) {
  3634. $self._error_("This method should not be implemented in ".__comma($recv($self._class())._name()));
  3635. return self;
  3636. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  3637. },
  3638. args: [],
  3639. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3640. referencedClasses: [],
  3641. messageSends: ["error:", ",", "name", "class"]
  3642. }),
  3643. $globals.Object);
  3644. $core.addMethod(
  3645. $core.method({
  3646. selector: "size",
  3647. protocol: "accessing",
  3648. fn: function (){
  3649. var self=this,$self=this;
  3650. return $core.withContext(function($ctx1) {
  3651. $self._error_("Object not indexable");
  3652. return self;
  3653. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  3654. },
  3655. args: [],
  3656. source: "size\x0a\x09self error: 'Object not indexable'",
  3657. referencedClasses: [],
  3658. messageSends: ["error:"]
  3659. }),
  3660. $globals.Object);
  3661. $core.addMethod(
  3662. $core.method({
  3663. selector: "subclassResponsibility",
  3664. protocol: "error handling",
  3665. fn: function (){
  3666. var self=this,$self=this;
  3667. return $core.withContext(function($ctx1) {
  3668. $self._error_("This method is a responsibility of a subclass");
  3669. return self;
  3670. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  3671. },
  3672. args: [],
  3673. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3674. referencedClasses: [],
  3675. messageSends: ["error:"]
  3676. }),
  3677. $globals.Object);
  3678. $core.addMethod(
  3679. $core.method({
  3680. selector: "value",
  3681. protocol: "evaluating",
  3682. fn: function (){
  3683. var self=this,$self=this;
  3684. return $core.withContext(function($ctx1) {
  3685. return self.valueOf();
  3686. return self;
  3687. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  3688. },
  3689. args: [],
  3690. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3691. referencedClasses: [],
  3692. messageSends: []
  3693. }),
  3694. $globals.Object);
  3695. $core.addMethod(
  3696. $core.method({
  3697. selector: "accessorProtocolWith:",
  3698. protocol: "helios",
  3699. fn: function (aGenerator){
  3700. var self=this,$self=this;
  3701. return $core.withContext(function($ctx1) {
  3702. $recv(aGenerator)._accessorProtocolForObject();
  3703. return self;
  3704. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3705. },
  3706. args: ["aGenerator"],
  3707. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3708. referencedClasses: [],
  3709. messageSends: ["accessorProtocolForObject"]
  3710. }),
  3711. $globals.Object.a$cls);
  3712. $core.addMethod(
  3713. $core.method({
  3714. selector: "accessorsSourceCodesWith:",
  3715. protocol: "helios",
  3716. fn: function (aGenerator){
  3717. var self=this,$self=this;
  3718. return $core.withContext(function($ctx1) {
  3719. $recv(aGenerator)._accessorsForObject();
  3720. return self;
  3721. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3722. },
  3723. args: ["aGenerator"],
  3724. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3725. referencedClasses: [],
  3726. messageSends: ["accessorsForObject"]
  3727. }),
  3728. $globals.Object.a$cls);
  3729. $core.addMethod(
  3730. $core.method({
  3731. selector: "initialize",
  3732. protocol: "initialization",
  3733. fn: function (){
  3734. var self=this,$self=this;
  3735. return self;
  3736. },
  3737. args: [],
  3738. source: "initialize\x0a\x09\x22no op\x22",
  3739. referencedClasses: [],
  3740. messageSends: []
  3741. }),
  3742. $globals.Object.a$cls);
  3743. $core.addMethod(
  3744. $core.method({
  3745. selector: "initializeProtocolWith:",
  3746. protocol: "helios",
  3747. fn: function (aGenerator){
  3748. var self=this,$self=this;
  3749. return $core.withContext(function($ctx1) {
  3750. $recv(aGenerator)._initializeProtocolForObject();
  3751. return self;
  3752. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3753. },
  3754. args: ["aGenerator"],
  3755. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3756. referencedClasses: [],
  3757. messageSends: ["initializeProtocolForObject"]
  3758. }),
  3759. $globals.Object.a$cls);
  3760. $core.addMethod(
  3761. $core.method({
  3762. selector: "initializeSourceCodesWith:",
  3763. protocol: "helios",
  3764. fn: function (aGenerator){
  3765. var self=this,$self=this;
  3766. return $core.withContext(function($ctx1) {
  3767. $recv(aGenerator)._initializeForObject();
  3768. return self;
  3769. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3770. },
  3771. args: ["aGenerator"],
  3772. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3773. referencedClasses: [],
  3774. messageSends: ["initializeForObject"]
  3775. }),
  3776. $globals.Object.a$cls);
  3777. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3778. $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: [ ... ]";
  3779. $core.addMethod(
  3780. $core.method({
  3781. selector: "&",
  3782. protocol: "controlling",
  3783. fn: function (aBoolean){
  3784. var self=this,$self=this;
  3785. return $core.withContext(function($ctx1) {
  3786. if(self == true) {
  3787. return aBoolean;
  3788. } else {
  3789. return false;
  3790. }
  3791. ;
  3792. return self;
  3793. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  3794. },
  3795. args: ["aBoolean"],
  3796. 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'>",
  3797. referencedClasses: [],
  3798. messageSends: []
  3799. }),
  3800. $globals.Boolean);
  3801. $core.addMethod(
  3802. $core.method({
  3803. selector: "==",
  3804. protocol: "comparing",
  3805. fn: function (aBoolean){
  3806. var self=this,$self=this;
  3807. return $core.withContext(function($ctx1) {
  3808. if (typeof aBoolean === "boolean") return (self == true) === aBoolean;
  3809. else if (aBoolean != null && typeof aBoolean === "object") return (self == true) === aBoolean.valueOf();
  3810. else return false;;
  3811. return self;
  3812. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  3813. },
  3814. args: ["aBoolean"],
  3815. 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'>",
  3816. referencedClasses: [],
  3817. messageSends: []
  3818. }),
  3819. $globals.Boolean);
  3820. $core.addMethod(
  3821. $core.method({
  3822. selector: "and:",
  3823. protocol: "controlling",
  3824. fn: function (aBlock){
  3825. var self=this,$self=this;
  3826. return $core.withContext(function($ctx1) {
  3827. if($core.assert(self)){
  3828. return $recv(aBlock)._value();
  3829. } else {
  3830. return false;
  3831. }
  3832. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  3833. },
  3834. args: ["aBlock"],
  3835. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  3836. referencedClasses: [],
  3837. messageSends: ["ifTrue:ifFalse:", "value"]
  3838. }),
  3839. $globals.Boolean);
  3840. $core.addMethod(
  3841. $core.method({
  3842. selector: "asBit",
  3843. protocol: "converting",
  3844. fn: function (){
  3845. var self=this,$self=this;
  3846. return $core.withContext(function($ctx1) {
  3847. if($core.assert(self)){
  3848. return (1);
  3849. } else {
  3850. return (0);
  3851. }
  3852. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  3853. },
  3854. args: [],
  3855. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3856. referencedClasses: [],
  3857. messageSends: ["ifTrue:ifFalse:"]
  3858. }),
  3859. $globals.Boolean);
  3860. $core.addMethod(
  3861. $core.method({
  3862. selector: "asJavaScriptObject",
  3863. protocol: "converting",
  3864. fn: function (){
  3865. var self=this,$self=this;
  3866. return self;
  3867. },
  3868. args: [],
  3869. source: "asJavaScriptObject\x0a\x09^ self",
  3870. referencedClasses: [],
  3871. messageSends: []
  3872. }),
  3873. $globals.Boolean);
  3874. $core.addMethod(
  3875. $core.method({
  3876. selector: "asString",
  3877. protocol: "converting",
  3878. fn: function (){
  3879. var self=this,$self=this;
  3880. return $core.withContext(function($ctx1) {
  3881. return self.toString();
  3882. return self;
  3883. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3884. },
  3885. args: [],
  3886. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3887. referencedClasses: [],
  3888. messageSends: []
  3889. }),
  3890. $globals.Boolean);
  3891. $core.addMethod(
  3892. $core.method({
  3893. selector: "deepCopy",
  3894. protocol: "copying",
  3895. fn: function (){
  3896. var self=this,$self=this;
  3897. return self;
  3898. },
  3899. args: [],
  3900. source: "deepCopy\x0a\x09^ self",
  3901. referencedClasses: [],
  3902. messageSends: []
  3903. }),
  3904. $globals.Boolean);
  3905. $core.addMethod(
  3906. $core.method({
  3907. selector: "ifFalse:",
  3908. protocol: "controlling",
  3909. fn: function (aBlock){
  3910. var self=this,$self=this;
  3911. return $core.withContext(function($ctx1) {
  3912. return $self._ifTrue_ifFalse_((function(){
  3913. }),aBlock);
  3914. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3915. },
  3916. args: ["aBlock"],
  3917. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3918. referencedClasses: [],
  3919. messageSends: ["ifTrue:ifFalse:"]
  3920. }),
  3921. $globals.Boolean);
  3922. $core.addMethod(
  3923. $core.method({
  3924. selector: "ifFalse:ifTrue:",
  3925. protocol: "controlling",
  3926. fn: function (aBlock,anotherBlock){
  3927. var self=this,$self=this;
  3928. return $core.withContext(function($ctx1) {
  3929. return $self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3930. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3931. },
  3932. args: ["aBlock", "anotherBlock"],
  3933. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3934. referencedClasses: [],
  3935. messageSends: ["ifTrue:ifFalse:"]
  3936. }),
  3937. $globals.Boolean);
  3938. $core.addMethod(
  3939. $core.method({
  3940. selector: "ifTrue:",
  3941. protocol: "controlling",
  3942. fn: function (aBlock){
  3943. var self=this,$self=this;
  3944. return $core.withContext(function($ctx1) {
  3945. return $self._ifTrue_ifFalse_(aBlock,(function(){
  3946. }));
  3947. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3948. },
  3949. args: ["aBlock"],
  3950. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3951. referencedClasses: [],
  3952. messageSends: ["ifTrue:ifFalse:"]
  3953. }),
  3954. $globals.Boolean);
  3955. $core.addMethod(
  3956. $core.method({
  3957. selector: "ifTrue:ifFalse:",
  3958. protocol: "controlling",
  3959. fn: function (aBlock,anotherBlock){
  3960. var self=this,$self=this;
  3961. return $core.withContext(function($ctx1) {
  3962. if(self == true) {
  3963. return aBlock._value();
  3964. } else {
  3965. return anotherBlock._value();
  3966. }
  3967. ;
  3968. return self;
  3969. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3970. },
  3971. args: ["aBlock", "anotherBlock"],
  3972. 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'>",
  3973. referencedClasses: [],
  3974. messageSends: []
  3975. }),
  3976. $globals.Boolean);
  3977. $core.addMethod(
  3978. $core.method({
  3979. selector: "isBoolean",
  3980. protocol: "testing",
  3981. fn: function (){
  3982. var self=this,$self=this;
  3983. return true;
  3984. },
  3985. args: [],
  3986. source: "isBoolean\x0a\x09^ true",
  3987. referencedClasses: [],
  3988. messageSends: []
  3989. }),
  3990. $globals.Boolean);
  3991. $core.addMethod(
  3992. $core.method({
  3993. selector: "isImmutable",
  3994. protocol: "testing",
  3995. fn: function (){
  3996. var self=this,$self=this;
  3997. return true;
  3998. },
  3999. args: [],
  4000. source: "isImmutable\x0a\x09^ true",
  4001. referencedClasses: [],
  4002. messageSends: []
  4003. }),
  4004. $globals.Boolean);
  4005. $core.addMethod(
  4006. $core.method({
  4007. selector: "not",
  4008. protocol: "controlling",
  4009. fn: function (){
  4010. var self=this,$self=this;
  4011. return $core.withContext(function($ctx1) {
  4012. return $self.__eq(false);
  4013. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  4014. },
  4015. args: [],
  4016. source: "not\x0a\x09^ self = false",
  4017. referencedClasses: [],
  4018. messageSends: ["="]
  4019. }),
  4020. $globals.Boolean);
  4021. $core.addMethod(
  4022. $core.method({
  4023. selector: "or:",
  4024. protocol: "controlling",
  4025. fn: function (aBlock){
  4026. var self=this,$self=this;
  4027. return $core.withContext(function($ctx1) {
  4028. if($core.assert(self)){
  4029. return true;
  4030. } else {
  4031. return $recv(aBlock)._value();
  4032. }
  4033. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  4034. },
  4035. args: ["aBlock"],
  4036. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  4037. referencedClasses: [],
  4038. messageSends: ["ifTrue:ifFalse:", "value"]
  4039. }),
  4040. $globals.Boolean);
  4041. $core.addMethod(
  4042. $core.method({
  4043. selector: "printOn:",
  4044. protocol: "printing",
  4045. fn: function (aStream){
  4046. var self=this,$self=this;
  4047. return $core.withContext(function($ctx1) {
  4048. $recv(aStream)._nextPutAll_($self._asString());
  4049. return self;
  4050. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  4051. },
  4052. args: ["aStream"],
  4053. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4054. referencedClasses: [],
  4055. messageSends: ["nextPutAll:", "asString"]
  4056. }),
  4057. $globals.Boolean);
  4058. $core.addMethod(
  4059. $core.method({
  4060. selector: "shallowCopy",
  4061. protocol: "copying",
  4062. fn: function (){
  4063. var self=this,$self=this;
  4064. return self;
  4065. },
  4066. args: [],
  4067. source: "shallowCopy\x0a\x09^ self",
  4068. referencedClasses: [],
  4069. messageSends: []
  4070. }),
  4071. $globals.Boolean);
  4072. $core.addMethod(
  4073. $core.method({
  4074. selector: "|",
  4075. protocol: "controlling",
  4076. fn: function (aBoolean){
  4077. var self=this,$self=this;
  4078. return $core.withContext(function($ctx1) {
  4079. if(self == true) {
  4080. return true;
  4081. } else {
  4082. return aBoolean;
  4083. }
  4084. ;
  4085. return self;
  4086. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  4087. },
  4088. args: ["aBoolean"],
  4089. 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'>",
  4090. referencedClasses: [],
  4091. messageSends: []
  4092. }),
  4093. $globals.Boolean);
  4094. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  4095. $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.).";
  4096. $core.addMethod(
  4097. $core.method({
  4098. selector: "+",
  4099. protocol: "arithmetic",
  4100. fn: function (aDate){
  4101. var self=this,$self=this;
  4102. return $core.withContext(function($ctx1) {
  4103. return self + aDate;
  4104. return self;
  4105. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  4106. },
  4107. args: ["aDate"],
  4108. source: "+ aDate\x0a\x09<inlineJS: 'return self + aDate'>",
  4109. referencedClasses: [],
  4110. messageSends: []
  4111. }),
  4112. $globals.Date);
  4113. $core.addMethod(
  4114. $core.method({
  4115. selector: "-",
  4116. protocol: "arithmetic",
  4117. fn: function (aDate){
  4118. var self=this,$self=this;
  4119. return $core.withContext(function($ctx1) {
  4120. return self - aDate;
  4121. return self;
  4122. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  4123. },
  4124. args: ["aDate"],
  4125. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  4126. referencedClasses: [],
  4127. messageSends: []
  4128. }),
  4129. $globals.Date);
  4130. $core.addMethod(
  4131. $core.method({
  4132. selector: "<",
  4133. protocol: "comparing",
  4134. fn: function (aDate){
  4135. var self=this,$self=this;
  4136. return $core.withContext(function($ctx1) {
  4137. return self < aDate;
  4138. return self;
  4139. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  4140. },
  4141. args: ["aDate"],
  4142. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  4143. referencedClasses: [],
  4144. messageSends: []
  4145. }),
  4146. $globals.Date);
  4147. $core.addMethod(
  4148. $core.method({
  4149. selector: "<=",
  4150. protocol: "comparing",
  4151. fn: function (aDate){
  4152. var self=this,$self=this;
  4153. return $core.withContext(function($ctx1) {
  4154. return self <= aDate;
  4155. return self;
  4156. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  4157. },
  4158. args: ["aDate"],
  4159. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  4160. referencedClasses: [],
  4161. messageSends: []
  4162. }),
  4163. $globals.Date);
  4164. $core.addMethod(
  4165. $core.method({
  4166. selector: "=",
  4167. protocol: "comparing",
  4168. fn: function (aDate){
  4169. var self=this,$self=this;
  4170. return $core.withContext(function($ctx1) {
  4171. var $2,$1,$3;
  4172. $2=$recv(aDate)._class();
  4173. $ctx1.sendIdx["class"]=1;
  4174. $1=$recv($2).__eq_eq($self._class());
  4175. $ctx1.sendIdx["=="]=1;
  4176. return $recv($1)._and_((function(){
  4177. return $core.withContext(function($ctx2) {
  4178. $3=$self._asMilliseconds();
  4179. $ctx2.sendIdx["asMilliseconds"]=1;
  4180. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  4181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4182. }));
  4183. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  4184. },
  4185. args: ["aDate"],
  4186. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  4187. referencedClasses: [],
  4188. messageSends: ["and:", "==", "class", "asMilliseconds"]
  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. return self >= aDate;
  4216. return self;
  4217. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  4218. },
  4219. args: ["aDate"],
  4220. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  4221. referencedClasses: [],
  4222. messageSends: []
  4223. }),
  4224. $globals.Date);
  4225. $core.addMethod(
  4226. $core.method({
  4227. selector: "asDateString",
  4228. protocol: "converting",
  4229. fn: function (){
  4230. var self=this,$self=this;
  4231. return $core.withContext(function($ctx1) {
  4232. return self.toDateString();
  4233. return self;
  4234. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  4235. },
  4236. args: [],
  4237. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  4238. referencedClasses: [],
  4239. messageSends: []
  4240. }),
  4241. $globals.Date);
  4242. $core.addMethod(
  4243. $core.method({
  4244. selector: "asLocaleString",
  4245. protocol: "converting",
  4246. fn: function (){
  4247. var self=this,$self=this;
  4248. return $core.withContext(function($ctx1) {
  4249. return self.toLocaleString();
  4250. return self;
  4251. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  4252. },
  4253. args: [],
  4254. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  4255. referencedClasses: [],
  4256. messageSends: []
  4257. }),
  4258. $globals.Date);
  4259. $core.addMethod(
  4260. $core.method({
  4261. selector: "asMilliseconds",
  4262. protocol: "converting",
  4263. fn: function (){
  4264. var self=this,$self=this;
  4265. return $core.withContext(function($ctx1) {
  4266. return $self._time();
  4267. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  4268. },
  4269. args: [],
  4270. source: "asMilliseconds\x0a\x09^ self time",
  4271. referencedClasses: [],
  4272. messageSends: ["time"]
  4273. }),
  4274. $globals.Date);
  4275. $core.addMethod(
  4276. $core.method({
  4277. selector: "asNumber",
  4278. protocol: "converting",
  4279. fn: function (){
  4280. var self=this,$self=this;
  4281. return $core.withContext(function($ctx1) {
  4282. return $self._asMilliseconds();
  4283. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  4284. },
  4285. args: [],
  4286. source: "asNumber\x0a\x09^ self asMilliseconds",
  4287. referencedClasses: [],
  4288. messageSends: ["asMilliseconds"]
  4289. }),
  4290. $globals.Date);
  4291. $core.addMethod(
  4292. $core.method({
  4293. selector: "asString",
  4294. protocol: "converting",
  4295. fn: function (){
  4296. var self=this,$self=this;
  4297. return $core.withContext(function($ctx1) {
  4298. return self.toString();
  4299. return self;
  4300. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  4301. },
  4302. args: [],
  4303. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4304. referencedClasses: [],
  4305. messageSends: []
  4306. }),
  4307. $globals.Date);
  4308. $core.addMethod(
  4309. $core.method({
  4310. selector: "asTimeString",
  4311. protocol: "converting",
  4312. fn: function (){
  4313. var self=this,$self=this;
  4314. return $core.withContext(function($ctx1) {
  4315. return self.toTimeString();
  4316. return self;
  4317. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  4318. },
  4319. args: [],
  4320. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  4321. referencedClasses: [],
  4322. messageSends: []
  4323. }),
  4324. $globals.Date);
  4325. $core.addMethod(
  4326. $core.method({
  4327. selector: "day",
  4328. protocol: "accessing",
  4329. fn: function (){
  4330. var self=this,$self=this;
  4331. return $core.withContext(function($ctx1) {
  4332. return $self._dayOfWeek();
  4333. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  4334. },
  4335. args: [],
  4336. source: "day\x0a\x09^ self dayOfWeek",
  4337. referencedClasses: [],
  4338. messageSends: ["dayOfWeek"]
  4339. }),
  4340. $globals.Date);
  4341. $core.addMethod(
  4342. $core.method({
  4343. selector: "day:",
  4344. protocol: "accessing",
  4345. fn: function (aNumber){
  4346. var self=this,$self=this;
  4347. return $core.withContext(function($ctx1) {
  4348. $self._dayOfWeek_(aNumber);
  4349. return self;
  4350. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  4351. },
  4352. args: ["aNumber"],
  4353. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  4354. referencedClasses: [],
  4355. messageSends: ["dayOfWeek:"]
  4356. }),
  4357. $globals.Date);
  4358. $core.addMethod(
  4359. $core.method({
  4360. selector: "dayOfMonth",
  4361. protocol: "accessing",
  4362. fn: function (){
  4363. var self=this,$self=this;
  4364. return $core.withContext(function($ctx1) {
  4365. return self.getDate();
  4366. return self;
  4367. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  4368. },
  4369. args: [],
  4370. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  4371. referencedClasses: [],
  4372. messageSends: []
  4373. }),
  4374. $globals.Date);
  4375. $core.addMethod(
  4376. $core.method({
  4377. selector: "dayOfMonth:",
  4378. protocol: "accessing",
  4379. fn: function (aNumber){
  4380. var self=this,$self=this;
  4381. return $core.withContext(function($ctx1) {
  4382. self.setDate(aNumber);
  4383. return self;
  4384. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  4385. },
  4386. args: ["aNumber"],
  4387. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  4388. referencedClasses: [],
  4389. messageSends: []
  4390. }),
  4391. $globals.Date);
  4392. $core.addMethod(
  4393. $core.method({
  4394. selector: "dayOfWeek",
  4395. protocol: "accessing",
  4396. fn: function (){
  4397. var self=this,$self=this;
  4398. return $core.withContext(function($ctx1) {
  4399. return self.getDay() + 1;
  4400. return self;
  4401. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  4402. },
  4403. args: [],
  4404. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  4405. referencedClasses: [],
  4406. messageSends: []
  4407. }),
  4408. $globals.Date);
  4409. $core.addMethod(
  4410. $core.method({
  4411. selector: "dayOfWeek:",
  4412. protocol: "accessing",
  4413. fn: function (aNumber){
  4414. var self=this,$self=this;
  4415. return $core.withContext(function($ctx1) {
  4416. return self.setDay(aNumber - 1);
  4417. return self;
  4418. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  4419. },
  4420. args: ["aNumber"],
  4421. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  4422. referencedClasses: [],
  4423. messageSends: []
  4424. }),
  4425. $globals.Date);
  4426. $core.addMethod(
  4427. $core.method({
  4428. selector: "hours",
  4429. protocol: "accessing",
  4430. fn: function (){
  4431. var self=this,$self=this;
  4432. return $core.withContext(function($ctx1) {
  4433. return self.getHours();
  4434. return self;
  4435. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  4436. },
  4437. args: [],
  4438. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  4439. referencedClasses: [],
  4440. messageSends: []
  4441. }),
  4442. $globals.Date);
  4443. $core.addMethod(
  4444. $core.method({
  4445. selector: "hours:",
  4446. protocol: "accessing",
  4447. fn: function (aNumber){
  4448. var self=this,$self=this;
  4449. return $core.withContext(function($ctx1) {
  4450. self.setHours(aNumber);
  4451. return self;
  4452. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  4453. },
  4454. args: ["aNumber"],
  4455. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  4456. referencedClasses: [],
  4457. messageSends: []
  4458. }),
  4459. $globals.Date);
  4460. $core.addMethod(
  4461. $core.method({
  4462. selector: "milliseconds",
  4463. protocol: "accessing",
  4464. fn: function (){
  4465. var self=this,$self=this;
  4466. return $core.withContext(function($ctx1) {
  4467. return self.getMilliseconds();
  4468. return self;
  4469. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  4470. },
  4471. args: [],
  4472. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  4473. referencedClasses: [],
  4474. messageSends: []
  4475. }),
  4476. $globals.Date);
  4477. $core.addMethod(
  4478. $core.method({
  4479. selector: "milliseconds:",
  4480. protocol: "accessing",
  4481. fn: function (aNumber){
  4482. var self=this,$self=this;
  4483. return $core.withContext(function($ctx1) {
  4484. self.setMilliseconds(aNumber);
  4485. return self;
  4486. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  4487. },
  4488. args: ["aNumber"],
  4489. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  4490. referencedClasses: [],
  4491. messageSends: []
  4492. }),
  4493. $globals.Date);
  4494. $core.addMethod(
  4495. $core.method({
  4496. selector: "minutes",
  4497. protocol: "accessing",
  4498. fn: function (){
  4499. var self=this,$self=this;
  4500. return $core.withContext(function($ctx1) {
  4501. return self.getMinutes();
  4502. return self;
  4503. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  4504. },
  4505. args: [],
  4506. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  4507. referencedClasses: [],
  4508. messageSends: []
  4509. }),
  4510. $globals.Date);
  4511. $core.addMethod(
  4512. $core.method({
  4513. selector: "minutes:",
  4514. protocol: "accessing",
  4515. fn: function (aNumber){
  4516. var self=this,$self=this;
  4517. return $core.withContext(function($ctx1) {
  4518. self.setMinutes(aNumber);
  4519. return self;
  4520. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  4521. },
  4522. args: ["aNumber"],
  4523. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  4524. referencedClasses: [],
  4525. messageSends: []
  4526. }),
  4527. $globals.Date);
  4528. $core.addMethod(
  4529. $core.method({
  4530. selector: "month",
  4531. protocol: "accessing",
  4532. fn: function (){
  4533. var self=this,$self=this;
  4534. return $core.withContext(function($ctx1) {
  4535. return self.getMonth() + 1;
  4536. return self;
  4537. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  4538. },
  4539. args: [],
  4540. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4541. referencedClasses: [],
  4542. messageSends: []
  4543. }),
  4544. $globals.Date);
  4545. $core.addMethod(
  4546. $core.method({
  4547. selector: "month:",
  4548. protocol: "accessing",
  4549. fn: function (aNumber){
  4550. var self=this,$self=this;
  4551. return $core.withContext(function($ctx1) {
  4552. self.setMonth(aNumber - 1);
  4553. return self;
  4554. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  4555. },
  4556. args: ["aNumber"],
  4557. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4558. referencedClasses: [],
  4559. messageSends: []
  4560. }),
  4561. $globals.Date);
  4562. $core.addMethod(
  4563. $core.method({
  4564. selector: "printOn:",
  4565. protocol: "printing",
  4566. fn: function (aStream){
  4567. var self=this,$self=this;
  4568. return $core.withContext(function($ctx1) {
  4569. $recv(aStream)._nextPutAll_($self._asString());
  4570. return self;
  4571. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  4572. },
  4573. args: ["aStream"],
  4574. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4575. referencedClasses: [],
  4576. messageSends: ["nextPutAll:", "asString"]
  4577. }),
  4578. $globals.Date);
  4579. $core.addMethod(
  4580. $core.method({
  4581. selector: "seconds",
  4582. protocol: "accessing",
  4583. fn: function (){
  4584. var self=this,$self=this;
  4585. return $core.withContext(function($ctx1) {
  4586. return self.getSeconds();
  4587. return self;
  4588. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  4589. },
  4590. args: [],
  4591. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4592. referencedClasses: [],
  4593. messageSends: []
  4594. }),
  4595. $globals.Date);
  4596. $core.addMethod(
  4597. $core.method({
  4598. selector: "seconds:",
  4599. protocol: "accessing",
  4600. fn: function (aNumber){
  4601. var self=this,$self=this;
  4602. return $core.withContext(function($ctx1) {
  4603. self.setSeconds(aNumber);
  4604. return self;
  4605. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  4606. },
  4607. args: ["aNumber"],
  4608. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4609. referencedClasses: [],
  4610. messageSends: []
  4611. }),
  4612. $globals.Date);
  4613. $core.addMethod(
  4614. $core.method({
  4615. selector: "time",
  4616. protocol: "accessing",
  4617. fn: function (){
  4618. var self=this,$self=this;
  4619. return $core.withContext(function($ctx1) {
  4620. return self.getTime();
  4621. return self;
  4622. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  4623. },
  4624. args: [],
  4625. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4626. referencedClasses: [],
  4627. messageSends: []
  4628. }),
  4629. $globals.Date);
  4630. $core.addMethod(
  4631. $core.method({
  4632. selector: "time:",
  4633. protocol: "accessing",
  4634. fn: function (aNumber){
  4635. var self=this,$self=this;
  4636. return $core.withContext(function($ctx1) {
  4637. self.setTime(aNumber);
  4638. return self;
  4639. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  4640. },
  4641. args: ["aNumber"],
  4642. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4643. referencedClasses: [],
  4644. messageSends: []
  4645. }),
  4646. $globals.Date);
  4647. $core.addMethod(
  4648. $core.method({
  4649. selector: "year",
  4650. protocol: "accessing",
  4651. fn: function (){
  4652. var self=this,$self=this;
  4653. return $core.withContext(function($ctx1) {
  4654. return self.getFullYear();
  4655. return self;
  4656. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  4657. },
  4658. args: [],
  4659. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4660. referencedClasses: [],
  4661. messageSends: []
  4662. }),
  4663. $globals.Date);
  4664. $core.addMethod(
  4665. $core.method({
  4666. selector: "year:",
  4667. protocol: "accessing",
  4668. fn: function (aNumber){
  4669. var self=this,$self=this;
  4670. return $core.withContext(function($ctx1) {
  4671. self.setFullYear(aNumber);
  4672. return self;
  4673. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  4674. },
  4675. args: ["aNumber"],
  4676. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4677. referencedClasses: [],
  4678. messageSends: []
  4679. }),
  4680. $globals.Date);
  4681. $core.addMethod(
  4682. $core.method({
  4683. selector: "classTag",
  4684. protocol: "accessing",
  4685. fn: function (){
  4686. var self=this,$self=this;
  4687. return "magnitude";
  4688. },
  4689. args: [],
  4690. 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'",
  4691. referencedClasses: [],
  4692. messageSends: []
  4693. }),
  4694. $globals.Date.a$cls);
  4695. $core.addMethod(
  4696. $core.method({
  4697. selector: "fromMilliseconds:",
  4698. protocol: "instance creation",
  4699. fn: function (aNumber){
  4700. var self=this,$self=this;
  4701. return $core.withContext(function($ctx1) {
  4702. return $self._new_(aNumber);
  4703. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4704. },
  4705. args: ["aNumber"],
  4706. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4707. referencedClasses: [],
  4708. messageSends: ["new:"]
  4709. }),
  4710. $globals.Date.a$cls);
  4711. $core.addMethod(
  4712. $core.method({
  4713. selector: "fromSeconds:",
  4714. protocol: "instance creation",
  4715. fn: function (aNumber){
  4716. var self=this,$self=this;
  4717. return $core.withContext(function($ctx1) {
  4718. return $self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4719. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4720. },
  4721. args: ["aNumber"],
  4722. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4723. referencedClasses: [],
  4724. messageSends: ["fromMilliseconds:", "*"]
  4725. }),
  4726. $globals.Date.a$cls);
  4727. $core.addMethod(
  4728. $core.method({
  4729. selector: "fromString:",
  4730. protocol: "instance creation",
  4731. fn: function (aString){
  4732. var self=this,$self=this;
  4733. return $core.withContext(function($ctx1) {
  4734. return $self._new_(aString);
  4735. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.a$cls)});
  4736. },
  4737. args: ["aString"],
  4738. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4739. referencedClasses: [],
  4740. messageSends: ["new:"]
  4741. }),
  4742. $globals.Date.a$cls);
  4743. $core.addMethod(
  4744. $core.method({
  4745. selector: "millisecondsToRun:",
  4746. protocol: "instance creation",
  4747. fn: function (aBlock){
  4748. var self=this,$self=this;
  4749. var t;
  4750. return $core.withContext(function($ctx1) {
  4751. t=$recv($globals.Date)._now();
  4752. $ctx1.sendIdx["now"]=1;
  4753. $recv(aBlock)._value();
  4754. return $recv($recv($globals.Date)._now()).__minus(t);
  4755. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.a$cls)});
  4756. },
  4757. args: ["aBlock"],
  4758. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4759. referencedClasses: ["Date"],
  4760. messageSends: ["now", "value", "-"]
  4761. }),
  4762. $globals.Date.a$cls);
  4763. $core.addMethod(
  4764. $core.method({
  4765. selector: "new:",
  4766. protocol: "instance creation",
  4767. fn: function (anObject){
  4768. var self=this,$self=this;
  4769. return $core.withContext(function($ctx1) {
  4770. return new Date(anObject);
  4771. return self;
  4772. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.a$cls)});
  4773. },
  4774. args: ["anObject"],
  4775. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  4776. referencedClasses: [],
  4777. messageSends: []
  4778. }),
  4779. $globals.Date.a$cls);
  4780. $core.addMethod(
  4781. $core.method({
  4782. selector: "now",
  4783. protocol: "instance creation",
  4784. fn: function (){
  4785. var self=this,$self=this;
  4786. return $core.withContext(function($ctx1) {
  4787. return $self._today();
  4788. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.a$cls)});
  4789. },
  4790. args: [],
  4791. source: "now\x0a\x09^ self today",
  4792. referencedClasses: [],
  4793. messageSends: ["today"]
  4794. }),
  4795. $globals.Date.a$cls);
  4796. $core.addMethod(
  4797. $core.method({
  4798. selector: "today",
  4799. protocol: "instance creation",
  4800. fn: function (){
  4801. var self=this,$self=this;
  4802. return $core.withContext(function($ctx1) {
  4803. return $self._new();
  4804. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.a$cls)});
  4805. },
  4806. args: [],
  4807. source: "today\x0a\x09^ self new",
  4808. referencedClasses: [],
  4809. messageSends: ["new"]
  4810. }),
  4811. $globals.Date.a$cls);
  4812. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  4813. $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 ].";
  4814. $core.addMethod(
  4815. $core.method({
  4816. selector: "&",
  4817. protocol: "converting",
  4818. fn: function (aNumber){
  4819. var self=this,$self=this;
  4820. return $core.withContext(function($ctx1) {
  4821. return self & aNumber;
  4822. return self;
  4823. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  4824. },
  4825. args: ["aNumber"],
  4826. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  4827. referencedClasses: [],
  4828. messageSends: []
  4829. }),
  4830. $globals.Number);
  4831. $core.addMethod(
  4832. $core.method({
  4833. selector: "*",
  4834. protocol: "arithmetic",
  4835. fn: function (aNumber){
  4836. var self=this,$self=this;
  4837. return $core.withContext(function($ctx1) {
  4838. return self * aNumber;
  4839. return self;
  4840. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  4841. },
  4842. args: ["aNumber"],
  4843. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self * aNumber'>",
  4844. referencedClasses: [],
  4845. messageSends: []
  4846. }),
  4847. $globals.Number);
  4848. $core.addMethod(
  4849. $core.method({
  4850. selector: "**",
  4851. protocol: "mathematical functions",
  4852. fn: function (exponent){
  4853. var self=this,$self=this;
  4854. return $core.withContext(function($ctx1) {
  4855. return $self._raisedTo_(exponent);
  4856. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4857. },
  4858. args: ["exponent"],
  4859. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4860. referencedClasses: [],
  4861. messageSends: ["raisedTo:"]
  4862. }),
  4863. $globals.Number);
  4864. $core.addMethod(
  4865. $core.method({
  4866. selector: "+",
  4867. protocol: "arithmetic",
  4868. fn: function (aNumber){
  4869. var self=this,$self=this;
  4870. return $core.withContext(function($ctx1) {
  4871. return self + aNumber;
  4872. return self;
  4873. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4874. },
  4875. args: ["aNumber"],
  4876. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self + aNumber'>",
  4877. referencedClasses: [],
  4878. messageSends: []
  4879. }),
  4880. $globals.Number);
  4881. $core.addMethod(
  4882. $core.method({
  4883. selector: "-",
  4884. protocol: "arithmetic",
  4885. fn: function (aNumber){
  4886. var self=this,$self=this;
  4887. return $core.withContext(function($ctx1) {
  4888. return self - aNumber;
  4889. return self;
  4890. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4891. },
  4892. args: ["aNumber"],
  4893. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self - aNumber'>",
  4894. referencedClasses: [],
  4895. messageSends: []
  4896. }),
  4897. $globals.Number);
  4898. $core.addMethod(
  4899. $core.method({
  4900. selector: "/",
  4901. protocol: "arithmetic",
  4902. fn: function (aNumber){
  4903. var self=this,$self=this;
  4904. return $core.withContext(function($ctx1) {
  4905. return self / aNumber;
  4906. return self;
  4907. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4908. },
  4909. args: ["aNumber"],
  4910. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self / aNumber'>",
  4911. referencedClasses: [],
  4912. messageSends: []
  4913. }),
  4914. $globals.Number);
  4915. $core.addMethod(
  4916. $core.method({
  4917. selector: "//",
  4918. protocol: "arithmetic",
  4919. fn: function (aNumber){
  4920. var self=this,$self=this;
  4921. return $core.withContext(function($ctx1) {
  4922. return $recv($self.__slash(aNumber))._floor();
  4923. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4924. },
  4925. args: ["aNumber"],
  4926. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4927. referencedClasses: [],
  4928. messageSends: ["floor", "/"]
  4929. }),
  4930. $globals.Number);
  4931. $core.addMethod(
  4932. $core.method({
  4933. selector: "<",
  4934. protocol: "comparing",
  4935. fn: function (aNumber){
  4936. var self=this,$self=this;
  4937. return $core.withContext(function($ctx1) {
  4938. return self < aNumber;
  4939. return self;
  4940. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4941. },
  4942. args: ["aNumber"],
  4943. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self < aNumber'>",
  4944. referencedClasses: [],
  4945. messageSends: []
  4946. }),
  4947. $globals.Number);
  4948. $core.addMethod(
  4949. $core.method({
  4950. selector: "<=",
  4951. protocol: "comparing",
  4952. fn: function (aNumber){
  4953. var self=this,$self=this;
  4954. return $core.withContext(function($ctx1) {
  4955. return self <= aNumber;
  4956. return self;
  4957. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  4958. },
  4959. args: ["aNumber"],
  4960. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self <= aNumber'>",
  4961. referencedClasses: [],
  4962. messageSends: []
  4963. }),
  4964. $globals.Number);
  4965. $core.addMethod(
  4966. $core.method({
  4967. selector: "==",
  4968. protocol: "comparing",
  4969. fn: function (aNumber){
  4970. var self=this,$self=this;
  4971. return $core.withContext(function($ctx1) {
  4972. if (typeof aNumber === "number") return Number(self) === aNumber;
  4973. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  4974. else return false;;
  4975. return self;
  4976. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  4977. },
  4978. args: ["aNumber"],
  4979. 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'>",
  4980. referencedClasses: [],
  4981. messageSends: []
  4982. }),
  4983. $globals.Number);
  4984. $core.addMethod(
  4985. $core.method({
  4986. selector: ">",
  4987. protocol: "comparing",
  4988. fn: function (aNumber){
  4989. var self=this,$self=this;
  4990. return $core.withContext(function($ctx1) {
  4991. return self > aNumber;
  4992. return self;
  4993. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  4994. },
  4995. args: ["aNumber"],
  4996. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self > aNumber'>",
  4997. referencedClasses: [],
  4998. messageSends: []
  4999. }),
  5000. $globals.Number);
  5001. $core.addMethod(
  5002. $core.method({
  5003. selector: ">=",
  5004. protocol: "comparing",
  5005. fn: function (aNumber){
  5006. var self=this,$self=this;
  5007. return $core.withContext(function($ctx1) {
  5008. return self >= aNumber;
  5009. return self;
  5010. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  5011. },
  5012. args: ["aNumber"],
  5013. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self >= aNumber'>",
  5014. referencedClasses: [],
  5015. messageSends: []
  5016. }),
  5017. $globals.Number);
  5018. $core.addMethod(
  5019. $core.method({
  5020. selector: "@",
  5021. protocol: "converting",
  5022. fn: function (aNumber){
  5023. var self=this,$self=this;
  5024. return $core.withContext(function($ctx1) {
  5025. return $recv($globals.Point)._x_y_(self,aNumber);
  5026. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  5027. },
  5028. args: ["aNumber"],
  5029. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  5030. referencedClasses: ["Point"],
  5031. messageSends: ["x:y:"]
  5032. }),
  5033. $globals.Number);
  5034. $core.addMethod(
  5035. $core.method({
  5036. selector: "\x5c\x5c",
  5037. protocol: "arithmetic",
  5038. fn: function (aNumber){
  5039. var self=this,$self=this;
  5040. return $core.withContext(function($ctx1) {
  5041. return self % aNumber;
  5042. return self;
  5043. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  5044. },
  5045. args: ["aNumber"],
  5046. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  5047. referencedClasses: [],
  5048. messageSends: []
  5049. }),
  5050. $globals.Number);
  5051. $core.addMethod(
  5052. $core.method({
  5053. selector: "abs",
  5054. protocol: "arithmetic",
  5055. fn: function (){
  5056. var self=this,$self=this;
  5057. return $core.withContext(function($ctx1) {
  5058. return Math.abs(self);;
  5059. return self;
  5060. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  5061. },
  5062. args: [],
  5063. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  5064. referencedClasses: [],
  5065. messageSends: []
  5066. }),
  5067. $globals.Number);
  5068. $core.addMethod(
  5069. $core.method({
  5070. selector: "arcCos",
  5071. protocol: "mathematical functions",
  5072. fn: function (){
  5073. var self=this,$self=this;
  5074. return $core.withContext(function($ctx1) {
  5075. return Math.acos(self);;
  5076. return self;
  5077. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  5078. },
  5079. args: [],
  5080. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  5081. referencedClasses: [],
  5082. messageSends: []
  5083. }),
  5084. $globals.Number);
  5085. $core.addMethod(
  5086. $core.method({
  5087. selector: "arcSin",
  5088. protocol: "mathematical functions",
  5089. fn: function (){
  5090. var self=this,$self=this;
  5091. return $core.withContext(function($ctx1) {
  5092. return Math.asin(self);;
  5093. return self;
  5094. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  5095. },
  5096. args: [],
  5097. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  5098. referencedClasses: [],
  5099. messageSends: []
  5100. }),
  5101. $globals.Number);
  5102. $core.addMethod(
  5103. $core.method({
  5104. selector: "arcTan",
  5105. protocol: "mathematical functions",
  5106. fn: function (){
  5107. var self=this,$self=this;
  5108. return $core.withContext(function($ctx1) {
  5109. return Math.atan(self);;
  5110. return self;
  5111. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  5112. },
  5113. args: [],
  5114. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  5115. referencedClasses: [],
  5116. messageSends: []
  5117. }),
  5118. $globals.Number);
  5119. $core.addMethod(
  5120. $core.method({
  5121. selector: "arcTan:",
  5122. protocol: "mathematical functions",
  5123. fn: function (aNumber){
  5124. var self=this,$self=this;
  5125. return $core.withContext(function($ctx1) {
  5126. return Math.atan2(self, aNumber);;
  5127. return self;
  5128. }, function($ctx1) {$ctx1.fill(self,"arcTan:",{aNumber:aNumber},$globals.Number)});
  5129. },
  5130. args: ["aNumber"],
  5131. source: "arcTan: aNumber\x0a\x09<inlineJS: 'return Math.atan2(self, aNumber);'>",
  5132. referencedClasses: [],
  5133. messageSends: []
  5134. }),
  5135. $globals.Number);
  5136. $core.addMethod(
  5137. $core.method({
  5138. selector: "asJavaScriptObject",
  5139. protocol: "converting",
  5140. fn: function (){
  5141. var self=this,$self=this;
  5142. return self;
  5143. },
  5144. args: [],
  5145. source: "asJavaScriptObject\x0a\x09^ self",
  5146. referencedClasses: [],
  5147. messageSends: []
  5148. }),
  5149. $globals.Number);
  5150. $core.addMethod(
  5151. $core.method({
  5152. selector: "asJavaScriptSource",
  5153. protocol: "converting",
  5154. fn: function (){
  5155. var self=this,$self=this;
  5156. return $core.withContext(function($ctx1) {
  5157. var $1;
  5158. $1=$recv("(".__comma($self._printString())).__comma(")");
  5159. $ctx1.sendIdx[","]=1;
  5160. return $1;
  5161. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Number)});
  5162. },
  5163. args: [],
  5164. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  5165. referencedClasses: [],
  5166. messageSends: [",", "printString"]
  5167. }),
  5168. $globals.Number);
  5169. $core.addMethod(
  5170. $core.method({
  5171. selector: "asNumber",
  5172. protocol: "converting",
  5173. fn: function (){
  5174. var self=this,$self=this;
  5175. return self;
  5176. },
  5177. args: [],
  5178. source: "asNumber\x0a\x09^ self",
  5179. referencedClasses: [],
  5180. messageSends: []
  5181. }),
  5182. $globals.Number);
  5183. $core.addMethod(
  5184. $core.method({
  5185. selector: "asPoint",
  5186. protocol: "converting",
  5187. fn: function (){
  5188. var self=this,$self=this;
  5189. return $core.withContext(function($ctx1) {
  5190. return $recv($globals.Point)._x_y_(self,self);
  5191. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  5192. },
  5193. args: [],
  5194. source: "asPoint\x0a\x09^ Point x: self y: self",
  5195. referencedClasses: ["Point"],
  5196. messageSends: ["x:y:"]
  5197. }),
  5198. $globals.Number);
  5199. $core.addMethod(
  5200. $core.method({
  5201. selector: "asString",
  5202. protocol: "converting",
  5203. fn: function (){
  5204. var self=this,$self=this;
  5205. return $core.withContext(function($ctx1) {
  5206. return String(self);
  5207. return self;
  5208. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  5209. },
  5210. args: [],
  5211. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  5212. referencedClasses: [],
  5213. messageSends: []
  5214. }),
  5215. $globals.Number);
  5216. $core.addMethod(
  5217. $core.method({
  5218. selector: "atRandom",
  5219. protocol: "converting",
  5220. fn: function (){
  5221. var self=this,$self=this;
  5222. return $core.withContext(function($ctx1) {
  5223. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  5224. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  5225. },
  5226. args: [],
  5227. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  5228. referencedClasses: ["Random"],
  5229. messageSends: ["+", "truncated", "*", "next", "new"]
  5230. }),
  5231. $globals.Number);
  5232. $core.addMethod(
  5233. $core.method({
  5234. selector: "between:and:",
  5235. protocol: "testing",
  5236. fn: function (min,max){
  5237. var self=this,$self=this;
  5238. return $core.withContext(function($ctx1) {
  5239. return $recv($self.__gt_eq(min))._and_((function(){
  5240. return $core.withContext(function($ctx2) {
  5241. return $self.__lt_eq(max);
  5242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5243. }));
  5244. }, function($ctx1) {$ctx1.fill(self,"between:and:",{min:min,max:max},$globals.Number)});
  5245. },
  5246. args: ["min", "max"],
  5247. source: "between: min and: max\x0a ^ self >= min and: [ self <= max ]",
  5248. referencedClasses: [],
  5249. messageSends: ["and:", ">=", "<="]
  5250. }),
  5251. $globals.Number);
  5252. $core.addMethod(
  5253. $core.method({
  5254. selector: "ceiling",
  5255. protocol: "converting",
  5256. fn: function (){
  5257. var self=this,$self=this;
  5258. return $core.withContext(function($ctx1) {
  5259. return Math.ceil(self);;
  5260. return self;
  5261. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  5262. },
  5263. args: [],
  5264. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  5265. referencedClasses: [],
  5266. messageSends: []
  5267. }),
  5268. $globals.Number);
  5269. $core.addMethod(
  5270. $core.method({
  5271. selector: "copy",
  5272. protocol: "copying",
  5273. fn: function (){
  5274. var self=this,$self=this;
  5275. return self;
  5276. },
  5277. args: [],
  5278. source: "copy\x0a\x09^ self",
  5279. referencedClasses: [],
  5280. messageSends: []
  5281. }),
  5282. $globals.Number);
  5283. $core.addMethod(
  5284. $core.method({
  5285. selector: "cos",
  5286. protocol: "mathematical functions",
  5287. fn: function (){
  5288. var self=this,$self=this;
  5289. return $core.withContext(function($ctx1) {
  5290. return Math.cos(self);;
  5291. return self;
  5292. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  5293. },
  5294. args: [],
  5295. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  5296. referencedClasses: [],
  5297. messageSends: []
  5298. }),
  5299. $globals.Number);
  5300. $core.addMethod(
  5301. $core.method({
  5302. selector: "deepCopy",
  5303. protocol: "copying",
  5304. fn: function (){
  5305. var self=this,$self=this;
  5306. return $core.withContext(function($ctx1) {
  5307. return $self._copy();
  5308. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  5309. },
  5310. args: [],
  5311. source: "deepCopy\x0a\x09^ self copy",
  5312. referencedClasses: [],
  5313. messageSends: ["copy"]
  5314. }),
  5315. $globals.Number);
  5316. $core.addMethod(
  5317. $core.method({
  5318. selector: "degreesToRadians",
  5319. protocol: "converting",
  5320. fn: function (){
  5321. var self=this,$self=this;
  5322. return $core.withContext(function($ctx1) {
  5323. return $self.__star($recv($globals.Number)._radiansPerDegree());
  5324. }, function($ctx1) {$ctx1.fill(self,"degreesToRadians",{},$globals.Number)});
  5325. },
  5326. args: [],
  5327. source: "degreesToRadians\x0a\x09^ self * Number radiansPerDegree",
  5328. referencedClasses: ["Number"],
  5329. messageSends: ["*", "radiansPerDegree"]
  5330. }),
  5331. $globals.Number);
  5332. $core.addMethod(
  5333. $core.method({
  5334. selector: "even",
  5335. protocol: "testing",
  5336. fn: function (){
  5337. var self=this,$self=this;
  5338. return $core.withContext(function($ctx1) {
  5339. return (0).__eq($self.__backslash_backslash((2)));
  5340. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  5341. },
  5342. args: [],
  5343. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  5344. referencedClasses: [],
  5345. messageSends: ["=", "\x5c\x5c"]
  5346. }),
  5347. $globals.Number);
  5348. $core.addMethod(
  5349. $core.method({
  5350. selector: "floor",
  5351. protocol: "converting",
  5352. fn: function (){
  5353. var self=this,$self=this;
  5354. return $core.withContext(function($ctx1) {
  5355. return Math.floor(self);;
  5356. return self;
  5357. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  5358. },
  5359. args: [],
  5360. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  5361. referencedClasses: [],
  5362. messageSends: []
  5363. }),
  5364. $globals.Number);
  5365. $core.addMethod(
  5366. $core.method({
  5367. selector: "isImmutable",
  5368. protocol: "testing",
  5369. fn: function (){
  5370. var self=this,$self=this;
  5371. return true;
  5372. },
  5373. args: [],
  5374. source: "isImmutable\x0a\x09^ true",
  5375. referencedClasses: [],
  5376. messageSends: []
  5377. }),
  5378. $globals.Number);
  5379. $core.addMethod(
  5380. $core.method({
  5381. selector: "isNumber",
  5382. protocol: "testing",
  5383. fn: function (){
  5384. var self=this,$self=this;
  5385. return true;
  5386. },
  5387. args: [],
  5388. source: "isNumber\x0a\x09^ true",
  5389. referencedClasses: [],
  5390. messageSends: []
  5391. }),
  5392. $globals.Number);
  5393. $core.addMethod(
  5394. $core.method({
  5395. selector: "isZero",
  5396. protocol: "testing",
  5397. fn: function (){
  5398. var self=this,$self=this;
  5399. return $core.withContext(function($ctx1) {
  5400. return $self.__eq((0));
  5401. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  5402. },
  5403. args: [],
  5404. source: "isZero\x0a\x09^ self = 0",
  5405. referencedClasses: [],
  5406. messageSends: ["="]
  5407. }),
  5408. $globals.Number);
  5409. $core.addMethod(
  5410. $core.method({
  5411. selector: "ln",
  5412. protocol: "mathematical functions",
  5413. fn: function (){
  5414. var self=this,$self=this;
  5415. return $core.withContext(function($ctx1) {
  5416. return Math.log(self);;
  5417. return self;
  5418. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  5419. },
  5420. args: [],
  5421. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  5422. referencedClasses: [],
  5423. messageSends: []
  5424. }),
  5425. $globals.Number);
  5426. $core.addMethod(
  5427. $core.method({
  5428. selector: "log",
  5429. protocol: "mathematical functions",
  5430. fn: function (){
  5431. var self=this,$self=this;
  5432. return $core.withContext(function($ctx1) {
  5433. return Math.log(self) / Math.LN10;;
  5434. return self;
  5435. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  5436. },
  5437. args: [],
  5438. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  5439. referencedClasses: [],
  5440. messageSends: []
  5441. }),
  5442. $globals.Number);
  5443. $core.addMethod(
  5444. $core.method({
  5445. selector: "log:",
  5446. protocol: "mathematical functions",
  5447. fn: function (aNumber){
  5448. var self=this,$self=this;
  5449. return $core.withContext(function($ctx1) {
  5450. return Math.log(self) / Math.log(aNumber);;
  5451. return self;
  5452. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  5453. },
  5454. args: ["aNumber"],
  5455. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  5456. referencedClasses: [],
  5457. messageSends: []
  5458. }),
  5459. $globals.Number);
  5460. $core.addMethod(
  5461. $core.method({
  5462. selector: "max:",
  5463. protocol: "arithmetic",
  5464. fn: function (aNumber){
  5465. var self=this,$self=this;
  5466. return $core.withContext(function($ctx1) {
  5467. return Math.max(self, aNumber);;
  5468. return self;
  5469. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  5470. },
  5471. args: ["aNumber"],
  5472. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  5473. referencedClasses: [],
  5474. messageSends: []
  5475. }),
  5476. $globals.Number);
  5477. $core.addMethod(
  5478. $core.method({
  5479. selector: "min:",
  5480. protocol: "arithmetic",
  5481. fn: function (aNumber){
  5482. var self=this,$self=this;
  5483. return $core.withContext(function($ctx1) {
  5484. return Math.min(self, aNumber);;
  5485. return self;
  5486. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  5487. },
  5488. args: ["aNumber"],
  5489. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  5490. referencedClasses: [],
  5491. messageSends: []
  5492. }),
  5493. $globals.Number);
  5494. $core.addMethod(
  5495. $core.method({
  5496. selector: "min:max:",
  5497. protocol: "arithmetic",
  5498. fn: function (aMin,aMax){
  5499. var self=this,$self=this;
  5500. return $core.withContext(function($ctx1) {
  5501. return $recv($self._min_(aMin))._max_(aMax);
  5502. }, function($ctx1) {$ctx1.fill(self,"min:max:",{aMin:aMin,aMax:aMax},$globals.Number)});
  5503. },
  5504. args: ["aMin", "aMax"],
  5505. source: "min: aMin max: aMax\x0a\x09^ (self min: aMin) max: aMax",
  5506. referencedClasses: [],
  5507. messageSends: ["max:", "min:"]
  5508. }),
  5509. $globals.Number);
  5510. $core.addMethod(
  5511. $core.method({
  5512. selector: "negated",
  5513. protocol: "arithmetic",
  5514. fn: function (){
  5515. var self=this,$self=this;
  5516. return $core.withContext(function($ctx1) {
  5517. return (0).__minus(self);
  5518. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  5519. },
  5520. args: [],
  5521. source: "negated\x0a\x09^ 0 - self",
  5522. referencedClasses: [],
  5523. messageSends: ["-"]
  5524. }),
  5525. $globals.Number);
  5526. $core.addMethod(
  5527. $core.method({
  5528. selector: "negative",
  5529. protocol: "testing",
  5530. fn: function (){
  5531. var self=this,$self=this;
  5532. return $core.withContext(function($ctx1) {
  5533. return $self.__lt((0));
  5534. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  5535. },
  5536. args: [],
  5537. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5538. referencedClasses: [],
  5539. messageSends: ["<"]
  5540. }),
  5541. $globals.Number);
  5542. $core.addMethod(
  5543. $core.method({
  5544. selector: "odd",
  5545. protocol: "testing",
  5546. fn: function (){
  5547. var self=this,$self=this;
  5548. return $core.withContext(function($ctx1) {
  5549. return $recv($self._even())._not();
  5550. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  5551. },
  5552. args: [],
  5553. source: "odd\x0a\x09^ self even not",
  5554. referencedClasses: [],
  5555. messageSends: ["not", "even"]
  5556. }),
  5557. $globals.Number);
  5558. $core.addMethod(
  5559. $core.method({
  5560. selector: "positive",
  5561. protocol: "testing",
  5562. fn: function (){
  5563. var self=this,$self=this;
  5564. return $core.withContext(function($ctx1) {
  5565. return $self.__gt_eq((0));
  5566. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  5567. },
  5568. args: [],
  5569. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5570. referencedClasses: [],
  5571. messageSends: [">="]
  5572. }),
  5573. $globals.Number);
  5574. $core.addMethod(
  5575. $core.method({
  5576. selector: "printOn:",
  5577. protocol: "printing",
  5578. fn: function (aStream){
  5579. var self=this,$self=this;
  5580. return $core.withContext(function($ctx1) {
  5581. $recv(aStream)._nextPutAll_($self._asString());
  5582. return self;
  5583. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  5584. },
  5585. args: ["aStream"],
  5586. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5587. referencedClasses: [],
  5588. messageSends: ["nextPutAll:", "asString"]
  5589. }),
  5590. $globals.Number);
  5591. $core.addMethod(
  5592. $core.method({
  5593. selector: "printShowingDecimalPlaces:",
  5594. protocol: "printing",
  5595. fn: function (placesDesired){
  5596. var self=this,$self=this;
  5597. return $core.withContext(function($ctx1) {
  5598. return self.toFixed(placesDesired);
  5599. return self;
  5600. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  5601. },
  5602. args: ["placesDesired"],
  5603. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5604. referencedClasses: [],
  5605. messageSends: []
  5606. }),
  5607. $globals.Number);
  5608. $core.addMethod(
  5609. $core.method({
  5610. selector: "radiansToDegrees",
  5611. protocol: "converting",
  5612. fn: function (){
  5613. var self=this,$self=this;
  5614. return $core.withContext(function($ctx1) {
  5615. return $self.__slash($recv($globals.Number)._radiansPerDegree());
  5616. }, function($ctx1) {$ctx1.fill(self,"radiansToDegrees",{},$globals.Number)});
  5617. },
  5618. args: [],
  5619. source: "radiansToDegrees\x0a\x09^ self / Number radiansPerDegree",
  5620. referencedClasses: ["Number"],
  5621. messageSends: ["/", "radiansPerDegree"]
  5622. }),
  5623. $globals.Number);
  5624. $core.addMethod(
  5625. $core.method({
  5626. selector: "raisedTo:",
  5627. protocol: "mathematical functions",
  5628. fn: function (exponent){
  5629. var self=this,$self=this;
  5630. return $core.withContext(function($ctx1) {
  5631. return Math.pow(self, exponent);;
  5632. return self;
  5633. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  5634. },
  5635. args: ["exponent"],
  5636. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  5637. referencedClasses: [],
  5638. messageSends: []
  5639. }),
  5640. $globals.Number);
  5641. $core.addMethod(
  5642. $core.method({
  5643. selector: "rounded",
  5644. protocol: "converting",
  5645. fn: function (){
  5646. var self=this,$self=this;
  5647. return $core.withContext(function($ctx1) {
  5648. return Math.round(self);;
  5649. return self;
  5650. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  5651. },
  5652. args: [],
  5653. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  5654. referencedClasses: [],
  5655. messageSends: []
  5656. }),
  5657. $globals.Number);
  5658. $core.addMethod(
  5659. $core.method({
  5660. selector: "sign",
  5661. protocol: "mathematical functions",
  5662. fn: function (){
  5663. var self=this,$self=this;
  5664. return $core.withContext(function($ctx1) {
  5665. var $1,$2;
  5666. $1=$self._isZero();
  5667. if($core.assert($1)){
  5668. return (0);
  5669. }
  5670. $2=$self._positive();
  5671. if($core.assert($2)){
  5672. return (1);
  5673. } else {
  5674. return (-1);
  5675. }
  5676. return self;
  5677. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  5678. },
  5679. args: [],
  5680. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5681. referencedClasses: [],
  5682. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5683. }),
  5684. $globals.Number);
  5685. $core.addMethod(
  5686. $core.method({
  5687. selector: "sin",
  5688. protocol: "mathematical functions",
  5689. fn: function (){
  5690. var self=this,$self=this;
  5691. return $core.withContext(function($ctx1) {
  5692. return Math.sin(self);;
  5693. return self;
  5694. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  5695. },
  5696. args: [],
  5697. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  5698. referencedClasses: [],
  5699. messageSends: []
  5700. }),
  5701. $globals.Number);
  5702. $core.addMethod(
  5703. $core.method({
  5704. selector: "sqrt",
  5705. protocol: "mathematical functions",
  5706. fn: function (){
  5707. var self=this,$self=this;
  5708. return $core.withContext(function($ctx1) {
  5709. return Math.sqrt(self);
  5710. return self;
  5711. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  5712. },
  5713. args: [],
  5714. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  5715. referencedClasses: [],
  5716. messageSends: []
  5717. }),
  5718. $globals.Number);
  5719. $core.addMethod(
  5720. $core.method({
  5721. selector: "squared",
  5722. protocol: "mathematical functions",
  5723. fn: function (){
  5724. var self=this,$self=this;
  5725. return $core.withContext(function($ctx1) {
  5726. return $self.__star(self);
  5727. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  5728. },
  5729. args: [],
  5730. source: "squared\x0a\x09^ self * self",
  5731. referencedClasses: [],
  5732. messageSends: ["*"]
  5733. }),
  5734. $globals.Number);
  5735. $core.addMethod(
  5736. $core.method({
  5737. selector: "tan",
  5738. protocol: "mathematical functions",
  5739. fn: function (){
  5740. var self=this,$self=this;
  5741. return $core.withContext(function($ctx1) {
  5742. return Math.tan(self);;
  5743. return self;
  5744. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  5745. },
  5746. args: [],
  5747. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  5748. referencedClasses: [],
  5749. messageSends: []
  5750. }),
  5751. $globals.Number);
  5752. $core.addMethod(
  5753. $core.method({
  5754. selector: "timesRepeat:",
  5755. protocol: "enumerating",
  5756. fn: function (aBlock){
  5757. var self=this,$self=this;
  5758. var count;
  5759. return $core.withContext(function($ctx1) {
  5760. count=(1);
  5761. $recv((function(){
  5762. return $core.withContext(function($ctx2) {
  5763. return $recv(count).__gt(self);
  5764. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5765. }))._whileFalse_((function(){
  5766. return $core.withContext(function($ctx2) {
  5767. $recv(aBlock)._value();
  5768. count=$recv(count).__plus((1));
  5769. return count;
  5770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5771. }));
  5772. return self;
  5773. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  5774. },
  5775. args: ["aBlock"],
  5776. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5777. referencedClasses: [],
  5778. messageSends: ["whileFalse:", ">", "value", "+"]
  5779. }),
  5780. $globals.Number);
  5781. $core.addMethod(
  5782. $core.method({
  5783. selector: "to:",
  5784. protocol: "converting",
  5785. fn: function (aNumber){
  5786. var self=this,$self=this;
  5787. var array,first,last,count;
  5788. return $core.withContext(function($ctx1) {
  5789. first=$self._truncated();
  5790. $ctx1.sendIdx["truncated"]=1;
  5791. last=$recv($recv(aNumber)._truncated()).__plus((1));
  5792. $ctx1.sendIdx["+"]=1;
  5793. count=(1);
  5794. array=$recv($globals.Array)._new();
  5795. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  5796. return $core.withContext(function($ctx2) {
  5797. $recv(array)._at_put_(count,first);
  5798. count=$recv(count).__plus((1));
  5799. $ctx2.sendIdx["+"]=2;
  5800. count;
  5801. first=$recv(first).__plus((1));
  5802. return first;
  5803. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5804. }));
  5805. return array;
  5806. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  5807. },
  5808. args: ["aNumber"],
  5809. 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",
  5810. referencedClasses: ["Array"],
  5811. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5812. }),
  5813. $globals.Number);
  5814. $core.addMethod(
  5815. $core.method({
  5816. selector: "to:by:",
  5817. protocol: "converting",
  5818. fn: function (stop,step){
  5819. var self=this,$self=this;
  5820. var array,value,pos;
  5821. return $core.withContext(function($ctx1) {
  5822. var $1,$2;
  5823. value=self;
  5824. array=$recv($globals.Array)._new();
  5825. pos=(1);
  5826. $1=$recv(step).__eq((0));
  5827. if($core.assert($1)){
  5828. $self._error_("step must be non-zero");
  5829. }
  5830. $2=$recv(step).__lt((0));
  5831. if($core.assert($2)){
  5832. $recv((function(){
  5833. return $core.withContext(function($ctx2) {
  5834. return $recv(value).__gt_eq(stop);
  5835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5836. }))._whileTrue_((function(){
  5837. return $core.withContext(function($ctx2) {
  5838. $recv(array)._at_put_(pos,value);
  5839. $ctx2.sendIdx["at:put:"]=1;
  5840. pos=$recv(pos).__plus((1));
  5841. $ctx2.sendIdx["+"]=1;
  5842. pos;
  5843. value=$recv(value).__plus(step);
  5844. $ctx2.sendIdx["+"]=2;
  5845. return value;
  5846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5847. }));
  5848. $ctx1.sendIdx["whileTrue:"]=1;
  5849. } else {
  5850. $recv((function(){
  5851. return $core.withContext(function($ctx2) {
  5852. return $recv(value).__lt_eq(stop);
  5853. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5854. }))._whileTrue_((function(){
  5855. return $core.withContext(function($ctx2) {
  5856. $recv(array)._at_put_(pos,value);
  5857. pos=$recv(pos).__plus((1));
  5858. $ctx2.sendIdx["+"]=3;
  5859. pos;
  5860. value=$recv(value).__plus(step);
  5861. return value;
  5862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5863. }));
  5864. }
  5865. return array;
  5866. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  5867. },
  5868. args: ["stop", "step"],
  5869. 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",
  5870. referencedClasses: ["Array"],
  5871. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  5872. }),
  5873. $globals.Number);
  5874. $core.addMethod(
  5875. $core.method({
  5876. selector: "to:by:do:",
  5877. protocol: "enumerating",
  5878. fn: function (stop,step,aBlock){
  5879. var self=this,$self=this;
  5880. var value;
  5881. return $core.withContext(function($ctx1) {
  5882. var $1,$2;
  5883. value=self;
  5884. $1=$recv(step).__eq((0));
  5885. if($core.assert($1)){
  5886. $self._error_("step must be non-zero");
  5887. }
  5888. $2=$recv(step).__lt((0));
  5889. if($core.assert($2)){
  5890. $recv((function(){
  5891. return $core.withContext(function($ctx2) {
  5892. return $recv(value).__gt_eq(stop);
  5893. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5894. }))._whileTrue_((function(){
  5895. return $core.withContext(function($ctx2) {
  5896. $recv(aBlock)._value_(value);
  5897. $ctx2.sendIdx["value:"]=1;
  5898. value=$recv(value).__plus(step);
  5899. $ctx2.sendIdx["+"]=1;
  5900. return value;
  5901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5902. }));
  5903. $ctx1.sendIdx["whileTrue:"]=1;
  5904. } else {
  5905. $recv((function(){
  5906. return $core.withContext(function($ctx2) {
  5907. return $recv(value).__lt_eq(stop);
  5908. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5909. }))._whileTrue_((function(){
  5910. return $core.withContext(function($ctx2) {
  5911. $recv(aBlock)._value_(value);
  5912. value=$recv(value).__plus(step);
  5913. return value;
  5914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5915. }));
  5916. }
  5917. return self;
  5918. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  5919. },
  5920. args: ["stop", "step", "aBlock"],
  5921. 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 ]]",
  5922. referencedClasses: [],
  5923. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  5924. }),
  5925. $globals.Number);
  5926. $core.addMethod(
  5927. $core.method({
  5928. selector: "to:do:",
  5929. protocol: "enumerating",
  5930. fn: function (stop,aBlock){
  5931. var self=this,$self=this;
  5932. var nextValue;
  5933. return $core.withContext(function($ctx1) {
  5934. nextValue=self;
  5935. $recv((function(){
  5936. return $core.withContext(function($ctx2) {
  5937. return $recv(nextValue).__lt_eq(stop);
  5938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5939. }))._whileTrue_((function(){
  5940. return $core.withContext(function($ctx2) {
  5941. $recv(aBlock)._value_(nextValue);
  5942. nextValue=$recv(nextValue).__plus((1));
  5943. return nextValue;
  5944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5945. }));
  5946. return self;
  5947. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  5948. },
  5949. args: ["stop", "aBlock"],
  5950. 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 ]",
  5951. referencedClasses: [],
  5952. messageSends: ["whileTrue:", "<=", "value:", "+"]
  5953. }),
  5954. $globals.Number);
  5955. $core.addMethod(
  5956. $core.method({
  5957. selector: "truncated",
  5958. protocol: "converting",
  5959. fn: function (){
  5960. var self=this,$self=this;
  5961. return $core.withContext(function($ctx1) {
  5962. if(self >= 0) {
  5963. return Math.floor(self);
  5964. } else {
  5965. return Math.floor(self * (-1)) * (-1);
  5966. };
  5967. ;
  5968. return self;
  5969. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  5970. },
  5971. args: [],
  5972. 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'>",
  5973. referencedClasses: [],
  5974. messageSends: []
  5975. }),
  5976. $globals.Number);
  5977. $core.addMethod(
  5978. $core.method({
  5979. selector: "|",
  5980. protocol: "converting",
  5981. fn: function (aNumber){
  5982. var self=this,$self=this;
  5983. return $core.withContext(function($ctx1) {
  5984. return self | aNumber;
  5985. return self;
  5986. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  5987. },
  5988. args: ["aNumber"],
  5989. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5990. referencedClasses: [],
  5991. messageSends: []
  5992. }),
  5993. $globals.Number);
  5994. $core.addMethod(
  5995. $core.method({
  5996. selector: "classTag",
  5997. protocol: "accessing",
  5998. fn: function (){
  5999. var self=this,$self=this;
  6000. return "magnitude";
  6001. },
  6002. args: [],
  6003. 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'",
  6004. referencedClasses: [],
  6005. messageSends: []
  6006. }),
  6007. $globals.Number.a$cls);
  6008. $core.addMethod(
  6009. $core.method({
  6010. selector: "e",
  6011. protocol: "instance creation",
  6012. fn: function (){
  6013. var self=this,$self=this;
  6014. return $core.withContext(function($ctx1) {
  6015. return Math.E;;
  6016. return self;
  6017. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.a$cls)});
  6018. },
  6019. args: [],
  6020. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  6021. referencedClasses: [],
  6022. messageSends: []
  6023. }),
  6024. $globals.Number.a$cls);
  6025. $core.addMethod(
  6026. $core.method({
  6027. selector: "pi",
  6028. protocol: "instance creation",
  6029. fn: function (){
  6030. var self=this,$self=this;
  6031. return $core.withContext(function($ctx1) {
  6032. return Math.PI;
  6033. return self;
  6034. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.a$cls)});
  6035. },
  6036. args: [],
  6037. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  6038. referencedClasses: [],
  6039. messageSends: []
  6040. }),
  6041. $globals.Number.a$cls);
  6042. $core.addMethod(
  6043. $core.method({
  6044. selector: "radiansPerDegree",
  6045. protocol: "instance creation",
  6046. fn: function (){
  6047. var self=this,$self=this;
  6048. return $core.withContext(function($ctx1) {
  6049. return $recv($self._pi()).__slash((180));
  6050. }, function($ctx1) {$ctx1.fill(self,"radiansPerDegree",{},$globals.Number.a$cls)});
  6051. },
  6052. args: [],
  6053. source: "radiansPerDegree\x0a\x09^ (self pi) / 180",
  6054. referencedClasses: [],
  6055. messageSends: ["/", "pi"]
  6056. }),
  6057. $globals.Number.a$cls);
  6058. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  6059. $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";
  6060. $core.addMethod(
  6061. $core.method({
  6062. selector: "*",
  6063. protocol: "arithmetic",
  6064. fn: function (aPoint){
  6065. var self=this,$self=this;
  6066. return $core.withContext(function($ctx1) {
  6067. var $2,$4,$3,$1,$6,$5;
  6068. $2=$self._x();
  6069. $ctx1.sendIdx["x"]=1;
  6070. $4=$recv(aPoint)._asPoint();
  6071. $ctx1.sendIdx["asPoint"]=1;
  6072. $3=$recv($4)._x();
  6073. $1=$recv($2).__star($3);
  6074. $ctx1.sendIdx["*"]=1;
  6075. $6=$self._y();
  6076. $ctx1.sendIdx["y"]=1;
  6077. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  6078. return $recv($globals.Point)._x_y_($1,$5);
  6079. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  6080. },
  6081. args: ["aPoint"],
  6082. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  6083. referencedClasses: ["Point"],
  6084. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  6085. }),
  6086. $globals.Point);
  6087. $core.addMethod(
  6088. $core.method({
  6089. selector: "+",
  6090. protocol: "arithmetic",
  6091. fn: function (aPoint){
  6092. var self=this,$self=this;
  6093. return $core.withContext(function($ctx1) {
  6094. var $2,$4,$3,$1,$6,$5;
  6095. $2=$self._x();
  6096. $ctx1.sendIdx["x"]=1;
  6097. $4=$recv(aPoint)._asPoint();
  6098. $ctx1.sendIdx["asPoint"]=1;
  6099. $3=$recv($4)._x();
  6100. $1=$recv($2).__plus($3);
  6101. $ctx1.sendIdx["+"]=1;
  6102. $6=$self._y();
  6103. $ctx1.sendIdx["y"]=1;
  6104. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  6105. return $recv($globals.Point)._x_y_($1,$5);
  6106. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  6107. },
  6108. args: ["aPoint"],
  6109. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  6110. referencedClasses: ["Point"],
  6111. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  6112. }),
  6113. $globals.Point);
  6114. $core.addMethod(
  6115. $core.method({
  6116. selector: "-",
  6117. protocol: "arithmetic",
  6118. fn: function (aPoint){
  6119. var self=this,$self=this;
  6120. return $core.withContext(function($ctx1) {
  6121. var $2,$4,$3,$1,$6,$5;
  6122. $2=$self._x();
  6123. $ctx1.sendIdx["x"]=1;
  6124. $4=$recv(aPoint)._asPoint();
  6125. $ctx1.sendIdx["asPoint"]=1;
  6126. $3=$recv($4)._x();
  6127. $1=$recv($2).__minus($3);
  6128. $ctx1.sendIdx["-"]=1;
  6129. $6=$self._y();
  6130. $ctx1.sendIdx["y"]=1;
  6131. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  6132. return $recv($globals.Point)._x_y_($1,$5);
  6133. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  6134. },
  6135. args: ["aPoint"],
  6136. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  6137. referencedClasses: ["Point"],
  6138. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  6139. }),
  6140. $globals.Point);
  6141. $core.addMethod(
  6142. $core.method({
  6143. selector: "/",
  6144. protocol: "arithmetic",
  6145. fn: function (aPoint){
  6146. var self=this,$self=this;
  6147. return $core.withContext(function($ctx1) {
  6148. var $2,$4,$3,$1,$6,$5;
  6149. $2=$self._x();
  6150. $ctx1.sendIdx["x"]=1;
  6151. $4=$recv(aPoint)._asPoint();
  6152. $ctx1.sendIdx["asPoint"]=1;
  6153. $3=$recv($4)._x();
  6154. $1=$recv($2).__slash($3);
  6155. $ctx1.sendIdx["/"]=1;
  6156. $6=$self._y();
  6157. $ctx1.sendIdx["y"]=1;
  6158. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  6159. return $recv($globals.Point)._x_y_($1,$5);
  6160. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  6161. },
  6162. args: ["aPoint"],
  6163. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6164. referencedClasses: ["Point"],
  6165. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  6166. }),
  6167. $globals.Point);
  6168. $core.addMethod(
  6169. $core.method({
  6170. selector: "<",
  6171. protocol: "comparing",
  6172. fn: function (aPoint){
  6173. var self=this,$self=this;
  6174. return $core.withContext(function($ctx1) {
  6175. var $2,$1,$3;
  6176. $2=$self._x();
  6177. $ctx1.sendIdx["x"]=1;
  6178. $1=$recv($2).__lt($recv(aPoint)._x());
  6179. $ctx1.sendIdx["<"]=1;
  6180. return $recv($1)._and_((function(){
  6181. return $core.withContext(function($ctx2) {
  6182. $3=$self._y();
  6183. $ctx2.sendIdx["y"]=1;
  6184. return $recv($3).__lt($recv(aPoint)._y());
  6185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6186. }));
  6187. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  6188. },
  6189. args: ["aPoint"],
  6190. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  6191. referencedClasses: [],
  6192. messageSends: ["and:", "<", "x", "y"]
  6193. }),
  6194. $globals.Point);
  6195. $core.addMethod(
  6196. $core.method({
  6197. selector: "<=",
  6198. protocol: "comparing",
  6199. fn: function (aPoint){
  6200. var self=this,$self=this;
  6201. return $core.withContext(function($ctx1) {
  6202. var $2,$1,$3;
  6203. $2=$self._x();
  6204. $ctx1.sendIdx["x"]=1;
  6205. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  6206. $ctx1.sendIdx["<="]=1;
  6207. return $recv($1)._and_((function(){
  6208. return $core.withContext(function($ctx2) {
  6209. $3=$self._y();
  6210. $ctx2.sendIdx["y"]=1;
  6211. return $recv($3).__lt_eq($recv(aPoint)._y());
  6212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6213. }));
  6214. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  6215. },
  6216. args: ["aPoint"],
  6217. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6218. referencedClasses: [],
  6219. messageSends: ["and:", "<=", "x", "y"]
  6220. }),
  6221. $globals.Point);
  6222. $core.addMethod(
  6223. $core.method({
  6224. selector: "=",
  6225. protocol: "comparing",
  6226. fn: function (aPoint){
  6227. var self=this,$self=this;
  6228. return $core.withContext(function($ctx1) {
  6229. var $2,$1,$4,$3,$6,$5;
  6230. $2=$recv(aPoint)._class();
  6231. $ctx1.sendIdx["class"]=1;
  6232. $1=$recv($2).__eq($self._class());
  6233. $ctx1.sendIdx["="]=1;
  6234. return $recv($1)._and_((function(){
  6235. return $core.withContext(function($ctx2) {
  6236. $4=$recv(aPoint)._x();
  6237. $ctx2.sendIdx["x"]=1;
  6238. $3=$recv($4).__eq($self._x());
  6239. $ctx2.sendIdx["="]=2;
  6240. $6=$recv(aPoint)._y();
  6241. $ctx2.sendIdx["y"]=1;
  6242. $5=$recv($6).__eq($self._y());
  6243. return $recv($3).__and($5);
  6244. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6245. }));
  6246. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  6247. },
  6248. args: ["aPoint"],
  6249. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6250. referencedClasses: [],
  6251. messageSends: ["and:", "=", "class", "&", "x", "y"]
  6252. }),
  6253. $globals.Point);
  6254. $core.addMethod(
  6255. $core.method({
  6256. selector: ">",
  6257. protocol: "comparing",
  6258. fn: function (aPoint){
  6259. var self=this,$self=this;
  6260. return $core.withContext(function($ctx1) {
  6261. var $2,$1,$3;
  6262. $2=$self._x();
  6263. $ctx1.sendIdx["x"]=1;
  6264. $1=$recv($2).__gt($recv(aPoint)._x());
  6265. $ctx1.sendIdx[">"]=1;
  6266. return $recv($1)._and_((function(){
  6267. return $core.withContext(function($ctx2) {
  6268. $3=$self._y();
  6269. $ctx2.sendIdx["y"]=1;
  6270. return $recv($3).__gt($recv(aPoint)._y());
  6271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6272. }));
  6273. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  6274. },
  6275. args: ["aPoint"],
  6276. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  6277. referencedClasses: [],
  6278. messageSends: ["and:", ">", "x", "y"]
  6279. }),
  6280. $globals.Point);
  6281. $core.addMethod(
  6282. $core.method({
  6283. selector: ">=",
  6284. protocol: "comparing",
  6285. fn: function (aPoint){
  6286. var self=this,$self=this;
  6287. return $core.withContext(function($ctx1) {
  6288. var $2,$1,$3;
  6289. $2=$self._x();
  6290. $ctx1.sendIdx["x"]=1;
  6291. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  6292. $ctx1.sendIdx[">="]=1;
  6293. return $recv($1)._and_((function(){
  6294. return $core.withContext(function($ctx2) {
  6295. $3=$self._y();
  6296. $ctx2.sendIdx["y"]=1;
  6297. return $recv($3).__gt_eq($recv(aPoint)._y());
  6298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6299. }));
  6300. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  6301. },
  6302. args: ["aPoint"],
  6303. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6304. referencedClasses: [],
  6305. messageSends: ["and:", ">=", "x", "y"]
  6306. }),
  6307. $globals.Point);
  6308. $core.addMethod(
  6309. $core.method({
  6310. selector: "angle",
  6311. protocol: "geometry",
  6312. fn: function (){
  6313. var self=this,$self=this;
  6314. return $core.withContext(function($ctx1) {
  6315. return $recv($self._y())._arcTan_($self._x());
  6316. }, function($ctx1) {$ctx1.fill(self,"angle",{},$globals.Point)});
  6317. },
  6318. args: [],
  6319. source: "angle\x0a\x09^ self y arcTan: self x",
  6320. referencedClasses: [],
  6321. messageSends: ["arcTan:", "y", "x"]
  6322. }),
  6323. $globals.Point);
  6324. $core.addMethod(
  6325. $core.method({
  6326. selector: "asPoint",
  6327. protocol: "converting",
  6328. fn: function (){
  6329. var self=this,$self=this;
  6330. return self;
  6331. },
  6332. args: [],
  6333. source: "asPoint\x0a\x09^ self",
  6334. referencedClasses: [],
  6335. messageSends: []
  6336. }),
  6337. $globals.Point);
  6338. $core.addMethod(
  6339. $core.method({
  6340. selector: "corner:",
  6341. protocol: "rectangle creation",
  6342. fn: function (aPoint){
  6343. var self=this,$self=this;
  6344. return $core.withContext(function($ctx1) {
  6345. return $recv($globals.Rectangle)._origin_corner_(self,aPoint);
  6346. }, function($ctx1) {$ctx1.fill(self,"corner:",{aPoint:aPoint},$globals.Point)});
  6347. },
  6348. args: ["aPoint"],
  6349. source: "corner: aPoint\x0a\x09^ Rectangle origin: self corner: aPoint",
  6350. referencedClasses: ["Rectangle"],
  6351. messageSends: ["origin:corner:"]
  6352. }),
  6353. $globals.Point);
  6354. $core.addMethod(
  6355. $core.method({
  6356. selector: "dist:",
  6357. protocol: "transforming",
  6358. fn: function (aPoint){
  6359. var self=this,$self=this;
  6360. var dx,dy;
  6361. return $core.withContext(function($ctx1) {
  6362. var $2,$1;
  6363. dx=$recv($recv(aPoint)._x()).__minus($self["@x"]);
  6364. $ctx1.sendIdx["-"]=1;
  6365. dy=$recv($recv(aPoint)._y()).__minus($self["@y"]);
  6366. $2=$recv(dx).__star(dx);
  6367. $ctx1.sendIdx["*"]=1;
  6368. $1=$recv($2).__plus($recv(dy).__star(dy));
  6369. return $recv($1)._sqrt();
  6370. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  6371. },
  6372. args: ["aPoint"],
  6373. 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",
  6374. referencedClasses: [],
  6375. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6376. }),
  6377. $globals.Point);
  6378. $core.addMethod(
  6379. $core.method({
  6380. selector: "dotProduct:",
  6381. protocol: "point functions",
  6382. fn: function (aPoint){
  6383. var self=this,$self=this;
  6384. return $core.withContext(function($ctx1) {
  6385. var $1;
  6386. $1=$recv($self["@x"]).__star($recv(aPoint)._x());
  6387. $ctx1.sendIdx["*"]=1;
  6388. return $recv($1).__plus($recv($self["@y"]).__star($recv(aPoint)._y()));
  6389. }, function($ctx1) {$ctx1.fill(self,"dotProduct:",{aPoint:aPoint},$globals.Point)});
  6390. },
  6391. args: ["aPoint"],
  6392. source: "dotProduct: aPoint\x0a\x09^ (x * aPoint x) + (y * aPoint y)",
  6393. referencedClasses: [],
  6394. messageSends: ["+", "*", "x", "y"]
  6395. }),
  6396. $globals.Point);
  6397. $core.addMethod(
  6398. $core.method({
  6399. selector: "extent:",
  6400. protocol: "rectangle creation",
  6401. fn: function (aPoint){
  6402. var self=this,$self=this;
  6403. return $core.withContext(function($ctx1) {
  6404. return $recv($globals.Rectangle)._origin_extent_(self,aPoint);
  6405. }, function($ctx1) {$ctx1.fill(self,"extent:",{aPoint:aPoint},$globals.Point)});
  6406. },
  6407. args: ["aPoint"],
  6408. source: "extent: aPoint\x0a\x09^ Rectangle origin: self extent: aPoint",
  6409. referencedClasses: ["Rectangle"],
  6410. messageSends: ["origin:extent:"]
  6411. }),
  6412. $globals.Point);
  6413. $core.addMethod(
  6414. $core.method({
  6415. selector: "normal",
  6416. protocol: "point functions",
  6417. fn: function (){
  6418. var self=this,$self=this;
  6419. var n,d;
  6420. return $core.withContext(function($ctx1) {
  6421. var $4,$3,$6,$5,$2,$1;
  6422. n=$recv($recv($self["@y"])._negated()).__at($self["@x"]);
  6423. $ctx1.sendIdx["@"]=1;
  6424. $4=$recv(n)._x();
  6425. $ctx1.sendIdx["x"]=1;
  6426. $3=$recv($4).__star($recv(n)._x());
  6427. $ctx1.sendIdx["*"]=1;
  6428. $6=$recv(n)._y();
  6429. $ctx1.sendIdx["y"]=1;
  6430. $5=$recv($6).__star($recv(n)._y());
  6431. d=$recv($3).__plus($5);
  6432. $2=d;
  6433. $1=$recv($2).__eq((0));
  6434. if($core.assert($1)){
  6435. return (-1).__at((0));
  6436. }
  6437. return $recv(n).__slash($recv(d)._sqrt());
  6438. }, function($ctx1) {$ctx1.fill(self,"normal",{n:n,d:d},$globals.Point)});
  6439. },
  6440. args: [],
  6441. 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",
  6442. referencedClasses: [],
  6443. messageSends: ["@", "negated", "ifTrue:", "=", "+", "*", "x", "y", "/", "sqrt"]
  6444. }),
  6445. $globals.Point);
  6446. $core.addMethod(
  6447. $core.method({
  6448. selector: "normalized",
  6449. protocol: "point functions",
  6450. fn: function (){
  6451. var self=this,$self=this;
  6452. var r;
  6453. return $core.withContext(function($ctx1) {
  6454. var $1,$2,$3;
  6455. r=$self._r();
  6456. $1=$recv(r).__eq((0));
  6457. if($core.assert($1)){
  6458. $2=$recv($globals.Point)._x_y_((0),(0));
  6459. $ctx1.sendIdx["x:y:"]=1;
  6460. return $2;
  6461. } else {
  6462. $3=$recv($self["@x"]).__slash(r);
  6463. $ctx1.sendIdx["/"]=1;
  6464. return $recv($globals.Point)._x_y_($3,$recv($self["@y"]).__slash(r));
  6465. }
  6466. return self;
  6467. }, function($ctx1) {$ctx1.fill(self,"normalized",{r:r},$globals.Point)});
  6468. },
  6469. args: [],
  6470. 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 ]",
  6471. referencedClasses: ["Point"],
  6472. messageSends: ["r", "ifTrue:ifFalse:", "=", "x:y:", "/"]
  6473. }),
  6474. $globals.Point);
  6475. $core.addMethod(
  6476. $core.method({
  6477. selector: "printOn:",
  6478. protocol: "printing",
  6479. fn: function (aStream){
  6480. var self=this,$self=this;
  6481. return $core.withContext(function($ctx1) {
  6482. var $1;
  6483. $recv($self["@x"])._printOn_(aStream);
  6484. $ctx1.sendIdx["printOn:"]=1;
  6485. $recv(aStream)._nextPutAll_("@");
  6486. $1=$recv($recv($self["@y"])._notNil())._and_((function(){
  6487. return $core.withContext(function($ctx2) {
  6488. return $recv($self["@y"])._negative();
  6489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6490. }));
  6491. if($core.assert($1)){
  6492. $recv(aStream)._space();
  6493. }
  6494. $recv($self["@y"])._printOn_(aStream);
  6495. return self;
  6496. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  6497. },
  6498. args: ["aStream"],
  6499. 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",
  6500. referencedClasses: [],
  6501. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6502. }),
  6503. $globals.Point);
  6504. $core.addMethod(
  6505. $core.method({
  6506. selector: "r",
  6507. protocol: "polar coordinates",
  6508. fn: function (){
  6509. var self=this,$self=this;
  6510. return $core.withContext(function($ctx1) {
  6511. var $2,$1;
  6512. $2=$recv($self["@x"]).__star($self["@x"]);
  6513. $ctx1.sendIdx["*"]=1;
  6514. $1=$recv($2).__plus($recv($self["@y"]).__star($self["@y"]));
  6515. return $recv($1)._sqrt();
  6516. }, function($ctx1) {$ctx1.fill(self,"r",{},$globals.Point)});
  6517. },
  6518. args: [],
  6519. source: "r\x0a\x09^ ((x * x) + (y * y)) sqrt",
  6520. referencedClasses: [],
  6521. messageSends: ["sqrt", "+", "*"]
  6522. }),
  6523. $globals.Point);
  6524. $core.addMethod(
  6525. $core.method({
  6526. selector: "rectangle:",
  6527. protocol: "rectangle creation",
  6528. fn: function (aPoint){
  6529. var self=this,$self=this;
  6530. return $core.withContext(function($ctx1) {
  6531. return $recv($globals.Rectangle)._point_point_(self,aPoint);
  6532. }, function($ctx1) {$ctx1.fill(self,"rectangle:",{aPoint:aPoint},$globals.Point)});
  6533. },
  6534. args: ["aPoint"],
  6535. source: "rectangle: aPoint\x0a\x09^ Rectangle point: self point: aPoint",
  6536. referencedClasses: ["Rectangle"],
  6537. messageSends: ["point:point:"]
  6538. }),
  6539. $globals.Point);
  6540. $core.addMethod(
  6541. $core.method({
  6542. selector: "translateBy:",
  6543. protocol: "transforming",
  6544. fn: function (delta){
  6545. var self=this,$self=this;
  6546. return $core.withContext(function($ctx1) {
  6547. var $1;
  6548. $1=$recv($recv(delta)._x()).__plus($self["@x"]);
  6549. $ctx1.sendIdx["+"]=1;
  6550. return $recv($1).__at($recv($recv(delta)._y()).__plus($self["@y"]));
  6551. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  6552. },
  6553. args: ["delta"],
  6554. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6555. referencedClasses: [],
  6556. messageSends: ["@", "+", "x", "y"]
  6557. }),
  6558. $globals.Point);
  6559. $core.addMethod(
  6560. $core.method({
  6561. selector: "x",
  6562. protocol: "accessing",
  6563. fn: function (){
  6564. var self=this,$self=this;
  6565. return $self["@x"];
  6566. },
  6567. args: [],
  6568. source: "x\x0a\x09^ x",
  6569. referencedClasses: [],
  6570. messageSends: []
  6571. }),
  6572. $globals.Point);
  6573. $core.addMethod(
  6574. $core.method({
  6575. selector: "x:",
  6576. protocol: "accessing",
  6577. fn: function (aNumber){
  6578. var self=this,$self=this;
  6579. $self["@x"]=aNumber;
  6580. return self;
  6581. },
  6582. args: ["aNumber"],
  6583. source: "x: aNumber\x0a\x09x := aNumber",
  6584. referencedClasses: [],
  6585. messageSends: []
  6586. }),
  6587. $globals.Point);
  6588. $core.addMethod(
  6589. $core.method({
  6590. selector: "y",
  6591. protocol: "accessing",
  6592. fn: function (){
  6593. var self=this,$self=this;
  6594. return $self["@y"];
  6595. },
  6596. args: [],
  6597. source: "y\x0a\x09^ y",
  6598. referencedClasses: [],
  6599. messageSends: []
  6600. }),
  6601. $globals.Point);
  6602. $core.addMethod(
  6603. $core.method({
  6604. selector: "y:",
  6605. protocol: "accessing",
  6606. fn: function (aNumber){
  6607. var self=this,$self=this;
  6608. $self["@y"]=aNumber;
  6609. return self;
  6610. },
  6611. args: ["aNumber"],
  6612. source: "y: aNumber\x0a\x09y := aNumber",
  6613. referencedClasses: [],
  6614. messageSends: []
  6615. }),
  6616. $globals.Point);
  6617. $core.addMethod(
  6618. $core.method({
  6619. selector: "classTag",
  6620. protocol: "accessing",
  6621. fn: function (){
  6622. var self=this,$self=this;
  6623. return "magnitude";
  6624. },
  6625. args: [],
  6626. 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'",
  6627. referencedClasses: [],
  6628. messageSends: []
  6629. }),
  6630. $globals.Point.a$cls);
  6631. $core.addMethod(
  6632. $core.method({
  6633. selector: "x:y:",
  6634. protocol: "instance creation",
  6635. fn: function (aNumber,anotherNumber){
  6636. var self=this,$self=this;
  6637. return $core.withContext(function($ctx1) {
  6638. var $1;
  6639. $1=$self._new();
  6640. $recv($1)._x_(aNumber);
  6641. $recv($1)._y_(anotherNumber);
  6642. return $recv($1)._yourself();
  6643. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.a$cls)});
  6644. },
  6645. args: ["aNumber", "anotherNumber"],
  6646. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  6647. referencedClasses: [],
  6648. messageSends: ["x:", "new", "y:", "yourself"]
  6649. }),
  6650. $globals.Point.a$cls);
  6651. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  6652. $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'`.";
  6653. $core.addMethod(
  6654. $core.method({
  6655. selector: "next",
  6656. protocol: "accessing",
  6657. fn: function (){
  6658. var self=this,$self=this;
  6659. return $core.withContext(function($ctx1) {
  6660. return Math.random();
  6661. return self;
  6662. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  6663. },
  6664. args: [],
  6665. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  6666. referencedClasses: [],
  6667. messageSends: []
  6668. }),
  6669. $globals.Random);
  6670. $core.addMethod(
  6671. $core.method({
  6672. selector: "next:",
  6673. protocol: "accessing",
  6674. fn: function (anInteger){
  6675. var self=this,$self=this;
  6676. return $core.withContext(function($ctx1) {
  6677. return $recv((1)._to_(anInteger))._collect_((function(each){
  6678. return $core.withContext(function($ctx2) {
  6679. return $self._next();
  6680. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6681. }));
  6682. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  6683. },
  6684. args: ["anInteger"],
  6685. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  6686. referencedClasses: [],
  6687. messageSends: ["collect:", "to:", "next"]
  6688. }),
  6689. $globals.Random);
  6690. $core.addClass("Rectangle", $globals.Object, ["origin", "corner"], "Kernel-Objects");
  6691. $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.";
  6692. $core.addMethod(
  6693. $core.method({
  6694. selector: "=",
  6695. protocol: "testing",
  6696. fn: function (aRectangle){
  6697. var self=this,$self=this;
  6698. return $core.withContext(function($ctx1) {
  6699. var $1;
  6700. $1=$recv($self["@origin"]).__eq($recv(aRectangle)._origin());
  6701. $ctx1.sendIdx["="]=1;
  6702. return $recv($1)._and_((function(){
  6703. return $core.withContext(function($ctx2) {
  6704. return $recv($self["@corner"]).__eq($recv(aRectangle)._corner());
  6705. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6706. }));
  6707. }, function($ctx1) {$ctx1.fill(self,"=",{aRectangle:aRectangle},$globals.Rectangle)});
  6708. },
  6709. args: ["aRectangle"],
  6710. source: "= aRectangle\x0a\x09^ origin = aRectangle origin and: [ corner = aRectangle corner ]",
  6711. referencedClasses: [],
  6712. messageSends: ["and:", "=", "origin", "corner"]
  6713. }),
  6714. $globals.Rectangle);
  6715. $core.addMethod(
  6716. $core.method({
  6717. selector: "containsPoint:",
  6718. protocol: "testing",
  6719. fn: function (aPoint){
  6720. var self=this,$self=this;
  6721. return $core.withContext(function($ctx1) {
  6722. return $recv($recv($self["@origin"]).__lt_eq(aPoint))._and_((function(){
  6723. return $core.withContext(function($ctx2) {
  6724. return $recv($self["@corner"]).__gt_eq(aPoint);
  6725. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6726. }));
  6727. }, function($ctx1) {$ctx1.fill(self,"containsPoint:",{aPoint:aPoint},$globals.Rectangle)});
  6728. },
  6729. args: ["aPoint"],
  6730. source: "containsPoint: aPoint\x0a\x09^ origin <= aPoint and: [ corner >= aPoint ]",
  6731. referencedClasses: [],
  6732. messageSends: ["and:", "<=", ">="]
  6733. }),
  6734. $globals.Rectangle);
  6735. $core.addMethod(
  6736. $core.method({
  6737. selector: "containsRect:",
  6738. protocol: "testing",
  6739. fn: function (aRect){
  6740. var self=this,$self=this;
  6741. return $core.withContext(function($ctx1) {
  6742. return $recv($recv($recv(aRect)._origin()).__gt_eq($self["@origin"]))._and_((function(){
  6743. return $core.withContext(function($ctx2) {
  6744. return $recv($recv(aRect)._corner()).__lt_eq($self["@corner"]);
  6745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6746. }));
  6747. }, function($ctx1) {$ctx1.fill(self,"containsRect:",{aRect:aRect},$globals.Rectangle)});
  6748. },
  6749. args: ["aRect"],
  6750. source: "containsRect: aRect\x0a\x09^ aRect origin >= origin and: [ aRect corner <= corner ]",
  6751. referencedClasses: [],
  6752. messageSends: ["and:", ">=", "origin", "<=", "corner"]
  6753. }),
  6754. $globals.Rectangle);
  6755. $core.addMethod(
  6756. $core.method({
  6757. selector: "corner",
  6758. protocol: "accessing",
  6759. fn: function (){
  6760. var self=this,$self=this;
  6761. return $self["@corner"];
  6762. },
  6763. args: [],
  6764. source: "corner\x0a\x09^ corner",
  6765. referencedClasses: [],
  6766. messageSends: []
  6767. }),
  6768. $globals.Rectangle);
  6769. $core.addMethod(
  6770. $core.method({
  6771. selector: "origin",
  6772. protocol: "accessing",
  6773. fn: function (){
  6774. var self=this,$self=this;
  6775. return $self["@origin"];
  6776. },
  6777. args: [],
  6778. source: "origin\x0a\x09^ origin",
  6779. referencedClasses: [],
  6780. messageSends: []
  6781. }),
  6782. $globals.Rectangle);
  6783. $core.addMethod(
  6784. $core.method({
  6785. selector: "printOn:",
  6786. protocol: "testing",
  6787. fn: function (aStream){
  6788. var self=this,$self=this;
  6789. return $core.withContext(function($ctx1) {
  6790. $recv($self["@origin"])._printOn_(aStream);
  6791. $ctx1.sendIdx["printOn:"]=1;
  6792. $recv(aStream)._nextPutAll_(" corner: ");
  6793. $recv($self["@corner"])._printOn_(aStream);
  6794. return self;
  6795. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Rectangle)});
  6796. },
  6797. args: ["aStream"],
  6798. source: "printOn: aStream\x0a\x09origin printOn: aStream.\x0a\x09aStream nextPutAll: ' corner: '.\x0a\x09corner printOn: aStream.",
  6799. referencedClasses: [],
  6800. messageSends: ["printOn:", "nextPutAll:"]
  6801. }),
  6802. $globals.Rectangle);
  6803. $core.addMethod(
  6804. $core.method({
  6805. selector: "setPoint:point:",
  6806. protocol: "private",
  6807. fn: function (pt1,pt2){
  6808. var self=this,$self=this;
  6809. return $core.withContext(function($ctx1) {
  6810. var $2,$3,$1,$5,$6,$4,$8,$7,$10,$9;
  6811. $2=$recv(pt1)._x();
  6812. $ctx1.sendIdx["x"]=1;
  6813. $3=$recv(pt2)._x();
  6814. $ctx1.sendIdx["x"]=2;
  6815. $1=$recv($2)._min_($3);
  6816. $ctx1.sendIdx["min:"]=1;
  6817. $5=$recv(pt1)._y();
  6818. $ctx1.sendIdx["y"]=1;
  6819. $6=$recv(pt2)._y();
  6820. $ctx1.sendIdx["y"]=2;
  6821. $4=$recv($5)._min_($6);
  6822. $self["@origin"]=$recv($1).__at($4);
  6823. $ctx1.sendIdx["@"]=1;
  6824. $8=$recv(pt1)._x();
  6825. $ctx1.sendIdx["x"]=3;
  6826. $7=$recv($8)._max_($recv(pt2)._x());
  6827. $ctx1.sendIdx["max:"]=1;
  6828. $10=$recv(pt1)._y();
  6829. $ctx1.sendIdx["y"]=3;
  6830. $9=$recv($10)._max_($recv(pt2)._y());
  6831. $self["@corner"]=$recv($7).__at($9);
  6832. return self;
  6833. }, function($ctx1) {$ctx1.fill(self,"setPoint:point:",{pt1:pt1,pt2:pt2},$globals.Rectangle)});
  6834. },
  6835. args: ["pt1", "pt2"],
  6836. 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).",
  6837. referencedClasses: [],
  6838. messageSends: ["@", "min:", "x", "y", "max:"]
  6839. }),
  6840. $globals.Rectangle);
  6841. $core.addMethod(
  6842. $core.method({
  6843. selector: "origin:corner:",
  6844. protocol: "instance creation",
  6845. fn: function (anOrigin,aCorner){
  6846. var self=this,$self=this;
  6847. return $core.withContext(function($ctx1) {
  6848. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6849. }, function($ctx1) {$ctx1.fill(self,"origin:corner:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6850. },
  6851. args: ["anOrigin", "aCorner"],
  6852. source: "origin: anOrigin corner: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  6853. referencedClasses: [],
  6854. messageSends: ["setPoint:point:", "basicNew"]
  6855. }),
  6856. $globals.Rectangle.a$cls);
  6857. $core.addMethod(
  6858. $core.method({
  6859. selector: "origin:extent:",
  6860. protocol: "instance creation",
  6861. fn: function (anOrigin,anExtent){
  6862. var self=this,$self=this;
  6863. return $core.withContext(function($ctx1) {
  6864. return $recv($self._basicNew())._setPoint_point_(anOrigin,$recv(anOrigin).__plus(anExtent));
  6865. }, function($ctx1) {$ctx1.fill(self,"origin:extent:",{anOrigin:anOrigin,anExtent:anExtent},$globals.Rectangle.a$cls)});
  6866. },
  6867. args: ["anOrigin", "anExtent"],
  6868. source: "origin: anOrigin extent: anExtent\x0a\x09^ self basicNew setPoint: anOrigin point: anOrigin + anExtent.",
  6869. referencedClasses: [],
  6870. messageSends: ["setPoint:point:", "basicNew", "+"]
  6871. }),
  6872. $globals.Rectangle.a$cls);
  6873. $core.addMethod(
  6874. $core.method({
  6875. selector: "point:point:",
  6876. protocol: "instance creation",
  6877. fn: function (anOrigin,aCorner){
  6878. var self=this,$self=this;
  6879. return $core.withContext(function($ctx1) {
  6880. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6881. }, function($ctx1) {$ctx1.fill(self,"point:point:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6882. },
  6883. args: ["anOrigin", "aCorner"],
  6884. source: "point: anOrigin point: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  6885. referencedClasses: [],
  6886. messageSends: ["setPoint:point:", "basicNew"]
  6887. }),
  6888. $globals.Rectangle.a$cls);
  6889. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  6890. $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`.";
  6891. $core.addMethod(
  6892. $core.method({
  6893. selector: "==",
  6894. protocol: "testing",
  6895. fn: function (anObject){
  6896. var self=this,$self=this;
  6897. return $core.withContext(function($ctx1) {
  6898. return $recv(anObject)._isNil();
  6899. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.UndefinedObject)});
  6900. },
  6901. args: ["anObject"],
  6902. source: "== anObject\x0a\x09^ anObject isNil",
  6903. referencedClasses: [],
  6904. messageSends: ["isNil"]
  6905. }),
  6906. $globals.UndefinedObject);
  6907. $core.addMethod(
  6908. $core.method({
  6909. selector: "asJavaScriptObject",
  6910. protocol: "converting",
  6911. fn: function (){
  6912. var self=this,$self=this;
  6913. return null;
  6914. },
  6915. args: [],
  6916. source: "asJavaScriptObject\x0a\x09^ null",
  6917. referencedClasses: [],
  6918. messageSends: []
  6919. }),
  6920. $globals.UndefinedObject);
  6921. $core.addMethod(
  6922. $core.method({
  6923. selector: "deepCopy",
  6924. protocol: "copying",
  6925. fn: function (){
  6926. var self=this,$self=this;
  6927. return self;
  6928. },
  6929. args: [],
  6930. source: "deepCopy\x0a\x09^ self",
  6931. referencedClasses: [],
  6932. messageSends: []
  6933. }),
  6934. $globals.UndefinedObject);
  6935. $core.addMethod(
  6936. $core.method({
  6937. selector: "identityHash",
  6938. protocol: "accessing",
  6939. fn: function (){
  6940. var self=this,$self=this;
  6941. return "NIL";
  6942. },
  6943. args: [],
  6944. source: "identityHash\x0a\x09^ 'NIL'",
  6945. referencedClasses: [],
  6946. messageSends: []
  6947. }),
  6948. $globals.UndefinedObject);
  6949. $core.addMethod(
  6950. $core.method({
  6951. selector: "ifNil:",
  6952. protocol: "testing",
  6953. fn: function (aBlock){
  6954. var self=this,$self=this;
  6955. return $core.withContext(function($ctx1) {
  6956. return $self._ifNil_ifNotNil_(aBlock,(function(){
  6957. }));
  6958. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  6959. },
  6960. args: ["aBlock"],
  6961. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  6962. referencedClasses: [],
  6963. messageSends: ["ifNil:ifNotNil:"]
  6964. }),
  6965. $globals.UndefinedObject);
  6966. $core.addMethod(
  6967. $core.method({
  6968. selector: "ifNil:ifNotNil:",
  6969. protocol: "testing",
  6970. fn: function (aBlock,anotherBlock){
  6971. var self=this,$self=this;
  6972. return $core.withContext(function($ctx1) {
  6973. return $recv(aBlock)._value();
  6974. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  6975. },
  6976. args: ["aBlock", "anotherBlock"],
  6977. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  6978. referencedClasses: [],
  6979. messageSends: ["value"]
  6980. }),
  6981. $globals.UndefinedObject);
  6982. $core.addMethod(
  6983. $core.method({
  6984. selector: "ifNotNil:",
  6985. protocol: "testing",
  6986. fn: function (aBlock){
  6987. var self=this,$self=this;
  6988. return self;
  6989. },
  6990. args: ["aBlock"],
  6991. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  6992. referencedClasses: [],
  6993. messageSends: []
  6994. }),
  6995. $globals.UndefinedObject);
  6996. $core.addMethod(
  6997. $core.method({
  6998. selector: "ifNotNil:ifNil:",
  6999. protocol: "testing",
  7000. fn: function (aBlock,anotherBlock){
  7001. var self=this,$self=this;
  7002. return $core.withContext(function($ctx1) {
  7003. return $recv(anotherBlock)._value();
  7004. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7005. },
  7006. args: ["aBlock", "anotherBlock"],
  7007. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  7008. referencedClasses: [],
  7009. messageSends: ["value"]
  7010. }),
  7011. $globals.UndefinedObject);
  7012. $core.addMethod(
  7013. $core.method({
  7014. selector: "isImmutable",
  7015. protocol: "testing",
  7016. fn: function (){
  7017. var self=this,$self=this;
  7018. return true;
  7019. },
  7020. args: [],
  7021. source: "isImmutable\x0a\x09^ true",
  7022. referencedClasses: [],
  7023. messageSends: []
  7024. }),
  7025. $globals.UndefinedObject);
  7026. $core.addMethod(
  7027. $core.method({
  7028. selector: "isNil",
  7029. protocol: "testing",
  7030. fn: function (){
  7031. var self=this,$self=this;
  7032. return true;
  7033. },
  7034. args: [],
  7035. source: "isNil\x0a\x09^ true",
  7036. referencedClasses: [],
  7037. messageSends: []
  7038. }),
  7039. $globals.UndefinedObject);
  7040. $core.addMethod(
  7041. $core.method({
  7042. selector: "notNil",
  7043. protocol: "testing",
  7044. fn: function (){
  7045. var self=this,$self=this;
  7046. return false;
  7047. },
  7048. args: [],
  7049. source: "notNil\x0a\x09^ false",
  7050. referencedClasses: [],
  7051. messageSends: []
  7052. }),
  7053. $globals.UndefinedObject);
  7054. $core.addMethod(
  7055. $core.method({
  7056. selector: "printOn:",
  7057. protocol: "printing",
  7058. fn: function (aStream){
  7059. var self=this,$self=this;
  7060. return $core.withContext(function($ctx1) {
  7061. $recv(aStream)._nextPutAll_("nil");
  7062. return self;
  7063. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  7064. },
  7065. args: ["aStream"],
  7066. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  7067. referencedClasses: [],
  7068. messageSends: ["nextPutAll:"]
  7069. }),
  7070. $globals.UndefinedObject);
  7071. $core.addMethod(
  7072. $core.method({
  7073. selector: "shallowCopy",
  7074. protocol: "copying",
  7075. fn: function (){
  7076. var self=this,$self=this;
  7077. return self;
  7078. },
  7079. args: [],
  7080. source: "shallowCopy\x0a\x09^ self",
  7081. referencedClasses: [],
  7082. messageSends: []
  7083. }),
  7084. $globals.UndefinedObject);
  7085. $core.addMethod(
  7086. $core.method({
  7087. selector: "value",
  7088. protocol: "evaluating",
  7089. fn: function (){
  7090. var self=this,$self=this;
  7091. return $core.withContext(function($ctx1) {
  7092. return null;
  7093. return self;
  7094. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.UndefinedObject)});
  7095. },
  7096. args: [],
  7097. source: "value\x0a\x09<inlineJS: 'return null'>",
  7098. referencedClasses: [],
  7099. messageSends: []
  7100. }),
  7101. $globals.UndefinedObject);
  7102. $core.addMethod(
  7103. $core.method({
  7104. selector: "new",
  7105. protocol: "instance creation",
  7106. fn: function (){
  7107. var self=this,$self=this;
  7108. return $core.withContext(function($ctx1) {
  7109. $self._error_("You cannot create new instances of UndefinedObject. Use nil");
  7110. return self;
  7111. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.a$cls)});
  7112. },
  7113. args: [],
  7114. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  7115. referencedClasses: [],
  7116. messageSends: ["error:"]
  7117. }),
  7118. $globals.UndefinedObject.a$cls);
  7119. $core.setTraitComposition([{trait: $globals.TSubclassable}], $globals.UndefinedObject);
  7120. });
  7121. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7122. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  7123. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  7124. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7125. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  7126. $core.addPackage("Kernel-Collections");
  7127. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  7128. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7129. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7130. $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:`";
  7131. $core.addMethod(
  7132. $core.method({
  7133. selector: "=",
  7134. protocol: "comparing",
  7135. fn: function (anAssociation){
  7136. var self=this,$self=this;
  7137. return $core.withContext(function($ctx1) {
  7138. var $3,$2,$5,$4,$6,$1;
  7139. $3=$self._class();
  7140. $ctx1.sendIdx["class"]=1;
  7141. $2=$recv($3).__eq($recv(anAssociation)._class());
  7142. $ctx1.sendIdx["="]=1;
  7143. $1=$recv($2)._and_((function(){
  7144. return $core.withContext(function($ctx2) {
  7145. $5=$self._key();
  7146. $ctx2.sendIdx["key"]=1;
  7147. $4=$recv($5).__eq($recv(anAssociation)._key());
  7148. $ctx2.sendIdx["="]=2;
  7149. return $recv($4)._and_((function(){
  7150. return $core.withContext(function($ctx3) {
  7151. $6=$self._value();
  7152. $ctx3.sendIdx["value"]=1;
  7153. return $recv($6).__eq($recv(anAssociation)._value());
  7154. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7155. }));
  7156. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7157. }));
  7158. $ctx1.sendIdx["and:"]=1;
  7159. return $1;
  7160. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  7161. },
  7162. args: ["anAssociation"],
  7163. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  7164. referencedClasses: [],
  7165. messageSends: ["and:", "=", "class", "key", "value"]
  7166. }),
  7167. $globals.Association);
  7168. $core.addMethod(
  7169. $core.method({
  7170. selector: "key",
  7171. protocol: "accessing",
  7172. fn: function (){
  7173. var self=this,$self=this;
  7174. return $self["@key"];
  7175. },
  7176. args: [],
  7177. source: "key\x0a\x09^ key",
  7178. referencedClasses: [],
  7179. messageSends: []
  7180. }),
  7181. $globals.Association);
  7182. $core.addMethod(
  7183. $core.method({
  7184. selector: "key:",
  7185. protocol: "accessing",
  7186. fn: function (aKey){
  7187. var self=this,$self=this;
  7188. $self["@key"]=aKey;
  7189. return self;
  7190. },
  7191. args: ["aKey"],
  7192. source: "key: aKey\x0a\x09key := aKey",
  7193. referencedClasses: [],
  7194. messageSends: []
  7195. }),
  7196. $globals.Association);
  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($self._key())._printOn_(aStream);
  7205. $ctx1.sendIdx["printOn:"]=1;
  7206. $recv(aStream)._nextPutAll_(" -> ");
  7207. $recv($self._value())._printOn_(aStream);
  7208. return self;
  7209. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  7210. },
  7211. args: ["aStream"],
  7212. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  7213. referencedClasses: [],
  7214. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  7215. }),
  7216. $globals.Association);
  7217. $core.addMethod(
  7218. $core.method({
  7219. selector: "value",
  7220. protocol: "accessing",
  7221. fn: function (){
  7222. var self=this,$self=this;
  7223. return $self["@value"];
  7224. },
  7225. args: [],
  7226. source: "value\x0a\x09^ value",
  7227. referencedClasses: [],
  7228. messageSends: []
  7229. }),
  7230. $globals.Association);
  7231. $core.addMethod(
  7232. $core.method({
  7233. selector: "value:",
  7234. protocol: "accessing",
  7235. fn: function (aValue){
  7236. var self=this,$self=this;
  7237. $self["@value"]=aValue;
  7238. return self;
  7239. },
  7240. args: ["aValue"],
  7241. source: "value: aValue\x0a\x09value := aValue",
  7242. referencedClasses: [],
  7243. messageSends: []
  7244. }),
  7245. $globals.Association);
  7246. $core.addMethod(
  7247. $core.method({
  7248. selector: "key:value:",
  7249. protocol: "instance creation",
  7250. fn: function (aKey,aValue){
  7251. var self=this,$self=this;
  7252. return $core.withContext(function($ctx1) {
  7253. var $1;
  7254. $1=$self._new();
  7255. $recv($1)._key_(aKey);
  7256. $recv($1)._value_(aValue);
  7257. return $recv($1)._yourself();
  7258. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  7259. },
  7260. args: ["aKey", "aValue"],
  7261. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7262. referencedClasses: [],
  7263. messageSends: ["key:", "new", "value:", "yourself"]
  7264. }),
  7265. $globals.Association.a$cls);
  7266. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  7267. $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`.";
  7268. $core.addMethod(
  7269. $core.method({
  7270. selector: "bucketOfElement:",
  7271. protocol: "accessing",
  7272. fn: function (anObject){
  7273. var self=this,$self=this;
  7274. return $core.withContext(function($ctx1) {
  7275. var hash = $self['@hashBlock'](anObject);
  7276. if (!hash) return null;
  7277. var buckets = $self['@buckets'],
  7278. bucket = buckets[hash];
  7279. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  7280. return bucket;
  7281. ;
  7282. return self;
  7283. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  7284. },
  7285. args: ["anObject"],
  7286. 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'>",
  7287. referencedClasses: [],
  7288. messageSends: []
  7289. }),
  7290. $globals.BucketStore);
  7291. $core.addMethod(
  7292. $core.method({
  7293. selector: "do:",
  7294. protocol: "enumerating",
  7295. fn: function (aBlock){
  7296. var self=this,$self=this;
  7297. return $core.withContext(function($ctx1) {
  7298. var buckets = $self['@buckets'];
  7299. var keys = Object.keys(buckets);
  7300. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  7301. ;
  7302. return self;
  7303. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  7304. },
  7305. args: ["aBlock"],
  7306. 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'>",
  7307. referencedClasses: [],
  7308. messageSends: []
  7309. }),
  7310. $globals.BucketStore);
  7311. $core.addMethod(
  7312. $core.method({
  7313. selector: "hashBlock:",
  7314. protocol: "accessing",
  7315. fn: function (aBlock){
  7316. var self=this,$self=this;
  7317. $self["@hashBlock"]=aBlock;
  7318. return self;
  7319. },
  7320. args: ["aBlock"],
  7321. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  7322. referencedClasses: [],
  7323. messageSends: []
  7324. }),
  7325. $globals.BucketStore);
  7326. $core.addMethod(
  7327. $core.method({
  7328. selector: "initialize",
  7329. protocol: "initialization",
  7330. fn: function (){
  7331. var self=this,$self=this;
  7332. return $core.withContext(function($ctx1) {
  7333. (
  7334. $ctx1.supercall = true,
  7335. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7336. $ctx1.supercall = false;
  7337. $self._removeAll();
  7338. return self;
  7339. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  7340. },
  7341. args: [],
  7342. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  7343. referencedClasses: [],
  7344. messageSends: ["initialize", "removeAll"]
  7345. }),
  7346. $globals.BucketStore);
  7347. $core.addMethod(
  7348. $core.method({
  7349. selector: "newBucket",
  7350. protocol: "private",
  7351. fn: function (){
  7352. var self=this,$self=this;
  7353. return $core.withContext(function($ctx1) {
  7354. $self._subclassResponsibility();
  7355. return self;
  7356. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  7357. },
  7358. args: [],
  7359. source: "newBucket\x0a\x09self subclassResponsibility",
  7360. referencedClasses: [],
  7361. messageSends: ["subclassResponsibility"]
  7362. }),
  7363. $globals.BucketStore);
  7364. $core.addMethod(
  7365. $core.method({
  7366. selector: "removeAll",
  7367. protocol: "adding/removing",
  7368. fn: function (){
  7369. var self=this,$self=this;
  7370. return $core.withContext(function($ctx1) {
  7371. $self['@buckets'] = Object.create(null);;
  7372. return self;
  7373. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  7374. },
  7375. args: [],
  7376. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  7377. referencedClasses: [],
  7378. messageSends: []
  7379. }),
  7380. $globals.BucketStore);
  7381. $core.addMethod(
  7382. $core.method({
  7383. selector: "hashBlock:",
  7384. protocol: "instance creation",
  7385. fn: function (aBlock){
  7386. var self=this,$self=this;
  7387. return $core.withContext(function($ctx1) {
  7388. var $1;
  7389. $1=$self._new();
  7390. $recv($1)._hashBlock_(aBlock);
  7391. return $recv($1)._yourself();
  7392. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  7393. },
  7394. args: ["aBlock"],
  7395. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  7396. referencedClasses: [],
  7397. messageSends: ["hashBlock:", "new", "yourself"]
  7398. }),
  7399. $globals.BucketStore.a$cls);
  7400. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  7401. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  7402. $core.addMethod(
  7403. $core.method({
  7404. selector: "newBucket",
  7405. protocol: "private",
  7406. fn: function (){
  7407. var self=this,$self=this;
  7408. return [];
  7409. },
  7410. args: [],
  7411. source: "newBucket\x0a\x09^ #()",
  7412. referencedClasses: [],
  7413. messageSends: []
  7414. }),
  7415. $globals.ArrayBucketStore);
  7416. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  7417. $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.";
  7418. $core.addMethod(
  7419. $core.method({
  7420. selector: ",",
  7421. protocol: "copying",
  7422. fn: function (aCollection){
  7423. var self=this,$self=this;
  7424. return $core.withContext(function($ctx1) {
  7425. var $1;
  7426. $1=$self._copy();
  7427. $recv($1)._addAll_(aCollection);
  7428. return $recv($1)._yourself();
  7429. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  7430. },
  7431. args: ["aCollection"],
  7432. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7433. referencedClasses: [],
  7434. messageSends: ["addAll:", "copy", "yourself"]
  7435. }),
  7436. $globals.Collection);
  7437. $core.addMethod(
  7438. $core.method({
  7439. selector: "add:",
  7440. protocol: "adding/removing",
  7441. fn: function (anObject){
  7442. var self=this,$self=this;
  7443. return $core.withContext(function($ctx1) {
  7444. $self._subclassResponsibility();
  7445. return self;
  7446. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  7447. },
  7448. args: ["anObject"],
  7449. source: "add: anObject\x0a\x09self subclassResponsibility",
  7450. referencedClasses: [],
  7451. messageSends: ["subclassResponsibility"]
  7452. }),
  7453. $globals.Collection);
  7454. $core.addMethod(
  7455. $core.method({
  7456. selector: "addAll:",
  7457. protocol: "adding/removing",
  7458. fn: function (aCollection){
  7459. var self=this,$self=this;
  7460. return $core.withContext(function($ctx1) {
  7461. $recv(aCollection)._do_((function(each){
  7462. return $core.withContext(function($ctx2) {
  7463. return $self._add_(each);
  7464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7465. }));
  7466. return aCollection;
  7467. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  7468. },
  7469. args: ["aCollection"],
  7470. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  7471. referencedClasses: [],
  7472. messageSends: ["do:", "add:"]
  7473. }),
  7474. $globals.Collection);
  7475. $core.addMethod(
  7476. $core.method({
  7477. selector: "allSatisfy:",
  7478. protocol: "enumerating",
  7479. fn: function (aBlock){
  7480. var self=this,$self=this;
  7481. return $core.withContext(function($ctx1) {
  7482. var $1;
  7483. var $early={};
  7484. try {
  7485. $self._do_((function(each){
  7486. return $core.withContext(function($ctx2) {
  7487. $1=$recv(aBlock)._value_(each);
  7488. if(!$core.assert($1)){
  7489. throw $early=[false];
  7490. }
  7491. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7492. }));
  7493. return true;
  7494. }
  7495. catch(e) {if(e===$early)return e[0]; throw e}
  7496. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  7497. },
  7498. args: ["aBlock"],
  7499. 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",
  7500. referencedClasses: [],
  7501. messageSends: ["do:", "ifFalse:", "value:"]
  7502. }),
  7503. $globals.Collection);
  7504. $core.addMethod(
  7505. $core.method({
  7506. selector: "anyOne",
  7507. protocol: "accessing",
  7508. fn: function (){
  7509. var self=this,$self=this;
  7510. return $core.withContext(function($ctx1) {
  7511. var $early={};
  7512. try {
  7513. $self._ifEmpty_((function(){
  7514. return $core.withContext(function($ctx2) {
  7515. return $self._error_("Collection is empty");
  7516. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7517. }));
  7518. $self._do_((function(each){
  7519. throw $early=[each];
  7520. }));
  7521. return self;
  7522. }
  7523. catch(e) {if(e===$early)return e[0]; throw e}
  7524. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  7525. },
  7526. args: [],
  7527. 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 ]",
  7528. referencedClasses: [],
  7529. messageSends: ["ifEmpty:", "error:", "do:"]
  7530. }),
  7531. $globals.Collection);
  7532. $core.addMethod(
  7533. $core.method({
  7534. selector: "anySatisfy:",
  7535. protocol: "enumerating",
  7536. fn: function (aBlock){
  7537. var self=this,$self=this;
  7538. return $core.withContext(function($ctx1) {
  7539. var $1;
  7540. var $early={};
  7541. try {
  7542. $self._do_((function(each){
  7543. return $core.withContext(function($ctx2) {
  7544. $1=$recv(aBlock)._value_(each);
  7545. if($core.assert($1)){
  7546. throw $early=[true];
  7547. }
  7548. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7549. }));
  7550. return false;
  7551. }
  7552. catch(e) {if(e===$early)return e[0]; throw e}
  7553. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  7554. },
  7555. args: ["aBlock"],
  7556. 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",
  7557. referencedClasses: [],
  7558. messageSends: ["do:", "ifTrue:", "value:"]
  7559. }),
  7560. $globals.Collection);
  7561. $core.addMethod(
  7562. $core.method({
  7563. selector: "asArray",
  7564. protocol: "converting",
  7565. fn: function (){
  7566. var self=this,$self=this;
  7567. return $core.withContext(function($ctx1) {
  7568. return $recv($globals.Array)._withAll_(self);
  7569. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  7570. },
  7571. args: [],
  7572. source: "asArray\x0a\x09^ Array withAll: self",
  7573. referencedClasses: ["Array"],
  7574. messageSends: ["withAll:"]
  7575. }),
  7576. $globals.Collection);
  7577. $core.addMethod(
  7578. $core.method({
  7579. selector: "asJavaScriptObject",
  7580. protocol: "converting",
  7581. fn: function (){
  7582. var self=this,$self=this;
  7583. return $core.withContext(function($ctx1) {
  7584. return $recv($self._asArray())._collect_((function(each){
  7585. return $core.withContext(function($ctx2) {
  7586. return $recv(each)._asJavaScriptObject();
  7587. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7588. }));
  7589. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  7590. },
  7591. args: [],
  7592. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  7593. referencedClasses: [],
  7594. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  7595. }),
  7596. $globals.Collection);
  7597. $core.addMethod(
  7598. $core.method({
  7599. selector: "asOrderedCollection",
  7600. protocol: "converting",
  7601. fn: function (){
  7602. var self=this,$self=this;
  7603. return $core.withContext(function($ctx1) {
  7604. return $self._asArray();
  7605. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  7606. },
  7607. args: [],
  7608. source: "asOrderedCollection\x0a\x09^ self asArray",
  7609. referencedClasses: [],
  7610. messageSends: ["asArray"]
  7611. }),
  7612. $globals.Collection);
  7613. $core.addMethod(
  7614. $core.method({
  7615. selector: "asSet",
  7616. protocol: "converting",
  7617. fn: function (){
  7618. var self=this,$self=this;
  7619. return $core.withContext(function($ctx1) {
  7620. return $recv($globals.Set)._withAll_(self);
  7621. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  7622. },
  7623. args: [],
  7624. source: "asSet\x0a\x09^ Set withAll: self",
  7625. referencedClasses: ["Set"],
  7626. messageSends: ["withAll:"]
  7627. }),
  7628. $globals.Collection);
  7629. $core.addMethod(
  7630. $core.method({
  7631. selector: "collect:",
  7632. protocol: "enumerating",
  7633. fn: function (aBlock){
  7634. var self=this,$self=this;
  7635. var stream;
  7636. return $core.withContext(function($ctx1) {
  7637. stream=$recv($recv($self._class())._new())._writeStream();
  7638. $self._do_((function(each){
  7639. return $core.withContext(function($ctx2) {
  7640. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  7641. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7642. }));
  7643. return $recv(stream)._contents();
  7644. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  7645. },
  7646. args: ["aBlock"],
  7647. 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",
  7648. referencedClasses: [],
  7649. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  7650. }),
  7651. $globals.Collection);
  7652. $core.addMethod(
  7653. $core.method({
  7654. selector: "copyWith:",
  7655. protocol: "copying",
  7656. fn: function (anObject){
  7657. var self=this,$self=this;
  7658. return $core.withContext(function($ctx1) {
  7659. var $1;
  7660. $1=$self._copy();
  7661. $recv($1)._add_(anObject);
  7662. return $recv($1)._yourself();
  7663. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  7664. },
  7665. args: ["anObject"],
  7666. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  7667. referencedClasses: [],
  7668. messageSends: ["add:", "copy", "yourself"]
  7669. }),
  7670. $globals.Collection);
  7671. $core.addMethod(
  7672. $core.method({
  7673. selector: "copyWithAll:",
  7674. protocol: "copying",
  7675. fn: function (aCollection){
  7676. var self=this,$self=this;
  7677. return $core.withContext(function($ctx1) {
  7678. var $1;
  7679. $1=$self._copy();
  7680. $recv($1)._addAll_(aCollection);
  7681. return $recv($1)._yourself();
  7682. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  7683. },
  7684. args: ["aCollection"],
  7685. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  7686. referencedClasses: [],
  7687. messageSends: ["addAll:", "copy", "yourself"]
  7688. }),
  7689. $globals.Collection);
  7690. $core.addMethod(
  7691. $core.method({
  7692. selector: "copyWithout:",
  7693. protocol: "copying",
  7694. fn: function (anObject){
  7695. var self=this,$self=this;
  7696. return $core.withContext(function($ctx1) {
  7697. return $self._reject_((function(each){
  7698. return $core.withContext(function($ctx2) {
  7699. return $recv(each).__eq(anObject);
  7700. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7701. }));
  7702. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  7703. },
  7704. args: ["anObject"],
  7705. 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 ]",
  7706. referencedClasses: [],
  7707. messageSends: ["reject:", "="]
  7708. }),
  7709. $globals.Collection);
  7710. $core.addMethod(
  7711. $core.method({
  7712. selector: "copyWithoutAll:",
  7713. protocol: "copying",
  7714. fn: function (aCollection){
  7715. var self=this,$self=this;
  7716. return $core.withContext(function($ctx1) {
  7717. return $self._reject_((function(each){
  7718. return $core.withContext(function($ctx2) {
  7719. return $recv(aCollection)._includes_(each);
  7720. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7721. }));
  7722. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  7723. },
  7724. args: ["aCollection"],
  7725. 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 ]",
  7726. referencedClasses: [],
  7727. messageSends: ["reject:", "includes:"]
  7728. }),
  7729. $globals.Collection);
  7730. $core.addMethod(
  7731. $core.method({
  7732. selector: "deepCopy",
  7733. protocol: "copying",
  7734. fn: function (){
  7735. var self=this,$self=this;
  7736. return $core.withContext(function($ctx1) {
  7737. return $self._collect_((function(each){
  7738. return $core.withContext(function($ctx2) {
  7739. return $recv(each)._deepCopy();
  7740. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7741. }));
  7742. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  7743. },
  7744. args: [],
  7745. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  7746. referencedClasses: [],
  7747. messageSends: ["collect:", "deepCopy"]
  7748. }),
  7749. $globals.Collection);
  7750. $core.addMethod(
  7751. $core.method({
  7752. selector: "detect:",
  7753. protocol: "enumerating",
  7754. fn: function (aBlock){
  7755. var self=this,$self=this;
  7756. return $core.withContext(function($ctx1) {
  7757. return $self._detect_ifNone_(aBlock,(function(){
  7758. return $core.withContext(function($ctx2) {
  7759. return $self._errorNotFound();
  7760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7761. }));
  7762. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  7763. },
  7764. args: ["aBlock"],
  7765. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  7766. referencedClasses: [],
  7767. messageSends: ["detect:ifNone:", "errorNotFound"]
  7768. }),
  7769. $globals.Collection);
  7770. $core.addMethod(
  7771. $core.method({
  7772. selector: "detect:ifNone:",
  7773. protocol: "enumerating",
  7774. fn: function (aBlock,anotherBlock){
  7775. var self=this,$self=this;
  7776. return $core.withContext(function($ctx1) {
  7777. $self._subclassResponsibility();
  7778. return self;
  7779. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7780. },
  7781. args: ["aBlock", "anotherBlock"],
  7782. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  7783. referencedClasses: [],
  7784. messageSends: ["subclassResponsibility"]
  7785. }),
  7786. $globals.Collection);
  7787. $core.addMethod(
  7788. $core.method({
  7789. selector: "do:",
  7790. protocol: "enumerating",
  7791. fn: function (aBlock){
  7792. var self=this,$self=this;
  7793. return $core.withContext(function($ctx1) {
  7794. $self._subclassResponsibility();
  7795. return self;
  7796. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  7797. },
  7798. args: ["aBlock"],
  7799. source: "do: aBlock\x0a\x09self subclassResponsibility",
  7800. referencedClasses: [],
  7801. messageSends: ["subclassResponsibility"]
  7802. }),
  7803. $globals.Collection);
  7804. $core.addMethod(
  7805. $core.method({
  7806. selector: "do:separatedBy:",
  7807. protocol: "enumerating",
  7808. fn: function (aBlock,anotherBlock){
  7809. var self=this,$self=this;
  7810. var actionBeforeElement;
  7811. return $core.withContext(function($ctx1) {
  7812. actionBeforeElement=(function(){
  7813. actionBeforeElement=anotherBlock;
  7814. return actionBeforeElement;
  7815. });
  7816. $self._do_((function(each){
  7817. return $core.withContext(function($ctx2) {
  7818. $recv(actionBeforeElement)._value();
  7819. return $recv(aBlock)._value_(each);
  7820. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7821. }));
  7822. return self;
  7823. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  7824. },
  7825. args: ["aBlock", "anotherBlock"],
  7826. 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 ]",
  7827. referencedClasses: [],
  7828. messageSends: ["do:", "value", "value:"]
  7829. }),
  7830. $globals.Collection);
  7831. $core.addMethod(
  7832. $core.method({
  7833. selector: "errorNotFound",
  7834. protocol: "error handling",
  7835. fn: function (){
  7836. var self=this,$self=this;
  7837. return $core.withContext(function($ctx1) {
  7838. $self._error_("Object is not in the collection");
  7839. return self;
  7840. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  7841. },
  7842. args: [],
  7843. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  7844. referencedClasses: [],
  7845. messageSends: ["error:"]
  7846. }),
  7847. $globals.Collection);
  7848. $core.addMethod(
  7849. $core.method({
  7850. selector: "ifEmpty:",
  7851. protocol: "testing",
  7852. fn: function (aBlock){
  7853. var self=this,$self=this;
  7854. return $core.withContext(function($ctx1) {
  7855. var $1;
  7856. $1=$self._isEmpty();
  7857. if($core.assert($1)){
  7858. return $recv(aBlock)._value();
  7859. } else {
  7860. return self;
  7861. }
  7862. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  7863. },
  7864. args: ["aBlock"],
  7865. 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 ]",
  7866. referencedClasses: [],
  7867. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  7868. }),
  7869. $globals.Collection);
  7870. $core.addMethod(
  7871. $core.method({
  7872. selector: "ifEmpty:ifNotEmpty:",
  7873. protocol: "testing",
  7874. fn: function (aBlock,anotherBlock){
  7875. var self=this,$self=this;
  7876. return $core.withContext(function($ctx1) {
  7877. var $1;
  7878. $1=$self._isEmpty();
  7879. if($core.assert($1)){
  7880. return $recv(aBlock)._value();
  7881. } else {
  7882. return $recv(anotherBlock)._value_(self);
  7883. }
  7884. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7885. },
  7886. args: ["aBlock", "anotherBlock"],
  7887. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  7888. referencedClasses: [],
  7889. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  7890. }),
  7891. $globals.Collection);
  7892. $core.addMethod(
  7893. $core.method({
  7894. selector: "ifNotEmpty:",
  7895. protocol: "testing",
  7896. fn: function (aBlock){
  7897. var self=this,$self=this;
  7898. return $core.withContext(function($ctx1) {
  7899. var $1;
  7900. $1=$self._notEmpty();
  7901. if($core.assert($1)){
  7902. return $recv(aBlock)._value_(self);
  7903. } else {
  7904. return self;
  7905. }
  7906. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  7907. },
  7908. args: ["aBlock"],
  7909. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  7910. referencedClasses: [],
  7911. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  7912. }),
  7913. $globals.Collection);
  7914. $core.addMethod(
  7915. $core.method({
  7916. selector: "ifNotEmpty:ifEmpty:",
  7917. protocol: "testing",
  7918. fn: function (aBlock,anotherBlock){
  7919. var self=this,$self=this;
  7920. return $core.withContext(function($ctx1) {
  7921. var $1;
  7922. $1=$self._notEmpty();
  7923. if($core.assert($1)){
  7924. return $recv(aBlock)._value_(self);
  7925. } else {
  7926. return $recv(anotherBlock)._value();
  7927. }
  7928. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7929. },
  7930. args: ["aBlock", "anotherBlock"],
  7931. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  7932. referencedClasses: [],
  7933. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  7934. }),
  7935. $globals.Collection);
  7936. $core.addMethod(
  7937. $core.method({
  7938. selector: "includes:",
  7939. protocol: "testing",
  7940. fn: function (anObject){
  7941. var self=this,$self=this;
  7942. return $core.withContext(function($ctx1) {
  7943. return $self._anySatisfy_((function(each){
  7944. return $core.withContext(function($ctx2) {
  7945. return $recv(each).__eq(anObject);
  7946. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7947. }));
  7948. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  7949. },
  7950. args: ["anObject"],
  7951. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  7952. referencedClasses: [],
  7953. messageSends: ["anySatisfy:", "="]
  7954. }),
  7955. $globals.Collection);
  7956. $core.addMethod(
  7957. $core.method({
  7958. selector: "inject:into:",
  7959. protocol: "enumerating",
  7960. fn: function (anObject,aBlock){
  7961. var self=this,$self=this;
  7962. var result;
  7963. return $core.withContext(function($ctx1) {
  7964. result=anObject;
  7965. $self._do_((function(each){
  7966. return $core.withContext(function($ctx2) {
  7967. result=$recv(aBlock)._value_value_(result,each);
  7968. return result;
  7969. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7970. }));
  7971. return result;
  7972. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  7973. },
  7974. args: ["anObject", "aBlock"],
  7975. 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",
  7976. referencedClasses: [],
  7977. messageSends: ["do:", "value:value:"]
  7978. }),
  7979. $globals.Collection);
  7980. $core.addMethod(
  7981. $core.method({
  7982. selector: "intersection:",
  7983. protocol: "enumerating",
  7984. fn: function (aCollection){
  7985. var self=this,$self=this;
  7986. var set,outputSet;
  7987. return $core.withContext(function($ctx1) {
  7988. var $2,$1;
  7989. set=$self._asSet();
  7990. outputSet=$recv($globals.Set)._new();
  7991. $recv(aCollection)._do_((function(each){
  7992. return $core.withContext(function($ctx2) {
  7993. $2=$recv(set)._includes_(each);
  7994. $ctx2.sendIdx["includes:"]=1;
  7995. $1=$recv($2)._and_((function(){
  7996. return $core.withContext(function($ctx3) {
  7997. return $recv($recv(outputSet)._includes_(each))._not();
  7998. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7999. }));
  8000. if($core.assert($1)){
  8001. return $recv(outputSet)._add_(each);
  8002. }
  8003. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8004. }));
  8005. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  8006. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  8007. },
  8008. args: ["aCollection"],
  8009. 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",
  8010. referencedClasses: ["Set"],
  8011. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  8012. }),
  8013. $globals.Collection);
  8014. $core.addMethod(
  8015. $core.method({
  8016. selector: "isEmpty",
  8017. protocol: "testing",
  8018. fn: function (){
  8019. var self=this,$self=this;
  8020. return $core.withContext(function($ctx1) {
  8021. return $recv($self._size()).__eq((0));
  8022. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  8023. },
  8024. args: [],
  8025. source: "isEmpty\x0a\x09^ self size = 0",
  8026. referencedClasses: [],
  8027. messageSends: ["=", "size"]
  8028. }),
  8029. $globals.Collection);
  8030. $core.addMethod(
  8031. $core.method({
  8032. selector: "noneSatisfy:",
  8033. protocol: "enumerating",
  8034. fn: function (aBlock){
  8035. var self=this,$self=this;
  8036. return $core.withContext(function($ctx1) {
  8037. var $1;
  8038. var $early={};
  8039. try {
  8040. $self._do_((function(item){
  8041. return $core.withContext(function($ctx2) {
  8042. $1=$recv(aBlock)._value_(item);
  8043. if($core.assert($1)){
  8044. throw $early=[false];
  8045. }
  8046. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  8047. }));
  8048. return true;
  8049. }
  8050. catch(e) {if(e===$early)return e[0]; throw e}
  8051. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  8052. },
  8053. args: ["aBlock"],
  8054. 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",
  8055. referencedClasses: [],
  8056. messageSends: ["do:", "ifTrue:", "value:"]
  8057. }),
  8058. $globals.Collection);
  8059. $core.addMethod(
  8060. $core.method({
  8061. selector: "notEmpty",
  8062. protocol: "testing",
  8063. fn: function (){
  8064. var self=this,$self=this;
  8065. return $core.withContext(function($ctx1) {
  8066. return $recv($self._isEmpty())._not();
  8067. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  8068. },
  8069. args: [],
  8070. source: "notEmpty\x0a\x09^ self isEmpty not",
  8071. referencedClasses: [],
  8072. messageSends: ["not", "isEmpty"]
  8073. }),
  8074. $globals.Collection);
  8075. $core.addMethod(
  8076. $core.method({
  8077. selector: "occurrencesOf:",
  8078. protocol: "accessing",
  8079. fn: function (anObject){
  8080. var self=this,$self=this;
  8081. var tally;
  8082. return $core.withContext(function($ctx1) {
  8083. var $1;
  8084. tally=(0);
  8085. $self._do_((function(each){
  8086. return $core.withContext(function($ctx2) {
  8087. $1=$recv(anObject).__eq(each);
  8088. if($core.assert($1)){
  8089. tally=$recv(tally).__plus((1));
  8090. return tally;
  8091. }
  8092. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8093. }));
  8094. return tally;
  8095. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  8096. },
  8097. args: ["anObject"],
  8098. 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",
  8099. referencedClasses: [],
  8100. messageSends: ["do:", "ifTrue:", "=", "+"]
  8101. }),
  8102. $globals.Collection);
  8103. $core.addMethod(
  8104. $core.method({
  8105. selector: "putOn:",
  8106. protocol: "streaming",
  8107. fn: function (aStream){
  8108. var self=this,$self=this;
  8109. return $core.withContext(function($ctx1) {
  8110. $self._do_((function(each){
  8111. return $core.withContext(function($ctx2) {
  8112. return $recv(each)._putOn_(aStream);
  8113. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8114. }));
  8115. return self;
  8116. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  8117. },
  8118. args: ["aStream"],
  8119. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  8120. referencedClasses: [],
  8121. messageSends: ["do:", "putOn:"]
  8122. }),
  8123. $globals.Collection);
  8124. $core.addMethod(
  8125. $core.method({
  8126. selector: "reject:",
  8127. protocol: "enumerating",
  8128. fn: function (aBlock){
  8129. var self=this,$self=this;
  8130. return $core.withContext(function($ctx1) {
  8131. return $self._select_((function(each){
  8132. return $core.withContext(function($ctx2) {
  8133. return $recv($recv(aBlock)._value_(each)).__eq(false);
  8134. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8135. }));
  8136. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  8137. },
  8138. args: ["aBlock"],
  8139. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  8140. referencedClasses: [],
  8141. messageSends: ["select:", "=", "value:"]
  8142. }),
  8143. $globals.Collection);
  8144. $core.addMethod(
  8145. $core.method({
  8146. selector: "remove:",
  8147. protocol: "adding/removing",
  8148. fn: function (anObject){
  8149. var self=this,$self=this;
  8150. return $core.withContext(function($ctx1) {
  8151. return $self._remove_ifAbsent_(anObject,(function(){
  8152. return $core.withContext(function($ctx2) {
  8153. return $self._errorNotFound();
  8154. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8155. }));
  8156. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  8157. },
  8158. args: ["anObject"],
  8159. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  8160. referencedClasses: [],
  8161. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  8162. }),
  8163. $globals.Collection);
  8164. $core.addMethod(
  8165. $core.method({
  8166. selector: "remove:ifAbsent:",
  8167. protocol: "adding/removing",
  8168. fn: function (anObject,aBlock){
  8169. var self=this,$self=this;
  8170. return $core.withContext(function($ctx1) {
  8171. $self._subclassResponsibility();
  8172. return self;
  8173. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  8174. },
  8175. args: ["anObject", "aBlock"],
  8176. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8177. referencedClasses: [],
  8178. messageSends: ["subclassResponsibility"]
  8179. }),
  8180. $globals.Collection);
  8181. $core.addMethod(
  8182. $core.method({
  8183. selector: "removeAll",
  8184. protocol: "adding/removing",
  8185. fn: function (){
  8186. var self=this,$self=this;
  8187. return $core.withContext(function($ctx1) {
  8188. $self._subclassResponsibility();
  8189. return self;
  8190. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  8191. },
  8192. args: [],
  8193. source: "removeAll\x0a\x09self subclassResponsibility",
  8194. referencedClasses: [],
  8195. messageSends: ["subclassResponsibility"]
  8196. }),
  8197. $globals.Collection);
  8198. $core.addMethod(
  8199. $core.method({
  8200. selector: "select:",
  8201. protocol: "enumerating",
  8202. fn: function (aBlock){
  8203. var self=this,$self=this;
  8204. var stream;
  8205. return $core.withContext(function($ctx1) {
  8206. var $1;
  8207. stream=$recv($recv($self._class())._new())._writeStream();
  8208. $self._do_((function(each){
  8209. return $core.withContext(function($ctx2) {
  8210. $1=$recv(aBlock)._value_(each);
  8211. if($core.assert($1)){
  8212. return $recv(stream)._nextPut_(each);
  8213. }
  8214. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8215. }));
  8216. return $recv(stream)._contents();
  8217. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  8218. },
  8219. args: ["aBlock"],
  8220. 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",
  8221. referencedClasses: [],
  8222. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8223. }),
  8224. $globals.Collection);
  8225. $core.addMethod(
  8226. $core.method({
  8227. selector: "select:thenCollect:",
  8228. protocol: "enumerating",
  8229. fn: function (selectBlock,collectBlock){
  8230. var self=this,$self=this;
  8231. var stream;
  8232. return $core.withContext(function($ctx1) {
  8233. var $1;
  8234. stream=$recv($recv($self._class())._new())._writeStream();
  8235. $self._do_((function(each){
  8236. return $core.withContext(function($ctx2) {
  8237. $1=$recv(selectBlock)._value_(each);
  8238. $ctx2.sendIdx["value:"]=1;
  8239. if($core.assert($1)){
  8240. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  8241. }
  8242. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8243. }));
  8244. return $recv(stream)._contents();
  8245. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  8246. },
  8247. args: ["selectBlock", "collectBlock"],
  8248. 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",
  8249. referencedClasses: [],
  8250. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8251. }),
  8252. $globals.Collection);
  8253. $core.addMethod(
  8254. $core.method({
  8255. selector: "shallowCopy",
  8256. protocol: "copying",
  8257. fn: function (){
  8258. var self=this,$self=this;
  8259. return $core.withContext(function($ctx1) {
  8260. return $self._collect_((function(each){
  8261. return each;
  8262. }));
  8263. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  8264. },
  8265. args: [],
  8266. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  8267. referencedClasses: [],
  8268. messageSends: ["collect:"]
  8269. }),
  8270. $globals.Collection);
  8271. $core.addMethod(
  8272. $core.method({
  8273. selector: "single",
  8274. protocol: "accessing",
  8275. fn: function (){
  8276. var self=this,$self=this;
  8277. return $core.withContext(function($ctx1) {
  8278. var $1;
  8279. $self._ifEmpty_((function(){
  8280. return $core.withContext(function($ctx2) {
  8281. return $self._error_("Collection is empty");
  8282. $ctx2.sendIdx["error:"]=1;
  8283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8284. }));
  8285. $1=$recv($self._size()).__gt((1));
  8286. if($core.assert($1)){
  8287. $self._error_("Collection holds more than one element");
  8288. }
  8289. return $self._anyOne();
  8290. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  8291. },
  8292. args: [],
  8293. 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",
  8294. referencedClasses: [],
  8295. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  8296. }),
  8297. $globals.Collection);
  8298. $core.addMethod(
  8299. $core.method({
  8300. selector: "size",
  8301. protocol: "accessing",
  8302. fn: function (){
  8303. var self=this,$self=this;
  8304. return $core.withContext(function($ctx1) {
  8305. $self._subclassResponsibility();
  8306. return self;
  8307. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  8308. },
  8309. args: [],
  8310. source: "size\x0a\x09self subclassResponsibility",
  8311. referencedClasses: [],
  8312. messageSends: ["subclassResponsibility"]
  8313. }),
  8314. $globals.Collection);
  8315. $core.addMethod(
  8316. $core.method({
  8317. selector: "classTag",
  8318. protocol: "accessing",
  8319. fn: function (){
  8320. var self=this,$self=this;
  8321. return "collection";
  8322. },
  8323. args: [],
  8324. 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'",
  8325. referencedClasses: [],
  8326. messageSends: []
  8327. }),
  8328. $globals.Collection.a$cls);
  8329. $core.addMethod(
  8330. $core.method({
  8331. selector: "new:",
  8332. protocol: "instance creation",
  8333. fn: function (anInteger){
  8334. var self=this,$self=this;
  8335. return $core.withContext(function($ctx1) {
  8336. return $self._new();
  8337. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  8338. },
  8339. args: ["anInteger"],
  8340. source: "new: anInteger\x0a\x09^ self new",
  8341. referencedClasses: [],
  8342. messageSends: ["new"]
  8343. }),
  8344. $globals.Collection.a$cls);
  8345. $core.addMethod(
  8346. $core.method({
  8347. selector: "with:",
  8348. protocol: "instance creation",
  8349. fn: function (anObject){
  8350. var self=this,$self=this;
  8351. return $core.withContext(function($ctx1) {
  8352. var $1;
  8353. $1=$self._new();
  8354. $recv($1)._add_(anObject);
  8355. return $recv($1)._yourself();
  8356. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  8357. },
  8358. args: ["anObject"],
  8359. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8360. referencedClasses: [],
  8361. messageSends: ["add:", "new", "yourself"]
  8362. }),
  8363. $globals.Collection.a$cls);
  8364. $core.addMethod(
  8365. $core.method({
  8366. selector: "with:with:",
  8367. protocol: "instance creation",
  8368. fn: function (anObject,anotherObject){
  8369. var self=this,$self=this;
  8370. return $core.withContext(function($ctx1) {
  8371. var $1;
  8372. $1=$self._new();
  8373. $recv($1)._add_(anObject);
  8374. $ctx1.sendIdx["add:"]=1;
  8375. $recv($1)._add_(anotherObject);
  8376. return $recv($1)._yourself();
  8377. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  8378. },
  8379. args: ["anObject", "anotherObject"],
  8380. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8381. referencedClasses: [],
  8382. messageSends: ["add:", "new", "yourself"]
  8383. }),
  8384. $globals.Collection.a$cls);
  8385. $core.addMethod(
  8386. $core.method({
  8387. selector: "with:with:with:",
  8388. protocol: "instance creation",
  8389. fn: function (firstObject,secondObject,thirdObject){
  8390. var self=this,$self=this;
  8391. return $core.withContext(function($ctx1) {
  8392. var $1;
  8393. $1=$self._new();
  8394. $recv($1)._add_(firstObject);
  8395. $ctx1.sendIdx["add:"]=1;
  8396. $recv($1)._add_(secondObject);
  8397. $ctx1.sendIdx["add:"]=2;
  8398. $recv($1)._add_(thirdObject);
  8399. return $recv($1)._yourself();
  8400. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  8401. },
  8402. args: ["firstObject", "secondObject", "thirdObject"],
  8403. 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",
  8404. referencedClasses: [],
  8405. messageSends: ["add:", "new", "yourself"]
  8406. }),
  8407. $globals.Collection.a$cls);
  8408. $core.addMethod(
  8409. $core.method({
  8410. selector: "withAll:",
  8411. protocol: "instance creation",
  8412. fn: function (aCollection){
  8413. var self=this,$self=this;
  8414. return $core.withContext(function($ctx1) {
  8415. var $1;
  8416. $1=$self._new();
  8417. $recv($1)._addAll_(aCollection);
  8418. return $recv($1)._yourself();
  8419. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  8420. },
  8421. args: ["aCollection"],
  8422. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8423. referencedClasses: [],
  8424. messageSends: ["addAll:", "new", "yourself"]
  8425. }),
  8426. $globals.Collection.a$cls);
  8427. $core.addClass("IndexableCollection", $globals.Collection, [], "Kernel-Collections");
  8428. $globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
  8429. $core.addMethod(
  8430. $core.method({
  8431. selector: "at:",
  8432. protocol: "accessing",
  8433. fn: function (anIndex){
  8434. var self=this,$self=this;
  8435. return $core.withContext(function($ctx1) {
  8436. return $self._at_ifAbsent_(anIndex,(function(){
  8437. return $core.withContext(function($ctx2) {
  8438. return $self._errorNotFound();
  8439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8440. }));
  8441. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  8442. },
  8443. args: ["anIndex"],
  8444. 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 ]",
  8445. referencedClasses: [],
  8446. messageSends: ["at:ifAbsent:", "errorNotFound"]
  8447. }),
  8448. $globals.IndexableCollection);
  8449. $core.addMethod(
  8450. $core.method({
  8451. selector: "at:ifAbsent:",
  8452. protocol: "accessing",
  8453. fn: function (anIndex,aBlock){
  8454. var self=this,$self=this;
  8455. return $core.withContext(function($ctx1) {
  8456. $self._subclassResponsibility();
  8457. return self;
  8458. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  8459. },
  8460. args: ["anIndex", "aBlock"],
  8461. 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",
  8462. referencedClasses: [],
  8463. messageSends: ["subclassResponsibility"]
  8464. }),
  8465. $globals.IndexableCollection);
  8466. $core.addMethod(
  8467. $core.method({
  8468. selector: "at:ifAbsentPut:",
  8469. protocol: "accessing",
  8470. fn: function (aKey,aBlock){
  8471. var self=this,$self=this;
  8472. return $core.withContext(function($ctx1) {
  8473. return $self._at_ifAbsent_(aKey,(function(){
  8474. return $core.withContext(function($ctx2) {
  8475. return $self._at_put_(aKey,$recv(aBlock)._value());
  8476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8477. }));
  8478. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  8479. },
  8480. args: ["aKey", "aBlock"],
  8481. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  8482. referencedClasses: [],
  8483. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  8484. }),
  8485. $globals.IndexableCollection);
  8486. $core.addMethod(
  8487. $core.method({
  8488. selector: "at:ifPresent:",
  8489. protocol: "accessing",
  8490. fn: function (anIndex,aBlock){
  8491. var self=this,$self=this;
  8492. return $core.withContext(function($ctx1) {
  8493. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  8494. return nil;
  8495. }));
  8496. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  8497. },
  8498. args: ["anIndex", "aBlock"],
  8499. 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 ]",
  8500. referencedClasses: [],
  8501. messageSends: ["at:ifPresent:ifAbsent:"]
  8502. }),
  8503. $globals.IndexableCollection);
  8504. $core.addMethod(
  8505. $core.method({
  8506. selector: "at:ifPresent:ifAbsent:",
  8507. protocol: "accessing",
  8508. fn: function (anIndex,aBlock,anotherBlock){
  8509. var self=this,$self=this;
  8510. return $core.withContext(function($ctx1) {
  8511. $self._subclassResponsibility();
  8512. return self;
  8513. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  8514. },
  8515. args: ["anIndex", "aBlock", "anotherBlock"],
  8516. 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",
  8517. referencedClasses: [],
  8518. messageSends: ["subclassResponsibility"]
  8519. }),
  8520. $globals.IndexableCollection);
  8521. $core.addMethod(
  8522. $core.method({
  8523. selector: "at:put:",
  8524. protocol: "accessing",
  8525. fn: function (anIndex,anObject){
  8526. var self=this,$self=this;
  8527. return $core.withContext(function($ctx1) {
  8528. $self._subclassResponsibility();
  8529. return self;
  8530. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  8531. },
  8532. args: ["anIndex", "anObject"],
  8533. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  8534. referencedClasses: [],
  8535. messageSends: ["subclassResponsibility"]
  8536. }),
  8537. $globals.IndexableCollection);
  8538. $core.addMethod(
  8539. $core.method({
  8540. selector: "indexOf:",
  8541. protocol: "accessing",
  8542. fn: function (anObject){
  8543. var self=this,$self=this;
  8544. return $core.withContext(function($ctx1) {
  8545. return $self._indexOf_ifAbsent_(anObject,(function(){
  8546. return $core.withContext(function($ctx2) {
  8547. return $self._errorNotFound();
  8548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8549. }));
  8550. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  8551. },
  8552. args: ["anObject"],
  8553. 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 ]",
  8554. referencedClasses: [],
  8555. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  8556. }),
  8557. $globals.IndexableCollection);
  8558. $core.addMethod(
  8559. $core.method({
  8560. selector: "indexOf:ifAbsent:",
  8561. protocol: "accessing",
  8562. fn: function (anObject,aBlock){
  8563. var self=this,$self=this;
  8564. return $core.withContext(function($ctx1) {
  8565. $self._subclassResponsibility();
  8566. return self;
  8567. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  8568. },
  8569. args: ["anObject", "aBlock"],
  8570. 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",
  8571. referencedClasses: [],
  8572. messageSends: ["subclassResponsibility"]
  8573. }),
  8574. $globals.IndexableCollection);
  8575. $core.addMethod(
  8576. $core.method({
  8577. selector: "with:do:",
  8578. protocol: "enumerating",
  8579. fn: function (anotherCollection,aBlock){
  8580. var self=this,$self=this;
  8581. return $core.withContext(function($ctx1) {
  8582. $self._withIndexDo_((function(each,index){
  8583. return $core.withContext(function($ctx2) {
  8584. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  8585. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  8586. }));
  8587. return self;
  8588. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  8589. },
  8590. args: ["anotherCollection", "aBlock"],
  8591. 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) ]",
  8592. referencedClasses: [],
  8593. messageSends: ["withIndexDo:", "value:value:", "at:"]
  8594. }),
  8595. $globals.IndexableCollection);
  8596. $core.addMethod(
  8597. $core.method({
  8598. selector: "withIndexDo:",
  8599. protocol: "enumerating",
  8600. fn: function (aBlock){
  8601. var self=this,$self=this;
  8602. return $core.withContext(function($ctx1) {
  8603. $self._subclassResponsibility();
  8604. return self;
  8605. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  8606. },
  8607. args: ["aBlock"],
  8608. 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",
  8609. referencedClasses: [],
  8610. messageSends: ["subclassResponsibility"]
  8611. }),
  8612. $globals.IndexableCollection);
  8613. $core.addClass("AssociativeCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  8614. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  8615. $core.addMethod(
  8616. $core.method({
  8617. selector: "=",
  8618. protocol: "comparing",
  8619. fn: function (anAssocitativeCollection){
  8620. var self=this,$self=this;
  8621. return $core.withContext(function($ctx1) {
  8622. var $2,$1,$4,$3,$5;
  8623. $2=$self._class();
  8624. $ctx1.sendIdx["class"]=1;
  8625. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  8626. $ctx1.sendIdx["="]=1;
  8627. if(!$core.assert($1)){
  8628. return false;
  8629. }
  8630. $4=$self._size();
  8631. $ctx1.sendIdx["size"]=1;
  8632. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  8633. $ctx1.sendIdx["="]=2;
  8634. if(!$core.assert($3)){
  8635. return false;
  8636. }
  8637. $5=$self._associations();
  8638. $ctx1.sendIdx["associations"]=1;
  8639. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  8640. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  8641. },
  8642. args: ["anAssocitativeCollection"],
  8643. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  8644. referencedClasses: [],
  8645. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  8646. }),
  8647. $globals.AssociativeCollection);
  8648. $core.addMethod(
  8649. $core.method({
  8650. selector: "add:",
  8651. protocol: "adding/removing",
  8652. fn: function (anAssociation){
  8653. var self=this,$self=this;
  8654. return $core.withContext(function($ctx1) {
  8655. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  8656. return self;
  8657. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  8658. },
  8659. args: ["anAssociation"],
  8660. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  8661. referencedClasses: [],
  8662. messageSends: ["at:put:", "key", "value"]
  8663. }),
  8664. $globals.AssociativeCollection);
  8665. $core.addMethod(
  8666. $core.method({
  8667. selector: "addAll:",
  8668. protocol: "adding/removing",
  8669. fn: function (anAssociativeCollection){
  8670. var self=this,$self=this;
  8671. return $core.withContext(function($ctx1) {
  8672. (
  8673. $ctx1.supercall = true,
  8674. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  8675. $ctx1.supercall = false;
  8676. return anAssociativeCollection;
  8677. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  8678. },
  8679. args: ["anAssociativeCollection"],
  8680. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  8681. referencedClasses: [],
  8682. messageSends: ["addAll:", "associations"]
  8683. }),
  8684. $globals.AssociativeCollection);
  8685. $core.addMethod(
  8686. $core.method({
  8687. selector: "asDictionary",
  8688. protocol: "converting",
  8689. fn: function (){
  8690. var self=this,$self=this;
  8691. return $core.withContext(function($ctx1) {
  8692. return $recv($globals.Dictionary)._from_($self._associations());
  8693. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  8694. },
  8695. args: [],
  8696. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  8697. referencedClasses: ["Dictionary"],
  8698. messageSends: ["from:", "associations"]
  8699. }),
  8700. $globals.AssociativeCollection);
  8701. $core.addMethod(
  8702. $core.method({
  8703. selector: "asHashedCollection",
  8704. protocol: "converting",
  8705. fn: function (){
  8706. var self=this,$self=this;
  8707. return $core.withContext(function($ctx1) {
  8708. return $recv($globals.HashedCollection)._from_($self._associations());
  8709. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  8710. },
  8711. args: [],
  8712. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  8713. referencedClasses: ["HashedCollection"],
  8714. messageSends: ["from:", "associations"]
  8715. }),
  8716. $globals.AssociativeCollection);
  8717. $core.addMethod(
  8718. $core.method({
  8719. selector: "asJavaScriptObject",
  8720. protocol: "converting",
  8721. fn: function (){
  8722. var self=this,$self=this;
  8723. var hash;
  8724. return $core.withContext(function($ctx1) {
  8725. hash=$recv($globals.HashedCollection)._new();
  8726. $self._keysAndValuesDo_((function(key,value){
  8727. return $core.withContext(function($ctx2) {
  8728. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  8729. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8730. }));
  8731. return hash;
  8732. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  8733. },
  8734. args: [],
  8735. 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",
  8736. referencedClasses: ["HashedCollection"],
  8737. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  8738. }),
  8739. $globals.AssociativeCollection);
  8740. $core.addMethod(
  8741. $core.method({
  8742. selector: "associations",
  8743. protocol: "accessing",
  8744. fn: function (){
  8745. var self=this,$self=this;
  8746. var associations;
  8747. return $core.withContext(function($ctx1) {
  8748. associations=[];
  8749. $self._associationsDo_((function(each){
  8750. return $core.withContext(function($ctx2) {
  8751. return $recv(associations)._add_(each);
  8752. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8753. }));
  8754. return associations;
  8755. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  8756. },
  8757. args: [],
  8758. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  8759. referencedClasses: [],
  8760. messageSends: ["associationsDo:", "add:"]
  8761. }),
  8762. $globals.AssociativeCollection);
  8763. $core.addMethod(
  8764. $core.method({
  8765. selector: "associationsDo:",
  8766. protocol: "enumerating",
  8767. fn: function (aBlock){
  8768. var self=this,$self=this;
  8769. return $core.withContext(function($ctx1) {
  8770. $self._keysAndValuesDo_((function(key,value){
  8771. return $core.withContext(function($ctx2) {
  8772. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  8773. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8774. }));
  8775. return self;
  8776. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8777. },
  8778. args: ["aBlock"],
  8779. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  8780. referencedClasses: ["Association"],
  8781. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  8782. }),
  8783. $globals.AssociativeCollection);
  8784. $core.addMethod(
  8785. $core.method({
  8786. selector: "at:ifPresent:ifAbsent:",
  8787. protocol: "accessing",
  8788. fn: function (aKey,aBlock,anotherBlock){
  8789. var self=this,$self=this;
  8790. return $core.withContext(function($ctx1) {
  8791. var $1;
  8792. $1=$self._includesKey_(aKey);
  8793. if($core.assert($1)){
  8794. return $recv(aBlock)._value_($self._at_(aKey));
  8795. } else {
  8796. return $recv(anotherBlock)._value();
  8797. }
  8798. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8799. },
  8800. args: ["aKey", "aBlock", "anotherBlock"],
  8801. 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 ]",
  8802. referencedClasses: [],
  8803. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  8804. }),
  8805. $globals.AssociativeCollection);
  8806. $core.addMethod(
  8807. $core.method({
  8808. selector: "collect:",
  8809. protocol: "enumerating",
  8810. fn: function (aBlock){
  8811. var self=this,$self=this;
  8812. var newDict;
  8813. return $core.withContext(function($ctx1) {
  8814. newDict=$recv($self._class())._new();
  8815. $self._keysAndValuesDo_((function(key,value){
  8816. return $core.withContext(function($ctx2) {
  8817. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  8818. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8819. }));
  8820. return newDict;
  8821. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  8822. },
  8823. args: ["aBlock"],
  8824. 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",
  8825. referencedClasses: [],
  8826. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  8827. }),
  8828. $globals.AssociativeCollection);
  8829. $core.addMethod(
  8830. $core.method({
  8831. selector: "deepCopy",
  8832. protocol: "copying",
  8833. fn: function (){
  8834. var self=this,$self=this;
  8835. var copy;
  8836. return $core.withContext(function($ctx1) {
  8837. copy=$recv($self._class())._new();
  8838. $self._keysAndValuesDo_((function(key,value){
  8839. return $core.withContext(function($ctx2) {
  8840. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  8841. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8842. }));
  8843. return copy;
  8844. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  8845. },
  8846. args: [],
  8847. 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",
  8848. referencedClasses: [],
  8849. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  8850. }),
  8851. $globals.AssociativeCollection);
  8852. $core.addMethod(
  8853. $core.method({
  8854. selector: "detect:ifNone:",
  8855. protocol: "enumerating",
  8856. fn: function (aBlock,anotherBlock){
  8857. var self=this,$self=this;
  8858. return $core.withContext(function($ctx1) {
  8859. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  8860. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8861. },
  8862. args: ["aBlock", "anotherBlock"],
  8863. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  8864. referencedClasses: [],
  8865. messageSends: ["detect:ifNone:", "values"]
  8866. }),
  8867. $globals.AssociativeCollection);
  8868. $core.addMethod(
  8869. $core.method({
  8870. selector: "do:",
  8871. protocol: "enumerating",
  8872. fn: function (aBlock){
  8873. var self=this,$self=this;
  8874. return $core.withContext(function($ctx1) {
  8875. $self._valuesDo_(aBlock);
  8876. return self;
  8877. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8878. },
  8879. args: ["aBlock"],
  8880. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  8881. referencedClasses: [],
  8882. messageSends: ["valuesDo:"]
  8883. }),
  8884. $globals.AssociativeCollection);
  8885. $core.addMethod(
  8886. $core.method({
  8887. selector: "includes:",
  8888. protocol: "enumerating",
  8889. fn: function (anObject){
  8890. var self=this,$self=this;
  8891. return $core.withContext(function($ctx1) {
  8892. return $recv($self._values())._includes_(anObject);
  8893. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  8894. },
  8895. args: ["anObject"],
  8896. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  8897. referencedClasses: [],
  8898. messageSends: ["includes:", "values"]
  8899. }),
  8900. $globals.AssociativeCollection);
  8901. $core.addMethod(
  8902. $core.method({
  8903. selector: "includesKey:",
  8904. protocol: "testing",
  8905. fn: function (aKey){
  8906. var self=this,$self=this;
  8907. return $core.withContext(function($ctx1) {
  8908. $self._subclassResponsibility();
  8909. return self;
  8910. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  8911. },
  8912. args: ["aKey"],
  8913. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  8914. referencedClasses: [],
  8915. messageSends: ["subclassResponsibility"]
  8916. }),
  8917. $globals.AssociativeCollection);
  8918. $core.addMethod(
  8919. $core.method({
  8920. selector: "indexOf:ifAbsent:",
  8921. protocol: "accessing",
  8922. fn: function (anObject,aBlock){
  8923. var self=this,$self=this;
  8924. return $core.withContext(function($ctx1) {
  8925. return $recv($self._keys())._detect_ifNone_((function(each){
  8926. return $core.withContext(function($ctx2) {
  8927. return $recv($self._at_(each)).__eq(anObject);
  8928. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8929. }),aBlock);
  8930. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  8931. },
  8932. args: ["anObject", "aBlock"],
  8933. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  8934. referencedClasses: [],
  8935. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  8936. }),
  8937. $globals.AssociativeCollection);
  8938. $core.addMethod(
  8939. $core.method({
  8940. selector: "keyAtValue:",
  8941. protocol: "accessing",
  8942. fn: function (anObject){
  8943. var self=this,$self=this;
  8944. return $core.withContext(function($ctx1) {
  8945. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  8946. return $core.withContext(function($ctx2) {
  8947. return $self._errorNotFound();
  8948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8949. }));
  8950. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  8951. },
  8952. args: ["anObject"],
  8953. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  8954. referencedClasses: [],
  8955. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  8956. }),
  8957. $globals.AssociativeCollection);
  8958. $core.addMethod(
  8959. $core.method({
  8960. selector: "keyAtValue:ifAbsent:",
  8961. protocol: "accessing",
  8962. fn: function (anObject,aBlock){
  8963. var self=this,$self=this;
  8964. return $core.withContext(function($ctx1) {
  8965. return $self._indexOf_ifAbsent_(anObject,aBlock);
  8966. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  8967. },
  8968. args: ["anObject", "aBlock"],
  8969. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  8970. referencedClasses: [],
  8971. messageSends: ["indexOf:ifAbsent:"]
  8972. }),
  8973. $globals.AssociativeCollection);
  8974. $core.addMethod(
  8975. $core.method({
  8976. selector: "keys",
  8977. protocol: "accessing",
  8978. fn: function (){
  8979. var self=this,$self=this;
  8980. return $core.withContext(function($ctx1) {
  8981. $self._subclassResponsibility();
  8982. return self;
  8983. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  8984. },
  8985. args: [],
  8986. source: "keys\x0a\x09self subclassResponsibility",
  8987. referencedClasses: [],
  8988. messageSends: ["subclassResponsibility"]
  8989. }),
  8990. $globals.AssociativeCollection);
  8991. $core.addMethod(
  8992. $core.method({
  8993. selector: "keysAndValuesDo:",
  8994. protocol: "enumerating",
  8995. fn: function (aBlock){
  8996. var self=this,$self=this;
  8997. return $core.withContext(function($ctx1) {
  8998. $self._keysDo_((function(each){
  8999. return $core.withContext(function($ctx2) {
  9000. return $recv(aBlock)._value_value_(each,$self._at_(each));
  9001. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9002. }));
  9003. return self;
  9004. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9005. },
  9006. args: ["aBlock"],
  9007. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  9008. referencedClasses: [],
  9009. messageSends: ["keysDo:", "value:value:", "at:"]
  9010. }),
  9011. $globals.AssociativeCollection);
  9012. $core.addMethod(
  9013. $core.method({
  9014. selector: "keysDo:",
  9015. protocol: "enumerating",
  9016. fn: function (aBlock){
  9017. var self=this,$self=this;
  9018. return $core.withContext(function($ctx1) {
  9019. $self._subclassResponsibility();
  9020. return self;
  9021. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9022. },
  9023. args: ["aBlock"],
  9024. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  9025. referencedClasses: [],
  9026. messageSends: ["subclassResponsibility"]
  9027. }),
  9028. $globals.AssociativeCollection);
  9029. $core.addMethod(
  9030. $core.method({
  9031. selector: "printOn:",
  9032. protocol: "printing",
  9033. fn: function (aStream){
  9034. var self=this,$self=this;
  9035. return $core.withContext(function($ctx1) {
  9036. (
  9037. $ctx1.supercall = true,
  9038. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  9039. $ctx1.supercall = false;
  9040. $ctx1.sendIdx["printOn:"]=1;
  9041. $recv(aStream)._nextPutAll_(" (");
  9042. $ctx1.sendIdx["nextPutAll:"]=1;
  9043. $recv($self._associations())._do_separatedBy_((function(each){
  9044. return $core.withContext(function($ctx2) {
  9045. return $recv(each)._printOn_(aStream);
  9046. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9047. }),(function(){
  9048. return $core.withContext(function($ctx2) {
  9049. return $recv(aStream)._nextPutAll_(" , ");
  9050. $ctx2.sendIdx["nextPutAll:"]=2;
  9051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9052. }));
  9053. $recv(aStream)._nextPutAll_(")");
  9054. return self;
  9055. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  9056. },
  9057. args: ["aStream"],
  9058. 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: ')'",
  9059. referencedClasses: [],
  9060. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  9061. }),
  9062. $globals.AssociativeCollection);
  9063. $core.addMethod(
  9064. $core.method({
  9065. selector: "remove:ifAbsent:",
  9066. protocol: "adding/removing",
  9067. fn: function (aKey,aBlock){
  9068. var self=this,$self=this;
  9069. return $core.withContext(function($ctx1) {
  9070. return $self._removeKey_ifAbsent_(aKey,aBlock);
  9071. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9072. },
  9073. args: ["aKey", "aBlock"],
  9074. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  9075. referencedClasses: [],
  9076. messageSends: ["removeKey:ifAbsent:"]
  9077. }),
  9078. $globals.AssociativeCollection);
  9079. $core.addMethod(
  9080. $core.method({
  9081. selector: "removeAll",
  9082. protocol: "adding/removing",
  9083. fn: function (){
  9084. var self=this,$self=this;
  9085. return $core.withContext(function($ctx1) {
  9086. return $recv($self._keys())._do_((function(each){
  9087. return $core.withContext(function($ctx2) {
  9088. return $self._removeKey_(each);
  9089. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9090. }));
  9091. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  9092. },
  9093. args: [],
  9094. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  9095. referencedClasses: [],
  9096. messageSends: ["do:", "keys", "removeKey:"]
  9097. }),
  9098. $globals.AssociativeCollection);
  9099. $core.addMethod(
  9100. $core.method({
  9101. selector: "removeKey:",
  9102. protocol: "adding/removing",
  9103. fn: function (aKey){
  9104. var self=this,$self=this;
  9105. return $core.withContext(function($ctx1) {
  9106. return $self._remove_(aKey);
  9107. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  9108. },
  9109. args: ["aKey"],
  9110. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  9111. referencedClasses: [],
  9112. messageSends: ["remove:"]
  9113. }),
  9114. $globals.AssociativeCollection);
  9115. $core.addMethod(
  9116. $core.method({
  9117. selector: "removeKey:ifAbsent:",
  9118. protocol: "adding/removing",
  9119. fn: function (aKey,aBlock){
  9120. var self=this,$self=this;
  9121. return $core.withContext(function($ctx1) {
  9122. $self._subclassResponsibility();
  9123. return self;
  9124. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9125. },
  9126. args: ["aKey", "aBlock"],
  9127. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9128. referencedClasses: [],
  9129. messageSends: ["subclassResponsibility"]
  9130. }),
  9131. $globals.AssociativeCollection);
  9132. $core.addMethod(
  9133. $core.method({
  9134. selector: "select:",
  9135. protocol: "enumerating",
  9136. fn: function (aBlock){
  9137. var self=this,$self=this;
  9138. var newDict;
  9139. return $core.withContext(function($ctx1) {
  9140. var $1;
  9141. newDict=$recv($self._class())._new();
  9142. $self._keysAndValuesDo_((function(key,value){
  9143. return $core.withContext(function($ctx2) {
  9144. $1=$recv(aBlock)._value_(value);
  9145. if($core.assert($1)){
  9146. return $recv(newDict)._at_put_(key,value);
  9147. }
  9148. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9149. }));
  9150. return newDict;
  9151. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  9152. },
  9153. args: ["aBlock"],
  9154. 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",
  9155. referencedClasses: [],
  9156. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9157. }),
  9158. $globals.AssociativeCollection);
  9159. $core.addMethod(
  9160. $core.method({
  9161. selector: "select:thenCollect:",
  9162. protocol: "enumerating",
  9163. fn: function (selectBlock,collectBlock){
  9164. var self=this,$self=this;
  9165. var newDict;
  9166. return $core.withContext(function($ctx1) {
  9167. var $1;
  9168. newDict=$recv($self._class())._new();
  9169. $self._keysAndValuesDo_((function(key,value){
  9170. return $core.withContext(function($ctx2) {
  9171. $1=$recv(selectBlock)._value_(value);
  9172. $ctx2.sendIdx["value:"]=1;
  9173. if($core.assert($1)){
  9174. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  9175. }
  9176. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9177. }));
  9178. return newDict;
  9179. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  9180. },
  9181. args: ["selectBlock", "collectBlock"],
  9182. 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",
  9183. referencedClasses: [],
  9184. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9185. }),
  9186. $globals.AssociativeCollection);
  9187. $core.addMethod(
  9188. $core.method({
  9189. selector: "shallowCopy",
  9190. protocol: "copying",
  9191. fn: function (){
  9192. var self=this,$self=this;
  9193. var copy;
  9194. return $core.withContext(function($ctx1) {
  9195. copy=$recv($self._class())._new();
  9196. $self._keysAndValuesDo_((function(key,value){
  9197. return $core.withContext(function($ctx2) {
  9198. return $recv(copy)._at_put_(key,value);
  9199. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9200. }));
  9201. return copy;
  9202. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  9203. },
  9204. args: [],
  9205. 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",
  9206. referencedClasses: [],
  9207. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  9208. }),
  9209. $globals.AssociativeCollection);
  9210. $core.addMethod(
  9211. $core.method({
  9212. selector: "size",
  9213. protocol: "accessing",
  9214. fn: function (){
  9215. var self=this,$self=this;
  9216. return $core.withContext(function($ctx1) {
  9217. return $recv($self._keys())._size();
  9218. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  9219. },
  9220. args: [],
  9221. source: "size\x0a\x09^ self keys size",
  9222. referencedClasses: [],
  9223. messageSends: ["size", "keys"]
  9224. }),
  9225. $globals.AssociativeCollection);
  9226. $core.addMethod(
  9227. $core.method({
  9228. selector: "values",
  9229. protocol: "accessing",
  9230. fn: function (){
  9231. var self=this,$self=this;
  9232. return $core.withContext(function($ctx1) {
  9233. $self._subclassResponsibility();
  9234. return self;
  9235. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  9236. },
  9237. args: [],
  9238. source: "values\x0a\x09self subclassResponsibility",
  9239. referencedClasses: [],
  9240. messageSends: ["subclassResponsibility"]
  9241. }),
  9242. $globals.AssociativeCollection);
  9243. $core.addMethod(
  9244. $core.method({
  9245. selector: "valuesDo:",
  9246. protocol: "enumerating",
  9247. fn: function (aBlock){
  9248. var self=this,$self=this;
  9249. return $core.withContext(function($ctx1) {
  9250. $self._subclassResponsibility();
  9251. return self;
  9252. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9253. },
  9254. args: ["aBlock"],
  9255. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  9256. referencedClasses: [],
  9257. messageSends: ["subclassResponsibility"]
  9258. }),
  9259. $globals.AssociativeCollection);
  9260. $core.addMethod(
  9261. $core.method({
  9262. selector: "withIndexDo:",
  9263. protocol: "enumerating",
  9264. fn: function (aBlock){
  9265. var self=this,$self=this;
  9266. return $core.withContext(function($ctx1) {
  9267. $self._keysAndValuesDo_((function(key,value){
  9268. return $core.withContext(function($ctx2) {
  9269. return $recv(aBlock)._value_value_(value,key);
  9270. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9271. }));
  9272. return self;
  9273. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9274. },
  9275. args: ["aBlock"],
  9276. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  9277. referencedClasses: [],
  9278. messageSends: ["keysAndValuesDo:", "value:value:"]
  9279. }),
  9280. $globals.AssociativeCollection);
  9281. $core.addMethod(
  9282. $core.method({
  9283. selector: "from:",
  9284. protocol: "instance creation",
  9285. fn: function (aCollection){
  9286. var self=this,$self=this;
  9287. var newCollection;
  9288. return $core.withContext(function($ctx1) {
  9289. newCollection=$self._new();
  9290. $recv(aCollection)._do_((function(each){
  9291. return $core.withContext(function($ctx2) {
  9292. return $recv(newCollection)._add_(each);
  9293. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9294. }));
  9295. return newCollection;
  9296. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9297. },
  9298. args: ["aCollection"],
  9299. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  9300. referencedClasses: [],
  9301. messageSends: ["new", "do:", "add:"]
  9302. }),
  9303. $globals.AssociativeCollection.a$cls);
  9304. $core.addMethod(
  9305. $core.method({
  9306. selector: "fromPairs:",
  9307. protocol: "instance creation",
  9308. fn: function (aCollection){
  9309. var self=this,$self=this;
  9310. return $core.withContext(function($ctx1) {
  9311. return $self._from_(aCollection);
  9312. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  9313. },
  9314. args: ["aCollection"],
  9315. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  9316. referencedClasses: [],
  9317. messageSends: ["from:"]
  9318. }),
  9319. $globals.AssociativeCollection.a$cls);
  9320. $core.addMethod(
  9321. $core.method({
  9322. selector: "newFromPairs:",
  9323. protocol: "instance creation",
  9324. fn: function (aCollection){
  9325. var self=this,$self=this;
  9326. var newCollection;
  9327. return $core.withContext(function($ctx1) {
  9328. var $2,$1,$3,$4;
  9329. $2=$recv(aCollection)._size();
  9330. $ctx1.sendIdx["size"]=1;
  9331. $1=$recv($2)._even();
  9332. if(!$core.assert($1)){
  9333. $self._error_("#newFromPairs only accepts arrays of an even length");
  9334. }
  9335. newCollection=$self._new();
  9336. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  9337. return $core.withContext(function($ctx2) {
  9338. $3=newCollection;
  9339. $4=$recv(aCollection)._at_(each);
  9340. $ctx2.sendIdx["at:"]=1;
  9341. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  9342. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9343. }));
  9344. return newCollection;
  9345. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9346. },
  9347. args: ["aCollection"],
  9348. 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",
  9349. referencedClasses: [],
  9350. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  9351. }),
  9352. $globals.AssociativeCollection.a$cls);
  9353. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  9354. $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.";
  9355. $core.addMethod(
  9356. $core.method({
  9357. selector: "at:ifAbsent:",
  9358. protocol: "accessing",
  9359. fn: function (aKey,aBlock){
  9360. var self=this,$self=this;
  9361. return $core.withContext(function($ctx1) {
  9362. var index = $self._positionOfKey_(aKey);
  9363. return index >=0 ? $self['@values'][index] : aBlock._value();
  9364. ;
  9365. return self;
  9366. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9367. },
  9368. args: ["aKey", "aBlock"],
  9369. 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'>",
  9370. referencedClasses: [],
  9371. messageSends: []
  9372. }),
  9373. $globals.Dictionary);
  9374. $core.addMethod(
  9375. $core.method({
  9376. selector: "at:put:",
  9377. protocol: "accessing",
  9378. fn: function (aKey,aValue){
  9379. var self=this,$self=this;
  9380. return $core.withContext(function($ctx1) {
  9381. var index = $self._positionOfKey_(aKey);
  9382. if(index === -1) {
  9383. var keys = $self['@keys'];
  9384. index = keys.length;
  9385. keys.push(aKey);
  9386. }
  9387. return $self['@values'][index] = aValue;
  9388. ;
  9389. return self;
  9390. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  9391. },
  9392. args: ["aKey", "aValue"],
  9393. 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'>",
  9394. referencedClasses: [],
  9395. messageSends: []
  9396. }),
  9397. $globals.Dictionary);
  9398. $core.addMethod(
  9399. $core.method({
  9400. selector: "includesKey:",
  9401. protocol: "testing",
  9402. fn: function (aKey){
  9403. var self=this,$self=this;
  9404. return $core.withContext(function($ctx1) {
  9405. return $self._positionOfKey_(aKey) >= 0;;
  9406. return self;
  9407. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  9408. },
  9409. args: ["aKey"],
  9410. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  9411. referencedClasses: [],
  9412. messageSends: []
  9413. }),
  9414. $globals.Dictionary);
  9415. $core.addMethod(
  9416. $core.method({
  9417. selector: "indexOf:ifAbsent:",
  9418. protocol: "accessing",
  9419. fn: function (anObject,aBlock){
  9420. var self=this,$self=this;
  9421. var index;
  9422. return $core.withContext(function($ctx1) {
  9423. var $1;
  9424. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  9425. return (0);
  9426. }));
  9427. $1=$recv(index).__eq((0));
  9428. if($core.assert($1)){
  9429. return $recv(aBlock)._value();
  9430. } else {
  9431. return $recv($self["@keys"])._at_(index);
  9432. }
  9433. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  9434. },
  9435. args: ["anObject", "aBlock"],
  9436. 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 ]",
  9437. referencedClasses: [],
  9438. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  9439. }),
  9440. $globals.Dictionary);
  9441. $core.addMethod(
  9442. $core.method({
  9443. selector: "initialize",
  9444. protocol: "initialization",
  9445. fn: function (){
  9446. var self=this,$self=this;
  9447. return $core.withContext(function($ctx1) {
  9448. (
  9449. $ctx1.supercall = true,
  9450. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9451. $ctx1.supercall = false;
  9452. $self["@keys"]=[];
  9453. $self["@values"]=[];
  9454. return self;
  9455. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  9456. },
  9457. args: [],
  9458. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9459. referencedClasses: [],
  9460. messageSends: ["initialize"]
  9461. }),
  9462. $globals.Dictionary);
  9463. $core.addMethod(
  9464. $core.method({
  9465. selector: "keys",
  9466. protocol: "accessing",
  9467. fn: function (){
  9468. var self=this,$self=this;
  9469. return $core.withContext(function($ctx1) {
  9470. return $recv($self["@keys"])._copy();
  9471. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  9472. },
  9473. args: [],
  9474. source: "keys\x0a\x09^ keys copy",
  9475. referencedClasses: [],
  9476. messageSends: ["copy"]
  9477. }),
  9478. $globals.Dictionary);
  9479. $core.addMethod(
  9480. $core.method({
  9481. selector: "keysAndValuesDo:",
  9482. protocol: "enumerating",
  9483. fn: function (aBlock){
  9484. var self=this,$self=this;
  9485. return $core.withContext(function($ctx1) {
  9486. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  9487. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9488. },
  9489. args: ["aBlock"],
  9490. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  9491. referencedClasses: [],
  9492. messageSends: ["with:do:"]
  9493. }),
  9494. $globals.Dictionary);
  9495. $core.addMethod(
  9496. $core.method({
  9497. selector: "keysDo:",
  9498. protocol: "enumerating",
  9499. fn: function (aBlock){
  9500. var self=this,$self=this;
  9501. return $core.withContext(function($ctx1) {
  9502. return $recv($self["@keys"])._do_(aBlock);
  9503. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  9504. },
  9505. args: ["aBlock"],
  9506. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  9507. referencedClasses: [],
  9508. messageSends: ["do:"]
  9509. }),
  9510. $globals.Dictionary);
  9511. $core.addMethod(
  9512. $core.method({
  9513. selector: "positionOfKey:",
  9514. protocol: "private",
  9515. fn: function (anObject){
  9516. var self=this,$self=this;
  9517. return $core.withContext(function($ctx1) {
  9518. var keys = $self['@keys'];
  9519. for(var i=0;i<keys.length;i++){
  9520. if(keys[i].__eq(anObject)) { return i;}
  9521. }
  9522. return -1;
  9523. ;
  9524. return self;
  9525. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  9526. },
  9527. args: ["anObject"],
  9528. 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'>",
  9529. referencedClasses: [],
  9530. messageSends: []
  9531. }),
  9532. $globals.Dictionary);
  9533. $core.addMethod(
  9534. $core.method({
  9535. selector: "removeAll",
  9536. protocol: "adding/removing",
  9537. fn: function (){
  9538. var self=this,$self=this;
  9539. return $core.withContext(function($ctx1) {
  9540. $recv($self["@keys"])._removeAll();
  9541. $ctx1.sendIdx["removeAll"]=1;
  9542. $recv($self["@values"])._removeAll();
  9543. return self;
  9544. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  9545. },
  9546. args: [],
  9547. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  9548. referencedClasses: [],
  9549. messageSends: ["removeAll"]
  9550. }),
  9551. $globals.Dictionary);
  9552. $core.addMethod(
  9553. $core.method({
  9554. selector: "removeKey:ifAbsent:",
  9555. protocol: "adding/removing",
  9556. fn: function (aKey,aBlock){
  9557. var self=this,$self=this;
  9558. return $core.withContext(function($ctx1) {
  9559. var index = $self._positionOfKey_(aKey);
  9560. if(index === -1) {
  9561. return aBlock._value()
  9562. } else {
  9563. var keys = $self['@keys'], values = $self['@values'];
  9564. var value = values[index], l = keys.length;
  9565. keys[index] = keys[l-1];
  9566. keys.pop();
  9567. values[index] = values[l-1];
  9568. values.pop();
  9569. return value;
  9570. }
  9571. ;
  9572. return self;
  9573. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9574. },
  9575. args: ["aKey", "aBlock"],
  9576. 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'>",
  9577. referencedClasses: [],
  9578. messageSends: []
  9579. }),
  9580. $globals.Dictionary);
  9581. $core.addMethod(
  9582. $core.method({
  9583. selector: "values",
  9584. protocol: "accessing",
  9585. fn: function (){
  9586. var self=this,$self=this;
  9587. return $self["@values"];
  9588. },
  9589. args: [],
  9590. source: "values\x0a\x09^ values",
  9591. referencedClasses: [],
  9592. messageSends: []
  9593. }),
  9594. $globals.Dictionary);
  9595. $core.addMethod(
  9596. $core.method({
  9597. selector: "valuesDo:",
  9598. protocol: "enumerating",
  9599. fn: function (aBlock){
  9600. var self=this,$self=this;
  9601. return $core.withContext(function($ctx1) {
  9602. return $recv($self["@values"])._do_(aBlock);
  9603. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9604. },
  9605. args: ["aBlock"],
  9606. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  9607. referencedClasses: [],
  9608. messageSends: ["do:"]
  9609. }),
  9610. $globals.Dictionary);
  9611. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  9612. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  9613. $core.addMethod(
  9614. $core.method({
  9615. selector: "at:ifAbsent:",
  9616. protocol: "accessing",
  9617. fn: function (aKey,aBlock){
  9618. var self=this,$self=this;
  9619. return $core.withContext(function($ctx1) {
  9620. var $1;
  9621. $1=$self._includesKey_(aKey);
  9622. if($core.assert($1)){
  9623. return $self._basicAt_(aKey);
  9624. } else {
  9625. return $recv(aBlock)._value();
  9626. }
  9627. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9628. },
  9629. args: ["aKey", "aBlock"],
  9630. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  9631. referencedClasses: [],
  9632. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  9633. }),
  9634. $globals.HashedCollection);
  9635. $core.addMethod(
  9636. $core.method({
  9637. selector: "at:put:",
  9638. protocol: "accessing",
  9639. fn: function (aKey,aValue){
  9640. var self=this,$self=this;
  9641. return $core.withContext(function($ctx1) {
  9642. return $self._basicAt_put_(aKey,aValue);
  9643. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  9644. },
  9645. args: ["aKey", "aValue"],
  9646. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  9647. referencedClasses: [],
  9648. messageSends: ["basicAt:put:"]
  9649. }),
  9650. $globals.HashedCollection);
  9651. $core.addMethod(
  9652. $core.method({
  9653. selector: "includesKey:",
  9654. protocol: "testing",
  9655. fn: function (aKey){
  9656. var self=this,$self=this;
  9657. return $core.withContext(function($ctx1) {
  9658. return self.hasOwnProperty(aKey);
  9659. return self;
  9660. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  9661. },
  9662. args: ["aKey"],
  9663. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  9664. referencedClasses: [],
  9665. messageSends: []
  9666. }),
  9667. $globals.HashedCollection);
  9668. $core.addMethod(
  9669. $core.method({
  9670. selector: "keys",
  9671. protocol: "accessing",
  9672. fn: function (){
  9673. var self=this,$self=this;
  9674. return $core.withContext(function($ctx1) {
  9675. return Object.keys(self);
  9676. return self;
  9677. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  9678. },
  9679. args: [],
  9680. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  9681. referencedClasses: [],
  9682. messageSends: []
  9683. }),
  9684. $globals.HashedCollection);
  9685. $core.addMethod(
  9686. $core.method({
  9687. selector: "keysDo:",
  9688. protocol: "enumerating",
  9689. fn: function (aBlock){
  9690. var self=this,$self=this;
  9691. return $core.withContext(function($ctx1) {
  9692. $recv($self._keys())._do_(aBlock);
  9693. return self;
  9694. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9695. },
  9696. args: ["aBlock"],
  9697. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  9698. referencedClasses: [],
  9699. messageSends: ["do:", "keys"]
  9700. }),
  9701. $globals.HashedCollection);
  9702. $core.addMethod(
  9703. $core.method({
  9704. selector: "removeKey:ifAbsent:",
  9705. protocol: "adding/removing",
  9706. fn: function (aKey,aBlock){
  9707. var self=this,$self=this;
  9708. return $core.withContext(function($ctx1) {
  9709. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  9710. return $core.withContext(function($ctx2) {
  9711. $self._basicDelete_(aKey);
  9712. return removed;
  9713. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  9714. }),(function(){
  9715. return $core.withContext(function($ctx2) {
  9716. return $recv(aBlock)._value();
  9717. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9718. }));
  9719. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9720. },
  9721. args: ["aKey", "aBlock"],
  9722. 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 ]",
  9723. referencedClasses: [],
  9724. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  9725. }),
  9726. $globals.HashedCollection);
  9727. $core.addMethod(
  9728. $core.method({
  9729. selector: "values",
  9730. protocol: "accessing",
  9731. fn: function (){
  9732. var self=this,$self=this;
  9733. return $core.withContext(function($ctx1) {
  9734. return $self._keys().map(function(key){
  9735. return $self._at_(key);
  9736. });
  9737. ;
  9738. return self;
  9739. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  9740. },
  9741. args: [],
  9742. 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'>",
  9743. referencedClasses: [],
  9744. messageSends: []
  9745. }),
  9746. $globals.HashedCollection);
  9747. $core.addMethod(
  9748. $core.method({
  9749. selector: "valuesDo:",
  9750. protocol: "enumerating",
  9751. fn: function (aBlock){
  9752. var self=this,$self=this;
  9753. return $core.withContext(function($ctx1) {
  9754. $recv($self._values())._do_(aBlock);
  9755. return self;
  9756. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9757. },
  9758. args: ["aBlock"],
  9759. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  9760. referencedClasses: [],
  9761. messageSends: ["do:", "values"]
  9762. }),
  9763. $globals.HashedCollection);
  9764. $core.addClass("SequenceableCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  9765. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  9766. $core.addMethod(
  9767. $core.method({
  9768. selector: "=",
  9769. protocol: "comparing",
  9770. fn: function (aCollection){
  9771. var self=this,$self=this;
  9772. return $core.withContext(function($ctx1) {
  9773. var $3,$2,$4,$1,$5;
  9774. var $early={};
  9775. try {
  9776. $3=$self._class();
  9777. $ctx1.sendIdx["class"]=1;
  9778. $2=$recv($3).__eq($recv(aCollection)._class());
  9779. $ctx1.sendIdx["="]=1;
  9780. $1=$recv($2)._and_((function(){
  9781. return $core.withContext(function($ctx2) {
  9782. $4=$self._size();
  9783. $ctx2.sendIdx["size"]=1;
  9784. return $recv($4).__eq($recv(aCollection)._size());
  9785. $ctx2.sendIdx["="]=2;
  9786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9787. }));
  9788. if(!$core.assert($1)){
  9789. return false;
  9790. }
  9791. $self._withIndexDo_((function(each,i){
  9792. return $core.withContext(function($ctx2) {
  9793. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  9794. if(!$core.assert($5)){
  9795. throw $early=[false];
  9796. }
  9797. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  9798. }));
  9799. return true;
  9800. }
  9801. catch(e) {if(e===$early)return e[0]; throw e}
  9802. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  9803. },
  9804. args: ["aCollection"],
  9805. 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",
  9806. referencedClasses: [],
  9807. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  9808. }),
  9809. $globals.SequenceableCollection);
  9810. $core.addMethod(
  9811. $core.method({
  9812. selector: "addLast:",
  9813. protocol: "adding/removing",
  9814. fn: function (anObject){
  9815. var self=this,$self=this;
  9816. return $core.withContext(function($ctx1) {
  9817. $self._add_(anObject);
  9818. return self;
  9819. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  9820. },
  9821. args: ["anObject"],
  9822. source: "addLast: anObject\x0a\x09self add: anObject",
  9823. referencedClasses: [],
  9824. messageSends: ["add:"]
  9825. }),
  9826. $globals.SequenceableCollection);
  9827. $core.addMethod(
  9828. $core.method({
  9829. selector: "allButFirst",
  9830. protocol: "accessing",
  9831. fn: function (){
  9832. var self=this,$self=this;
  9833. return $core.withContext(function($ctx1) {
  9834. return $self._copyFrom_to_((2),$self._size());
  9835. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  9836. },
  9837. args: [],
  9838. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  9839. referencedClasses: [],
  9840. messageSends: ["copyFrom:to:", "size"]
  9841. }),
  9842. $globals.SequenceableCollection);
  9843. $core.addMethod(
  9844. $core.method({
  9845. selector: "allButLast",
  9846. protocol: "accessing",
  9847. fn: function (){
  9848. var self=this,$self=this;
  9849. return $core.withContext(function($ctx1) {
  9850. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  9851. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  9852. },
  9853. args: [],
  9854. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  9855. referencedClasses: [],
  9856. messageSends: ["copyFrom:to:", "-", "size"]
  9857. }),
  9858. $globals.SequenceableCollection);
  9859. $core.addMethod(
  9860. $core.method({
  9861. selector: "anyOne",
  9862. protocol: "accessing",
  9863. fn: function (){
  9864. var self=this,$self=this;
  9865. return $core.withContext(function($ctx1) {
  9866. return $self._at_((1));
  9867. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  9868. },
  9869. args: [],
  9870. source: "anyOne\x0a\x09^ self at: 1",
  9871. referencedClasses: [],
  9872. messageSends: ["at:"]
  9873. }),
  9874. $globals.SequenceableCollection);
  9875. $core.addMethod(
  9876. $core.method({
  9877. selector: "atRandom",
  9878. protocol: "accessing",
  9879. fn: function (){
  9880. var self=this,$self=this;
  9881. return $core.withContext(function($ctx1) {
  9882. return $self._at_($recv($self._size())._atRandom());
  9883. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  9884. },
  9885. args: [],
  9886. source: "atRandom\x0a\x09^ self at: self size atRandom",
  9887. referencedClasses: [],
  9888. messageSends: ["at:", "atRandom", "size"]
  9889. }),
  9890. $globals.SequenceableCollection);
  9891. $core.addMethod(
  9892. $core.method({
  9893. selector: "beginsWith:",
  9894. protocol: "testing",
  9895. fn: function (prefix){
  9896. var self=this,$self=this;
  9897. return $core.withContext(function($ctx1) {
  9898. var $2,$3,$1;
  9899. $2=$self._size();
  9900. $ctx1.sendIdx["size"]=1;
  9901. $3=$recv(prefix)._size();
  9902. $ctx1.sendIdx["size"]=2;
  9903. $1=$recv($2).__lt($3);
  9904. if($core.assert($1)){
  9905. return false;
  9906. }
  9907. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  9908. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  9909. },
  9910. args: ["prefix"],
  9911. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  9912. referencedClasses: [],
  9913. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  9914. }),
  9915. $globals.SequenceableCollection);
  9916. $core.addMethod(
  9917. $core.method({
  9918. selector: "copyFrom:to:",
  9919. protocol: "copying",
  9920. fn: function (anIndex,anotherIndex){
  9921. var self=this,$self=this;
  9922. return $core.withContext(function($ctx1) {
  9923. $self._subclassResponsibility();
  9924. return self;
  9925. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  9926. },
  9927. args: ["anIndex", "anotherIndex"],
  9928. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  9929. referencedClasses: [],
  9930. messageSends: ["subclassResponsibility"]
  9931. }),
  9932. $globals.SequenceableCollection);
  9933. $core.addMethod(
  9934. $core.method({
  9935. selector: "detect:ifNone:",
  9936. protocol: "enumerating",
  9937. fn: function (aBlock,anotherBlock){
  9938. var self=this,$self=this;
  9939. return $core.withContext(function($ctx1) {
  9940. var nself = $self._numericallyIndexable();
  9941. for(var i = 0; i < nself.length; i++)
  9942. if(aBlock._value_(nself[i]))
  9943. return nself[i];
  9944. return anotherBlock._value();
  9945. ;
  9946. return self;
  9947. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  9948. },
  9949. args: ["aBlock", "anotherBlock"],
  9950. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i = 0; i < nself.length; i++)\x0a\x09\x09\x09if(aBlock._value_(nself[i]))\x0a\x09\x09\x09\x09return nself[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09'>",
  9951. referencedClasses: [],
  9952. messageSends: []
  9953. }),
  9954. $globals.SequenceableCollection);
  9955. $core.addMethod(
  9956. $core.method({
  9957. selector: "do:",
  9958. protocol: "enumerating",
  9959. fn: function (aBlock){
  9960. var self=this,$self=this;
  9961. return $core.withContext(function($ctx1) {
  9962. var nself = $self._numericallyIndexable();
  9963. for(var i=0; i < nself.length; i++) {
  9964. aBlock._value_(nself[i]);
  9965. }
  9966. ;
  9967. return self;
  9968. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  9969. },
  9970. args: ["aBlock"],
  9971. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < nself.length; i++) {\x0a\x09\x09\x09aBlock._value_(nself[i]);\x0a\x09\x09}\x0a\x09'>",
  9972. referencedClasses: [],
  9973. messageSends: []
  9974. }),
  9975. $globals.SequenceableCollection);
  9976. $core.addMethod(
  9977. $core.method({
  9978. selector: "endsWith:",
  9979. protocol: "testing",
  9980. fn: function (suffix){
  9981. var self=this,$self=this;
  9982. return $core.withContext(function($ctx1) {
  9983. var $2,$3,$1;
  9984. $2=$self._size();
  9985. $ctx1.sendIdx["size"]=1;
  9986. $3=$recv(suffix)._size();
  9987. $ctx1.sendIdx["size"]=2;
  9988. $1=$recv($2).__lt($3);
  9989. if($core.assert($1)){
  9990. return false;
  9991. }
  9992. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  9993. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  9994. },
  9995. args: ["suffix"],
  9996. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  9997. referencedClasses: [],
  9998. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  9999. }),
  10000. $globals.SequenceableCollection);
  10001. $core.addMethod(
  10002. $core.method({
  10003. selector: "first",
  10004. protocol: "accessing",
  10005. fn: function (){
  10006. var self=this,$self=this;
  10007. return $core.withContext(function($ctx1) {
  10008. return $self._at_((1));
  10009. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  10010. },
  10011. args: [],
  10012. source: "first\x0a\x09^ self at: 1",
  10013. referencedClasses: [],
  10014. messageSends: ["at:"]
  10015. }),
  10016. $globals.SequenceableCollection);
  10017. $core.addMethod(
  10018. $core.method({
  10019. selector: "first:",
  10020. protocol: "accessing",
  10021. fn: function (aNumber){
  10022. var self=this,$self=this;
  10023. return $core.withContext(function($ctx1) {
  10024. var $1;
  10025. $1=$recv($self._size()).__lt(aNumber);
  10026. if($core.assert($1)){
  10027. $self._error_("Invalid number of elements");
  10028. }
  10029. return $self._copyFrom_to_((1),aNumber);
  10030. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10031. },
  10032. args: ["aNumber"],
  10033. 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",
  10034. referencedClasses: [],
  10035. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  10036. }),
  10037. $globals.SequenceableCollection);
  10038. $core.addMethod(
  10039. $core.method({
  10040. selector: "fourth",
  10041. protocol: "accessing",
  10042. fn: function (){
  10043. var self=this,$self=this;
  10044. return $core.withContext(function($ctx1) {
  10045. return $self._at_((4));
  10046. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  10047. },
  10048. args: [],
  10049. source: "fourth\x0a\x09^ self at: 4",
  10050. referencedClasses: [],
  10051. messageSends: ["at:"]
  10052. }),
  10053. $globals.SequenceableCollection);
  10054. $core.addMethod(
  10055. $core.method({
  10056. selector: "includes:",
  10057. protocol: "testing",
  10058. fn: function (anObject){
  10059. var self=this,$self=this;
  10060. return $core.withContext(function($ctx1) {
  10061. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  10062. return nil;
  10063. })))._notNil();
  10064. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  10065. },
  10066. args: ["anObject"],
  10067. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  10068. referencedClasses: [],
  10069. messageSends: ["notNil", "indexOf:ifAbsent:"]
  10070. }),
  10071. $globals.SequenceableCollection);
  10072. $core.addMethod(
  10073. $core.method({
  10074. selector: "indexOf:ifAbsent:",
  10075. protocol: "accessing",
  10076. fn: function (anObject,aBlock){
  10077. var self=this,$self=this;
  10078. return $core.withContext(function($ctx1) {
  10079. var nself = $self._numericallyIndexable();
  10080. for(var i=0; i < nself.length; i++) {
  10081. if($recv(nself[i]).__eq(anObject)) {return i+1}
  10082. };
  10083. return aBlock._value();
  10084. ;
  10085. return self;
  10086. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  10087. },
  10088. args: ["anObject", "aBlock"],
  10089. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < nself.length; i++) {\x0a\x09\x09\x09if($recv(nself[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  10090. referencedClasses: [],
  10091. messageSends: []
  10092. }),
  10093. $globals.SequenceableCollection);
  10094. $core.addMethod(
  10095. $core.method({
  10096. selector: "indexOf:startingAt:",
  10097. protocol: "accessing",
  10098. fn: function (anObject,start){
  10099. var self=this,$self=this;
  10100. return $core.withContext(function($ctx1) {
  10101. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  10102. return (0);
  10103. }));
  10104. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  10105. },
  10106. args: ["anObject", "start"],
  10107. 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 ]",
  10108. referencedClasses: [],
  10109. messageSends: ["indexOf:startingAt:ifAbsent:"]
  10110. }),
  10111. $globals.SequenceableCollection);
  10112. $core.addMethod(
  10113. $core.method({
  10114. selector: "indexOf:startingAt:ifAbsent:",
  10115. protocol: "accessing",
  10116. fn: function (anObject,start,aBlock){
  10117. var self=this,$self=this;
  10118. return $core.withContext(function($ctx1) {
  10119. var nself = $self._numericallyIndexable();
  10120. for(var i=start - 1; i < nself.length; i++){
  10121. if($recv(nself[i]).__eq(anObject)) {return i+1}
  10122. }
  10123. return aBlock._value();
  10124. ;
  10125. return self;
  10126. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  10127. },
  10128. args: ["anObject", "start", "aBlock"],
  10129. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=start - 1; i < nself.length; i++){\x0a\x09\x09\x09if($recv(nself[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  10130. referencedClasses: [],
  10131. messageSends: []
  10132. }),
  10133. $globals.SequenceableCollection);
  10134. $core.addMethod(
  10135. $core.method({
  10136. selector: "last",
  10137. protocol: "accessing",
  10138. fn: function (){
  10139. var self=this,$self=this;
  10140. return $core.withContext(function($ctx1) {
  10141. return $self._at_($self._size());
  10142. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  10143. },
  10144. args: [],
  10145. source: "last\x0a\x09^ self at: self size",
  10146. referencedClasses: [],
  10147. messageSends: ["at:", "size"]
  10148. }),
  10149. $globals.SequenceableCollection);
  10150. $core.addMethod(
  10151. $core.method({
  10152. selector: "last:",
  10153. protocol: "accessing",
  10154. fn: function (aNumber){
  10155. var self=this,$self=this;
  10156. return $core.withContext(function($ctx1) {
  10157. var $2,$1,$5,$4,$3;
  10158. $2=$self._size();
  10159. $ctx1.sendIdx["size"]=1;
  10160. $1=$recv($2).__lt(aNumber);
  10161. if($core.assert($1)){
  10162. $self._error_("Invalid number of elements");
  10163. }
  10164. $5=$self._size();
  10165. $ctx1.sendIdx["size"]=2;
  10166. $4=$recv($5).__minus(aNumber);
  10167. $3=$recv($4).__plus((1));
  10168. return $self._copyFrom_to_($3,$self._size());
  10169. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10170. },
  10171. args: ["aNumber"],
  10172. 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",
  10173. referencedClasses: [],
  10174. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  10175. }),
  10176. $globals.SequenceableCollection);
  10177. $core.addMethod(
  10178. $core.method({
  10179. selector: "newStream",
  10180. protocol: "streaming",
  10181. fn: function (){
  10182. var self=this,$self=this;
  10183. return $core.withContext(function($ctx1) {
  10184. return $recv($self._streamClass())._on_(self);
  10185. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  10186. },
  10187. args: [],
  10188. source: "newStream\x0a\x09^ self streamClass on: self",
  10189. referencedClasses: [],
  10190. messageSends: ["on:", "streamClass"]
  10191. }),
  10192. $globals.SequenceableCollection);
  10193. $core.addMethod(
  10194. $core.method({
  10195. selector: "numericallyIndexable",
  10196. protocol: "private",
  10197. fn: function (){
  10198. var self=this,$self=this;
  10199. return $core.withContext(function($ctx1) {
  10200. $self._subclassResponsibility();
  10201. return self;
  10202. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  10203. },
  10204. args: [],
  10205. source: "numericallyIndexable\x0a\x09\x22This is an internal converting message.\x0a\x09It answeres a representation of the receiver\x0a\x09that can use foo[i] in JavaScript code.\x0a\x09\x0a\x09It fixes IE8, where boxed String is unable\x0a\x09to numerically index its characters,\x0a\x09but primitive string can.\x22\x0a\x09\x0a\x09self subclassResponsibility",
  10206. referencedClasses: [],
  10207. messageSends: ["subclassResponsibility"]
  10208. }),
  10209. $globals.SequenceableCollection);
  10210. $core.addMethod(
  10211. $core.method({
  10212. selector: "readStream",
  10213. protocol: "streaming",
  10214. fn: function (){
  10215. var self=this,$self=this;
  10216. return $core.withContext(function($ctx1) {
  10217. return $self._stream();
  10218. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  10219. },
  10220. args: [],
  10221. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10222. referencedClasses: [],
  10223. messageSends: ["stream"]
  10224. }),
  10225. $globals.SequenceableCollection);
  10226. $core.addMethod(
  10227. $core.method({
  10228. selector: "removeLast",
  10229. protocol: "adding/removing",
  10230. fn: function (){
  10231. var self=this,$self=this;
  10232. return $core.withContext(function($ctx1) {
  10233. return $self._remove_($self._last());
  10234. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  10235. },
  10236. args: [],
  10237. source: "removeLast\x0a\x09^ self remove: self last",
  10238. referencedClasses: [],
  10239. messageSends: ["remove:", "last"]
  10240. }),
  10241. $globals.SequenceableCollection);
  10242. $core.addMethod(
  10243. $core.method({
  10244. selector: "reverseDo:",
  10245. protocol: "enumerating",
  10246. fn: function (aBlock){
  10247. var self=this,$self=this;
  10248. return $core.withContext(function($ctx1) {
  10249. $recv($self._reversed())._do_(aBlock);
  10250. return self;
  10251. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10252. },
  10253. args: ["aBlock"],
  10254. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  10255. referencedClasses: [],
  10256. messageSends: ["do:", "reversed"]
  10257. }),
  10258. $globals.SequenceableCollection);
  10259. $core.addMethod(
  10260. $core.method({
  10261. selector: "reversed",
  10262. protocol: "converting",
  10263. fn: function (){
  10264. var self=this,$self=this;
  10265. return $core.withContext(function($ctx1) {
  10266. $self._subclassResponsibility();
  10267. return self;
  10268. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  10269. },
  10270. args: [],
  10271. source: "reversed\x0a\x09self subclassResponsibility",
  10272. referencedClasses: [],
  10273. messageSends: ["subclassResponsibility"]
  10274. }),
  10275. $globals.SequenceableCollection);
  10276. $core.addMethod(
  10277. $core.method({
  10278. selector: "second",
  10279. protocol: "accessing",
  10280. fn: function (){
  10281. var self=this,$self=this;
  10282. return $core.withContext(function($ctx1) {
  10283. return $self._at_((2));
  10284. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  10285. },
  10286. args: [],
  10287. source: "second\x0a\x09^ self at: 2",
  10288. referencedClasses: [],
  10289. messageSends: ["at:"]
  10290. }),
  10291. $globals.SequenceableCollection);
  10292. $core.addMethod(
  10293. $core.method({
  10294. selector: "single",
  10295. protocol: "accessing",
  10296. fn: function (){
  10297. var self=this,$self=this;
  10298. return $core.withContext(function($ctx1) {
  10299. if (self.length == 0) throw new Error("Collection is empty");
  10300. if (self.length > 1) throw new Error("Collection holds more than one element.");
  10301. return $self._numericallyIndexable()[0];;
  10302. return self;
  10303. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  10304. },
  10305. args: [],
  10306. source: "single\x0a<inlineJS: '\x0a\x09if (self.length == 0) throw new Error(\x22Collection is empty\x22);\x0a\x09if (self.length > 1) throw new Error(\x22Collection holds more than one element.\x22);\x0a\x09return $self._numericallyIndexable()[0];\x0a'>",
  10307. referencedClasses: [],
  10308. messageSends: []
  10309. }),
  10310. $globals.SequenceableCollection);
  10311. $core.addMethod(
  10312. $core.method({
  10313. selector: "stream",
  10314. protocol: "streaming",
  10315. fn: function (){
  10316. var self=this,$self=this;
  10317. return $core.withContext(function($ctx1) {
  10318. return $self._newStream();
  10319. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  10320. },
  10321. args: [],
  10322. source: "stream\x0a\x09^ self newStream",
  10323. referencedClasses: [],
  10324. messageSends: ["newStream"]
  10325. }),
  10326. $globals.SequenceableCollection);
  10327. $core.addMethod(
  10328. $core.method({
  10329. selector: "streamClass",
  10330. protocol: "streaming",
  10331. fn: function (){
  10332. var self=this,$self=this;
  10333. return $core.withContext(function($ctx1) {
  10334. return $recv($self._class())._streamClass();
  10335. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  10336. },
  10337. args: [],
  10338. source: "streamClass\x0a\x09^ self class streamClass",
  10339. referencedClasses: [],
  10340. messageSends: ["streamClass", "class"]
  10341. }),
  10342. $globals.SequenceableCollection);
  10343. $core.addMethod(
  10344. $core.method({
  10345. selector: "third",
  10346. protocol: "accessing",
  10347. fn: function (){
  10348. var self=this,$self=this;
  10349. return $core.withContext(function($ctx1) {
  10350. return $self._at_((3));
  10351. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  10352. },
  10353. args: [],
  10354. source: "third\x0a\x09^ self at: 3",
  10355. referencedClasses: [],
  10356. messageSends: ["at:"]
  10357. }),
  10358. $globals.SequenceableCollection);
  10359. $core.addMethod(
  10360. $core.method({
  10361. selector: "with:do:",
  10362. protocol: "enumerating",
  10363. fn: function (anotherCollection,aBlock){
  10364. var self=this,$self=this;
  10365. return $core.withContext(function($ctx1) {
  10366. var nself = $self._numericallyIndexable();
  10367. anotherCollection = anotherCollection._numericallyIndexable();
  10368. for(var i=0; i<nself.length; i++) {
  10369. aBlock._value_value_(nself[i], anotherCollection[i]);
  10370. }
  10371. ;
  10372. return self;
  10373. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  10374. },
  10375. args: ["anotherCollection", "aBlock"],
  10376. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09anotherCollection = anotherCollection._numericallyIndexable();\x0a\x09\x09for(var i=0; i<nself.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(nself[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09'>",
  10377. referencedClasses: [],
  10378. messageSends: []
  10379. }),
  10380. $globals.SequenceableCollection);
  10381. $core.addMethod(
  10382. $core.method({
  10383. selector: "withIndexDo:",
  10384. protocol: "enumerating",
  10385. fn: function (aBlock){
  10386. var self=this,$self=this;
  10387. return $core.withContext(function($ctx1) {
  10388. var nself = $self._numericallyIndexable();
  10389. for(var i=0; i < nself.length; i++) {
  10390. aBlock._value_value_(nself[i], i+1);
  10391. }
  10392. ;
  10393. return self;
  10394. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10395. },
  10396. args: ["aBlock"],
  10397. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < nself.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(nself[i], i+1);\x0a\x09\x09}\x0a\x09'>",
  10398. referencedClasses: [],
  10399. messageSends: []
  10400. }),
  10401. $globals.SequenceableCollection);
  10402. $core.addMethod(
  10403. $core.method({
  10404. selector: "writeStream",
  10405. protocol: "streaming",
  10406. fn: function (){
  10407. var self=this,$self=this;
  10408. return $core.withContext(function($ctx1) {
  10409. return $self._stream();
  10410. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  10411. },
  10412. args: [],
  10413. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10414. referencedClasses: [],
  10415. messageSends: ["stream"]
  10416. }),
  10417. $globals.SequenceableCollection);
  10418. $core.addMethod(
  10419. $core.method({
  10420. selector: "streamClass",
  10421. protocol: "accessing",
  10422. fn: function (){
  10423. var self=this,$self=this;
  10424. return $globals.Stream;
  10425. },
  10426. args: [],
  10427. source: "streamClass\x0a\x09\x09^ Stream",
  10428. referencedClasses: ["Stream"],
  10429. messageSends: []
  10430. }),
  10431. $globals.SequenceableCollection.a$cls);
  10432. $core.addMethod(
  10433. $core.method({
  10434. selector: "streamContents:",
  10435. protocol: "streaming",
  10436. fn: function (aBlock){
  10437. var self=this,$self=this;
  10438. var stream;
  10439. return $core.withContext(function($ctx1) {
  10440. stream=$recv($self._streamClass())._on_($self._new());
  10441. $recv(aBlock)._value_(stream);
  10442. return $recv(stream)._contents();
  10443. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  10444. },
  10445. args: ["aBlock"],
  10446. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  10447. referencedClasses: [],
  10448. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  10449. }),
  10450. $globals.SequenceableCollection.a$cls);
  10451. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  10452. $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`.";
  10453. $core.addMethod(
  10454. $core.method({
  10455. selector: "add:",
  10456. protocol: "adding/removing",
  10457. fn: function (anObject){
  10458. var self=this,$self=this;
  10459. return $core.withContext(function($ctx1) {
  10460. self.push(anObject); return anObject;;
  10461. return self;
  10462. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  10463. },
  10464. args: ["anObject"],
  10465. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  10466. referencedClasses: [],
  10467. messageSends: []
  10468. }),
  10469. $globals.Array);
  10470. $core.addMethod(
  10471. $core.method({
  10472. selector: "addAll:",
  10473. protocol: "adding/removing",
  10474. fn: function (aCollection){
  10475. var self=this,$self=this;
  10476. return $core.withContext(function($ctx1) {
  10477. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  10478. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  10479. return aCollection;;
  10480. return self;
  10481. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  10482. },
  10483. args: ["aCollection"],
  10484. 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'>",
  10485. referencedClasses: [],
  10486. messageSends: []
  10487. }),
  10488. $globals.Array);
  10489. $core.addMethod(
  10490. $core.method({
  10491. selector: "addFirst:",
  10492. protocol: "adding/removing",
  10493. fn: function (anObject){
  10494. var self=this,$self=this;
  10495. return $core.withContext(function($ctx1) {
  10496. self.unshift(anObject); return anObject;;
  10497. return self;
  10498. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  10499. },
  10500. args: ["anObject"],
  10501. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  10502. referencedClasses: [],
  10503. messageSends: []
  10504. }),
  10505. $globals.Array);
  10506. $core.addMethod(
  10507. $core.method({
  10508. selector: "asJavaScriptSource",
  10509. protocol: "converting",
  10510. fn: function (){
  10511. var self=this,$self=this;
  10512. return $core.withContext(function($ctx1) {
  10513. var $1;
  10514. $1=$recv("[".__comma($recv($self._collect_((function(each){
  10515. return $core.withContext(function($ctx2) {
  10516. return $recv(each)._asJavaScriptSource();
  10517. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10518. })))._join_(", "))).__comma("]");
  10519. $ctx1.sendIdx[","]=1;
  10520. return $1;
  10521. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  10522. },
  10523. args: [],
  10524. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  10525. referencedClasses: [],
  10526. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  10527. }),
  10528. $globals.Array);
  10529. $core.addMethod(
  10530. $core.method({
  10531. selector: "at:ifAbsent:",
  10532. protocol: "accessing",
  10533. fn: function (anIndex,aBlock){
  10534. var self=this,$self=this;
  10535. return $core.withContext(function($ctx1) {
  10536. return anIndex >= 1 && anIndex <= self.length
  10537. ? self[anIndex - 1]
  10538. : aBlock._value()
  10539. ;
  10540. return self;
  10541. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  10542. },
  10543. args: ["anIndex", "aBlock"],
  10544. 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'>",
  10545. referencedClasses: [],
  10546. messageSends: []
  10547. }),
  10548. $globals.Array);
  10549. $core.addMethod(
  10550. $core.method({
  10551. selector: "at:ifPresent:ifAbsent:",
  10552. protocol: "accessing",
  10553. fn: function (anIndex,aBlock,anotherBlock){
  10554. var self=this,$self=this;
  10555. return $core.withContext(function($ctx1) {
  10556. return anIndex >= 1 && anIndex <= self.length
  10557. ? aBlock._value_(self[anIndex - 1])
  10558. : anotherBlock._value()
  10559. ;
  10560. return self;
  10561. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  10562. },
  10563. args: ["anIndex", "aBlock", "anotherBlock"],
  10564. 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'>",
  10565. referencedClasses: [],
  10566. messageSends: []
  10567. }),
  10568. $globals.Array);
  10569. $core.addMethod(
  10570. $core.method({
  10571. selector: "at:put:",
  10572. protocol: "accessing",
  10573. fn: function (anIndex,anObject){
  10574. var self=this,$self=this;
  10575. return $core.withContext(function($ctx1) {
  10576. return self[anIndex - 1] = anObject;
  10577. return self;
  10578. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  10579. },
  10580. args: ["anIndex", "anObject"],
  10581. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  10582. referencedClasses: [],
  10583. messageSends: []
  10584. }),
  10585. $globals.Array);
  10586. $core.addMethod(
  10587. $core.method({
  10588. selector: "collect:",
  10589. protocol: "enumerating",
  10590. fn: function (aBlock){
  10591. var self=this,$self=this;
  10592. return $core.withContext(function($ctx1) {
  10593. return self.map(function(each) {return aBlock._value_(each)});
  10594. return self;
  10595. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  10596. },
  10597. args: ["aBlock"],
  10598. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  10599. referencedClasses: [],
  10600. messageSends: []
  10601. }),
  10602. $globals.Array);
  10603. $core.addMethod(
  10604. $core.method({
  10605. selector: "copyFrom:to:",
  10606. protocol: "copying",
  10607. fn: function (anIndex,anotherIndex){
  10608. var self=this,$self=this;
  10609. return $core.withContext(function($ctx1) {
  10610. if (anIndex >= 1 && anotherIndex <= self.length) {
  10611. return self.slice(anIndex - 1, anotherIndex);
  10612. } else {
  10613. self._at_(anIndex);
  10614. self._at_(self.length + 1);
  10615. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  10616. };
  10617. return self;
  10618. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  10619. },
  10620. args: ["anIndex", "anotherIndex"],
  10621. 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'>",
  10622. referencedClasses: [],
  10623. messageSends: []
  10624. }),
  10625. $globals.Array);
  10626. $core.addMethod(
  10627. $core.method({
  10628. selector: "join:",
  10629. protocol: "enumerating",
  10630. fn: function (aString){
  10631. var self=this,$self=this;
  10632. return $core.withContext(function($ctx1) {
  10633. return self.join(aString);
  10634. return self;
  10635. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  10636. },
  10637. args: ["aString"],
  10638. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  10639. referencedClasses: [],
  10640. messageSends: []
  10641. }),
  10642. $globals.Array);
  10643. $core.addMethod(
  10644. $core.method({
  10645. selector: "numericallyIndexable",
  10646. protocol: "private",
  10647. fn: function (){
  10648. var self=this,$self=this;
  10649. return self;
  10650. },
  10651. args: [],
  10652. source: "numericallyIndexable\x0a\x09^ self",
  10653. referencedClasses: [],
  10654. messageSends: []
  10655. }),
  10656. $globals.Array);
  10657. $core.addMethod(
  10658. $core.method({
  10659. selector: "printOn:",
  10660. protocol: "printing",
  10661. fn: function (aStream){
  10662. var self=this,$self=this;
  10663. return $core.withContext(function($ctx1) {
  10664. (
  10665. $ctx1.supercall = true,
  10666. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  10667. $ctx1.supercall = false;
  10668. $ctx1.sendIdx["printOn:"]=1;
  10669. $recv(aStream)._nextPutAll_(" (");
  10670. $ctx1.sendIdx["nextPutAll:"]=1;
  10671. $self._do_separatedBy_((function(each){
  10672. return $core.withContext(function($ctx2) {
  10673. return $recv(each)._printOn_(aStream);
  10674. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10675. }),(function(){
  10676. return $core.withContext(function($ctx2) {
  10677. return $recv(aStream)._nextPutAll_(" ");
  10678. $ctx2.sendIdx["nextPutAll:"]=2;
  10679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10680. }));
  10681. $recv(aStream)._nextPutAll_(")");
  10682. return self;
  10683. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  10684. },
  10685. args: ["aStream"],
  10686. 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: ')'",
  10687. referencedClasses: [],
  10688. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  10689. }),
  10690. $globals.Array);
  10691. $core.addMethod(
  10692. $core.method({
  10693. selector: "remove:ifAbsent:",
  10694. protocol: "adding/removing",
  10695. fn: function (anObject,aBlock){
  10696. var self=this,$self=this;
  10697. var index;
  10698. return $core.withContext(function($ctx1) {
  10699. var $1;
  10700. index=$self._indexOf_ifAbsent_(anObject,(function(){
  10701. return (0);
  10702. }));
  10703. $1=$recv(index).__eq((0));
  10704. if($core.assert($1)){
  10705. return $recv(aBlock)._value();
  10706. } else {
  10707. $self._removeIndex_(index);
  10708. return anObject;
  10709. }
  10710. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  10711. },
  10712. args: ["anObject", "aBlock"],
  10713. 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 ]",
  10714. referencedClasses: [],
  10715. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  10716. }),
  10717. $globals.Array);
  10718. $core.addMethod(
  10719. $core.method({
  10720. selector: "removeAll",
  10721. protocol: "adding/removing",
  10722. fn: function (){
  10723. var self=this,$self=this;
  10724. return $core.withContext(function($ctx1) {
  10725. self.length = 0;
  10726. return self;
  10727. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  10728. },
  10729. args: [],
  10730. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  10731. referencedClasses: [],
  10732. messageSends: []
  10733. }),
  10734. $globals.Array);
  10735. $core.addMethod(
  10736. $core.method({
  10737. selector: "removeFrom:to:",
  10738. protocol: "adding/removing",
  10739. fn: function (aNumber,anotherNumber){
  10740. var self=this,$self=this;
  10741. return $core.withContext(function($ctx1) {
  10742. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  10743. return self;
  10744. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  10745. },
  10746. args: ["aNumber", "anotherNumber"],
  10747. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  10748. referencedClasses: [],
  10749. messageSends: []
  10750. }),
  10751. $globals.Array);
  10752. $core.addMethod(
  10753. $core.method({
  10754. selector: "removeIndex:",
  10755. protocol: "adding/removing",
  10756. fn: function (anInteger){
  10757. var self=this,$self=this;
  10758. return $core.withContext(function($ctx1) {
  10759. self.splice(anInteger - 1, 1);
  10760. return self;
  10761. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  10762. },
  10763. args: ["anInteger"],
  10764. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  10765. referencedClasses: [],
  10766. messageSends: []
  10767. }),
  10768. $globals.Array);
  10769. $core.addMethod(
  10770. $core.method({
  10771. selector: "removeLast",
  10772. protocol: "adding/removing",
  10773. fn: function (){
  10774. var self=this,$self=this;
  10775. return $core.withContext(function($ctx1) {
  10776. return self.pop();;
  10777. return self;
  10778. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  10779. },
  10780. args: [],
  10781. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  10782. referencedClasses: [],
  10783. messageSends: []
  10784. }),
  10785. $globals.Array);
  10786. $core.addMethod(
  10787. $core.method({
  10788. selector: "reversed",
  10789. protocol: "converting",
  10790. fn: function (){
  10791. var self=this,$self=this;
  10792. return $core.withContext(function($ctx1) {
  10793. return self.slice().reverse();
  10794. return self;
  10795. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  10796. },
  10797. args: [],
  10798. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  10799. referencedClasses: [],
  10800. messageSends: []
  10801. }),
  10802. $globals.Array);
  10803. $core.addMethod(
  10804. $core.method({
  10805. selector: "select:",
  10806. protocol: "enumerating",
  10807. fn: function (aBlock){
  10808. var self=this,$self=this;
  10809. return $core.withContext(function($ctx1) {
  10810. return self.filter(function(each) {return aBlock._value_(each)});
  10811. return self;
  10812. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  10813. },
  10814. args: ["aBlock"],
  10815. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  10816. referencedClasses: [],
  10817. messageSends: []
  10818. }),
  10819. $globals.Array);
  10820. $core.addMethod(
  10821. $core.method({
  10822. selector: "shallowCopy",
  10823. protocol: "copying",
  10824. fn: function (){
  10825. var self=this,$self=this;
  10826. return $core.withContext(function($ctx1) {
  10827. return self.slice();
  10828. return self;
  10829. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  10830. },
  10831. args: [],
  10832. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  10833. referencedClasses: [],
  10834. messageSends: []
  10835. }),
  10836. $globals.Array);
  10837. $core.addMethod(
  10838. $core.method({
  10839. selector: "size",
  10840. protocol: "accessing",
  10841. fn: function (){
  10842. var self=this,$self=this;
  10843. return $core.withContext(function($ctx1) {
  10844. return self.length;
  10845. return self;
  10846. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  10847. },
  10848. args: [],
  10849. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  10850. referencedClasses: [],
  10851. messageSends: []
  10852. }),
  10853. $globals.Array);
  10854. $core.addMethod(
  10855. $core.method({
  10856. selector: "sort",
  10857. protocol: "enumerating",
  10858. fn: function (){
  10859. var self=this,$self=this;
  10860. return $core.withContext(function($ctx1) {
  10861. return $self._sort_((function(a,b){
  10862. return $core.withContext(function($ctx2) {
  10863. return $recv(a).__lt(b);
  10864. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  10865. }));
  10866. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  10867. },
  10868. args: [],
  10869. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  10870. referencedClasses: [],
  10871. messageSends: ["sort:", "<"]
  10872. }),
  10873. $globals.Array);
  10874. $core.addMethod(
  10875. $core.method({
  10876. selector: "sort:",
  10877. protocol: "enumerating",
  10878. fn: function (aBlock){
  10879. var self=this,$self=this;
  10880. return $core.withContext(function($ctx1) {
  10881. return self.sort(function(a, b) {
  10882. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  10883. })
  10884. ;
  10885. return self;
  10886. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  10887. },
  10888. args: ["aBlock"],
  10889. 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'>",
  10890. referencedClasses: [],
  10891. messageSends: []
  10892. }),
  10893. $globals.Array);
  10894. $core.addMethod(
  10895. $core.method({
  10896. selector: "sorted",
  10897. protocol: "enumerating",
  10898. fn: function (){
  10899. var self=this,$self=this;
  10900. return $core.withContext(function($ctx1) {
  10901. return $recv($self._copy())._sort();
  10902. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  10903. },
  10904. args: [],
  10905. source: "sorted\x0a\x09^ self copy sort",
  10906. referencedClasses: [],
  10907. messageSends: ["sort", "copy"]
  10908. }),
  10909. $globals.Array);
  10910. $core.addMethod(
  10911. $core.method({
  10912. selector: "sorted:",
  10913. protocol: "enumerating",
  10914. fn: function (aBlock){
  10915. var self=this,$self=this;
  10916. return $core.withContext(function($ctx1) {
  10917. return $recv($self._copy())._sort_(aBlock);
  10918. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  10919. },
  10920. args: ["aBlock"],
  10921. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  10922. referencedClasses: [],
  10923. messageSends: ["sort:", "copy"]
  10924. }),
  10925. $globals.Array);
  10926. $core.addMethod(
  10927. $core.method({
  10928. selector: "new:",
  10929. protocol: "instance creation",
  10930. fn: function (anInteger){
  10931. var self=this,$self=this;
  10932. return $core.withContext(function($ctx1) {
  10933. return new Array(anInteger);
  10934. return self;
  10935. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  10936. },
  10937. args: ["anInteger"],
  10938. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  10939. referencedClasses: [],
  10940. messageSends: []
  10941. }),
  10942. $globals.Array.a$cls);
  10943. $core.addMethod(
  10944. $core.method({
  10945. selector: "with:",
  10946. protocol: "instance creation",
  10947. fn: function (anObject){
  10948. var self=this,$self=this;
  10949. return $core.withContext(function($ctx1) {
  10950. var $1;
  10951. $1=$self._new_((1));
  10952. $recv($1)._at_put_((1),anObject);
  10953. return $recv($1)._yourself();
  10954. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  10955. },
  10956. args: ["anObject"],
  10957. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  10958. referencedClasses: [],
  10959. messageSends: ["at:put:", "new:", "yourself"]
  10960. }),
  10961. $globals.Array.a$cls);
  10962. $core.addMethod(
  10963. $core.method({
  10964. selector: "with:with:",
  10965. protocol: "instance creation",
  10966. fn: function (anObject,anObject2){
  10967. var self=this,$self=this;
  10968. return $core.withContext(function($ctx1) {
  10969. var $1;
  10970. $1=$self._new_((2));
  10971. $recv($1)._at_put_((1),anObject);
  10972. $ctx1.sendIdx["at:put:"]=1;
  10973. $recv($1)._at_put_((2),anObject2);
  10974. return $recv($1)._yourself();
  10975. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  10976. },
  10977. args: ["anObject", "anObject2"],
  10978. 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",
  10979. referencedClasses: [],
  10980. messageSends: ["at:put:", "new:", "yourself"]
  10981. }),
  10982. $globals.Array.a$cls);
  10983. $core.addMethod(
  10984. $core.method({
  10985. selector: "with:with:with:",
  10986. protocol: "instance creation",
  10987. fn: function (anObject,anObject2,anObject3){
  10988. var self=this,$self=this;
  10989. return $core.withContext(function($ctx1) {
  10990. var $1;
  10991. $1=$self._new_((3));
  10992. $recv($1)._at_put_((1),anObject);
  10993. $ctx1.sendIdx["at:put:"]=1;
  10994. $recv($1)._at_put_((2),anObject2);
  10995. $ctx1.sendIdx["at:put:"]=2;
  10996. $recv($1)._at_put_((3),anObject3);
  10997. return $recv($1)._yourself();
  10998. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  10999. },
  11000. args: ["anObject", "anObject2", "anObject3"],
  11001. 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",
  11002. referencedClasses: [],
  11003. messageSends: ["at:put:", "new:", "yourself"]
  11004. }),
  11005. $globals.Array.a$cls);
  11006. $core.addMethod(
  11007. $core.method({
  11008. selector: "withAll:",
  11009. protocol: "instance creation",
  11010. fn: function (aCollection){
  11011. var self=this,$self=this;
  11012. var instance,index;
  11013. return $core.withContext(function($ctx1) {
  11014. index=(1);
  11015. instance=$self._new_($recv(aCollection)._size());
  11016. $recv(aCollection)._do_((function(each){
  11017. return $core.withContext(function($ctx2) {
  11018. $recv(instance)._at_put_(index,each);
  11019. index=$recv(index).__plus((1));
  11020. return index;
  11021. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11022. }));
  11023. return instance;
  11024. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  11025. },
  11026. args: ["aCollection"],
  11027. 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",
  11028. referencedClasses: [],
  11029. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  11030. }),
  11031. $globals.Array.a$cls);
  11032. $core.addClass("CharacterArray", $globals.SequenceableCollection, [], "Kernel-Collections");
  11033. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  11034. $core.addMethod(
  11035. $core.method({
  11036. selector: ",",
  11037. protocol: "copying",
  11038. fn: function (aString){
  11039. var self=this,$self=this;
  11040. return $core.withContext(function($ctx1) {
  11041. var $1;
  11042. $1=$self._asString();
  11043. $ctx1.sendIdx["asString"]=1;
  11044. return $recv($1).__comma($recv(aString)._asString());
  11045. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  11046. },
  11047. args: ["aString"],
  11048. source: ", aString\x0a\x09^ self asString, aString asString",
  11049. referencedClasses: [],
  11050. messageSends: [",", "asString"]
  11051. }),
  11052. $globals.CharacterArray);
  11053. $core.addMethod(
  11054. $core.method({
  11055. selector: "add:",
  11056. protocol: "adding/removing",
  11057. fn: function (anObject){
  11058. var self=this,$self=this;
  11059. return $core.withContext(function($ctx1) {
  11060. $self._errorReadOnly();
  11061. return self;
  11062. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  11063. },
  11064. args: ["anObject"],
  11065. source: "add: anObject\x0a\x09self errorReadOnly",
  11066. referencedClasses: [],
  11067. messageSends: ["errorReadOnly"]
  11068. }),
  11069. $globals.CharacterArray);
  11070. $core.addMethod(
  11071. $core.method({
  11072. selector: "asLowercase",
  11073. protocol: "converting",
  11074. fn: function (){
  11075. var self=this,$self=this;
  11076. return $core.withContext(function($ctx1) {
  11077. return $recv($self._class())._fromString_($recv($self._asString())._asLowercase());
  11078. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  11079. },
  11080. args: [],
  11081. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  11082. referencedClasses: [],
  11083. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  11084. }),
  11085. $globals.CharacterArray);
  11086. $core.addMethod(
  11087. $core.method({
  11088. selector: "asNumber",
  11089. protocol: "converting",
  11090. fn: function (){
  11091. var self=this,$self=this;
  11092. return $core.withContext(function($ctx1) {
  11093. return $recv($self._asString())._asNumber();
  11094. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  11095. },
  11096. args: [],
  11097. source: "asNumber\x0a\x09^ self asString asNumber",
  11098. referencedClasses: [],
  11099. messageSends: ["asNumber", "asString"]
  11100. }),
  11101. $globals.CharacterArray);
  11102. $core.addMethod(
  11103. $core.method({
  11104. selector: "asString",
  11105. protocol: "converting",
  11106. fn: function (){
  11107. var self=this,$self=this;
  11108. return $core.withContext(function($ctx1) {
  11109. return $self._subclassResponsibility();
  11110. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  11111. },
  11112. args: [],
  11113. source: "asString\x0a\x09^ self subclassResponsibility",
  11114. referencedClasses: [],
  11115. messageSends: ["subclassResponsibility"]
  11116. }),
  11117. $globals.CharacterArray);
  11118. $core.addMethod(
  11119. $core.method({
  11120. selector: "asSymbol",
  11121. protocol: "converting",
  11122. fn: function (){
  11123. var self=this,$self=this;
  11124. return $core.withContext(function($ctx1) {
  11125. return $self._asString();
  11126. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  11127. },
  11128. args: [],
  11129. source: "asSymbol\x0a\x09^ self asString",
  11130. referencedClasses: [],
  11131. messageSends: ["asString"]
  11132. }),
  11133. $globals.CharacterArray);
  11134. $core.addMethod(
  11135. $core.method({
  11136. selector: "asSymbolPrintOn:",
  11137. protocol: "printing",
  11138. fn: function (aStream){
  11139. var self=this,$self=this;
  11140. return $core.withContext(function($ctx1) {
  11141. var $1;
  11142. $recv(aStream)._nextPutAll_("#");
  11143. $1=$recv($self._asString())._isSelector();
  11144. if($core.assert($1)){
  11145. $recv(aStream)._nextPut_(self);
  11146. } else {
  11147. $self._printOn_(aStream);
  11148. }
  11149. return self;
  11150. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.CharacterArray)});
  11151. },
  11152. args: ["aStream"],
  11153. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  11154. referencedClasses: [],
  11155. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  11156. }),
  11157. $globals.CharacterArray);
  11158. $core.addMethod(
  11159. $core.method({
  11160. selector: "asUppercase",
  11161. protocol: "converting",
  11162. fn: function (){
  11163. var self=this,$self=this;
  11164. return $core.withContext(function($ctx1) {
  11165. return $recv($self._class())._fromString_($recv($self._asString())._asUppercase());
  11166. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  11167. },
  11168. args: [],
  11169. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  11170. referencedClasses: [],
  11171. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  11172. }),
  11173. $globals.CharacterArray);
  11174. $core.addMethod(
  11175. $core.method({
  11176. selector: "at:put:",
  11177. protocol: "accessing",
  11178. fn: function (anIndex,anObject){
  11179. var self=this,$self=this;
  11180. return $core.withContext(function($ctx1) {
  11181. $self._errorReadOnly();
  11182. return self;
  11183. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  11184. },
  11185. args: ["anIndex", "anObject"],
  11186. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  11187. referencedClasses: [],
  11188. messageSends: ["errorReadOnly"]
  11189. }),
  11190. $globals.CharacterArray);
  11191. $core.addMethod(
  11192. $core.method({
  11193. selector: "errorReadOnly",
  11194. protocol: "error handling",
  11195. fn: function (){
  11196. var self=this,$self=this;
  11197. return $core.withContext(function($ctx1) {
  11198. $self._error_("Object is read-only");
  11199. return self;
  11200. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  11201. },
  11202. args: [],
  11203. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  11204. referencedClasses: [],
  11205. messageSends: ["error:"]
  11206. }),
  11207. $globals.CharacterArray);
  11208. $core.addMethod(
  11209. $core.method({
  11210. selector: "printOn:",
  11211. protocol: "printing",
  11212. fn: function (aStream){
  11213. var self=this,$self=this;
  11214. return $core.withContext(function($ctx1) {
  11215. $recv($self._asString())._printOn_(aStream);
  11216. return self;
  11217. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  11218. },
  11219. args: ["aStream"],
  11220. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  11221. referencedClasses: [],
  11222. messageSends: ["printOn:", "asString"]
  11223. }),
  11224. $globals.CharacterArray);
  11225. $core.addMethod(
  11226. $core.method({
  11227. selector: "putOn:",
  11228. protocol: "streaming",
  11229. fn: function (aStream){
  11230. var self=this,$self=this;
  11231. return $core.withContext(function($ctx1) {
  11232. $recv(aStream)._nextPutString_(self);
  11233. return self;
  11234. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  11235. },
  11236. args: ["aStream"],
  11237. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  11238. referencedClasses: [],
  11239. messageSends: ["nextPutString:"]
  11240. }),
  11241. $globals.CharacterArray);
  11242. $core.addMethod(
  11243. $core.method({
  11244. selector: "remove:",
  11245. protocol: "adding/removing",
  11246. fn: function (anObject){
  11247. var self=this,$self=this;
  11248. return $core.withContext(function($ctx1) {
  11249. $self._errorReadOnly();
  11250. return self;
  11251. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  11252. },
  11253. args: ["anObject"],
  11254. source: "remove: anObject\x0a\x09self errorReadOnly",
  11255. referencedClasses: [],
  11256. messageSends: ["errorReadOnly"]
  11257. }),
  11258. $globals.CharacterArray);
  11259. $core.addMethod(
  11260. $core.method({
  11261. selector: "remove:ifAbsent:",
  11262. protocol: "adding/removing",
  11263. fn: function (anObject,aBlock){
  11264. var self=this,$self=this;
  11265. return $core.withContext(function($ctx1) {
  11266. $self._errorReadOnly();
  11267. return self;
  11268. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.CharacterArray)});
  11269. },
  11270. args: ["anObject", "aBlock"],
  11271. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  11272. referencedClasses: [],
  11273. messageSends: ["errorReadOnly"]
  11274. }),
  11275. $globals.CharacterArray);
  11276. $core.addMethod(
  11277. $core.method({
  11278. selector: "symbolPrintString",
  11279. protocol: "printing",
  11280. fn: function (){
  11281. var self=this,$self=this;
  11282. return $core.withContext(function($ctx1) {
  11283. return $recv($globals.String)._streamContents_((function(str){
  11284. return $core.withContext(function($ctx2) {
  11285. return $self._asSymbolPrintOn_(str);
  11286. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  11287. }));
  11288. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.CharacterArray)});
  11289. },
  11290. args: [],
  11291. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  11292. referencedClasses: ["String"],
  11293. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  11294. }),
  11295. $globals.CharacterArray);
  11296. $core.addMethod(
  11297. $core.method({
  11298. selector: "fromString:",
  11299. protocol: "instance creation",
  11300. fn: function (aString){
  11301. var self=this,$self=this;
  11302. return $core.withContext(function($ctx1) {
  11303. $self._subclassResponsibility();
  11304. return self;
  11305. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.a$cls)});
  11306. },
  11307. args: ["aString"],
  11308. source: "fromString: aString\x0a\x09self subclassResponsibility",
  11309. referencedClasses: [],
  11310. messageSends: ["subclassResponsibility"]
  11311. }),
  11312. $globals.CharacterArray.a$cls);
  11313. $core.addClass("String", $globals.CharacterArray, [], "Kernel-Collections");
  11314. $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 >> #,`";
  11315. $core.addMethod(
  11316. $core.method({
  11317. selector: ",",
  11318. protocol: "copying",
  11319. fn: function (aString){
  11320. var self=this,$self=this;
  11321. return $core.withContext(function($ctx1) {
  11322. return String(self) + aString;
  11323. return self;
  11324. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  11325. },
  11326. args: ["aString"],
  11327. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  11328. referencedClasses: [],
  11329. messageSends: []
  11330. }),
  11331. $globals.String);
  11332. $core.addMethod(
  11333. $core.method({
  11334. selector: "<",
  11335. protocol: "comparing",
  11336. fn: function (aString){
  11337. var self=this,$self=this;
  11338. return $core.withContext(function($ctx1) {
  11339. return String(self) < aString._asString();
  11340. return self;
  11341. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  11342. },
  11343. args: ["aString"],
  11344. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  11345. referencedClasses: [],
  11346. messageSends: []
  11347. }),
  11348. $globals.String);
  11349. $core.addMethod(
  11350. $core.method({
  11351. selector: "<=",
  11352. protocol: "comparing",
  11353. fn: function (aString){
  11354. var self=this,$self=this;
  11355. return $core.withContext(function($ctx1) {
  11356. return String(self) <= aString._asString();
  11357. return self;
  11358. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  11359. },
  11360. args: ["aString"],
  11361. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  11362. referencedClasses: [],
  11363. messageSends: []
  11364. }),
  11365. $globals.String);
  11366. $core.addMethod(
  11367. $core.method({
  11368. selector: "=",
  11369. protocol: "comparing",
  11370. fn: function (aString){
  11371. var self=this,$self=this;
  11372. return $core.withContext(function($ctx1) {
  11373. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  11374. return self;
  11375. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  11376. },
  11377. args: ["aString"],
  11378. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  11379. referencedClasses: [],
  11380. messageSends: []
  11381. }),
  11382. $globals.String);
  11383. $core.addMethod(
  11384. $core.method({
  11385. selector: "==",
  11386. protocol: "comparing",
  11387. fn: function (aString){
  11388. var self=this,$self=this;
  11389. return $core.withContext(function($ctx1) {
  11390. if (typeof aString === "string") return String(self) === aString;
  11391. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  11392. else return false;;
  11393. return self;
  11394. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  11395. },
  11396. args: ["aString"],
  11397. 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'>",
  11398. referencedClasses: [],
  11399. messageSends: []
  11400. }),
  11401. $globals.String);
  11402. $core.addMethod(
  11403. $core.method({
  11404. selector: ">",
  11405. protocol: "comparing",
  11406. fn: function (aString){
  11407. var self=this,$self=this;
  11408. return $core.withContext(function($ctx1) {
  11409. return String(self) > aString._asString();
  11410. return self;
  11411. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  11412. },
  11413. args: ["aString"],
  11414. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  11415. referencedClasses: [],
  11416. messageSends: []
  11417. }),
  11418. $globals.String);
  11419. $core.addMethod(
  11420. $core.method({
  11421. selector: ">=",
  11422. protocol: "comparing",
  11423. fn: function (aString){
  11424. var self=this,$self=this;
  11425. return $core.withContext(function($ctx1) {
  11426. return String(self) >= aString._asString();
  11427. return self;
  11428. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  11429. },
  11430. args: ["aString"],
  11431. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  11432. referencedClasses: [],
  11433. messageSends: []
  11434. }),
  11435. $globals.String);
  11436. $core.addMethod(
  11437. $core.method({
  11438. selector: "asJavaScriptMethodName",
  11439. protocol: "converting",
  11440. fn: function (){
  11441. var self=this,$self=this;
  11442. return $core.withContext(function($ctx1) {
  11443. return $core.st2js(self);
  11444. return self;
  11445. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  11446. },
  11447. args: [],
  11448. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  11449. referencedClasses: [],
  11450. messageSends: []
  11451. }),
  11452. $globals.String);
  11453. $core.addMethod(
  11454. $core.method({
  11455. selector: "asJavaScriptObject",
  11456. protocol: "converting",
  11457. fn: function (){
  11458. var self=this,$self=this;
  11459. return self;
  11460. },
  11461. args: [],
  11462. source: "asJavaScriptObject\x0a\x09^ self",
  11463. referencedClasses: [],
  11464. messageSends: []
  11465. }),
  11466. $globals.String);
  11467. $core.addMethod(
  11468. $core.method({
  11469. selector: "asJavaScriptSource",
  11470. protocol: "converting",
  11471. fn: function (){
  11472. var self=this,$self=this;
  11473. return $core.withContext(function($ctx1) {
  11474. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  11475. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  11476. else
  11477. return "\"" + self + "\"";
  11478. ;
  11479. return self;
  11480. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  11481. },
  11482. args: [],
  11483. 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'>",
  11484. referencedClasses: [],
  11485. messageSends: []
  11486. }),
  11487. $globals.String);
  11488. $core.addMethod(
  11489. $core.method({
  11490. selector: "asLowercase",
  11491. protocol: "converting",
  11492. fn: function (){
  11493. var self=this,$self=this;
  11494. return $core.withContext(function($ctx1) {
  11495. return self.toLowerCase();
  11496. return self;
  11497. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  11498. },
  11499. args: [],
  11500. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  11501. referencedClasses: [],
  11502. messageSends: []
  11503. }),
  11504. $globals.String);
  11505. $core.addMethod(
  11506. $core.method({
  11507. selector: "asMutator",
  11508. protocol: "converting",
  11509. fn: function (){
  11510. var self=this,$self=this;
  11511. return $core.withContext(function($ctx1) {
  11512. var $1;
  11513. $1=$recv($self._last()).__eq(":");
  11514. if(!$core.assert($1)){
  11515. return $self.__comma(":");
  11516. }
  11517. return self;
  11518. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  11519. },
  11520. args: [],
  11521. 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",
  11522. referencedClasses: [],
  11523. messageSends: ["ifFalse:", "=", "last", ","]
  11524. }),
  11525. $globals.String);
  11526. $core.addMethod(
  11527. $core.method({
  11528. selector: "asNumber",
  11529. protocol: "converting",
  11530. fn: function (){
  11531. var self=this,$self=this;
  11532. return $core.withContext(function($ctx1) {
  11533. return Number(self);
  11534. return self;
  11535. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  11536. },
  11537. args: [],
  11538. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  11539. referencedClasses: [],
  11540. messageSends: []
  11541. }),
  11542. $globals.String);
  11543. $core.addMethod(
  11544. $core.method({
  11545. selector: "asRegexp",
  11546. protocol: "converting",
  11547. fn: function (){
  11548. var self=this,$self=this;
  11549. return $core.withContext(function($ctx1) {
  11550. return $recv($globals.RegularExpression)._fromString_(self);
  11551. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  11552. },
  11553. args: [],
  11554. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11555. referencedClasses: ["RegularExpression"],
  11556. messageSends: ["fromString:"]
  11557. }),
  11558. $globals.String);
  11559. $core.addMethod(
  11560. $core.method({
  11561. selector: "asString",
  11562. protocol: "converting",
  11563. fn: function (){
  11564. var self=this,$self=this;
  11565. return self;
  11566. },
  11567. args: [],
  11568. source: "asString\x0a\x09^ self",
  11569. referencedClasses: [],
  11570. messageSends: []
  11571. }),
  11572. $globals.String);
  11573. $core.addMethod(
  11574. $core.method({
  11575. selector: "asSymbol",
  11576. protocol: "converting",
  11577. fn: function (){
  11578. var self=this,$self=this;
  11579. return self;
  11580. },
  11581. args: [],
  11582. source: "asSymbol\x0a\x09^ self",
  11583. referencedClasses: [],
  11584. messageSends: []
  11585. }),
  11586. $globals.String);
  11587. $core.addMethod(
  11588. $core.method({
  11589. selector: "asUppercase",
  11590. protocol: "converting",
  11591. fn: function (){
  11592. var self=this,$self=this;
  11593. return $core.withContext(function($ctx1) {
  11594. return self.toUpperCase();
  11595. return self;
  11596. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  11597. },
  11598. args: [],
  11599. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  11600. referencedClasses: [],
  11601. messageSends: []
  11602. }),
  11603. $globals.String);
  11604. $core.addMethod(
  11605. $core.method({
  11606. selector: "asciiValue",
  11607. protocol: "accessing",
  11608. fn: function (){
  11609. var self=this,$self=this;
  11610. return $core.withContext(function($ctx1) {
  11611. return self.charCodeAt(0);;
  11612. return self;
  11613. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  11614. },
  11615. args: [],
  11616. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  11617. referencedClasses: [],
  11618. messageSends: []
  11619. }),
  11620. $globals.String);
  11621. $core.addMethod(
  11622. $core.method({
  11623. selector: "at:ifAbsent:",
  11624. protocol: "accessing",
  11625. fn: function (anIndex,aBlock){
  11626. var self=this,$self=this;
  11627. return $core.withContext(function($ctx1) {
  11628. return String(self)[anIndex - 1] || aBlock._value();
  11629. return self;
  11630. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  11631. },
  11632. args: ["anIndex", "aBlock"],
  11633. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  11634. referencedClasses: [],
  11635. messageSends: []
  11636. }),
  11637. $globals.String);
  11638. $core.addMethod(
  11639. $core.method({
  11640. selector: "at:ifPresent:ifAbsent:",
  11641. protocol: "accessing",
  11642. fn: function (anIndex,aBlock,anotherBlock){
  11643. var self=this,$self=this;
  11644. return $core.withContext(function($ctx1) {
  11645. var result = String(self)[anIndex - 1];
  11646. return result ? aBlock._value_(result) : anotherBlock._value();
  11647. ;
  11648. return self;
  11649. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  11650. },
  11651. args: ["anIndex", "aBlock", "anotherBlock"],
  11652. 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'>",
  11653. referencedClasses: [],
  11654. messageSends: []
  11655. }),
  11656. $globals.String);
  11657. $core.addMethod(
  11658. $core.method({
  11659. selector: "capitalized",
  11660. protocol: "converting",
  11661. fn: function (){
  11662. var self=this,$self=this;
  11663. return $core.withContext(function($ctx1) {
  11664. return $self._ifNotEmpty_((function(){
  11665. return $core.withContext(function($ctx2) {
  11666. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  11667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11668. }));
  11669. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  11670. },
  11671. args: [],
  11672. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  11673. referencedClasses: [],
  11674. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  11675. }),
  11676. $globals.String);
  11677. $core.addMethod(
  11678. $core.method({
  11679. selector: "charCodeAt:",
  11680. protocol: "accessing",
  11681. fn: function (anInteger){
  11682. var self=this,$self=this;
  11683. return $core.withContext(function($ctx1) {
  11684. return self.charCodeAt(anInteger - 1);
  11685. return self;
  11686. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  11687. },
  11688. args: ["anInteger"],
  11689. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  11690. referencedClasses: [],
  11691. messageSends: []
  11692. }),
  11693. $globals.String);
  11694. $core.addMethod(
  11695. $core.method({
  11696. selector: "copyFrom:to:",
  11697. protocol: "copying",
  11698. fn: function (anIndex,anotherIndex){
  11699. var self=this,$self=this;
  11700. return $core.withContext(function($ctx1) {
  11701. return self.substring(anIndex - 1, anotherIndex);
  11702. return self;
  11703. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  11704. },
  11705. args: ["anIndex", "anotherIndex"],
  11706. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  11707. referencedClasses: [],
  11708. messageSends: []
  11709. }),
  11710. $globals.String);
  11711. $core.addMethod(
  11712. $core.method({
  11713. selector: "crlfSanitized",
  11714. protocol: "converting",
  11715. fn: function (){
  11716. var self=this,$self=this;
  11717. return $core.withContext(function($ctx1) {
  11718. return $recv($self._lines())._join_($recv($globals.String)._lf());
  11719. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  11720. },
  11721. args: [],
  11722. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  11723. referencedClasses: ["String"],
  11724. messageSends: ["join:", "lines", "lf"]
  11725. }),
  11726. $globals.String);
  11727. $core.addMethod(
  11728. $core.method({
  11729. selector: "deepCopy",
  11730. protocol: "copying",
  11731. fn: function (){
  11732. var self=this,$self=this;
  11733. return $core.withContext(function($ctx1) {
  11734. return $self._shallowCopy();
  11735. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  11736. },
  11737. args: [],
  11738. source: "deepCopy\x0a\x09^ self shallowCopy",
  11739. referencedClasses: [],
  11740. messageSends: ["shallowCopy"]
  11741. }),
  11742. $globals.String);
  11743. $core.addMethod(
  11744. $core.method({
  11745. selector: "escaped",
  11746. protocol: "converting",
  11747. fn: function (){
  11748. var self=this,$self=this;
  11749. return $core.withContext(function($ctx1) {
  11750. return escape(self);
  11751. return self;
  11752. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  11753. },
  11754. args: [],
  11755. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  11756. referencedClasses: [],
  11757. messageSends: []
  11758. }),
  11759. $globals.String);
  11760. $core.addMethod(
  11761. $core.method({
  11762. selector: "includesSubString:",
  11763. protocol: "testing",
  11764. fn: function (subString){
  11765. var self=this,$self=this;
  11766. return $core.withContext(function($ctx1) {
  11767. return self.indexOf(subString) != -1;
  11768. return self;
  11769. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  11770. },
  11771. args: ["subString"],
  11772. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  11773. referencedClasses: [],
  11774. messageSends: []
  11775. }),
  11776. $globals.String);
  11777. $core.addMethod(
  11778. $core.method({
  11779. selector: "isCapitalized",
  11780. protocol: "testing",
  11781. fn: function (){
  11782. var self=this,$self=this;
  11783. return $core.withContext(function($ctx1) {
  11784. var $2,$1;
  11785. $2=$self._first();
  11786. $ctx1.sendIdx["first"]=1;
  11787. $1=$recv($2)._asUppercase();
  11788. return $recv($1).__eq_eq($self._first());
  11789. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  11790. },
  11791. args: [],
  11792. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  11793. referencedClasses: [],
  11794. messageSends: ["==", "asUppercase", "first"]
  11795. }),
  11796. $globals.String);
  11797. $core.addMethod(
  11798. $core.method({
  11799. selector: "isImmutable",
  11800. protocol: "testing",
  11801. fn: function (){
  11802. var self=this,$self=this;
  11803. return true;
  11804. },
  11805. args: [],
  11806. source: "isImmutable\x0a\x09^ true",
  11807. referencedClasses: [],
  11808. messageSends: []
  11809. }),
  11810. $globals.String);
  11811. $core.addMethod(
  11812. $core.method({
  11813. selector: "isSelector",
  11814. protocol: "testing",
  11815. fn: function (){
  11816. var self=this,$self=this;
  11817. return $core.withContext(function($ctx1) {
  11818. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  11819. return self;
  11820. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  11821. },
  11822. args: [],
  11823. 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>",
  11824. referencedClasses: [],
  11825. messageSends: []
  11826. }),
  11827. $globals.String);
  11828. $core.addMethod(
  11829. $core.method({
  11830. selector: "isString",
  11831. protocol: "testing",
  11832. fn: function (){
  11833. var self=this,$self=this;
  11834. return true;
  11835. },
  11836. args: [],
  11837. source: "isString\x0a\x09^ true",
  11838. referencedClasses: [],
  11839. messageSends: []
  11840. }),
  11841. $globals.String);
  11842. $core.addMethod(
  11843. $core.method({
  11844. selector: "isVowel",
  11845. protocol: "testing",
  11846. fn: function (){
  11847. var self=this,$self=this;
  11848. return $core.withContext(function($ctx1) {
  11849. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  11850. return $core.withContext(function($ctx2) {
  11851. return "aeiou"._includes_($self._asLowercase());
  11852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11853. }));
  11854. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  11855. },
  11856. args: [],
  11857. 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 ]",
  11858. referencedClasses: [],
  11859. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  11860. }),
  11861. $globals.String);
  11862. $core.addMethod(
  11863. $core.method({
  11864. selector: "join:",
  11865. protocol: "split join",
  11866. fn: function (aCollection){
  11867. var self=this,$self=this;
  11868. return $core.withContext(function($ctx1) {
  11869. return $recv($globals.String)._streamContents_((function(stream){
  11870. return $core.withContext(function($ctx2) {
  11871. return $recv(aCollection)._do_separatedBy_((function(each){
  11872. return $core.withContext(function($ctx3) {
  11873. return $recv(stream)._nextPutAll_($recv(each)._asString());
  11874. $ctx3.sendIdx["nextPutAll:"]=1;
  11875. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  11876. }),(function(){
  11877. return $core.withContext(function($ctx3) {
  11878. return $recv(stream)._nextPutAll_(self);
  11879. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11880. }));
  11881. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  11882. }));
  11883. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  11884. },
  11885. args: ["aCollection"],
  11886. 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 ]]",
  11887. referencedClasses: ["String"],
  11888. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  11889. }),
  11890. $globals.String);
  11891. $core.addMethod(
  11892. $core.method({
  11893. selector: "lineIndicesDo:",
  11894. protocol: "split join",
  11895. fn: function (aBlock){
  11896. var self=this,$self=this;
  11897. var cr,lf,start,sz,nextLF,nextCR;
  11898. return $core.withContext(function($ctx1) {
  11899. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  11900. var $early={};
  11901. try {
  11902. start=(1);
  11903. sz=$self._size();
  11904. cr=$recv($globals.String)._cr();
  11905. nextCR=$self._indexOf_startingAt_(cr,(1));
  11906. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  11907. lf=$recv($globals.String)._lf();
  11908. nextLF=$self._indexOf_startingAt_(lf,(1));
  11909. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  11910. $recv((function(){
  11911. return $core.withContext(function($ctx2) {
  11912. return $recv(start).__lt_eq(sz);
  11913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11914. }))._whileTrue_((function(){
  11915. return $core.withContext(function($ctx2) {
  11916. $2=$recv(nextLF).__eq((0));
  11917. $ctx2.sendIdx["="]=1;
  11918. $1=$recv($2)._and_((function(){
  11919. return $core.withContext(function($ctx3) {
  11920. return $recv(nextCR).__eq((0));
  11921. $ctx3.sendIdx["="]=2;
  11922. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11923. }));
  11924. $ctx2.sendIdx["and:"]=1;
  11925. if($core.assert($1)){
  11926. $recv(aBlock)._value_value_value_(start,sz,sz);
  11927. $ctx2.sendIdx["value:value:value:"]=1;
  11928. throw $early=[self];
  11929. }
  11930. $4=$recv(nextCR).__eq((0));
  11931. $ctx2.sendIdx["="]=3;
  11932. $3=$recv($4)._or_((function(){
  11933. return $core.withContext(function($ctx3) {
  11934. $5=(0).__lt(nextLF);
  11935. $ctx3.sendIdx["<"]=1;
  11936. return $recv($5)._and_((function(){
  11937. return $core.withContext(function($ctx4) {
  11938. return $recv(nextLF).__lt(nextCR);
  11939. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  11940. }));
  11941. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  11942. }));
  11943. if($core.assert($3)){
  11944. $6=start;
  11945. $7=$recv(nextLF).__minus((1));
  11946. $ctx2.sendIdx["-"]=1;
  11947. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  11948. $ctx2.sendIdx["value:value:value:"]=2;
  11949. start=(1).__plus(nextLF);
  11950. $ctx2.sendIdx["+"]=1;
  11951. start;
  11952. nextLF=$self._indexOf_startingAt_(lf,start);
  11953. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  11954. return nextLF;
  11955. } else {
  11956. $9=(1).__plus(nextCR);
  11957. $ctx2.sendIdx["+"]=2;
  11958. $8=$recv($9).__eq(nextLF);
  11959. if($core.assert($8)){
  11960. $10=start;
  11961. $11=$recv(nextCR).__minus((1));
  11962. $ctx2.sendIdx["-"]=2;
  11963. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  11964. $ctx2.sendIdx["value:value:value:"]=3;
  11965. start=(1).__plus(nextLF);
  11966. $ctx2.sendIdx["+"]=3;
  11967. start;
  11968. nextCR=$self._indexOf_startingAt_(cr,start);
  11969. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  11970. nextCR;
  11971. nextLF=$self._indexOf_startingAt_(lf,start);
  11972. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  11973. return nextLF;
  11974. } else {
  11975. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  11976. start=(1).__plus(nextCR);
  11977. start;
  11978. nextCR=$self._indexOf_startingAt_(cr,start);
  11979. return nextCR;
  11980. }
  11981. }
  11982. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  11983. }));
  11984. return self;
  11985. }
  11986. catch(e) {if(e===$early)return e[0]; throw e}
  11987. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  11988. },
  11989. args: ["aBlock"],
  11990. 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 ] ]]",
  11991. referencedClasses: ["String"],
  11992. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  11993. }),
  11994. $globals.String);
  11995. $core.addMethod(
  11996. $core.method({
  11997. selector: "lineNumber:",
  11998. protocol: "split join",
  11999. fn: function (anIndex){
  12000. var self=this,$self=this;
  12001. var lineCount;
  12002. return $core.withContext(function($ctx1) {
  12003. var $2,$1;
  12004. var $early={};
  12005. try {
  12006. lineCount=(0);
  12007. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  12008. return $core.withContext(function($ctx2) {
  12009. lineCount=$recv(lineCount).__plus((1));
  12010. $2=lineCount;
  12011. $1=$recv($2).__eq(anIndex);
  12012. if($core.assert($1)){
  12013. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  12014. }
  12015. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  12016. }));
  12017. return nil;
  12018. }
  12019. catch(e) {if(e===$early)return e[0]; throw e}
  12020. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  12021. },
  12022. args: ["anIndex"],
  12023. 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",
  12024. referencedClasses: [],
  12025. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  12026. }),
  12027. $globals.String);
  12028. $core.addMethod(
  12029. $core.method({
  12030. selector: "lines",
  12031. protocol: "split join",
  12032. fn: function (){
  12033. var self=this,$self=this;
  12034. return $core.withContext(function($ctx1) {
  12035. var result = self.split(/\r\n|\r|\n/);
  12036. if (!result[result.length-1]) result.pop();
  12037. return result;;
  12038. return self;
  12039. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  12040. },
  12041. args: [],
  12042. 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'>",
  12043. referencedClasses: [],
  12044. messageSends: []
  12045. }),
  12046. $globals.String);
  12047. $core.addMethod(
  12048. $core.method({
  12049. selector: "linesDo:",
  12050. protocol: "split join",
  12051. fn: function (aBlock){
  12052. var self=this,$self=this;
  12053. return $core.withContext(function($ctx1) {
  12054. $recv($self._lines())._do_(aBlock);
  12055. return self;
  12056. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  12057. },
  12058. args: ["aBlock"],
  12059. 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",
  12060. referencedClasses: [],
  12061. messageSends: ["do:", "lines"]
  12062. }),
  12063. $globals.String);
  12064. $core.addMethod(
  12065. $core.method({
  12066. selector: "match:",
  12067. protocol: "regular expressions",
  12068. fn: function (aRegexp){
  12069. var self=this,$self=this;
  12070. return $core.withContext(function($ctx1) {
  12071. return self.search(aRegexp) != -1;
  12072. return self;
  12073. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  12074. },
  12075. args: ["aRegexp"],
  12076. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  12077. referencedClasses: [],
  12078. messageSends: []
  12079. }),
  12080. $globals.String);
  12081. $core.addMethod(
  12082. $core.method({
  12083. selector: "matchesOf:",
  12084. protocol: "regular expressions",
  12085. fn: function (aRegularExpression){
  12086. var self=this,$self=this;
  12087. return $core.withContext(function($ctx1) {
  12088. return self.match(aRegularExpression);
  12089. return self;
  12090. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  12091. },
  12092. args: ["aRegularExpression"],
  12093. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  12094. referencedClasses: [],
  12095. messageSends: []
  12096. }),
  12097. $globals.String);
  12098. $core.addMethod(
  12099. $core.method({
  12100. selector: "numericallyIndexable",
  12101. protocol: "private",
  12102. fn: function (){
  12103. var self=this,$self=this;
  12104. return $core.withContext(function($ctx1) {
  12105. return String(self);
  12106. return self;
  12107. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  12108. },
  12109. args: [],
  12110. source: "numericallyIndexable\x0a\x09<inlineJS: 'return String(self)'>",
  12111. referencedClasses: [],
  12112. messageSends: []
  12113. }),
  12114. $globals.String);
  12115. $core.addMethod(
  12116. $core.method({
  12117. selector: "printNl",
  12118. protocol: "printing",
  12119. fn: function (){
  12120. var self=this,$self=this;
  12121. return $core.withContext(function($ctx1) {
  12122. console.log(self);
  12123. return self;
  12124. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  12125. },
  12126. args: [],
  12127. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  12128. referencedClasses: [],
  12129. messageSends: []
  12130. }),
  12131. $globals.String);
  12132. $core.addMethod(
  12133. $core.method({
  12134. selector: "printOn:",
  12135. protocol: "printing",
  12136. fn: function (aStream){
  12137. var self=this,$self=this;
  12138. return $core.withContext(function($ctx1) {
  12139. $recv(aStream)._nextPutAll_("'");
  12140. $ctx1.sendIdx["nextPutAll:"]=1;
  12141. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  12142. $ctx1.sendIdx["nextPutAll:"]=2;
  12143. $recv(aStream)._nextPutAll_("'");
  12144. return self;
  12145. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  12146. },
  12147. args: ["aStream"],
  12148. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  12149. referencedClasses: [],
  12150. messageSends: ["nextPutAll:", "replace:with:"]
  12151. }),
  12152. $globals.String);
  12153. $core.addMethod(
  12154. $core.method({
  12155. selector: "replace:with:",
  12156. protocol: "regular expressions",
  12157. fn: function (aString,anotherString){
  12158. var self=this,$self=this;
  12159. return $core.withContext(function($ctx1) {
  12160. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  12161. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  12162. },
  12163. args: ["aString", "anotherString"],
  12164. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  12165. referencedClasses: ["RegularExpression"],
  12166. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  12167. }),
  12168. $globals.String);
  12169. $core.addMethod(
  12170. $core.method({
  12171. selector: "replaceRegexp:with:",
  12172. protocol: "regular expressions",
  12173. fn: function (aRegexp,aString){
  12174. var self=this,$self=this;
  12175. return $core.withContext(function($ctx1) {
  12176. return self.replace(aRegexp, aString);
  12177. return self;
  12178. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  12179. },
  12180. args: ["aRegexp", "aString"],
  12181. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  12182. referencedClasses: [],
  12183. messageSends: []
  12184. }),
  12185. $globals.String);
  12186. $core.addMethod(
  12187. $core.method({
  12188. selector: "reversed",
  12189. protocol: "converting",
  12190. fn: function (){
  12191. var self=this,$self=this;
  12192. return $core.withContext(function($ctx1) {
  12193. return self.split("").reverse().join("");
  12194. return self;
  12195. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  12196. },
  12197. args: [],
  12198. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  12199. referencedClasses: [],
  12200. messageSends: []
  12201. }),
  12202. $globals.String);
  12203. $core.addMethod(
  12204. $core.method({
  12205. selector: "shallowCopy",
  12206. protocol: "copying",
  12207. fn: function (){
  12208. var self=this,$self=this;
  12209. return self;
  12210. },
  12211. args: [],
  12212. source: "shallowCopy\x0a\x09^ self",
  12213. referencedClasses: [],
  12214. messageSends: []
  12215. }),
  12216. $globals.String);
  12217. $core.addMethod(
  12218. $core.method({
  12219. selector: "size",
  12220. protocol: "accessing",
  12221. fn: function (){
  12222. var self=this,$self=this;
  12223. return $core.withContext(function($ctx1) {
  12224. return self.length;
  12225. return self;
  12226. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  12227. },
  12228. args: [],
  12229. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  12230. referencedClasses: [],
  12231. messageSends: []
  12232. }),
  12233. $globals.String);
  12234. $core.addMethod(
  12235. $core.method({
  12236. selector: "subStrings:",
  12237. protocol: "split join",
  12238. fn: function (aString){
  12239. var self=this,$self=this;
  12240. return $core.withContext(function($ctx1) {
  12241. return $self._tokenize_(aString);
  12242. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  12243. },
  12244. args: ["aString"],
  12245. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  12246. referencedClasses: [],
  12247. messageSends: ["tokenize:"]
  12248. }),
  12249. $globals.String);
  12250. $core.addMethod(
  12251. $core.method({
  12252. selector: "tokenize:",
  12253. protocol: "split join",
  12254. fn: function (aString){
  12255. var self=this,$self=this;
  12256. return $core.withContext(function($ctx1) {
  12257. return self.split(aString);
  12258. return self;
  12259. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  12260. },
  12261. args: ["aString"],
  12262. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  12263. referencedClasses: [],
  12264. messageSends: []
  12265. }),
  12266. $globals.String);
  12267. $core.addMethod(
  12268. $core.method({
  12269. selector: "trimBoth",
  12270. protocol: "regular expressions",
  12271. fn: function (){
  12272. var self=this,$self=this;
  12273. return $core.withContext(function($ctx1) {
  12274. return $self._trimBoth_("\x5cs");
  12275. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  12276. },
  12277. args: [],
  12278. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  12279. referencedClasses: [],
  12280. messageSends: ["trimBoth:"]
  12281. }),
  12282. $globals.String);
  12283. $core.addMethod(
  12284. $core.method({
  12285. selector: "trimBoth:",
  12286. protocol: "regular expressions",
  12287. fn: function (separators){
  12288. var self=this,$self=this;
  12289. return $core.withContext(function($ctx1) {
  12290. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  12291. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  12292. },
  12293. args: ["separators"],
  12294. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  12295. referencedClasses: [],
  12296. messageSends: ["trimRight:", "trimLeft:"]
  12297. }),
  12298. $globals.String);
  12299. $core.addMethod(
  12300. $core.method({
  12301. selector: "trimLeft",
  12302. protocol: "regular expressions",
  12303. fn: function (){
  12304. var self=this,$self=this;
  12305. return $core.withContext(function($ctx1) {
  12306. return $self._trimLeft_("\x5cs");
  12307. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  12308. },
  12309. args: [],
  12310. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  12311. referencedClasses: [],
  12312. messageSends: ["trimLeft:"]
  12313. }),
  12314. $globals.String);
  12315. $core.addMethod(
  12316. $core.method({
  12317. selector: "trimLeft:",
  12318. protocol: "regular expressions",
  12319. fn: function (separators){
  12320. var self=this,$self=this;
  12321. return $core.withContext(function($ctx1) {
  12322. var $2,$1;
  12323. $2=$recv("^[".__comma(separators)).__comma("]+");
  12324. $ctx1.sendIdx[","]=1;
  12325. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12326. return $self._replaceRegexp_with_($1,"");
  12327. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  12328. },
  12329. args: ["separators"],
  12330. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  12331. referencedClasses: ["RegularExpression"],
  12332. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12333. }),
  12334. $globals.String);
  12335. $core.addMethod(
  12336. $core.method({
  12337. selector: "trimRight",
  12338. protocol: "regular expressions",
  12339. fn: function (){
  12340. var self=this,$self=this;
  12341. return $core.withContext(function($ctx1) {
  12342. return $self._trimRight_("\x5cs");
  12343. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  12344. },
  12345. args: [],
  12346. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  12347. referencedClasses: [],
  12348. messageSends: ["trimRight:"]
  12349. }),
  12350. $globals.String);
  12351. $core.addMethod(
  12352. $core.method({
  12353. selector: "trimRight:",
  12354. protocol: "regular expressions",
  12355. fn: function (separators){
  12356. var self=this,$self=this;
  12357. return $core.withContext(function($ctx1) {
  12358. var $2,$1;
  12359. $2=$recv("[".__comma(separators)).__comma("]+$");
  12360. $ctx1.sendIdx[","]=1;
  12361. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12362. return $self._replaceRegexp_with_($1,"");
  12363. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  12364. },
  12365. args: ["separators"],
  12366. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  12367. referencedClasses: ["RegularExpression"],
  12368. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12369. }),
  12370. $globals.String);
  12371. $core.addMethod(
  12372. $core.method({
  12373. selector: "unescaped",
  12374. protocol: "converting",
  12375. fn: function (){
  12376. var self=this,$self=this;
  12377. return $core.withContext(function($ctx1) {
  12378. return unescape(self);
  12379. return self;
  12380. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  12381. },
  12382. args: [],
  12383. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  12384. referencedClasses: [],
  12385. messageSends: []
  12386. }),
  12387. $globals.String);
  12388. $core.addMethod(
  12389. $core.method({
  12390. selector: "uriComponentDecoded",
  12391. protocol: "converting",
  12392. fn: function (){
  12393. var self=this,$self=this;
  12394. return $core.withContext(function($ctx1) {
  12395. return decodeURIComponent(self);
  12396. return self;
  12397. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  12398. },
  12399. args: [],
  12400. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  12401. referencedClasses: [],
  12402. messageSends: []
  12403. }),
  12404. $globals.String);
  12405. $core.addMethod(
  12406. $core.method({
  12407. selector: "uriComponentEncoded",
  12408. protocol: "converting",
  12409. fn: function (){
  12410. var self=this,$self=this;
  12411. return $core.withContext(function($ctx1) {
  12412. return encodeURIComponent(self);
  12413. return self;
  12414. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  12415. },
  12416. args: [],
  12417. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  12418. referencedClasses: [],
  12419. messageSends: []
  12420. }),
  12421. $globals.String);
  12422. $core.addMethod(
  12423. $core.method({
  12424. selector: "uriDecoded",
  12425. protocol: "converting",
  12426. fn: function (){
  12427. var self=this,$self=this;
  12428. return $core.withContext(function($ctx1) {
  12429. return decodeURI(self);
  12430. return self;
  12431. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  12432. },
  12433. args: [],
  12434. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  12435. referencedClasses: [],
  12436. messageSends: []
  12437. }),
  12438. $globals.String);
  12439. $core.addMethod(
  12440. $core.method({
  12441. selector: "uriEncoded",
  12442. protocol: "converting",
  12443. fn: function (){
  12444. var self=this,$self=this;
  12445. return $core.withContext(function($ctx1) {
  12446. return encodeURI(self);
  12447. return self;
  12448. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  12449. },
  12450. args: [],
  12451. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  12452. referencedClasses: [],
  12453. messageSends: []
  12454. }),
  12455. $globals.String);
  12456. $core.addMethod(
  12457. $core.method({
  12458. selector: "value:",
  12459. protocol: "evaluating",
  12460. fn: function (anObject){
  12461. var self=this,$self=this;
  12462. return $core.withContext(function($ctx1) {
  12463. return $recv(anObject)._perform_(self);
  12464. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  12465. },
  12466. args: ["anObject"],
  12467. source: "value: anObject \x0a\x09^ anObject perform: self",
  12468. referencedClasses: [],
  12469. messageSends: ["perform:"]
  12470. }),
  12471. $globals.String);
  12472. $core.addMethod(
  12473. $core.method({
  12474. selector: "cr",
  12475. protocol: "accessing",
  12476. fn: function (){
  12477. var self=this,$self=this;
  12478. return $core.withContext(function($ctx1) {
  12479. return "\r";
  12480. return self;
  12481. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  12482. },
  12483. args: [],
  12484. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  12485. referencedClasses: [],
  12486. messageSends: []
  12487. }),
  12488. $globals.String.a$cls);
  12489. $core.addMethod(
  12490. $core.method({
  12491. selector: "crlf",
  12492. protocol: "accessing",
  12493. fn: function (){
  12494. var self=this,$self=this;
  12495. return $core.withContext(function($ctx1) {
  12496. return "\r\n";
  12497. return self;
  12498. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  12499. },
  12500. args: [],
  12501. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  12502. referencedClasses: [],
  12503. messageSends: []
  12504. }),
  12505. $globals.String.a$cls);
  12506. $core.addMethod(
  12507. $core.method({
  12508. selector: "esc",
  12509. protocol: "accessing",
  12510. fn: function (){
  12511. var self=this,$self=this;
  12512. return $core.withContext(function($ctx1) {
  12513. return $self._fromCharCode_((27));
  12514. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  12515. },
  12516. args: [],
  12517. source: "esc\x0a\x09^ self fromCharCode: 27",
  12518. referencedClasses: [],
  12519. messageSends: ["fromCharCode:"]
  12520. }),
  12521. $globals.String.a$cls);
  12522. $core.addMethod(
  12523. $core.method({
  12524. selector: "fromCharCode:",
  12525. protocol: "instance creation",
  12526. fn: function (anInteger){
  12527. var self=this,$self=this;
  12528. return $core.withContext(function($ctx1) {
  12529. return String.fromCharCode(anInteger);
  12530. return self;
  12531. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  12532. },
  12533. args: ["anInteger"],
  12534. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  12535. referencedClasses: [],
  12536. messageSends: []
  12537. }),
  12538. $globals.String.a$cls);
  12539. $core.addMethod(
  12540. $core.method({
  12541. selector: "fromString:",
  12542. protocol: "instance creation",
  12543. fn: function (aString){
  12544. var self=this,$self=this;
  12545. return $core.withContext(function($ctx1) {
  12546. return String(aString);
  12547. return self;
  12548. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  12549. },
  12550. args: ["aString"],
  12551. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  12552. referencedClasses: [],
  12553. messageSends: []
  12554. }),
  12555. $globals.String.a$cls);
  12556. $core.addMethod(
  12557. $core.method({
  12558. selector: "lf",
  12559. protocol: "accessing",
  12560. fn: function (){
  12561. var self=this,$self=this;
  12562. return $core.withContext(function($ctx1) {
  12563. return "\n";
  12564. return self;
  12565. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  12566. },
  12567. args: [],
  12568. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  12569. referencedClasses: [],
  12570. messageSends: []
  12571. }),
  12572. $globals.String.a$cls);
  12573. $core.addMethod(
  12574. $core.method({
  12575. selector: "random",
  12576. protocol: "random",
  12577. fn: function (){
  12578. var self=this,$self=this;
  12579. return $core.withContext(function($ctx1) {
  12580. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  12581. return self;
  12582. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  12583. },
  12584. args: [],
  12585. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);'>",
  12586. referencedClasses: [],
  12587. messageSends: []
  12588. }),
  12589. $globals.String.a$cls);
  12590. $core.addMethod(
  12591. $core.method({
  12592. selector: "randomNotIn:",
  12593. protocol: "random",
  12594. fn: function (aString){
  12595. var self=this,$self=this;
  12596. var result;
  12597. return $core.withContext(function($ctx1) {
  12598. $recv((function(){
  12599. return $core.withContext(function($ctx2) {
  12600. result=$self._random();
  12601. result;
  12602. return $recv(aString)._includesSubString_(result);
  12603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12604. }))._whileTrue();
  12605. return result;
  12606. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  12607. },
  12608. args: ["aString"],
  12609. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  12610. referencedClasses: [],
  12611. messageSends: ["whileTrue", "random", "includesSubString:"]
  12612. }),
  12613. $globals.String.a$cls);
  12614. $core.addMethod(
  12615. $core.method({
  12616. selector: "space",
  12617. protocol: "accessing",
  12618. fn: function (){
  12619. var self=this,$self=this;
  12620. return $core.withContext(function($ctx1) {
  12621. return " ";
  12622. return self;
  12623. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  12624. },
  12625. args: [],
  12626. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  12627. referencedClasses: [],
  12628. messageSends: []
  12629. }),
  12630. $globals.String.a$cls);
  12631. $core.addMethod(
  12632. $core.method({
  12633. selector: "streamClass",
  12634. protocol: "accessing",
  12635. fn: function (){
  12636. var self=this,$self=this;
  12637. return $globals.StringStream;
  12638. },
  12639. args: [],
  12640. source: "streamClass\x0a\x09\x09^ StringStream",
  12641. referencedClasses: ["StringStream"],
  12642. messageSends: []
  12643. }),
  12644. $globals.String.a$cls);
  12645. $core.addMethod(
  12646. $core.method({
  12647. selector: "tab",
  12648. protocol: "accessing",
  12649. fn: function (){
  12650. var self=this,$self=this;
  12651. return $core.withContext(function($ctx1) {
  12652. return "\t";
  12653. return self;
  12654. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  12655. },
  12656. args: [],
  12657. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  12658. referencedClasses: [],
  12659. messageSends: []
  12660. }),
  12661. $globals.String.a$cls);
  12662. $core.addMethod(
  12663. $core.method({
  12664. selector: "value:",
  12665. protocol: "instance creation",
  12666. fn: function (aUTFCharCode){
  12667. var self=this,$self=this;
  12668. return $core.withContext(function($ctx1) {
  12669. return String.fromCharCode(aUTFCharCode);;
  12670. return self;
  12671. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  12672. },
  12673. args: ["aUTFCharCode"],
  12674. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  12675. referencedClasses: [],
  12676. messageSends: []
  12677. }),
  12678. $globals.String.a$cls);
  12679. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  12680. $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`.";
  12681. $core.addMethod(
  12682. $core.method({
  12683. selector: "=",
  12684. protocol: "comparing",
  12685. fn: function (aCollection){
  12686. var self=this,$self=this;
  12687. return $core.withContext(function($ctx1) {
  12688. var $2,$1,$4,$3,$5;
  12689. var $early={};
  12690. try {
  12691. $2=$self._class();
  12692. $ctx1.sendIdx["class"]=1;
  12693. $1=$recv($2).__eq($recv(aCollection)._class());
  12694. $ctx1.sendIdx["="]=1;
  12695. if(!$core.assert($1)){
  12696. return false;
  12697. }
  12698. $4=$self._size();
  12699. $ctx1.sendIdx["size"]=1;
  12700. $3=$recv($4).__eq($recv(aCollection)._size());
  12701. if(!$core.assert($3)){
  12702. return false;
  12703. }
  12704. $self._do_((function(each){
  12705. return $core.withContext(function($ctx2) {
  12706. $5=$recv(aCollection)._includes_(each);
  12707. if(!$core.assert($5)){
  12708. throw $early=[false];
  12709. }
  12710. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  12711. }));
  12712. return true;
  12713. }
  12714. catch(e) {if(e===$early)return e[0]; throw e}
  12715. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  12716. },
  12717. args: ["aCollection"],
  12718. 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",
  12719. referencedClasses: [],
  12720. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  12721. }),
  12722. $globals.Set);
  12723. $core.addMethod(
  12724. $core.method({
  12725. selector: "add:",
  12726. protocol: "adding/removing",
  12727. fn: function (anObject){
  12728. var self=this,$self=this;
  12729. var bucket;
  12730. return $core.withContext(function($ctx1) {
  12731. var $1,$receiver;
  12732. bucket=$self._bucketsOfElement_(anObject);
  12733. $1=$recv(bucket)._second();
  12734. if(($receiver = $1) == null || $receiver.a$nil){
  12735. var object,slowBucket;
  12736. object=$recv(bucket)._first();
  12737. $ctx1.sendIdx["first"]=1;
  12738. object;
  12739. slowBucket=$recv(bucket)._third();
  12740. slowBucket;
  12741. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  12742. return $core.withContext(function($ctx2) {
  12743. $recv(slowBucket)._add_(object);
  12744. $self["@size"]=$recv($self["@size"]).__plus((1));
  12745. return $self["@size"];
  12746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12747. }));
  12748. return object;
  12749. } else {
  12750. var primitiveBucket;
  12751. primitiveBucket=$receiver;
  12752. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  12753. }
  12754. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12755. },
  12756. args: ["anObject"],
  12757. 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 ]",
  12758. referencedClasses: [],
  12759. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  12760. }),
  12761. $globals.Set);
  12762. $core.addMethod(
  12763. $core.method({
  12764. selector: "add:in:",
  12765. protocol: "private",
  12766. fn: function (anObject,anotherObject){
  12767. var self=this,$self=this;
  12768. return $core.withContext(function($ctx1) {
  12769. if (anObject in anotherObject.store) { return false; }
  12770. $self['@size']++;
  12771. anotherObject.store[anObject] = true;
  12772. return anObject;
  12773. ;
  12774. return self;
  12775. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12776. },
  12777. args: ["anObject", "anotherObject"],
  12778. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09$self[''@size'']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  12779. referencedClasses: [],
  12780. messageSends: []
  12781. }),
  12782. $globals.Set);
  12783. $core.addMethod(
  12784. $core.method({
  12785. selector: "bucketsOfElement:",
  12786. protocol: "private",
  12787. fn: function (anObject){
  12788. var self=this,$self=this;
  12789. return $core.withContext(function($ctx1) {
  12790. // include nil to well-known objects under "boolean" fastBucket
  12791. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  12792. var prim = anObject.valueOf();
  12793. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  12794. var bucket = null;
  12795. $self['@slowBucketStores'].some(function (store) {
  12796. return bucket = store._bucketOfElement_(anObject);
  12797. });
  12798. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  12799. }
  12800. return [ prim, $self['@fastBuckets'][typeof prim] ];
  12801. ;
  12802. return self;
  12803. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  12804. },
  12805. args: ["anObject"],
  12806. 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'>",
  12807. referencedClasses: [],
  12808. messageSends: []
  12809. }),
  12810. $globals.Set);
  12811. $core.addMethod(
  12812. $core.method({
  12813. selector: "classNameOf:",
  12814. protocol: "private",
  12815. fn: function (anObject){
  12816. var self=this,$self=this;
  12817. return $core.withContext(function($ctx1) {
  12818. return anObject.a$cls != null && anObject.a$cls.className;
  12819. return self;
  12820. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  12821. },
  12822. args: ["anObject"],
  12823. 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.className'>",
  12824. referencedClasses: [],
  12825. messageSends: []
  12826. }),
  12827. $globals.Set);
  12828. $core.addMethod(
  12829. $core.method({
  12830. selector: "collect:",
  12831. protocol: "enumerating",
  12832. fn: function (aBlock){
  12833. var self=this,$self=this;
  12834. var collection;
  12835. return $core.withContext(function($ctx1) {
  12836. collection=$recv($self._class())._new();
  12837. $self._do_((function(each){
  12838. return $core.withContext(function($ctx2) {
  12839. return $recv(collection)._add_($recv(aBlock)._value_(each));
  12840. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12841. }));
  12842. return collection;
  12843. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12844. },
  12845. args: ["aBlock"],
  12846. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  12847. referencedClasses: [],
  12848. messageSends: ["new", "class", "do:", "add:", "value:"]
  12849. }),
  12850. $globals.Set);
  12851. $core.addMethod(
  12852. $core.method({
  12853. selector: "detect:ifNone:",
  12854. protocol: "enumerating",
  12855. fn: function (aBlock,anotherBlock){
  12856. var self=this,$self=this;
  12857. return $core.withContext(function($ctx1) {
  12858. var $1;
  12859. var $early={};
  12860. try {
  12861. $self._do_((function(each){
  12862. return $core.withContext(function($ctx2) {
  12863. $1=$recv(aBlock)._value_(each);
  12864. if($core.assert($1)){
  12865. throw $early=[each];
  12866. }
  12867. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12868. }));
  12869. return $recv(anotherBlock)._value();
  12870. }
  12871. catch(e) {if(e===$early)return e[0]; throw e}
  12872. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  12873. },
  12874. args: ["aBlock", "anotherBlock"],
  12875. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  12876. referencedClasses: [],
  12877. messageSends: ["do:", "ifTrue:", "value:", "value"]
  12878. }),
  12879. $globals.Set);
  12880. $core.addMethod(
  12881. $core.method({
  12882. selector: "do:",
  12883. protocol: "enumerating",
  12884. fn: function (aBlock){
  12885. var self=this,$self=this;
  12886. return $core.withContext(function($ctx1) {
  12887. var el, keys, i;
  12888. el = $self['@fastBuckets'];
  12889. keys = Object.keys(el);
  12890. for (i = 0; i < keys.length; ++i) {
  12891. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  12892. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  12893. else { store._do_(aBlock); }
  12894. }
  12895. el = $self['@slowBucketStores'];
  12896. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  12897. $self['@defaultBucket']._do_(aBlock);
  12898. ;
  12899. return self;
  12900. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  12901. },
  12902. args: ["aBlock"],
  12903. 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'>",
  12904. referencedClasses: [],
  12905. messageSends: []
  12906. }),
  12907. $globals.Set);
  12908. $core.addMethod(
  12909. $core.method({
  12910. selector: "includes:",
  12911. protocol: "testing",
  12912. fn: function (anObject){
  12913. var self=this,$self=this;
  12914. var bucket;
  12915. return $core.withContext(function($ctx1) {
  12916. var $1,$2,$3,$receiver;
  12917. bucket=$self._bucketsOfElement_(anObject);
  12918. $1=$recv(bucket)._second();
  12919. if(($receiver = $1) == null || $receiver.a$nil){
  12920. $2=$recv(bucket)._third();
  12921. $3=$recv(bucket)._first();
  12922. $ctx1.sendIdx["first"]=1;
  12923. return $recv($2)._includes_($3);
  12924. } else {
  12925. var primitiveBucket;
  12926. primitiveBucket=$receiver;
  12927. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  12928. }
  12929. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12930. },
  12931. args: ["anObject"],
  12932. 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 ]",
  12933. referencedClasses: [],
  12934. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  12935. }),
  12936. $globals.Set);
  12937. $core.addMethod(
  12938. $core.method({
  12939. selector: "includes:in:",
  12940. protocol: "private",
  12941. fn: function (anObject,anotherObject){
  12942. var self=this,$self=this;
  12943. return $core.withContext(function($ctx1) {
  12944. return anObject in anotherObject.store;
  12945. return self;
  12946. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12947. },
  12948. args: ["anObject", "anotherObject"],
  12949. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  12950. referencedClasses: [],
  12951. messageSends: []
  12952. }),
  12953. $globals.Set);
  12954. $core.addMethod(
  12955. $core.method({
  12956. selector: "initialize",
  12957. protocol: "initialization",
  12958. fn: function (){
  12959. var self=this,$self=this;
  12960. return $core.withContext(function($ctx1) {
  12961. (
  12962. $ctx1.supercall = true,
  12963. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  12964. $ctx1.supercall = false;
  12965. $self["@defaultBucket"]=[];
  12966. $self._initializeSlowBucketStores();
  12967. $self._removeAll();
  12968. return self;
  12969. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  12970. },
  12971. args: [],
  12972. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  12973. referencedClasses: [],
  12974. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  12975. }),
  12976. $globals.Set);
  12977. $core.addMethod(
  12978. $core.method({
  12979. selector: "initializeSlowBucketStores",
  12980. protocol: "initialization",
  12981. fn: function (){
  12982. var self=this,$self=this;
  12983. return $core.withContext(function($ctx1) {
  12984. var $1;
  12985. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  12986. return $core.withContext(function($ctx2) {
  12987. return $self._classNameOf_(x);
  12988. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  12989. }));
  12990. $ctx1.sendIdx["hashBlock:"]=1;
  12991. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  12992. return $core.withContext(function($ctx2) {
  12993. return $self._jsConstructorNameOf_(x);
  12994. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  12995. }))];
  12996. return self;
  12997. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  12998. },
  12999. args: [],
  13000. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  13001. referencedClasses: ["ArrayBucketStore"],
  13002. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  13003. }),
  13004. $globals.Set);
  13005. $core.addMethod(
  13006. $core.method({
  13007. selector: "jsConstructorNameOf:",
  13008. protocol: "private",
  13009. fn: function (anObject){
  13010. var self=this,$self=this;
  13011. return $core.withContext(function($ctx1) {
  13012. return anObject.constructor && anObject.constructor.name;
  13013. return self;
  13014. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  13015. },
  13016. args: ["anObject"],
  13017. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  13018. referencedClasses: [],
  13019. messageSends: []
  13020. }),
  13021. $globals.Set);
  13022. $core.addMethod(
  13023. $core.method({
  13024. selector: "printOn:",
  13025. protocol: "printing",
  13026. fn: function (aStream){
  13027. var self=this,$self=this;
  13028. return $core.withContext(function($ctx1) {
  13029. (
  13030. $ctx1.supercall = true,
  13031. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  13032. $ctx1.supercall = false;
  13033. $ctx1.sendIdx["printOn:"]=1;
  13034. $recv(aStream)._nextPutAll_(" (");
  13035. $ctx1.sendIdx["nextPutAll:"]=1;
  13036. $self._do_separatedBy_((function(each){
  13037. return $core.withContext(function($ctx2) {
  13038. return $recv(each)._printOn_(aStream);
  13039. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13040. }),(function(){
  13041. return $core.withContext(function($ctx2) {
  13042. return $recv(aStream)._nextPutAll_(" ");
  13043. $ctx2.sendIdx["nextPutAll:"]=2;
  13044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13045. }));
  13046. $recv(aStream)._nextPutAll_(")");
  13047. return self;
  13048. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  13049. },
  13050. args: ["aStream"],
  13051. 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: ')'",
  13052. referencedClasses: [],
  13053. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13054. }),
  13055. $globals.Set);
  13056. $core.addMethod(
  13057. $core.method({
  13058. selector: "remove:ifAbsent:",
  13059. protocol: "adding/removing",
  13060. fn: function (anObject,aBlock){
  13061. var self=this,$self=this;
  13062. var bucket;
  13063. return $core.withContext(function($ctx1) {
  13064. var $1,$2,$3,$receiver;
  13065. var $early={};
  13066. try {
  13067. bucket=$self._bucketsOfElement_(anObject);
  13068. $1=$recv(bucket)._second();
  13069. if(($receiver = $1) == null || $receiver.a$nil){
  13070. $2=$recv(bucket)._third();
  13071. $3=$recv(bucket)._first();
  13072. $ctx1.sendIdx["first"]=1;
  13073. $recv($2)._remove_ifAbsent_($3,(function(){
  13074. return $core.withContext(function($ctx2) {
  13075. throw $early=[$recv(aBlock)._value()];
  13076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13077. }));
  13078. $self["@size"]=$recv($self["@size"]).__minus((1));
  13079. return $self["@size"];
  13080. } else {
  13081. var primitiveBucket;
  13082. primitiveBucket=$receiver;
  13083. return $self._remove_in_($recv(bucket)._first(),primitiveBucket);
  13084. }
  13085. }
  13086. catch(e) {if(e===$early)return e[0]; throw e}
  13087. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  13088. },
  13089. args: ["anObject", "aBlock"],
  13090. 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 ]",
  13091. referencedClasses: [],
  13092. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  13093. }),
  13094. $globals.Set);
  13095. $core.addMethod(
  13096. $core.method({
  13097. selector: "remove:in:",
  13098. protocol: "private",
  13099. fn: function (anObject,anotherObject){
  13100. var self=this,$self=this;
  13101. return $core.withContext(function($ctx1) {
  13102. if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self['@size']--; };
  13103. return self;
  13104. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  13105. },
  13106. args: ["anObject", "anotherObject"],
  13107. source: "remove: anObject in: anotherObject\x0a\x09<inlineJS: 'if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self[''@size'']--; }'>",
  13108. referencedClasses: [],
  13109. messageSends: []
  13110. }),
  13111. $globals.Set);
  13112. $core.addMethod(
  13113. $core.method({
  13114. selector: "removeAll",
  13115. protocol: "adding/removing",
  13116. fn: function (){
  13117. var self=this,$self=this;
  13118. return $core.withContext(function($ctx1) {
  13119. $self['@fastBuckets'] = {
  13120. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  13121. "number": { store: Object.create(null), fn: Number },
  13122. "string": { store: Object.create(null) }
  13123. };
  13124. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  13125. $self['@defaultBucket']._removeAll();
  13126. $self['@size'] = 0;
  13127. ;
  13128. return self;
  13129. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  13130. },
  13131. args: [],
  13132. 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'>",
  13133. referencedClasses: [],
  13134. messageSends: []
  13135. }),
  13136. $globals.Set);
  13137. $core.addMethod(
  13138. $core.method({
  13139. selector: "select:",
  13140. protocol: "enumerating",
  13141. fn: function (aBlock){
  13142. var self=this,$self=this;
  13143. var collection;
  13144. return $core.withContext(function($ctx1) {
  13145. var $1;
  13146. collection=$recv($self._class())._new();
  13147. $self._do_((function(each){
  13148. return $core.withContext(function($ctx2) {
  13149. $1=$recv(aBlock)._value_(each);
  13150. if($core.assert($1)){
  13151. return $recv(collection)._add_(each);
  13152. }
  13153. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13154. }));
  13155. return collection;
  13156. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  13157. },
  13158. args: ["aBlock"],
  13159. 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",
  13160. referencedClasses: [],
  13161. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13162. }),
  13163. $globals.Set);
  13164. $core.addMethod(
  13165. $core.method({
  13166. selector: "select:thenCollect:",
  13167. protocol: "enumerating",
  13168. fn: function (selectBlock,collectBlock){
  13169. var self=this,$self=this;
  13170. var collection;
  13171. return $core.withContext(function($ctx1) {
  13172. var $1;
  13173. collection=$recv($self._class())._new();
  13174. $self._do_((function(each){
  13175. return $core.withContext(function($ctx2) {
  13176. $1=$recv(selectBlock)._value_(each);
  13177. $ctx2.sendIdx["value:"]=1;
  13178. if($core.assert($1)){
  13179. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  13180. }
  13181. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13182. }));
  13183. return collection;
  13184. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  13185. },
  13186. args: ["selectBlock", "collectBlock"],
  13187. 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",
  13188. referencedClasses: [],
  13189. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13190. }),
  13191. $globals.Set);
  13192. $core.addMethod(
  13193. $core.method({
  13194. selector: "size",
  13195. protocol: "accessing",
  13196. fn: function (){
  13197. var self=this,$self=this;
  13198. return $self["@size"];
  13199. },
  13200. args: [],
  13201. source: "size\x0a\x09^ size",
  13202. referencedClasses: [],
  13203. messageSends: []
  13204. }),
  13205. $globals.Set);
  13206. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  13207. $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.";
  13208. $core.addMethod(
  13209. $core.method({
  13210. selector: "<<",
  13211. protocol: "writing",
  13212. fn: function (anObject){
  13213. var self=this,$self=this;
  13214. return $core.withContext(function($ctx1) {
  13215. $self._write_(anObject);
  13216. return self;
  13217. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  13218. },
  13219. args: ["anObject"],
  13220. source: "<< anObject\x0a\x09self write: anObject",
  13221. referencedClasses: [],
  13222. messageSends: ["write:"]
  13223. }),
  13224. $globals.ProtoStream);
  13225. $core.addMethod(
  13226. $core.method({
  13227. selector: "atEnd",
  13228. protocol: "testing",
  13229. fn: function (){
  13230. var self=this,$self=this;
  13231. return $core.withContext(function($ctx1) {
  13232. $self._subclassResponsibility();
  13233. return self;
  13234. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  13235. },
  13236. args: [],
  13237. source: "atEnd\x0a\x09self subclassResponsibility",
  13238. referencedClasses: [],
  13239. messageSends: ["subclassResponsibility"]
  13240. }),
  13241. $globals.ProtoStream);
  13242. $core.addMethod(
  13243. $core.method({
  13244. selector: "atStart",
  13245. protocol: "testing",
  13246. fn: function (){
  13247. var self=this,$self=this;
  13248. return $core.withContext(function($ctx1) {
  13249. $self._subclassResponsibility();
  13250. return self;
  13251. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  13252. },
  13253. args: [],
  13254. source: "atStart\x0a\x09self subclassResponsibility",
  13255. referencedClasses: [],
  13256. messageSends: ["subclassResponsibility"]
  13257. }),
  13258. $globals.ProtoStream);
  13259. $core.addMethod(
  13260. $core.method({
  13261. selector: "contents",
  13262. protocol: "accessing",
  13263. fn: function (){
  13264. var self=this,$self=this;
  13265. return $core.withContext(function($ctx1) {
  13266. $self._subclassResponsibility();
  13267. return self;
  13268. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  13269. },
  13270. args: [],
  13271. source: "contents\x0a\x09self subclassResponsibility",
  13272. referencedClasses: [],
  13273. messageSends: ["subclassResponsibility"]
  13274. }),
  13275. $globals.ProtoStream);
  13276. $core.addMethod(
  13277. $core.method({
  13278. selector: "do:",
  13279. protocol: "enumerating",
  13280. fn: function (aBlock){
  13281. var self=this,$self=this;
  13282. return $core.withContext(function($ctx1) {
  13283. $recv((function(){
  13284. return $core.withContext(function($ctx2) {
  13285. return $self._atEnd();
  13286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13287. }))._whileFalse_((function(){
  13288. return $core.withContext(function($ctx2) {
  13289. return $recv(aBlock)._value_($self._next());
  13290. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13291. }));
  13292. return self;
  13293. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  13294. },
  13295. args: ["aBlock"],
  13296. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  13297. referencedClasses: [],
  13298. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  13299. }),
  13300. $globals.ProtoStream);
  13301. $core.addMethod(
  13302. $core.method({
  13303. selector: "isEmpty",
  13304. protocol: "testing",
  13305. fn: function (){
  13306. var self=this,$self=this;
  13307. return $core.withContext(function($ctx1) {
  13308. return $recv($self._atStart())._and_((function(){
  13309. return $core.withContext(function($ctx2) {
  13310. return $self._atEnd();
  13311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13312. }));
  13313. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  13314. },
  13315. args: [],
  13316. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  13317. referencedClasses: [],
  13318. messageSends: ["and:", "atStart", "atEnd"]
  13319. }),
  13320. $globals.ProtoStream);
  13321. $core.addMethod(
  13322. $core.method({
  13323. selector: "next",
  13324. protocol: "reading",
  13325. fn: function (){
  13326. var self=this,$self=this;
  13327. return $core.withContext(function($ctx1) {
  13328. var $1;
  13329. $1=$self._atEnd();
  13330. if($core.assert($1)){
  13331. return nil;
  13332. } else {
  13333. return $self._subclassResponsibility();
  13334. }
  13335. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  13336. },
  13337. args: [],
  13338. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13339. referencedClasses: [],
  13340. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13341. }),
  13342. $globals.ProtoStream);
  13343. $core.addMethod(
  13344. $core.method({
  13345. selector: "nextPut:",
  13346. protocol: "writing",
  13347. fn: function (anObject){
  13348. var self=this,$self=this;
  13349. return $core.withContext(function($ctx1) {
  13350. $self._subclassResponsibility();
  13351. return self;
  13352. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  13353. },
  13354. args: ["anObject"],
  13355. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  13356. referencedClasses: [],
  13357. messageSends: ["subclassResponsibility"]
  13358. }),
  13359. $globals.ProtoStream);
  13360. $core.addMethod(
  13361. $core.method({
  13362. selector: "nextPutAll:",
  13363. protocol: "writing",
  13364. fn: function (aCollection){
  13365. var self=this,$self=this;
  13366. return $core.withContext(function($ctx1) {
  13367. $recv(aCollection)._do_((function(each){
  13368. return $core.withContext(function($ctx2) {
  13369. return $self._nextPut_(each);
  13370. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13371. }));
  13372. return self;
  13373. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  13374. },
  13375. args: ["aCollection"],
  13376. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  13377. referencedClasses: [],
  13378. messageSends: ["do:", "nextPut:"]
  13379. }),
  13380. $globals.ProtoStream);
  13381. $core.addMethod(
  13382. $core.method({
  13383. selector: "nextPutString:",
  13384. protocol: "writing",
  13385. fn: function (aString){
  13386. var self=this,$self=this;
  13387. return $core.withContext(function($ctx1) {
  13388. $self._nextPut_(aString);
  13389. return self;
  13390. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  13391. },
  13392. args: ["aString"],
  13393. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  13394. referencedClasses: [],
  13395. messageSends: ["nextPut:"]
  13396. }),
  13397. $globals.ProtoStream);
  13398. $core.addMethod(
  13399. $core.method({
  13400. selector: "peek",
  13401. protocol: "reading",
  13402. fn: function (){
  13403. var self=this,$self=this;
  13404. return $core.withContext(function($ctx1) {
  13405. var $1;
  13406. $1=$self._atEnd();
  13407. if($core.assert($1)){
  13408. return nil;
  13409. } else {
  13410. return $self._subclassResponsibility();
  13411. }
  13412. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  13413. },
  13414. args: [],
  13415. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13416. referencedClasses: [],
  13417. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13418. }),
  13419. $globals.ProtoStream);
  13420. $core.addMethod(
  13421. $core.method({
  13422. selector: "reset",
  13423. protocol: "actions",
  13424. fn: function (){
  13425. var self=this,$self=this;
  13426. return $core.withContext(function($ctx1) {
  13427. $self._subclassResponsibility();
  13428. return self;
  13429. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  13430. },
  13431. args: [],
  13432. source: "reset\x0a\x09self subclassResponsibility",
  13433. referencedClasses: [],
  13434. messageSends: ["subclassResponsibility"]
  13435. }),
  13436. $globals.ProtoStream);
  13437. $core.addMethod(
  13438. $core.method({
  13439. selector: "resetContents",
  13440. protocol: "actions",
  13441. fn: function (){
  13442. var self=this,$self=this;
  13443. return $core.withContext(function($ctx1) {
  13444. $self._subclassResponsibility();
  13445. return self;
  13446. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  13447. },
  13448. args: [],
  13449. source: "resetContents\x0a\x09self subclassResponsibility",
  13450. referencedClasses: [],
  13451. messageSends: ["subclassResponsibility"]
  13452. }),
  13453. $globals.ProtoStream);
  13454. $core.addMethod(
  13455. $core.method({
  13456. selector: "setToEnd",
  13457. protocol: "positioning",
  13458. fn: function (){
  13459. var self=this,$self=this;
  13460. return $core.withContext(function($ctx1) {
  13461. $self._subclassResponsibility();
  13462. return self;
  13463. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  13464. },
  13465. args: [],
  13466. source: "setToEnd\x0a\x09self subclassResponsibility",
  13467. referencedClasses: [],
  13468. messageSends: ["subclassResponsibility"]
  13469. }),
  13470. $globals.ProtoStream);
  13471. $core.addMethod(
  13472. $core.method({
  13473. selector: "setToStart",
  13474. protocol: "positioning",
  13475. fn: function (){
  13476. var self=this,$self=this;
  13477. return $core.withContext(function($ctx1) {
  13478. $self._reset();
  13479. return self;
  13480. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  13481. },
  13482. args: [],
  13483. source: "setToStart\x0a\x09self reset",
  13484. referencedClasses: [],
  13485. messageSends: ["reset"]
  13486. }),
  13487. $globals.ProtoStream);
  13488. $core.addMethod(
  13489. $core.method({
  13490. selector: "write:",
  13491. protocol: "writing",
  13492. fn: function (anObject){
  13493. var self=this,$self=this;
  13494. return $core.withContext(function($ctx1) {
  13495. $recv(anObject)._putOn_(self);
  13496. return self;
  13497. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  13498. },
  13499. args: ["anObject"],
  13500. source: "write: anObject\x0a\x09anObject putOn: self",
  13501. referencedClasses: [],
  13502. messageSends: ["putOn:"]
  13503. }),
  13504. $globals.ProtoStream);
  13505. $core.addMethod(
  13506. $core.method({
  13507. selector: "on:",
  13508. protocol: "instance creation",
  13509. fn: function (aCollection){
  13510. var self=this,$self=this;
  13511. return $core.withContext(function($ctx1) {
  13512. var $1;
  13513. $1=$self._new();
  13514. $recv($1)._setCollection_(aCollection);
  13515. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13516. return $recv($1)._yourself();
  13517. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  13518. },
  13519. args: ["aCollection"],
  13520. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13521. referencedClasses: [],
  13522. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13523. }),
  13524. $globals.ProtoStream.a$cls);
  13525. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  13526. $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.";
  13527. $core.addMethod(
  13528. $core.method({
  13529. selector: "atEnd",
  13530. protocol: "testing",
  13531. fn: function (){
  13532. var self=this,$self=this;
  13533. return $core.withContext(function($ctx1) {
  13534. return $recv($self._position()).__eq($self._size());
  13535. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  13536. },
  13537. args: [],
  13538. source: "atEnd\x0a\x09^ self position = self size",
  13539. referencedClasses: [],
  13540. messageSends: ["=", "position", "size"]
  13541. }),
  13542. $globals.Stream);
  13543. $core.addMethod(
  13544. $core.method({
  13545. selector: "atStart",
  13546. protocol: "testing",
  13547. fn: function (){
  13548. var self=this,$self=this;
  13549. return $core.withContext(function($ctx1) {
  13550. return $recv($self._position()).__eq((0));
  13551. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  13552. },
  13553. args: [],
  13554. source: "atStart\x0a\x09^ self position = 0",
  13555. referencedClasses: [],
  13556. messageSends: ["=", "position"]
  13557. }),
  13558. $globals.Stream);
  13559. $core.addMethod(
  13560. $core.method({
  13561. selector: "close",
  13562. protocol: "actions",
  13563. fn: function (){
  13564. var self=this,$self=this;
  13565. return self;
  13566. },
  13567. args: [],
  13568. source: "close",
  13569. referencedClasses: [],
  13570. messageSends: []
  13571. }),
  13572. $globals.Stream);
  13573. $core.addMethod(
  13574. $core.method({
  13575. selector: "collection",
  13576. protocol: "accessing",
  13577. fn: function (){
  13578. var self=this,$self=this;
  13579. return $self["@collection"];
  13580. },
  13581. args: [],
  13582. source: "collection\x0a\x09^ collection",
  13583. referencedClasses: [],
  13584. messageSends: []
  13585. }),
  13586. $globals.Stream);
  13587. $core.addMethod(
  13588. $core.method({
  13589. selector: "contents",
  13590. protocol: "accessing",
  13591. fn: function (){
  13592. var self=this,$self=this;
  13593. return $core.withContext(function($ctx1) {
  13594. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  13595. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  13596. },
  13597. args: [],
  13598. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13599. referencedClasses: [],
  13600. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  13601. }),
  13602. $globals.Stream);
  13603. $core.addMethod(
  13604. $core.method({
  13605. selector: "flush",
  13606. protocol: "actions",
  13607. fn: function (){
  13608. var self=this,$self=this;
  13609. return self;
  13610. },
  13611. args: [],
  13612. source: "flush",
  13613. referencedClasses: [],
  13614. messageSends: []
  13615. }),
  13616. $globals.Stream);
  13617. $core.addMethod(
  13618. $core.method({
  13619. selector: "isEmpty",
  13620. protocol: "testing",
  13621. fn: function (){
  13622. var self=this,$self=this;
  13623. return $core.withContext(function($ctx1) {
  13624. return $recv($self._size()).__eq((0));
  13625. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  13626. },
  13627. args: [],
  13628. source: "isEmpty\x0a\x09^ self size = 0",
  13629. referencedClasses: [],
  13630. messageSends: ["=", "size"]
  13631. }),
  13632. $globals.Stream);
  13633. $core.addMethod(
  13634. $core.method({
  13635. selector: "next",
  13636. protocol: "reading",
  13637. fn: function (){
  13638. var self=this,$self=this;
  13639. return $core.withContext(function($ctx1) {
  13640. var $1,$3,$2;
  13641. $1=$self._atEnd();
  13642. if($core.assert($1)){
  13643. return nil;
  13644. } else {
  13645. $3=$self._position();
  13646. $ctx1.sendIdx["position"]=1;
  13647. $2=$recv($3).__plus((1));
  13648. $self._position_($2);
  13649. return $recv($self["@collection"])._at_($self._position());
  13650. }
  13651. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  13652. },
  13653. args: [],
  13654. 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 ]",
  13655. referencedClasses: [],
  13656. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  13657. }),
  13658. $globals.Stream);
  13659. $core.addMethod(
  13660. $core.method({
  13661. selector: "next:",
  13662. protocol: "reading",
  13663. fn: function (anInteger){
  13664. var self=this,$self=this;
  13665. var tempCollection;
  13666. return $core.withContext(function($ctx1) {
  13667. var $1;
  13668. tempCollection=$recv($recv($self._collection())._class())._new();
  13669. $recv(anInteger)._timesRepeat_((function(){
  13670. return $core.withContext(function($ctx2) {
  13671. $1=$self._atEnd();
  13672. if(!$core.assert($1)){
  13673. return $recv(tempCollection)._add_($self._next());
  13674. }
  13675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13676. }));
  13677. return tempCollection;
  13678. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  13679. },
  13680. args: ["anInteger"],
  13681. 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",
  13682. referencedClasses: [],
  13683. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  13684. }),
  13685. $globals.Stream);
  13686. $core.addMethod(
  13687. $core.method({
  13688. selector: "nextPut:",
  13689. protocol: "writing",
  13690. fn: function (anObject){
  13691. var self=this,$self=this;
  13692. return $core.withContext(function($ctx1) {
  13693. var $2,$1,$3,$4;
  13694. $2=$self._position();
  13695. $ctx1.sendIdx["position"]=1;
  13696. $1=$recv($2).__plus((1));
  13697. $self._position_($1);
  13698. $3=$self._collection();
  13699. $4=$self._position();
  13700. $ctx1.sendIdx["position"]=2;
  13701. $recv($3)._at_put_($4,anObject);
  13702. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13703. return self;
  13704. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  13705. },
  13706. args: ["anObject"],
  13707. 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)",
  13708. referencedClasses: [],
  13709. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  13710. }),
  13711. $globals.Stream);
  13712. $core.addMethod(
  13713. $core.method({
  13714. selector: "peek",
  13715. protocol: "reading",
  13716. fn: function (){
  13717. var self=this,$self=this;
  13718. return $core.withContext(function($ctx1) {
  13719. var $1;
  13720. $1=$self._atEnd();
  13721. if(!$core.assert($1)){
  13722. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  13723. }
  13724. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  13725. },
  13726. args: [],
  13727. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  13728. referencedClasses: [],
  13729. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  13730. }),
  13731. $globals.Stream);
  13732. $core.addMethod(
  13733. $core.method({
  13734. selector: "position",
  13735. protocol: "accessing",
  13736. fn: function (){
  13737. var self=this,$self=this;
  13738. return $core.withContext(function($ctx1) {
  13739. var $1,$receiver;
  13740. $1=$self["@position"];
  13741. if(($receiver = $1) == null || $receiver.a$nil){
  13742. $self["@position"]=(0);
  13743. return $self["@position"];
  13744. } else {
  13745. return $1;
  13746. }
  13747. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  13748. },
  13749. args: [],
  13750. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  13751. referencedClasses: [],
  13752. messageSends: ["ifNil:"]
  13753. }),
  13754. $globals.Stream);
  13755. $core.addMethod(
  13756. $core.method({
  13757. selector: "position:",
  13758. protocol: "accessing",
  13759. fn: function (anInteger){
  13760. var self=this,$self=this;
  13761. $self["@position"]=anInteger;
  13762. return self;
  13763. },
  13764. args: ["anInteger"],
  13765. source: "position: anInteger\x0a\x09position := anInteger",
  13766. referencedClasses: [],
  13767. messageSends: []
  13768. }),
  13769. $globals.Stream);
  13770. $core.addMethod(
  13771. $core.method({
  13772. selector: "reset",
  13773. protocol: "actions",
  13774. fn: function (){
  13775. var self=this,$self=this;
  13776. return $core.withContext(function($ctx1) {
  13777. $self._position_((0));
  13778. return self;
  13779. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  13780. },
  13781. args: [],
  13782. source: "reset\x0a\x09self position: 0",
  13783. referencedClasses: [],
  13784. messageSends: ["position:"]
  13785. }),
  13786. $globals.Stream);
  13787. $core.addMethod(
  13788. $core.method({
  13789. selector: "resetContents",
  13790. protocol: "actions",
  13791. fn: function (){
  13792. var self=this,$self=this;
  13793. return $core.withContext(function($ctx1) {
  13794. $self._reset();
  13795. $self._setStreamSize_((0));
  13796. return self;
  13797. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  13798. },
  13799. args: [],
  13800. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13801. referencedClasses: [],
  13802. messageSends: ["reset", "setStreamSize:"]
  13803. }),
  13804. $globals.Stream);
  13805. $core.addMethod(
  13806. $core.method({
  13807. selector: "setCollection:",
  13808. protocol: "accessing",
  13809. fn: function (aCollection){
  13810. var self=this,$self=this;
  13811. $self["@collection"]=aCollection;
  13812. return self;
  13813. },
  13814. args: ["aCollection"],
  13815. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13816. referencedClasses: [],
  13817. messageSends: []
  13818. }),
  13819. $globals.Stream);
  13820. $core.addMethod(
  13821. $core.method({
  13822. selector: "setStreamSize:",
  13823. protocol: "accessing",
  13824. fn: function (anInteger){
  13825. var self=this,$self=this;
  13826. $self["@streamSize"]=anInteger;
  13827. return self;
  13828. },
  13829. args: ["anInteger"],
  13830. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  13831. referencedClasses: [],
  13832. messageSends: []
  13833. }),
  13834. $globals.Stream);
  13835. $core.addMethod(
  13836. $core.method({
  13837. selector: "setToEnd",
  13838. protocol: "positioning",
  13839. fn: function (){
  13840. var self=this,$self=this;
  13841. return $core.withContext(function($ctx1) {
  13842. $self._position_($self._size());
  13843. return self;
  13844. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  13845. },
  13846. args: [],
  13847. source: "setToEnd\x0a\x09self position: self size",
  13848. referencedClasses: [],
  13849. messageSends: ["position:", "size"]
  13850. }),
  13851. $globals.Stream);
  13852. $core.addMethod(
  13853. $core.method({
  13854. selector: "size",
  13855. protocol: "accessing",
  13856. fn: function (){
  13857. var self=this,$self=this;
  13858. return $core.withContext(function($ctx1) {
  13859. return $self._streamSize();
  13860. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  13861. },
  13862. args: [],
  13863. source: "size\x0a\x09^ self streamSize",
  13864. referencedClasses: [],
  13865. messageSends: ["streamSize"]
  13866. }),
  13867. $globals.Stream);
  13868. $core.addMethod(
  13869. $core.method({
  13870. selector: "skip:",
  13871. protocol: "positioning",
  13872. fn: function (anInteger){
  13873. var self=this,$self=this;
  13874. return $core.withContext(function($ctx1) {
  13875. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  13876. return self;
  13877. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  13878. },
  13879. args: ["anInteger"],
  13880. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  13881. referencedClasses: [],
  13882. messageSends: ["position:", "min:max:", "+", "position", "size"]
  13883. }),
  13884. $globals.Stream);
  13885. $core.addMethod(
  13886. $core.method({
  13887. selector: "streamSize",
  13888. protocol: "accessing",
  13889. fn: function (){
  13890. var self=this,$self=this;
  13891. return $self["@streamSize"];
  13892. },
  13893. args: [],
  13894. source: "streamSize\x0a\x09^ streamSize",
  13895. referencedClasses: [],
  13896. messageSends: []
  13897. }),
  13898. $globals.Stream);
  13899. $core.addMethod(
  13900. $core.method({
  13901. selector: "on:",
  13902. protocol: "instance creation",
  13903. fn: function (aCollection){
  13904. var self=this,$self=this;
  13905. return $core.withContext(function($ctx1) {
  13906. var $1;
  13907. $1=$self._new();
  13908. $recv($1)._setCollection_(aCollection);
  13909. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13910. return $recv($1)._yourself();
  13911. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  13912. },
  13913. args: ["aCollection"],
  13914. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13915. referencedClasses: [],
  13916. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13917. }),
  13918. $globals.Stream.a$cls);
  13919. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  13920. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  13921. $core.addMethod(
  13922. $core.method({
  13923. selector: "cr",
  13924. protocol: "writing",
  13925. fn: function (){
  13926. var self=this,$self=this;
  13927. return $core.withContext(function($ctx1) {
  13928. return $self._nextPutAll_($recv($globals.String)._cr());
  13929. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  13930. },
  13931. args: [],
  13932. source: "cr\x0a\x09^ self nextPutAll: String cr",
  13933. referencedClasses: ["String"],
  13934. messageSends: ["nextPutAll:", "cr"]
  13935. }),
  13936. $globals.StringStream);
  13937. $core.addMethod(
  13938. $core.method({
  13939. selector: "crlf",
  13940. protocol: "writing",
  13941. fn: function (){
  13942. var self=this,$self=this;
  13943. return $core.withContext(function($ctx1) {
  13944. return $self._nextPutAll_($recv($globals.String)._crlf());
  13945. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  13946. },
  13947. args: [],
  13948. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  13949. referencedClasses: ["String"],
  13950. messageSends: ["nextPutAll:", "crlf"]
  13951. }),
  13952. $globals.StringStream);
  13953. $core.addMethod(
  13954. $core.method({
  13955. selector: "lf",
  13956. protocol: "writing",
  13957. fn: function (){
  13958. var self=this,$self=this;
  13959. return $core.withContext(function($ctx1) {
  13960. return $self._nextPutAll_($recv($globals.String)._lf());
  13961. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  13962. },
  13963. args: [],
  13964. source: "lf\x0a\x09^ self nextPutAll: String lf",
  13965. referencedClasses: ["String"],
  13966. messageSends: ["nextPutAll:", "lf"]
  13967. }),
  13968. $globals.StringStream);
  13969. $core.addMethod(
  13970. $core.method({
  13971. selector: "next:",
  13972. protocol: "reading",
  13973. fn: function (anInteger){
  13974. var self=this,$self=this;
  13975. var tempCollection;
  13976. return $core.withContext(function($ctx1) {
  13977. var $1;
  13978. tempCollection=$recv($recv($self._collection())._class())._new();
  13979. $recv(anInteger)._timesRepeat_((function(){
  13980. return $core.withContext(function($ctx2) {
  13981. $1=$self._atEnd();
  13982. if(!$core.assert($1)){
  13983. tempCollection=$recv(tempCollection).__comma($self._next());
  13984. return tempCollection;
  13985. }
  13986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13987. }));
  13988. return tempCollection;
  13989. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  13990. },
  13991. args: ["anInteger"],
  13992. 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",
  13993. referencedClasses: [],
  13994. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  13995. }),
  13996. $globals.StringStream);
  13997. $core.addMethod(
  13998. $core.method({
  13999. selector: "nextPut:",
  14000. protocol: "writing",
  14001. fn: function (aString){
  14002. var self=this,$self=this;
  14003. return $core.withContext(function($ctx1) {
  14004. $self._nextPutAll_(aString);
  14005. return self;
  14006. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  14007. },
  14008. args: ["aString"],
  14009. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  14010. referencedClasses: [],
  14011. messageSends: ["nextPutAll:"]
  14012. }),
  14013. $globals.StringStream);
  14014. $core.addMethod(
  14015. $core.method({
  14016. selector: "nextPutAll:",
  14017. protocol: "writing",
  14018. fn: function (aString){
  14019. var self=this,$self=this;
  14020. var pre,post;
  14021. return $core.withContext(function($ctx1) {
  14022. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  14023. $1=$self._atEnd();
  14024. if($core.assert($1)){
  14025. $3=$self._collection();
  14026. $ctx1.sendIdx["collection"]=1;
  14027. $2=$recv($3).__comma(aString);
  14028. $ctx1.sendIdx[","]=1;
  14029. $self._setCollection_($2);
  14030. $ctx1.sendIdx["setCollection:"]=1;
  14031. } else {
  14032. $4=$self._collection();
  14033. $ctx1.sendIdx["collection"]=2;
  14034. $5=$self._position();
  14035. $ctx1.sendIdx["position"]=1;
  14036. pre=$recv($4)._copyFrom_to_((1),$5);
  14037. $ctx1.sendIdx["copyFrom:to:"]=1;
  14038. pre;
  14039. $6=$self._collection();
  14040. $ctx1.sendIdx["collection"]=3;
  14041. $9=$self._position();
  14042. $ctx1.sendIdx["position"]=2;
  14043. $8=$recv($9).__plus((1));
  14044. $ctx1.sendIdx["+"]=2;
  14045. $10=$recv(aString)._size();
  14046. $ctx1.sendIdx["size"]=1;
  14047. $7=$recv($8).__plus($10);
  14048. $ctx1.sendIdx["+"]=1;
  14049. $11=$recv($self._collection())._size();
  14050. $ctx1.sendIdx["size"]=2;
  14051. post=$recv($6)._copyFrom_to_($7,$11);
  14052. post;
  14053. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  14054. $ctx1.sendIdx[","]=2;
  14055. $self._setCollection_($12);
  14056. }
  14057. $14=$self._position();
  14058. $ctx1.sendIdx["position"]=3;
  14059. $13=$recv($14).__plus($recv(aString)._size());
  14060. $self._position_($13);
  14061. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  14062. return self;
  14063. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  14064. },
  14065. args: ["aString"],
  14066. 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)",
  14067. referencedClasses: [],
  14068. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  14069. }),
  14070. $globals.StringStream);
  14071. $core.addMethod(
  14072. $core.method({
  14073. selector: "nextPutString:",
  14074. protocol: "writing",
  14075. fn: function (aString){
  14076. var self=this,$self=this;
  14077. return $core.withContext(function($ctx1) {
  14078. $self._nextPutAll_(aString);
  14079. return self;
  14080. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  14081. },
  14082. args: ["aString"],
  14083. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  14084. referencedClasses: [],
  14085. messageSends: ["nextPutAll:"]
  14086. }),
  14087. $globals.StringStream);
  14088. $core.addMethod(
  14089. $core.method({
  14090. selector: "print:",
  14091. protocol: "writing",
  14092. fn: function (anObject){
  14093. var self=this,$self=this;
  14094. return $core.withContext(function($ctx1) {
  14095. $recv(anObject)._printOn_(self);
  14096. return self;
  14097. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  14098. },
  14099. args: ["anObject"],
  14100. source: "print: anObject\x0a\x09anObject printOn: self",
  14101. referencedClasses: [],
  14102. messageSends: ["printOn:"]
  14103. }),
  14104. $globals.StringStream);
  14105. $core.addMethod(
  14106. $core.method({
  14107. selector: "printSymbol:",
  14108. protocol: "writing",
  14109. fn: function (anObject){
  14110. var self=this,$self=this;
  14111. return $core.withContext(function($ctx1) {
  14112. $recv(anObject)._asSymbolPrintOn_(self);
  14113. return self;
  14114. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  14115. },
  14116. args: ["anObject"],
  14117. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  14118. referencedClasses: [],
  14119. messageSends: ["asSymbolPrintOn:"]
  14120. }),
  14121. $globals.StringStream);
  14122. $core.addMethod(
  14123. $core.method({
  14124. selector: "space",
  14125. protocol: "writing",
  14126. fn: function (){
  14127. var self=this,$self=this;
  14128. return $core.withContext(function($ctx1) {
  14129. $self._nextPut_(" ");
  14130. return self;
  14131. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  14132. },
  14133. args: [],
  14134. source: "space\x0a\x09self nextPut: ' '",
  14135. referencedClasses: [],
  14136. messageSends: ["nextPut:"]
  14137. }),
  14138. $globals.StringStream);
  14139. $core.addMethod(
  14140. $core.method({
  14141. selector: "tab",
  14142. protocol: "writing",
  14143. fn: function (){
  14144. var self=this,$self=this;
  14145. return $core.withContext(function($ctx1) {
  14146. return $self._nextPutAll_($recv($globals.String)._tab());
  14147. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  14148. },
  14149. args: [],
  14150. source: "tab\x0a\x09^ self nextPutAll: String tab",
  14151. referencedClasses: ["String"],
  14152. messageSends: ["nextPutAll:", "tab"]
  14153. }),
  14154. $globals.StringStream);
  14155. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  14156. $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.";
  14157. $core.addMethod(
  14158. $core.method({
  14159. selector: "initialize",
  14160. protocol: "initialization",
  14161. fn: function (){
  14162. var self=this,$self=this;
  14163. return $core.withContext(function($ctx1) {
  14164. (
  14165. $ctx1.supercall = true,
  14166. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  14167. $ctx1.supercall = false;
  14168. $self["@read"]=$recv($globals.OrderedCollection)._new();
  14169. $ctx1.sendIdx["new"]=1;
  14170. $self["@write"]=$recv($globals.OrderedCollection)._new();
  14171. $self["@readIndex"]=(1);
  14172. return self;
  14173. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  14174. },
  14175. args: [],
  14176. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  14177. referencedClasses: ["OrderedCollection"],
  14178. messageSends: ["initialize", "new"]
  14179. }),
  14180. $globals.Queue);
  14181. $core.addMethod(
  14182. $core.method({
  14183. selector: "next",
  14184. protocol: "accessing",
  14185. fn: function (){
  14186. var self=this,$self=this;
  14187. return $core.withContext(function($ctx1) {
  14188. return $self._nextIfAbsent_((function(){
  14189. return $core.withContext(function($ctx2) {
  14190. return $self._error_("Cannot read from empty Queue.");
  14191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14192. }));
  14193. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  14194. },
  14195. args: [],
  14196. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  14197. referencedClasses: [],
  14198. messageSends: ["nextIfAbsent:", "error:"]
  14199. }),
  14200. $globals.Queue);
  14201. $core.addMethod(
  14202. $core.method({
  14203. selector: "nextIfAbsent:",
  14204. protocol: "accessing",
  14205. fn: function (aBlock){
  14206. var self=this,$self=this;
  14207. var result;
  14208. return $core.withContext(function($ctx1) {
  14209. var $1;
  14210. var $early={};
  14211. try {
  14212. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  14213. return $core.withContext(function($ctx2) {
  14214. $recv($self["@write"])._ifEmpty_((function(){
  14215. return $core.withContext(function($ctx3) {
  14216. $1=$recv($self["@readIndex"]).__gt((1));
  14217. if($core.assert($1)){
  14218. $self["@read"]=[];
  14219. $self["@read"];
  14220. $self["@readIndex"]=(1);
  14221. $self["@readIndex"];
  14222. }
  14223. throw $early=[$recv(aBlock)._value()];
  14224. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14225. }));
  14226. $self["@read"]=$self["@write"];
  14227. $self["@read"];
  14228. $self["@readIndex"]=(1);
  14229. $self["@readIndex"];
  14230. $self["@write"]=$recv($globals.OrderedCollection)._new();
  14231. $self["@write"];
  14232. return $recv($self["@read"])._first();
  14233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14234. }));
  14235. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  14236. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  14237. return result;
  14238. }
  14239. catch(e) {if(e===$early)return e[0]; throw e}
  14240. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  14241. },
  14242. args: ["aBlock"],
  14243. 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",
  14244. referencedClasses: ["OrderedCollection"],
  14245. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  14246. }),
  14247. $globals.Queue);
  14248. $core.addMethod(
  14249. $core.method({
  14250. selector: "nextPut:",
  14251. protocol: "accessing",
  14252. fn: function (anObject){
  14253. var self=this,$self=this;
  14254. return $core.withContext(function($ctx1) {
  14255. $recv($self["@write"])._add_(anObject);
  14256. return self;
  14257. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  14258. },
  14259. args: ["anObject"],
  14260. source: "nextPut: anObject\x0a\x09write add: anObject",
  14261. referencedClasses: [],
  14262. messageSends: ["add:"]
  14263. }),
  14264. $globals.Queue);
  14265. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  14266. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  14267. $core.addMethod(
  14268. $core.method({
  14269. selector: "compile:",
  14270. protocol: "evaluating",
  14271. fn: function (aString){
  14272. var self=this,$self=this;
  14273. return $core.withContext(function($ctx1) {
  14274. return self.compile(aString);
  14275. return self;
  14276. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  14277. },
  14278. args: ["aString"],
  14279. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  14280. referencedClasses: [],
  14281. messageSends: []
  14282. }),
  14283. $globals.RegularExpression);
  14284. $core.addMethod(
  14285. $core.method({
  14286. selector: "exec:",
  14287. protocol: "evaluating",
  14288. fn: function (aString){
  14289. var self=this,$self=this;
  14290. return $core.withContext(function($ctx1) {
  14291. return self.exec(aString) || nil;
  14292. return self;
  14293. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  14294. },
  14295. args: ["aString"],
  14296. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  14297. referencedClasses: [],
  14298. messageSends: []
  14299. }),
  14300. $globals.RegularExpression);
  14301. $core.addMethod(
  14302. $core.method({
  14303. selector: "test:",
  14304. protocol: "evaluating",
  14305. fn: function (aString){
  14306. var self=this,$self=this;
  14307. return $core.withContext(function($ctx1) {
  14308. return self.test(aString);
  14309. return self;
  14310. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  14311. },
  14312. args: ["aString"],
  14313. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  14314. referencedClasses: [],
  14315. messageSends: []
  14316. }),
  14317. $globals.RegularExpression);
  14318. $core.addMethod(
  14319. $core.method({
  14320. selector: "fromString:",
  14321. protocol: "instance creation",
  14322. fn: function (aString){
  14323. var self=this,$self=this;
  14324. return $core.withContext(function($ctx1) {
  14325. return $self._fromString_flag_(aString,"");
  14326. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  14327. },
  14328. args: ["aString"],
  14329. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  14330. referencedClasses: [],
  14331. messageSends: ["fromString:flag:"]
  14332. }),
  14333. $globals.RegularExpression.a$cls);
  14334. $core.addMethod(
  14335. $core.method({
  14336. selector: "fromString:flag:",
  14337. protocol: "instance creation",
  14338. fn: function (aString,anotherString){
  14339. var self=this,$self=this;
  14340. return $core.withContext(function($ctx1) {
  14341. return new RegExp(aString, anotherString);
  14342. return self;
  14343. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  14344. },
  14345. args: ["aString", "anotherString"],
  14346. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  14347. referencedClasses: [],
  14348. messageSends: []
  14349. }),
  14350. $globals.RegularExpression.a$cls);
  14351. });
  14352. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Helpers", "amber_core/Kernel-Objects"], function($boot){"use strict";
  14353. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  14354. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  14355. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  14356. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  14357. $core.addPackage("Kernel-Classes");
  14358. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  14359. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  14360. $core.addClass("Behavior", $globals.Object, ["organization"], "Kernel-Classes");
  14361. $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.";
  14362. $core.addMethod(
  14363. $core.method({
  14364. selector: "allInstanceVariableNames",
  14365. protocol: "accessing",
  14366. fn: function (){
  14367. var self=this,$self=this;
  14368. var result;
  14369. return $core.withContext(function($ctx1) {
  14370. var $1,$receiver;
  14371. result=$recv($self._instanceVariableNames())._copy();
  14372. $1=$self._superclass();
  14373. $ctx1.sendIdx["superclass"]=1;
  14374. if(($receiver = $1) == null || $receiver.a$nil){
  14375. $1;
  14376. } else {
  14377. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  14378. }
  14379. return result;
  14380. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  14381. },
  14382. args: [],
  14383. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14384. referencedClasses: [],
  14385. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14386. }),
  14387. $globals.Behavior);
  14388. $core.addMethod(
  14389. $core.method({
  14390. selector: "allSelectors",
  14391. protocol: "accessing",
  14392. fn: function (){
  14393. var self=this,$self=this;
  14394. return $core.withContext(function($ctx1) {
  14395. var $1,$2;
  14396. $1=$self._allSuperclasses();
  14397. $2=$self._selectors();
  14398. $ctx1.sendIdx["selectors"]=1;
  14399. return $recv($1)._inject_into_($2,(function(acc,each){
  14400. return $core.withContext(function($ctx2) {
  14401. $recv(acc)._addAll_($recv(each)._selectors());
  14402. return $recv(acc)._yourself();
  14403. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  14404. }));
  14405. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  14406. },
  14407. args: [],
  14408. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  14409. referencedClasses: [],
  14410. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  14411. }),
  14412. $globals.Behavior);
  14413. $core.addMethod(
  14414. $core.method({
  14415. selector: "allSubclasses",
  14416. protocol: "accessing",
  14417. fn: function (){
  14418. var self=this,$self=this;
  14419. return $core.withContext(function($ctx1) {
  14420. return $recv($globals.Array)._streamContents_((function(str){
  14421. return $core.withContext(function($ctx2) {
  14422. return $self._allSubclassesDo_((function(each){
  14423. return $core.withContext(function($ctx3) {
  14424. return $recv(str)._nextPut_(each);
  14425. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14426. }));
  14427. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  14428. }));
  14429. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  14430. },
  14431. args: [],
  14432. 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 ] ]",
  14433. referencedClasses: ["Array"],
  14434. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  14435. }),
  14436. $globals.Behavior);
  14437. $core.addMethod(
  14438. $core.method({
  14439. selector: "allSubclassesDo:",
  14440. protocol: "enumerating",
  14441. fn: function (aBlock){
  14442. var self=this,$self=this;
  14443. return $core.withContext(function($ctx1) {
  14444. $core.traverseClassTree(self, function(subclass) {
  14445. if (subclass !== self) aBlock._value_(subclass);
  14446. });
  14447. return self;
  14448. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  14449. },
  14450. args: ["aBlock"],
  14451. 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})'>",
  14452. referencedClasses: [],
  14453. messageSends: []
  14454. }),
  14455. $globals.Behavior);
  14456. $core.addMethod(
  14457. $core.method({
  14458. selector: "allSuperclasses",
  14459. protocol: "accessing",
  14460. fn: function (){
  14461. var self=this,$self=this;
  14462. return $core.withContext(function($ctx1) {
  14463. var $1,$3,$2,$receiver;
  14464. $1=$self._superclass();
  14465. $ctx1.sendIdx["superclass"]=1;
  14466. if(($receiver = $1) == null || $receiver.a$nil){
  14467. return [];
  14468. } else {
  14469. $1;
  14470. }
  14471. $3=$self._superclass();
  14472. $ctx1.sendIdx["superclass"]=2;
  14473. $2=$recv($globals.OrderedCollection)._with_($3);
  14474. $recv($2)._addAll_($recv($self._superclass())._allSuperclasses());
  14475. return $recv($2)._yourself();
  14476. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  14477. },
  14478. args: [],
  14479. 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",
  14480. referencedClasses: ["OrderedCollection"],
  14481. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  14482. }),
  14483. $globals.Behavior);
  14484. $core.addMethod(
  14485. $core.method({
  14486. selector: "basicNew",
  14487. protocol: "instance creation",
  14488. fn: function (){
  14489. var self=this,$self=this;
  14490. return $core.withContext(function($ctx1) {
  14491. return new self.fn();
  14492. return self;
  14493. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  14494. },
  14495. args: [],
  14496. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  14497. referencedClasses: [],
  14498. messageSends: []
  14499. }),
  14500. $globals.Behavior);
  14501. $core.addMethod(
  14502. $core.method({
  14503. selector: "basicOrganization",
  14504. protocol: "accessing",
  14505. fn: function (){
  14506. var self=this,$self=this;
  14507. return $self["@organization"];
  14508. },
  14509. args: [],
  14510. source: "basicOrganization\x0a\x09^ organization",
  14511. referencedClasses: [],
  14512. messageSends: []
  14513. }),
  14514. $globals.Behavior);
  14515. $core.addMethod(
  14516. $core.method({
  14517. selector: "basicOrganization:",
  14518. protocol: "accessing",
  14519. fn: function (aClassOrganizer){
  14520. var self=this,$self=this;
  14521. $self["@organization"]=aClassOrganizer;
  14522. return self;
  14523. },
  14524. args: ["aClassOrganizer"],
  14525. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  14526. referencedClasses: [],
  14527. messageSends: []
  14528. }),
  14529. $globals.Behavior);
  14530. $core.addMethod(
  14531. $core.method({
  14532. selector: "canUnderstand:",
  14533. protocol: "testing",
  14534. fn: function (aSelector){
  14535. var self=this,$self=this;
  14536. return $core.withContext(function($ctx1) {
  14537. var $2,$1;
  14538. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  14539. return $core.withContext(function($ctx2) {
  14540. $2=$self._superclass();
  14541. $ctx2.sendIdx["superclass"]=1;
  14542. $1=$recv($2)._notNil();
  14543. return $recv($1)._and_((function(){
  14544. return $core.withContext(function($ctx3) {
  14545. return $recv($self._superclass())._canUnderstand_(aSelector);
  14546. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14547. }));
  14548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14549. }));
  14550. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  14551. },
  14552. args: ["aSelector"],
  14553. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  14554. referencedClasses: [],
  14555. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  14556. }),
  14557. $globals.Behavior);
  14558. $core.addMethod(
  14559. $core.method({
  14560. selector: "includesBehavior:",
  14561. protocol: "testing",
  14562. fn: function (aClass){
  14563. var self=this,$self=this;
  14564. return $core.withContext(function($ctx1) {
  14565. return $recv($self.__eq_eq(aClass))._or_((function(){
  14566. return $core.withContext(function($ctx2) {
  14567. return $self._inheritsFrom_(aClass);
  14568. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14569. }));
  14570. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  14571. },
  14572. args: ["aClass"],
  14573. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  14574. referencedClasses: [],
  14575. messageSends: ["or:", "==", "inheritsFrom:"]
  14576. }),
  14577. $globals.Behavior);
  14578. $core.addMethod(
  14579. $core.method({
  14580. selector: "inheritsFrom:",
  14581. protocol: "testing",
  14582. fn: function (aClass){
  14583. var self=this,$self=this;
  14584. return $core.withContext(function($ctx1) {
  14585. var $1,$3,$2,$receiver;
  14586. $1=$self._superclass();
  14587. $ctx1.sendIdx["superclass"]=1;
  14588. if(($receiver = $1) == null || $receiver.a$nil){
  14589. return false;
  14590. } else {
  14591. $1;
  14592. }
  14593. $3=$self._superclass();
  14594. $ctx1.sendIdx["superclass"]=2;
  14595. $2=$recv(aClass).__eq_eq($3);
  14596. return $recv($2)._or_((function(){
  14597. return $core.withContext(function($ctx2) {
  14598. return $recv($self._superclass())._inheritsFrom_(aClass);
  14599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14600. }));
  14601. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  14602. },
  14603. args: ["aClass"],
  14604. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  14605. referencedClasses: [],
  14606. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  14607. }),
  14608. $globals.Behavior);
  14609. $core.addMethod(
  14610. $core.method({
  14611. selector: "instanceVariableNames",
  14612. protocol: "accessing",
  14613. fn: function (){
  14614. var self=this,$self=this;
  14615. return $core.withContext(function($ctx1) {
  14616. return self.iVarNames;
  14617. return self;
  14618. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  14619. },
  14620. args: [],
  14621. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  14622. referencedClasses: [],
  14623. messageSends: []
  14624. }),
  14625. $globals.Behavior);
  14626. $core.addMethod(
  14627. $core.method({
  14628. selector: "isBehavior",
  14629. protocol: "testing",
  14630. fn: function (){
  14631. var self=this,$self=this;
  14632. return true;
  14633. },
  14634. args: [],
  14635. source: "isBehavior\x0a\x09^ true",
  14636. referencedClasses: [],
  14637. messageSends: []
  14638. }),
  14639. $globals.Behavior);
  14640. $core.addMethod(
  14641. $core.method({
  14642. selector: "javascriptConstructor",
  14643. protocol: "accessing",
  14644. fn: function (){
  14645. var self=this,$self=this;
  14646. return $core.withContext(function($ctx1) {
  14647. return self.fn;
  14648. return self;
  14649. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  14650. },
  14651. args: [],
  14652. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  14653. referencedClasses: [],
  14654. messageSends: []
  14655. }),
  14656. $globals.Behavior);
  14657. $core.addMethod(
  14658. $core.method({
  14659. selector: "javascriptConstructor:",
  14660. protocol: "accessing",
  14661. fn: function (aJavaScriptFunction){
  14662. var self=this,$self=this;
  14663. return $core.withContext(function($ctx1) {
  14664. $core.setClassConstructor(self, aJavaScriptFunction);;
  14665. return self;
  14666. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  14667. },
  14668. args: ["aJavaScriptFunction"],
  14669. 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);'>",
  14670. referencedClasses: [],
  14671. messageSends: []
  14672. }),
  14673. $globals.Behavior);
  14674. $core.addMethod(
  14675. $core.method({
  14676. selector: "lookupSelector:",
  14677. protocol: "accessing",
  14678. fn: function (selector){
  14679. var self=this,$self=this;
  14680. var lookupClass;
  14681. return $core.withContext(function($ctx1) {
  14682. var $1;
  14683. var $early={};
  14684. try {
  14685. lookupClass=self;
  14686. $recv((function(){
  14687. return $core.withContext(function($ctx2) {
  14688. return $recv(lookupClass).__eq(nil);
  14689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14690. }))._whileFalse_((function(){
  14691. return $core.withContext(function($ctx2) {
  14692. $1=$recv(lookupClass)._includesSelector_(selector);
  14693. if($core.assert($1)){
  14694. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  14695. }
  14696. lookupClass=$recv(lookupClass)._superclass();
  14697. return lookupClass;
  14698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14699. }));
  14700. return nil;
  14701. }
  14702. catch(e) {if(e===$early)return e[0]; throw e}
  14703. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  14704. },
  14705. args: ["selector"],
  14706. 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",
  14707. referencedClasses: [],
  14708. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  14709. }),
  14710. $globals.Behavior);
  14711. $core.addMethod(
  14712. $core.method({
  14713. selector: "new",
  14714. protocol: "instance creation",
  14715. fn: function (){
  14716. var self=this,$self=this;
  14717. return $core.withContext(function($ctx1) {
  14718. return $recv($self._basicNew())._initialize();
  14719. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  14720. },
  14721. args: [],
  14722. source: "new\x0a\x09^ self basicNew initialize",
  14723. referencedClasses: [],
  14724. messageSends: ["initialize", "basicNew"]
  14725. }),
  14726. $globals.Behavior);
  14727. $core.addMethod(
  14728. $core.method({
  14729. selector: "prototype",
  14730. protocol: "accessing",
  14731. fn: function (){
  14732. var self=this,$self=this;
  14733. return $core.withContext(function($ctx1) {
  14734. return self.fn.prototype;
  14735. return self;
  14736. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  14737. },
  14738. args: [],
  14739. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  14740. referencedClasses: [],
  14741. messageSends: []
  14742. }),
  14743. $globals.Behavior);
  14744. $core.addMethod(
  14745. $core.method({
  14746. selector: "subclasses",
  14747. protocol: "accessing",
  14748. fn: function (){
  14749. var self=this,$self=this;
  14750. return $core.withContext(function($ctx1) {
  14751. $self._subclassResponsibility();
  14752. return self;
  14753. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  14754. },
  14755. args: [],
  14756. source: "subclasses\x0a\x09self subclassResponsibility",
  14757. referencedClasses: [],
  14758. messageSends: ["subclassResponsibility"]
  14759. }),
  14760. $globals.Behavior);
  14761. $core.addMethod(
  14762. $core.method({
  14763. selector: "superclass",
  14764. protocol: "accessing",
  14765. fn: function (){
  14766. var self=this,$self=this;
  14767. return $core.withContext(function($ctx1) {
  14768. return self.superclass;
  14769. return self;
  14770. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  14771. },
  14772. args: [],
  14773. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  14774. referencedClasses: [],
  14775. messageSends: []
  14776. }),
  14777. $globals.Behavior);
  14778. $core.addMethod(
  14779. $core.method({
  14780. selector: "theMetaClass",
  14781. protocol: "accessing",
  14782. fn: function (){
  14783. var self=this,$self=this;
  14784. return $core.withContext(function($ctx1) {
  14785. $self._subclassResponsibility();
  14786. return self;
  14787. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  14788. },
  14789. args: [],
  14790. source: "theMetaClass\x0a\x09self subclassResponsibility",
  14791. referencedClasses: [],
  14792. messageSends: ["subclassResponsibility"]
  14793. }),
  14794. $globals.Behavior);
  14795. $core.addMethod(
  14796. $core.method({
  14797. selector: "theNonMetaClass",
  14798. protocol: "accessing",
  14799. fn: function (){
  14800. var self=this,$self=this;
  14801. return $core.withContext(function($ctx1) {
  14802. $self._subclassResponsibility();
  14803. return self;
  14804. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  14805. },
  14806. args: [],
  14807. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  14808. referencedClasses: [],
  14809. messageSends: ["subclassResponsibility"]
  14810. }),
  14811. $globals.Behavior);
  14812. $core.addMethod(
  14813. $core.method({
  14814. selector: "withAllSubclasses",
  14815. protocol: "accessing",
  14816. fn: function (){
  14817. var self=this,$self=this;
  14818. return $core.withContext(function($ctx1) {
  14819. var $1;
  14820. $1=$recv($globals.Array)._with_(self);
  14821. $recv($1)._addAll_($self._allSubclasses());
  14822. return $recv($1)._yourself();
  14823. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  14824. },
  14825. args: [],
  14826. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  14827. referencedClasses: ["Array"],
  14828. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  14829. }),
  14830. $globals.Behavior);
  14831. $core.addClass("Class", $globals.Behavior, [], "Kernel-Classes");
  14832. $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.";
  14833. $core.addMethod(
  14834. $core.method({
  14835. selector: "classTag",
  14836. protocol: "accessing",
  14837. fn: function (){
  14838. var self=this,$self=this;
  14839. return "class";
  14840. },
  14841. args: [],
  14842. 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'",
  14843. referencedClasses: [],
  14844. messageSends: []
  14845. }),
  14846. $globals.Class);
  14847. $core.addMethod(
  14848. $core.method({
  14849. selector: "definition",
  14850. protocol: "accessing",
  14851. fn: function (){
  14852. var self=this,$self=this;
  14853. return $core.withContext(function($ctx1) {
  14854. var $1,$2;
  14855. return $recv($globals.String)._streamContents_((function(stream){
  14856. return $core.withContext(function($ctx2) {
  14857. $recv(stream)._print_($self._superclass());
  14858. $ctx2.sendIdx["print:"]=1;
  14859. $recv(stream)._write_(" subclass: ");
  14860. $ctx2.sendIdx["write:"]=1;
  14861. $recv(stream)._printSymbol_($self._name());
  14862. $recv(stream)._lf();
  14863. $ctx2.sendIdx["lf"]=1;
  14864. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  14865. return $core.withContext(function($ctx3) {
  14866. $1=$recv($globals.String)._tab();
  14867. $ctx3.sendIdx["tab"]=1;
  14868. $2=$recv($globals.String)._lf();
  14869. $ctx3.sendIdx["lf"]=2;
  14870. return [$1,"uses: ",tcd,$2];
  14871. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  14872. })));
  14873. $ctx2.sendIdx["write:"]=2;
  14874. $recv(stream)._tab();
  14875. $ctx2.sendIdx["tab"]=2;
  14876. $recv(stream)._write_("instanceVariableNames: ");
  14877. $ctx2.sendIdx["write:"]=3;
  14878. $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  14879. $ctx2.sendIdx["print:"]=2;
  14880. $recv(stream)._lf();
  14881. $recv(stream)._tab();
  14882. $recv(stream)._write_("package: ");
  14883. return $recv(stream)._print_($self._category());
  14884. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14885. }));
  14886. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  14887. },
  14888. args: [],
  14889. 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 ]",
  14890. referencedClasses: ["String"],
  14891. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "instanceVariableNames", "category"]
  14892. }),
  14893. $globals.Class);
  14894. $core.addMethod(
  14895. $core.method({
  14896. selector: "isClass",
  14897. protocol: "testing",
  14898. fn: function (){
  14899. var self=this,$self=this;
  14900. return true;
  14901. },
  14902. args: [],
  14903. source: "isClass\x0a\x09^ true",
  14904. referencedClasses: [],
  14905. messageSends: []
  14906. }),
  14907. $globals.Class);
  14908. $core.addMethod(
  14909. $core.method({
  14910. selector: "rename:",
  14911. protocol: "accessing",
  14912. fn: function (aString){
  14913. var self=this,$self=this;
  14914. return $core.withContext(function($ctx1) {
  14915. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  14916. return self;
  14917. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  14918. },
  14919. args: ["aString"],
  14920. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  14921. referencedClasses: ["ClassBuilder"],
  14922. messageSends: ["renameClass:to:", "new"]
  14923. }),
  14924. $globals.Class);
  14925. $core.addMethod(
  14926. $core.method({
  14927. selector: "subclasses",
  14928. protocol: "accessing",
  14929. fn: function (){
  14930. var self=this,$self=this;
  14931. return $core.withContext(function($ctx1) {
  14932. return self.subclasses._copy();
  14933. return self;
  14934. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  14935. },
  14936. args: [],
  14937. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  14938. referencedClasses: [],
  14939. messageSends: []
  14940. }),
  14941. $globals.Class);
  14942. $core.addMethod(
  14943. $core.method({
  14944. selector: "theMetaClass",
  14945. protocol: "accessing",
  14946. fn: function (){
  14947. var self=this,$self=this;
  14948. return $core.withContext(function($ctx1) {
  14949. return $self._class();
  14950. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  14951. },
  14952. args: [],
  14953. source: "theMetaClass\x0a\x09^ self class",
  14954. referencedClasses: [],
  14955. messageSends: ["class"]
  14956. }),
  14957. $globals.Class);
  14958. $core.addClass("Metaclass", $globals.Behavior, [], "Kernel-Classes");
  14959. $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.";
  14960. $core.addMethod(
  14961. $core.method({
  14962. selector: "asJavaScriptSource",
  14963. protocol: "converting",
  14964. fn: function (){
  14965. var self=this,$self=this;
  14966. return $core.withContext(function($ctx1) {
  14967. var $1;
  14968. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  14969. $ctx1.sendIdx[","]=1;
  14970. return $1;
  14971. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  14972. },
  14973. args: [],
  14974. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  14975. referencedClasses: [],
  14976. messageSends: [",", "name", "instanceClass"]
  14977. }),
  14978. $globals.Metaclass);
  14979. $core.addMethod(
  14980. $core.method({
  14981. selector: "definition",
  14982. protocol: "accessing",
  14983. fn: function (){
  14984. var self=this,$self=this;
  14985. return $core.withContext(function($ctx1) {
  14986. var $1,$2;
  14987. return $recv($globals.String)._streamContents_((function(stream){
  14988. return $core.withContext(function($ctx2) {
  14989. $recv(stream)._print_(self);
  14990. $ctx2.sendIdx["print:"]=1;
  14991. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  14992. return " ";
  14993. }),(function(tcd){
  14994. return $core.withContext(function($ctx3) {
  14995. $1=$recv($globals.String)._lf();
  14996. $ctx3.sendIdx["lf"]=1;
  14997. $2=$recv($globals.String)._tab();
  14998. $ctx3.sendIdx["tab"]=1;
  14999. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  15000. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  15001. })));
  15002. $ctx2.sendIdx["write:"]=1;
  15003. $recv(stream)._write_("instanceVariableNames: ");
  15004. return $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  15005. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15006. }));
  15007. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  15008. },
  15009. args: [],
  15010. 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) ]",
  15011. referencedClasses: ["String"],
  15012. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "instanceVariableNames"]
  15013. }),
  15014. $globals.Metaclass);
  15015. $core.addMethod(
  15016. $core.method({
  15017. selector: "instanceClass",
  15018. protocol: "accessing",
  15019. fn: function (){
  15020. var self=this,$self=this;
  15021. return $core.withContext(function($ctx1) {
  15022. return self.instanceClass;
  15023. return self;
  15024. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  15025. },
  15026. args: [],
  15027. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  15028. referencedClasses: [],
  15029. messageSends: []
  15030. }),
  15031. $globals.Metaclass);
  15032. $core.addMethod(
  15033. $core.method({
  15034. selector: "instanceVariableNames:",
  15035. protocol: "accessing",
  15036. fn: function (aCollection){
  15037. var self=this,$self=this;
  15038. return $core.withContext(function($ctx1) {
  15039. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  15040. return self;
  15041. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  15042. },
  15043. args: ["aCollection"],
  15044. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection.\x0a\x09^ self",
  15045. referencedClasses: ["ClassBuilder"],
  15046. messageSends: ["class:instanceVariableNames:", "new"]
  15047. }),
  15048. $globals.Metaclass);
  15049. $core.addMethod(
  15050. $core.method({
  15051. selector: "isMetaclass",
  15052. protocol: "testing",
  15053. fn: function (){
  15054. var self=this,$self=this;
  15055. return true;
  15056. },
  15057. args: [],
  15058. source: "isMetaclass\x0a\x09^ true",
  15059. referencedClasses: [],
  15060. messageSends: []
  15061. }),
  15062. $globals.Metaclass);
  15063. $core.addMethod(
  15064. $core.method({
  15065. selector: "name",
  15066. protocol: "accessing",
  15067. fn: function (){
  15068. var self=this,$self=this;
  15069. return $core.withContext(function($ctx1) {
  15070. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  15071. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  15072. },
  15073. args: [],
  15074. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15075. referencedClasses: [],
  15076. messageSends: [",", "name", "instanceClass"]
  15077. }),
  15078. $globals.Metaclass);
  15079. $core.addMethod(
  15080. $core.method({
  15081. selector: "package",
  15082. protocol: "accessing",
  15083. fn: function (){
  15084. var self=this,$self=this;
  15085. return $core.withContext(function($ctx1) {
  15086. return $recv($self._instanceClass())._package();
  15087. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  15088. },
  15089. args: [],
  15090. source: "package\x0a\x09^ self instanceClass package",
  15091. referencedClasses: [],
  15092. messageSends: ["package", "instanceClass"]
  15093. }),
  15094. $globals.Metaclass);
  15095. $core.addMethod(
  15096. $core.method({
  15097. selector: "subclasses",
  15098. protocol: "accessing",
  15099. fn: function (){
  15100. var self=this,$self=this;
  15101. return $core.withContext(function($ctx1) {
  15102. return $core.metaSubclasses(self);
  15103. return self;
  15104. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  15105. },
  15106. args: [],
  15107. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  15108. referencedClasses: [],
  15109. messageSends: []
  15110. }),
  15111. $globals.Metaclass);
  15112. $core.addMethod(
  15113. $core.method({
  15114. selector: "theMetaClass",
  15115. protocol: "accessing",
  15116. fn: function (){
  15117. var self=this,$self=this;
  15118. return self;
  15119. },
  15120. args: [],
  15121. source: "theMetaClass\x0a\x09^ self",
  15122. referencedClasses: [],
  15123. messageSends: []
  15124. }),
  15125. $globals.Metaclass);
  15126. $core.addMethod(
  15127. $core.method({
  15128. selector: "theNonMetaClass",
  15129. protocol: "accessing",
  15130. fn: function (){
  15131. var self=this,$self=this;
  15132. return $core.withContext(function($ctx1) {
  15133. return $self._instanceClass();
  15134. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  15135. },
  15136. args: [],
  15137. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15138. referencedClasses: [],
  15139. messageSends: ["instanceClass"]
  15140. }),
  15141. $globals.Metaclass);
  15142. $core.addMethod(
  15143. $core.method({
  15144. selector: "uses:instanceVariableNames:",
  15145. protocol: "accessing",
  15146. fn: function (aTraitCompositionDescription,aCollection){
  15147. var self=this,$self=this;
  15148. var metaclass;
  15149. return $core.withContext(function($ctx1) {
  15150. metaclass=$self._instanceVariableNames_(aCollection);
  15151. $recv(metaclass)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15152. return metaclass;
  15153. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,metaclass:metaclass},$globals.Metaclass)});
  15154. },
  15155. args: ["aTraitCompositionDescription", "aCollection"],
  15156. source: "uses: aTraitCompositionDescription instanceVariableNames: aCollection\x0a\x09| metaclass |\x0a\x09metaclass := self instanceVariableNames: aCollection.\x0a\x09metaclass setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ metaclass",
  15157. referencedClasses: [],
  15158. messageSends: ["instanceVariableNames:", "setTraitComposition:", "asTraitComposition"]
  15159. }),
  15160. $globals.Metaclass);
  15161. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15162. $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:`.";
  15163. $core.addMethod(
  15164. $core.method({
  15165. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15166. protocol: "class definition",
  15167. fn: function (aClass,className,aCollection,packageName){
  15168. var self=this,$self=this;
  15169. var theClass,thePackage;
  15170. return $core.withContext(function($ctx1) {
  15171. var $1,$2,$3,$receiver;
  15172. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15173. thePackage=$recv($globals.Package)._named_(packageName);
  15174. $1=theClass;
  15175. if(($receiver = $1) == null || $receiver.a$nil){
  15176. $1;
  15177. } else {
  15178. $recv(theClass)._package_(thePackage);
  15179. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15180. if(!$core.assert($2)){
  15181. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15182. }
  15183. }
  15184. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15185. $recv($3)._recompile();
  15186. return $recv($3)._yourself();
  15187. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  15188. },
  15189. args: ["aClass", "className", "aCollection", "packageName"],
  15190. 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",
  15191. referencedClasses: ["Smalltalk", "Package"],
  15192. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15193. }),
  15194. $globals.ClassBuilder);
  15195. $core.addMethod(
  15196. $core.method({
  15197. selector: "addTraitNamed:package:",
  15198. protocol: "class definition",
  15199. fn: function (traitName,packageName){
  15200. var self=this,$self=this;
  15201. var theTrait,thePackage;
  15202. return $core.withContext(function($ctx1) {
  15203. var $1,$2,$receiver;
  15204. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15205. thePackage=$recv($globals.Package)._named_(packageName);
  15206. $1=theTrait;
  15207. if(($receiver = $1) == null || $receiver.a$nil){
  15208. $1;
  15209. } else {
  15210. $2=theTrait;
  15211. $recv($2)._package_(thePackage);
  15212. $recv($2)._recompile();
  15213. return $recv($2)._yourself();
  15214. }
  15215. return $self._basicAddTraitNamed_package_(traitName,packageName);
  15216. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  15217. },
  15218. args: ["traitName", "packageName"],
  15219. 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",
  15220. referencedClasses: ["Smalltalk", "Package"],
  15221. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15222. }),
  15223. $globals.ClassBuilder);
  15224. $core.addMethod(
  15225. $core.method({
  15226. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15227. protocol: "private",
  15228. fn: function (aClass,aString,aCollection,packageName){
  15229. var self=this,$self=this;
  15230. return $core.withContext(function($ctx1) {
  15231. return $core.addClass(aString, aClass, aCollection, packageName);
  15232. ;
  15233. return self;
  15234. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  15235. },
  15236. args: ["aClass", "aString", "aCollection", "packageName"],
  15237. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15238. referencedClasses: [],
  15239. messageSends: []
  15240. }),
  15241. $globals.ClassBuilder);
  15242. $core.addMethod(
  15243. $core.method({
  15244. selector: "basicAddTraitNamed:package:",
  15245. protocol: "private",
  15246. fn: function (aString,anotherString){
  15247. var self=this,$self=this;
  15248. return $core.withContext(function($ctx1) {
  15249. return $core.addTrait(aString, anotherString);
  15250. return self;
  15251. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  15252. },
  15253. args: ["aString", "anotherString"],
  15254. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15255. referencedClasses: [],
  15256. messageSends: []
  15257. }),
  15258. $globals.ClassBuilder);
  15259. $core.addMethod(
  15260. $core.method({
  15261. selector: "basicClass:instanceVariableNames:",
  15262. protocol: "private",
  15263. fn: function (aClass,aString){
  15264. var self=this,$self=this;
  15265. return $core.withContext(function($ctx1) {
  15266. $self._basicClass_instanceVariables_(aClass,$self._instanceVariableNamesFor_(aString));
  15267. return self;
  15268. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15269. },
  15270. args: ["aClass", "aString"],
  15271. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  15272. referencedClasses: [],
  15273. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  15274. }),
  15275. $globals.ClassBuilder);
  15276. $core.addMethod(
  15277. $core.method({
  15278. selector: "basicClass:instanceVariables:",
  15279. protocol: "private",
  15280. fn: function (aClass,aCollection){
  15281. var self=this,$self=this;
  15282. return $core.withContext(function($ctx1) {
  15283. var $1;
  15284. $1=$recv(aClass)._isMetaclass();
  15285. if(!$core.assert($1)){
  15286. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  15287. }
  15288. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  15289. return self;
  15290. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15291. },
  15292. args: ["aClass", "aCollection"],
  15293. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  15294. referencedClasses: [],
  15295. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  15296. }),
  15297. $globals.ClassBuilder);
  15298. $core.addMethod(
  15299. $core.method({
  15300. selector: "basicRemoveClass:",
  15301. protocol: "private",
  15302. fn: function (aClass){
  15303. var self=this,$self=this;
  15304. return $core.withContext(function($ctx1) {
  15305. $core.removeClass(aClass);
  15306. return self;
  15307. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  15308. },
  15309. args: ["aClass"],
  15310. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  15311. referencedClasses: [],
  15312. messageSends: []
  15313. }),
  15314. $globals.ClassBuilder);
  15315. $core.addMethod(
  15316. $core.method({
  15317. selector: "basicRenameClass:to:",
  15318. protocol: "private",
  15319. fn: function (aClass,aString){
  15320. var self=this,$self=this;
  15321. return $core.withContext(function($ctx1) {
  15322. $globals[aString] = aClass;
  15323. delete $globals[aClass.className];
  15324. aClass.className = aString;
  15325. ;
  15326. return self;
  15327. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15328. },
  15329. args: ["aClass", "aString"],
  15330. source: "basicRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09'>",
  15331. referencedClasses: [],
  15332. messageSends: []
  15333. }),
  15334. $globals.ClassBuilder);
  15335. $core.addMethod(
  15336. $core.method({
  15337. selector: "basicSwapClassNames:with:",
  15338. protocol: "private",
  15339. fn: function (aClass,anotherClass){
  15340. var self=this,$self=this;
  15341. return $core.withContext(function($ctx1) {
  15342. var tmp = aClass.className;
  15343. aClass.className = anotherClass.className;
  15344. anotherClass.className = tmp;
  15345. ;
  15346. return self;
  15347. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15348. },
  15349. args: ["aClass", "anotherClass"],
  15350. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<inlineJS: '\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09'>",
  15351. referencedClasses: [],
  15352. messageSends: []
  15353. }),
  15354. $globals.ClassBuilder);
  15355. $core.addMethod(
  15356. $core.method({
  15357. selector: "class:instanceVariableNames:",
  15358. protocol: "class definition",
  15359. fn: function (aClass,ivarNames){
  15360. var self=this,$self=this;
  15361. return $core.withContext(function($ctx1) {
  15362. var $1,$3,$2;
  15363. $self._basicClass_instanceVariableNames_(aClass,ivarNames);
  15364. $1=$recv($globals.SystemAnnouncer)._current();
  15365. $3=$recv($globals.ClassDefinitionChanged)._new();
  15366. $recv($3)._theClass_(aClass);
  15367. $2=$recv($3)._yourself();
  15368. $recv($1)._announce_($2);
  15369. return self;
  15370. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  15371. },
  15372. args: ["aClass", "ivarNames"],
  15373. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  15374. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  15375. messageSends: ["basicClass:instanceVariableNames:", "announce:", "current", "theClass:", "new", "yourself"]
  15376. }),
  15377. $globals.ClassBuilder);
  15378. $core.addMethod(
  15379. $core.method({
  15380. selector: "copyClass:named:",
  15381. protocol: "copying",
  15382. fn: function (aClass,className){
  15383. var self=this,$self=this;
  15384. var newClass;
  15385. return $core.withContext(function($ctx1) {
  15386. var $1,$3,$2;
  15387. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15388. $self._copyClass_to_(aClass,newClass);
  15389. $1=$recv($globals.SystemAnnouncer)._current();
  15390. $3=$recv($globals.ClassAdded)._new();
  15391. $recv($3)._theClass_(newClass);
  15392. $2=$recv($3)._yourself();
  15393. $recv($1)._announce_($2);
  15394. return newClass;
  15395. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  15396. },
  15397. args: ["aClass", "className"],
  15398. 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",
  15399. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15400. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  15401. }),
  15402. $globals.ClassBuilder);
  15403. $core.addMethod(
  15404. $core.method({
  15405. selector: "copyClass:to:",
  15406. protocol: "copying",
  15407. fn: function (aClass,anotherClass){
  15408. var self=this,$self=this;
  15409. return $core.withContext(function($ctx1) {
  15410. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  15411. $recv(anotherClass)._comment_($recv(aClass)._comment());
  15412. $1=$recv(aClass)._methodDictionary();
  15413. $ctx1.sendIdx["methodDictionary"]=1;
  15414. $recv($1)._valuesDo_((function(each){
  15415. return $core.withContext(function($ctx2) {
  15416. $3=$recv(each)._methodClass();
  15417. $ctx2.sendIdx["methodClass"]=1;
  15418. $2=$recv($3).__eq(aClass);
  15419. $ctx2.sendIdx["="]=1;
  15420. if($core.assert($2)){
  15421. $4=$recv($globals.Compiler)._new();
  15422. $ctx2.sendIdx["new"]=1;
  15423. $5=$recv(each)._source();
  15424. $ctx2.sendIdx["source"]=1;
  15425. $6=$recv(each)._protocol();
  15426. $ctx2.sendIdx["protocol"]=1;
  15427. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  15428. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  15429. }
  15430. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15431. }));
  15432. $ctx1.sendIdx["valuesDo:"]=1;
  15433. $7=$recv(aClass)._traitComposition();
  15434. $ctx1.sendIdx["traitComposition"]=1;
  15435. $recv(anotherClass)._setTraitComposition_($7);
  15436. $ctx1.sendIdx["setTraitComposition:"]=1;
  15437. $8=$recv(anotherClass)._class();
  15438. $ctx1.sendIdx["class"]=1;
  15439. $10=$recv(aClass)._class();
  15440. $ctx1.sendIdx["class"]=2;
  15441. $9=$recv($10)._instanceVariableNames();
  15442. $self._basicClass_instanceVariables_($8,$9);
  15443. $12=$recv(aClass)._class();
  15444. $ctx1.sendIdx["class"]=3;
  15445. $11=$recv($12)._methodDictionary();
  15446. $recv($11)._valuesDo_((function(each){
  15447. return $core.withContext(function($ctx2) {
  15448. $14=$recv(each)._methodClass();
  15449. $15=$recv(aClass)._class();
  15450. $ctx2.sendIdx["class"]=4;
  15451. $13=$recv($14).__eq($15);
  15452. if($core.assert($13)){
  15453. $16=$recv($globals.Compiler)._new();
  15454. $17=$recv(each)._source();
  15455. $18=$recv(anotherClass)._class();
  15456. $ctx2.sendIdx["class"]=5;
  15457. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  15458. }
  15459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15460. }));
  15461. $19=$recv(anotherClass)._class();
  15462. $ctx1.sendIdx["class"]=6;
  15463. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  15464. return self;
  15465. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15466. },
  15467. args: ["aClass", "anotherClass"],
  15468. 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",
  15469. referencedClasses: ["Compiler"],
  15470. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  15471. }),
  15472. $globals.ClassBuilder);
  15473. $core.addMethod(
  15474. $core.method({
  15475. selector: "installMethod:forClass:protocol:",
  15476. protocol: "method definition",
  15477. fn: function (aCompiledMethod,aBehavior,aString){
  15478. var self=this,$self=this;
  15479. return $core.withContext(function($ctx1) {
  15480. $recv(aCompiledMethod)._protocol_(aString);
  15481. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  15482. return aCompiledMethod;
  15483. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  15484. },
  15485. args: ["aCompiledMethod", "aBehavior", "aString"],
  15486. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  15487. referencedClasses: [],
  15488. messageSends: ["protocol:", "addCompiledMethod:"]
  15489. }),
  15490. $globals.ClassBuilder);
  15491. $core.addMethod(
  15492. $core.method({
  15493. selector: "instanceVariableNamesFor:",
  15494. protocol: "accessing",
  15495. fn: function (aString){
  15496. var self=this,$self=this;
  15497. return $core.withContext(function($ctx1) {
  15498. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  15499. return $core.withContext(function($ctx2) {
  15500. return $recv(each)._isEmpty();
  15501. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15502. }));
  15503. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  15504. },
  15505. args: ["aString"],
  15506. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  15507. referencedClasses: [],
  15508. messageSends: ["reject:", "tokenize:", "isEmpty"]
  15509. }),
  15510. $globals.ClassBuilder);
  15511. $core.addMethod(
  15512. $core.method({
  15513. selector: "migrateClass:superclass:",
  15514. protocol: "class migration",
  15515. fn: function (aClass,anotherClass){
  15516. var self=this,$self=this;
  15517. return $core.withContext(function($ctx1) {
  15518. var $1;
  15519. $1=$recv(aClass)._name();
  15520. $ctx1.sendIdx["name"]=1;
  15521. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15522. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15523. },
  15524. args: ["aClass", "anotherClass"],
  15525. 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",
  15526. referencedClasses: [],
  15527. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  15528. }),
  15529. $globals.ClassBuilder);
  15530. $core.addMethod(
  15531. $core.method({
  15532. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  15533. protocol: "class migration",
  15534. fn: function (className,aClass,aCollection,packageName){
  15535. var self=this,$self=this;
  15536. var oldClass,newClass,tmp;
  15537. return $core.withContext(function($ctx1) {
  15538. var $1,$2,$4,$3;
  15539. tmp="new*".__comma(className);
  15540. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15541. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  15542. $self._basicSwapClassNames_with_(oldClass,newClass);
  15543. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  15544. $recv((function(){
  15545. return $core.withContext(function($ctx2) {
  15546. return $self._copyClass_to_(oldClass,newClass);
  15547. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15548. }))._on_do_($globals.Error,(function(exception){
  15549. return $core.withContext(function($ctx2) {
  15550. $self._basicSwapClassNames_with_(oldClass,newClass);
  15551. $1=$self._basicRemoveClass_(newClass);
  15552. $ctx2.sendIdx["basicRemoveClass:"]=1;
  15553. $1;
  15554. return $recv(exception)._resignal();
  15555. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  15556. }));
  15557. $self._rawRenameClass_to_(oldClass,tmp);
  15558. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  15559. $self._rawRenameClass_to_(newClass,className);
  15560. $recv($recv(oldClass)._subclasses())._do_((function(each){
  15561. return $core.withContext(function($ctx2) {
  15562. return $self._migrateClass_superclass_(each,newClass);
  15563. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15564. }));
  15565. $self._basicRemoveClass_(oldClass);
  15566. $2=$recv($globals.SystemAnnouncer)._current();
  15567. $4=$recv($globals.ClassMigrated)._new();
  15568. $recv($4)._theClass_(newClass);
  15569. $recv($4)._oldClass_(oldClass);
  15570. $3=$recv($4)._yourself();
  15571. $recv($2)._announce_($3);
  15572. return newClass;
  15573. }, 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)});
  15574. },
  15575. args: ["className", "aClass", "aCollection", "packageName"],
  15576. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception resignal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15577. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  15578. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "resignal", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  15579. }),
  15580. $globals.ClassBuilder);
  15581. $core.addMethod(
  15582. $core.method({
  15583. selector: "rawRenameClass:to:",
  15584. protocol: "private",
  15585. fn: function (aClass,aString){
  15586. var self=this,$self=this;
  15587. return $core.withContext(function($ctx1) {
  15588. $globals[aString] = aClass;
  15589. ;
  15590. return self;
  15591. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15592. },
  15593. args: ["aClass", "aString"],
  15594. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  15595. referencedClasses: [],
  15596. messageSends: []
  15597. }),
  15598. $globals.ClassBuilder);
  15599. $core.addMethod(
  15600. $core.method({
  15601. selector: "renameClass:to:",
  15602. protocol: "class migration",
  15603. fn: function (aClass,className){
  15604. var self=this,$self=this;
  15605. return $core.withContext(function($ctx1) {
  15606. var $1,$3,$2;
  15607. $self._basicRenameClass_to_(aClass,className);
  15608. $recv(aClass)._recompile();
  15609. $1=$recv($globals.SystemAnnouncer)._current();
  15610. $3=$recv($globals.ClassRenamed)._new();
  15611. $recv($3)._theClass_(aClass);
  15612. $2=$recv($3)._yourself();
  15613. $recv($1)._announce_($2);
  15614. return self;
  15615. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15616. },
  15617. args: ["aClass", "className"],
  15618. 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)",
  15619. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  15620. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  15621. }),
  15622. $globals.ClassBuilder);
  15623. $core.addMethod(
  15624. $core.method({
  15625. selector: "setupClass:",
  15626. protocol: "public",
  15627. fn: function (aClass){
  15628. var self=this,$self=this;
  15629. return $core.withContext(function($ctx1) {
  15630. $self._deprecatedAPI_("Classes are now auto-inited.");
  15631. return self;
  15632. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  15633. },
  15634. args: ["aClass"],
  15635. source: "setupClass: aClass\x0a\x09self deprecatedAPI: 'Classes are now auto-inited.'",
  15636. referencedClasses: [],
  15637. messageSends: ["deprecatedAPI:"]
  15638. }),
  15639. $globals.ClassBuilder);
  15640. $core.addMethod(
  15641. $core.method({
  15642. selector: "superclass:subclass:",
  15643. protocol: "class definition",
  15644. fn: function (aClass,className){
  15645. var self=this,$self=this;
  15646. return $core.withContext(function($ctx1) {
  15647. return $self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  15648. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15649. },
  15650. args: ["aClass", "className"],
  15651. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  15652. referencedClasses: [],
  15653. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  15654. }),
  15655. $globals.ClassBuilder);
  15656. $core.addMethod(
  15657. $core.method({
  15658. selector: "superclass:subclass:instanceVariableNames:package:",
  15659. protocol: "class definition",
  15660. fn: function (aClass,className,ivarNames,packageName){
  15661. var self=this,$self=this;
  15662. var newClass;
  15663. return $core.withContext(function($ctx1) {
  15664. var $1,$2,$3,$5,$4,$receiver;
  15665. $1=$self._instanceVariableNamesFor_(ivarNames);
  15666. if(($receiver = packageName) == null || $receiver.a$nil){
  15667. $2="unclassified";
  15668. } else {
  15669. $2=packageName;
  15670. }
  15671. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  15672. $3=$recv($globals.SystemAnnouncer)._current();
  15673. $5=$recv($globals.ClassAdded)._new();
  15674. $recv($5)._theClass_(newClass);
  15675. $4=$recv($5)._yourself();
  15676. $recv($3)._announce_($4);
  15677. return newClass;
  15678. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  15679. },
  15680. args: ["aClass", "className", "ivarNames", "packageName"],
  15681. 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",
  15682. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15683. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  15684. }),
  15685. $globals.ClassBuilder);
  15686. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  15687. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  15688. $core.addMethod(
  15689. $core.method({
  15690. selector: "getNodesFrom:",
  15691. protocol: "accessing",
  15692. fn: function (aCollection){
  15693. var self=this,$self=this;
  15694. var children,others;
  15695. return $core.withContext(function($ctx1) {
  15696. var $1;
  15697. children=[];
  15698. others=[];
  15699. $recv(aCollection)._do_((function(each){
  15700. return $core.withContext(function($ctx2) {
  15701. $1=$recv($recv(each)._superclass()).__eq($self._theClass());
  15702. if($core.assert($1)){
  15703. return $recv(children)._add_(each);
  15704. $ctx2.sendIdx["add:"]=1;
  15705. } else {
  15706. return $recv(others)._add_(each);
  15707. }
  15708. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15709. }));
  15710. $self["@nodes"]=$recv(children)._collect_((function(each){
  15711. return $core.withContext(function($ctx2) {
  15712. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv($self._level()).__plus((1)));
  15713. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  15714. }));
  15715. return self;
  15716. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  15717. },
  15718. args: ["aCollection"],
  15719. 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 ]",
  15720. referencedClasses: ["ClassSorterNode"],
  15721. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  15722. }),
  15723. $globals.ClassSorterNode);
  15724. $core.addMethod(
  15725. $core.method({
  15726. selector: "level",
  15727. protocol: "accessing",
  15728. fn: function (){
  15729. var self=this,$self=this;
  15730. return $self["@level"];
  15731. },
  15732. args: [],
  15733. source: "level\x0a\x09^ level",
  15734. referencedClasses: [],
  15735. messageSends: []
  15736. }),
  15737. $globals.ClassSorterNode);
  15738. $core.addMethod(
  15739. $core.method({
  15740. selector: "level:",
  15741. protocol: "accessing",
  15742. fn: function (anInteger){
  15743. var self=this,$self=this;
  15744. $self["@level"]=anInteger;
  15745. return self;
  15746. },
  15747. args: ["anInteger"],
  15748. source: "level: anInteger\x0a\x09level := anInteger",
  15749. referencedClasses: [],
  15750. messageSends: []
  15751. }),
  15752. $globals.ClassSorterNode);
  15753. $core.addMethod(
  15754. $core.method({
  15755. selector: "nodes",
  15756. protocol: "accessing",
  15757. fn: function (){
  15758. var self=this,$self=this;
  15759. return $self["@nodes"];
  15760. },
  15761. args: [],
  15762. source: "nodes\x0a\x09^ nodes",
  15763. referencedClasses: [],
  15764. messageSends: []
  15765. }),
  15766. $globals.ClassSorterNode);
  15767. $core.addMethod(
  15768. $core.method({
  15769. selector: "theClass",
  15770. protocol: "accessing",
  15771. fn: function (){
  15772. var self=this,$self=this;
  15773. return $self["@theClass"];
  15774. },
  15775. args: [],
  15776. source: "theClass\x0a\x09^ theClass",
  15777. referencedClasses: [],
  15778. messageSends: []
  15779. }),
  15780. $globals.ClassSorterNode);
  15781. $core.addMethod(
  15782. $core.method({
  15783. selector: "theClass:",
  15784. protocol: "accessing",
  15785. fn: function (aClass){
  15786. var self=this,$self=this;
  15787. $self["@theClass"]=aClass;
  15788. return self;
  15789. },
  15790. args: ["aClass"],
  15791. source: "theClass: aClass\x0a\x09theClass := aClass",
  15792. referencedClasses: [],
  15793. messageSends: []
  15794. }),
  15795. $globals.ClassSorterNode);
  15796. $core.addMethod(
  15797. $core.method({
  15798. selector: "traverseClassesWith:",
  15799. protocol: "visiting",
  15800. fn: function (aCollection){
  15801. var self=this,$self=this;
  15802. return $core.withContext(function($ctx1) {
  15803. var $1,$3,$2;
  15804. $1=$self._theClass();
  15805. $ctx1.sendIdx["theClass"]=1;
  15806. $recv(aCollection)._add_($1);
  15807. $recv($recv($self._nodes())._sorted_((function(a,b){
  15808. return $core.withContext(function($ctx2) {
  15809. $3=$recv(a)._theClass();
  15810. $ctx2.sendIdx["theClass"]=2;
  15811. $2=$recv($3)._name();
  15812. $ctx2.sendIdx["name"]=1;
  15813. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  15814. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  15815. })))._do_((function(aNode){
  15816. return $core.withContext(function($ctx2) {
  15817. return $recv(aNode)._traverseClassesWith_(aCollection);
  15818. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  15819. }));
  15820. return self;
  15821. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  15822. },
  15823. args: ["aCollection"],
  15824. 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 ].",
  15825. referencedClasses: [],
  15826. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  15827. }),
  15828. $globals.ClassSorterNode);
  15829. $core.addMethod(
  15830. $core.method({
  15831. selector: "on:classes:level:",
  15832. protocol: "instance creation",
  15833. fn: function (aClass,aCollection,anInteger){
  15834. var self=this,$self=this;
  15835. return $core.withContext(function($ctx1) {
  15836. var $1;
  15837. $1=$self._new();
  15838. $recv($1)._theClass_(aClass);
  15839. $recv($1)._level_(anInteger);
  15840. $recv($1)._getNodesFrom_(aCollection);
  15841. return $recv($1)._yourself();
  15842. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.a$cls)});
  15843. },
  15844. args: ["aClass", "aCollection", "anInteger"],
  15845. 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",
  15846. referencedClasses: [],
  15847. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  15848. }),
  15849. $globals.ClassSorterNode.a$cls);
  15850. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  15851. $core.addMethod(
  15852. $core.method({
  15853. selector: "allInstanceVariableNames",
  15854. protocol: "accessing",
  15855. fn: function (){
  15856. var self=this,$self=this;
  15857. return [];
  15858. },
  15859. args: [],
  15860. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  15861. referencedClasses: [],
  15862. messageSends: []
  15863. }),
  15864. $globals.TBehaviorDefaults);
  15865. $core.addMethod(
  15866. $core.method({
  15867. selector: "allSubclassesDo:",
  15868. protocol: "enumerating",
  15869. fn: function (aBlock){
  15870. var self=this,$self=this;
  15871. return self;
  15872. },
  15873. args: ["aBlock"],
  15874. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  15875. referencedClasses: [],
  15876. messageSends: []
  15877. }),
  15878. $globals.TBehaviorDefaults);
  15879. $core.addMethod(
  15880. $core.method({
  15881. selector: "name",
  15882. protocol: "accessing",
  15883. fn: function (){
  15884. var self=this,$self=this;
  15885. return nil;
  15886. },
  15887. args: [],
  15888. source: "name\x0a\x09^ nil",
  15889. referencedClasses: [],
  15890. messageSends: []
  15891. }),
  15892. $globals.TBehaviorDefaults);
  15893. $core.addMethod(
  15894. $core.method({
  15895. selector: "printOn:",
  15896. protocol: "printing",
  15897. fn: function (aStream){
  15898. var self=this,$self=this;
  15899. return $core.withContext(function($ctx1) {
  15900. var $1,$receiver;
  15901. $1=$self._name();
  15902. if(($receiver = $1) == null || $receiver.a$nil){
  15903. (
  15904. $ctx1.supercall = true,
  15905. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  15906. $ctx1.supercall = false;
  15907. } else {
  15908. var name;
  15909. name=$receiver;
  15910. $recv(aStream)._nextPutAll_(name);
  15911. }
  15912. return self;
  15913. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.TBehaviorDefaults)});
  15914. },
  15915. args: ["aStream"],
  15916. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  15917. referencedClasses: [],
  15918. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  15919. }),
  15920. $globals.TBehaviorDefaults);
  15921. $core.addMethod(
  15922. $core.method({
  15923. selector: "superclass",
  15924. protocol: "accessing",
  15925. fn: function (){
  15926. var self=this,$self=this;
  15927. return nil;
  15928. },
  15929. args: [],
  15930. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  15931. referencedClasses: [],
  15932. messageSends: []
  15933. }),
  15934. $globals.TBehaviorDefaults);
  15935. $core.addMethod(
  15936. $core.method({
  15937. selector: "traitUsers",
  15938. protocol: "accessing",
  15939. fn: function (){
  15940. var self=this,$self=this;
  15941. return [];
  15942. },
  15943. args: [],
  15944. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  15945. referencedClasses: [],
  15946. messageSends: []
  15947. }),
  15948. $globals.TBehaviorDefaults);
  15949. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  15950. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  15951. $core.addMethod(
  15952. $core.method({
  15953. selector: ">>",
  15954. protocol: "accessing",
  15955. fn: function (aString){
  15956. var self=this,$self=this;
  15957. return $core.withContext(function($ctx1) {
  15958. return $self._methodAt_(aString);
  15959. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.TBehaviorProvider)});
  15960. },
  15961. args: ["aString"],
  15962. source: ">> aString\x0a\x09^ self methodAt: aString",
  15963. referencedClasses: [],
  15964. messageSends: ["methodAt:"]
  15965. }),
  15966. $globals.TBehaviorProvider);
  15967. $core.addMethod(
  15968. $core.method({
  15969. selector: "addCompiledMethod:",
  15970. protocol: "compiling",
  15971. fn: function (aMethod){
  15972. var self=this,$self=this;
  15973. var oldMethod,announcement;
  15974. return $core.withContext(function($ctx1) {
  15975. var $1,$2,$3,$4,$receiver;
  15976. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  15977. return nil;
  15978. }));
  15979. $self._basicAddCompiledMethod_(aMethod);
  15980. $1=oldMethod;
  15981. if(($receiver = $1) == null || $receiver.a$nil){
  15982. $2=$recv($globals.MethodAdded)._new();
  15983. $ctx1.sendIdx["new"]=1;
  15984. $recv($2)._method_(aMethod);
  15985. $ctx1.sendIdx["method:"]=1;
  15986. $3=$recv($2)._yourself();
  15987. $ctx1.sendIdx["yourself"]=1;
  15988. announcement=$3;
  15989. } else {
  15990. $4=$recv($globals.MethodModified)._new();
  15991. $recv($4)._oldMethod_(oldMethod);
  15992. $recv($4)._method_(aMethod);
  15993. announcement=$recv($4)._yourself();
  15994. }
  15995. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  15996. return self;
  15997. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.TBehaviorProvider)});
  15998. },
  15999. args: ["aMethod"],
  16000. 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",
  16001. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  16002. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  16003. }),
  16004. $globals.TBehaviorProvider);
  16005. $core.addMethod(
  16006. $core.method({
  16007. selector: "basicAddCompiledMethod:",
  16008. protocol: "private",
  16009. fn: function (aMethod){
  16010. var self=this,$self=this;
  16011. return $core.withContext(function($ctx1) {
  16012. $core.addMethod(aMethod, self);
  16013. return self;
  16014. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16015. },
  16016. args: ["aMethod"],
  16017. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  16018. referencedClasses: [],
  16019. messageSends: []
  16020. }),
  16021. $globals.TBehaviorProvider);
  16022. $core.addMethod(
  16023. $core.method({
  16024. selector: "basicRemoveCompiledMethod:",
  16025. protocol: "private",
  16026. fn: function (aMethod){
  16027. var self=this,$self=this;
  16028. return $core.withContext(function($ctx1) {
  16029. $core.removeMethod(aMethod,self);
  16030. return self;
  16031. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16032. },
  16033. args: ["aMethod"],
  16034. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  16035. referencedClasses: [],
  16036. messageSends: []
  16037. }),
  16038. $globals.TBehaviorProvider);
  16039. $core.addMethod(
  16040. $core.method({
  16041. selector: "compile:protocol:",
  16042. protocol: "compiling",
  16043. fn: function (aString,anotherString){
  16044. var self=this,$self=this;
  16045. return $core.withContext(function($ctx1) {
  16046. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  16047. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.TBehaviorProvider)});
  16048. },
  16049. args: ["aString", "anotherString"],
  16050. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  16051. referencedClasses: ["Compiler"],
  16052. messageSends: ["install:forClass:protocol:", "new"]
  16053. }),
  16054. $globals.TBehaviorProvider);
  16055. $core.addMethod(
  16056. $core.method({
  16057. selector: "includesSelector:",
  16058. protocol: "testing",
  16059. fn: function (aString){
  16060. var self=this,$self=this;
  16061. return $core.withContext(function($ctx1) {
  16062. return $recv($self._methodDictionary())._includesKey_(aString);
  16063. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.TBehaviorProvider)});
  16064. },
  16065. args: ["aString"],
  16066. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  16067. referencedClasses: [],
  16068. messageSends: ["includesKey:", "methodDictionary"]
  16069. }),
  16070. $globals.TBehaviorProvider);
  16071. $core.addMethod(
  16072. $core.method({
  16073. selector: "methodAt:",
  16074. protocol: "accessing",
  16075. fn: function (aString){
  16076. var self=this,$self=this;
  16077. return $core.withContext(function($ctx1) {
  16078. return $recv($self._methodDictionary())._at_(aString);
  16079. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.TBehaviorProvider)});
  16080. },
  16081. args: ["aString"],
  16082. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  16083. referencedClasses: [],
  16084. messageSends: ["at:", "methodDictionary"]
  16085. }),
  16086. $globals.TBehaviorProvider);
  16087. $core.addMethod(
  16088. $core.method({
  16089. selector: "methodDictionary",
  16090. protocol: "accessing",
  16091. fn: function (){
  16092. var self=this,$self=this;
  16093. return $core.withContext(function($ctx1) {
  16094. var dict = $globals.HashedCollection._new();
  16095. var methods = self.methods;
  16096. Object.keys(methods).forEach(function(i) {
  16097. if(methods[i].selector) {
  16098. dict._at_put_(methods[i].selector, methods[i]);
  16099. }
  16100. });
  16101. return dict;
  16102. return self;
  16103. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.TBehaviorProvider)});
  16104. },
  16105. args: [],
  16106. 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'>",
  16107. referencedClasses: [],
  16108. messageSends: []
  16109. }),
  16110. $globals.TBehaviorProvider);
  16111. $core.addMethod(
  16112. $core.method({
  16113. selector: "methodOrganizationEnter:andLeave:",
  16114. protocol: "accessing",
  16115. fn: function (aMethod,oldMethod){
  16116. var self=this,$self=this;
  16117. return $core.withContext(function($ctx1) {
  16118. var $1,$2,$receiver;
  16119. if(($receiver = aMethod) == null || $receiver.a$nil){
  16120. aMethod;
  16121. } else {
  16122. $1=$self._organization();
  16123. $2=$recv(aMethod)._protocol();
  16124. $ctx1.sendIdx["protocol"]=1;
  16125. $recv($1)._addElement_($2);
  16126. }
  16127. if(($receiver = oldMethod) == null || $receiver.a$nil){
  16128. oldMethod;
  16129. } else {
  16130. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  16131. }
  16132. return self;
  16133. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod},$globals.TBehaviorProvider)});
  16134. },
  16135. args: ["aMethod", "oldMethod"],
  16136. 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 ]",
  16137. referencedClasses: [],
  16138. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  16139. }),
  16140. $globals.TBehaviorProvider);
  16141. $core.addMethod(
  16142. $core.method({
  16143. selector: "methodTemplate",
  16144. protocol: "accessing",
  16145. fn: function (){
  16146. var self=this,$self=this;
  16147. return $core.withContext(function($ctx1) {
  16148. return $recv($globals.String)._streamContents_((function(stream){
  16149. return $core.withContext(function($ctx2) {
  16150. $recv(stream)._write_("messageSelectorAndArgumentNames");
  16151. $ctx2.sendIdx["write:"]=1;
  16152. $recv(stream)._lf();
  16153. $ctx2.sendIdx["lf"]=1;
  16154. $recv(stream)._tab();
  16155. $ctx2.sendIdx["tab"]=1;
  16156. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  16157. $ctx2.sendIdx["write:"]=2;
  16158. $recv(stream)._lf();
  16159. $ctx2.sendIdx["lf"]=2;
  16160. $recv(stream)._lf();
  16161. $ctx2.sendIdx["lf"]=3;
  16162. $recv(stream)._tab();
  16163. $ctx2.sendIdx["tab"]=2;
  16164. $recv(stream)._write_("| temporary variable names |");
  16165. $ctx2.sendIdx["write:"]=3;
  16166. $recv(stream)._lf();
  16167. $recv(stream)._tab();
  16168. return $recv(stream)._write_("statements");
  16169. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16170. }));
  16171. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.TBehaviorProvider)});
  16172. },
  16173. args: [],
  16174. 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' ]",
  16175. referencedClasses: ["String"],
  16176. messageSends: ["streamContents:", "write:", "lf", "tab"]
  16177. }),
  16178. $globals.TBehaviorProvider);
  16179. $core.addMethod(
  16180. $core.method({
  16181. selector: "methods",
  16182. protocol: "accessing",
  16183. fn: function (){
  16184. var self=this,$self=this;
  16185. return $core.withContext(function($ctx1) {
  16186. return $recv($self._methodDictionary())._values();
  16187. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.TBehaviorProvider)});
  16188. },
  16189. args: [],
  16190. source: "methods\x0a\x09^ self methodDictionary values",
  16191. referencedClasses: [],
  16192. messageSends: ["values", "methodDictionary"]
  16193. }),
  16194. $globals.TBehaviorProvider);
  16195. $core.addMethod(
  16196. $core.method({
  16197. selector: "methodsInProtocol:",
  16198. protocol: "accessing",
  16199. fn: function (aString){
  16200. var self=this,$self=this;
  16201. return $core.withContext(function($ctx1) {
  16202. return $recv($self._methods())._select_((function(each){
  16203. return $core.withContext(function($ctx2) {
  16204. return $recv($recv(each)._protocol()).__eq(aString);
  16205. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16206. }));
  16207. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16208. },
  16209. args: ["aString"],
  16210. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  16211. referencedClasses: [],
  16212. messageSends: ["select:", "methods", "=", "protocol"]
  16213. }),
  16214. $globals.TBehaviorProvider);
  16215. $core.addMethod(
  16216. $core.method({
  16217. selector: "organization",
  16218. protocol: "accessing",
  16219. fn: function (){
  16220. var self=this,$self=this;
  16221. return $core.withContext(function($ctx1) {
  16222. var $1,$receiver;
  16223. $1=$self._basicOrganization();
  16224. $ctx1.sendIdx["basicOrganization"]=1;
  16225. if(($receiver = $1) == null || $receiver.a$nil){
  16226. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  16227. return $self._basicOrganization();
  16228. } else {
  16229. return $1;
  16230. }
  16231. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.TBehaviorProvider)});
  16232. },
  16233. args: [],
  16234. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  16235. referencedClasses: ["ClassOrganizer"],
  16236. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  16237. }),
  16238. $globals.TBehaviorProvider);
  16239. $core.addMethod(
  16240. $core.method({
  16241. selector: "ownMethods",
  16242. protocol: "accessing",
  16243. fn: function (){
  16244. var self=this,$self=this;
  16245. return $core.withContext(function($ctx1) {
  16246. var $1;
  16247. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  16248. return $core.withContext(function($ctx2) {
  16249. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  16250. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  16251. })))._sorted_((function(a,b){
  16252. return $core.withContext(function($ctx2) {
  16253. $1=$recv(a)._selector();
  16254. $ctx2.sendIdx["selector"]=1;
  16255. return $recv($1).__lt_eq($recv(b)._selector());
  16256. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16257. }));
  16258. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.TBehaviorProvider)});
  16259. },
  16260. args: [],
  16261. 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 ]",
  16262. referencedClasses: ["OrderedCollection"],
  16263. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  16264. }),
  16265. $globals.TBehaviorProvider);
  16266. $core.addMethod(
  16267. $core.method({
  16268. selector: "ownMethodsInProtocol:",
  16269. protocol: "accessing",
  16270. fn: function (aString){
  16271. var self=this,$self=this;
  16272. return $core.withContext(function($ctx1) {
  16273. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  16274. return $core.withContext(function($ctx2) {
  16275. return $recv($recv(each)._methodClass()).__eq(self);
  16276. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16277. }));
  16278. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16279. },
  16280. args: ["aString"],
  16281. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  16282. referencedClasses: [],
  16283. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  16284. }),
  16285. $globals.TBehaviorProvider);
  16286. $core.addMethod(
  16287. $core.method({
  16288. selector: "ownProtocols",
  16289. protocol: "accessing",
  16290. fn: function (){
  16291. var self=this,$self=this;
  16292. return $core.withContext(function($ctx1) {
  16293. return $recv($self._protocols())._reject_((function(each){
  16294. return $core.withContext(function($ctx2) {
  16295. return $recv(each)._match_("^\x5c*");
  16296. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16297. }));
  16298. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.TBehaviorProvider)});
  16299. },
  16300. args: [],
  16301. 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*' ]",
  16302. referencedClasses: [],
  16303. messageSends: ["reject:", "protocols", "match:"]
  16304. }),
  16305. $globals.TBehaviorProvider);
  16306. $core.addMethod(
  16307. $core.method({
  16308. selector: "packageOfProtocol:",
  16309. protocol: "accessing",
  16310. fn: function (aString){
  16311. var self=this,$self=this;
  16312. return $core.withContext(function($ctx1) {
  16313. var $1;
  16314. $1=$recv(aString)._beginsWith_("*");
  16315. if(!$core.assert($1)){
  16316. return $self._package();
  16317. }
  16318. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  16319. return nil;
  16320. }));
  16321. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16322. },
  16323. args: ["aString"],
  16324. 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 ]",
  16325. referencedClasses: ["Package"],
  16326. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  16327. }),
  16328. $globals.TBehaviorProvider);
  16329. $core.addMethod(
  16330. $core.method({
  16331. selector: "protocols",
  16332. protocol: "accessing",
  16333. fn: function (){
  16334. var self=this,$self=this;
  16335. return $core.withContext(function($ctx1) {
  16336. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  16337. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.TBehaviorProvider)});
  16338. },
  16339. args: [],
  16340. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  16341. referencedClasses: [],
  16342. messageSends: ["sorted", "asArray", "elements", "organization"]
  16343. }),
  16344. $globals.TBehaviorProvider);
  16345. $core.addMethod(
  16346. $core.method({
  16347. selector: "protocolsDo:",
  16348. protocol: "enumerating",
  16349. fn: function (aBlock){
  16350. var self=this,$self=this;
  16351. var methodsByProtocol;
  16352. return $core.withContext(function($ctx1) {
  16353. methodsByProtocol=$recv($globals.HashedCollection)._new();
  16354. $ctx1.sendIdx["new"]=1;
  16355. $recv($self._methodDictionary())._valuesDo_((function(m){
  16356. return $core.withContext(function($ctx2) {
  16357. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  16358. return $core.withContext(function($ctx3) {
  16359. return $recv($globals.Array)._new();
  16360. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16361. })))._add_(m);
  16362. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  16363. }));
  16364. $recv($self._protocols())._do_((function(protocol){
  16365. return $core.withContext(function($ctx2) {
  16366. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  16367. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  16368. }));
  16369. return self;
  16370. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.TBehaviorProvider)});
  16371. },
  16372. args: ["aBlock"],
  16373. 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) ]",
  16374. referencedClasses: ["HashedCollection", "Array"],
  16375. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  16376. }),
  16377. $globals.TBehaviorProvider);
  16378. $core.addMethod(
  16379. $core.method({
  16380. selector: "recompile",
  16381. protocol: "compiling",
  16382. fn: function (){
  16383. var self=this,$self=this;
  16384. return $core.withContext(function($ctx1) {
  16385. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  16386. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.TBehaviorProvider)});
  16387. },
  16388. args: [],
  16389. source: "recompile\x0a\x09^ Compiler new recompile: self",
  16390. referencedClasses: ["Compiler"],
  16391. messageSends: ["recompile:", "new"]
  16392. }),
  16393. $globals.TBehaviorProvider);
  16394. $core.addMethod(
  16395. $core.method({
  16396. selector: "removeCompiledMethod:",
  16397. protocol: "compiling",
  16398. fn: function (aMethod){
  16399. var self=this,$self=this;
  16400. return $core.withContext(function($ctx1) {
  16401. var $1,$3,$2;
  16402. $self._basicRemoveCompiledMethod_(aMethod);
  16403. $1=$recv($globals.SystemAnnouncer)._current();
  16404. $3=$recv($globals.MethodRemoved)._new();
  16405. $recv($3)._method_(aMethod);
  16406. $2=$recv($3)._yourself();
  16407. $recv($1)._announce_($2);
  16408. return self;
  16409. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16410. },
  16411. args: ["aMethod"],
  16412. 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)",
  16413. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  16414. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  16415. }),
  16416. $globals.TBehaviorProvider);
  16417. $core.addMethod(
  16418. $core.method({
  16419. selector: "removeProtocolIfEmpty:",
  16420. protocol: "accessing",
  16421. fn: function (aString){
  16422. var self=this,$self=this;
  16423. return $core.withContext(function($ctx1) {
  16424. $recv($self._methods())._detect_ifNone_((function(each){
  16425. return $core.withContext(function($ctx2) {
  16426. return $recv($recv(each)._protocol()).__eq(aString);
  16427. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16428. }),(function(){
  16429. return $core.withContext(function($ctx2) {
  16430. return $recv($self._organization())._removeElement_(aString);
  16431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16432. }));
  16433. return self;
  16434. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.TBehaviorProvider)});
  16435. },
  16436. args: ["aString"],
  16437. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  16438. referencedClasses: [],
  16439. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  16440. }),
  16441. $globals.TBehaviorProvider);
  16442. $core.addMethod(
  16443. $core.method({
  16444. selector: "selectors",
  16445. protocol: "accessing",
  16446. fn: function (){
  16447. var self=this,$self=this;
  16448. return $core.withContext(function($ctx1) {
  16449. return $recv($self._methodDictionary())._keys();
  16450. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.TBehaviorProvider)});
  16451. },
  16452. args: [],
  16453. source: "selectors\x0a\x09^ self methodDictionary keys",
  16454. referencedClasses: [],
  16455. messageSends: ["keys", "methodDictionary"]
  16456. }),
  16457. $globals.TBehaviorProvider);
  16458. $core.addMethod(
  16459. $core.method({
  16460. selector: "setTraitComposition:",
  16461. protocol: "compiling",
  16462. fn: function (aTraitComposition){
  16463. var self=this,$self=this;
  16464. return $core.withContext(function($ctx1) {
  16465. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  16466. return self;
  16467. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.TBehaviorProvider)});
  16468. },
  16469. args: ["aTraitComposition"],
  16470. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  16471. referencedClasses: [],
  16472. messageSends: []
  16473. }),
  16474. $globals.TBehaviorProvider);
  16475. $core.addMethod(
  16476. $core.method({
  16477. selector: "traitComposition",
  16478. protocol: "accessing",
  16479. fn: function (){
  16480. var self=this,$self=this;
  16481. return $core.withContext(function($ctx1) {
  16482. var $1,$receiver;
  16483. $1=$self._basicAt_("traitComposition");
  16484. if(($receiver = $1) == null || $receiver.a$nil){
  16485. return [];
  16486. } else {
  16487. var aCollection;
  16488. aCollection=$receiver;
  16489. return $recv(aCollection)._collect_((function(each){
  16490. return $core.withContext(function($ctx2) {
  16491. return $recv($globals.TraitTransformation)._fromJSON_(each);
  16492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16493. }));
  16494. }
  16495. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.TBehaviorProvider)});
  16496. },
  16497. args: [],
  16498. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  16499. referencedClasses: ["TraitTransformation"],
  16500. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  16501. }),
  16502. $globals.TBehaviorProvider);
  16503. $core.addMethod(
  16504. $core.method({
  16505. selector: "traitCompositionDefinition",
  16506. protocol: "accessing",
  16507. fn: function (){
  16508. var self=this,$self=this;
  16509. return $core.withContext(function($ctx1) {
  16510. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  16511. return $core.withContext(function($ctx2) {
  16512. return $recv($globals.String)._streamContents_((function(str){
  16513. return $core.withContext(function($ctx3) {
  16514. $recv(str)._write_("{");
  16515. $ctx3.sendIdx["write:"]=1;
  16516. $recv(traitComposition)._do_separatedBy_((function(each){
  16517. return $core.withContext(function($ctx4) {
  16518. return $recv(str)._write_($recv(each)._definition());
  16519. $ctx4.sendIdx["write:"]=2;
  16520. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16521. }),(function(){
  16522. return $core.withContext(function($ctx4) {
  16523. return $recv(str)._write_(". ");
  16524. $ctx4.sendIdx["write:"]=3;
  16525. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16526. }));
  16527. return $recv(str)._write_("}");
  16528. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  16529. }));
  16530. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  16531. }));
  16532. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.TBehaviorProvider)});
  16533. },
  16534. args: [],
  16535. 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: '}' ] ]",
  16536. referencedClasses: ["String"],
  16537. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  16538. }),
  16539. $globals.TBehaviorProvider);
  16540. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  16541. $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.";
  16542. $core.addMethod(
  16543. $core.method({
  16544. selector: "asJavaScriptSource",
  16545. protocol: "converting",
  16546. fn: function (){
  16547. var self=this,$self=this;
  16548. return $core.withContext(function($ctx1) {
  16549. return "$globals.".__comma($self._name());
  16550. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TMasterBehavior)});
  16551. },
  16552. args: [],
  16553. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  16554. referencedClasses: [],
  16555. messageSends: [",", "name"]
  16556. }),
  16557. $globals.TMasterBehavior);
  16558. $core.addMethod(
  16559. $core.method({
  16560. selector: "browse",
  16561. protocol: "browsing",
  16562. fn: function (){
  16563. var self=this,$self=this;
  16564. return $core.withContext(function($ctx1) {
  16565. $recv($globals.Finder)._findClass_(self);
  16566. return self;
  16567. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.TMasterBehavior)});
  16568. },
  16569. args: [],
  16570. source: "browse\x0a\x09Finder findClass: self",
  16571. referencedClasses: ["Finder"],
  16572. messageSends: ["findClass:"]
  16573. }),
  16574. $globals.TMasterBehavior);
  16575. $core.addMethod(
  16576. $core.method({
  16577. selector: "category",
  16578. protocol: "accessing",
  16579. fn: function (){
  16580. var self=this,$self=this;
  16581. return $core.withContext(function($ctx1) {
  16582. var $1,$receiver;
  16583. $1=$self._package();
  16584. $ctx1.sendIdx["package"]=1;
  16585. if(($receiver = $1) == null || $receiver.a$nil){
  16586. return "Unclassified";
  16587. } else {
  16588. return $recv($self._package())._name();
  16589. }
  16590. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.TMasterBehavior)});
  16591. },
  16592. args: [],
  16593. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  16594. referencedClasses: [],
  16595. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  16596. }),
  16597. $globals.TMasterBehavior);
  16598. $core.addMethod(
  16599. $core.method({
  16600. selector: "classTag",
  16601. protocol: "accessing",
  16602. fn: function (){
  16603. var self=this,$self=this;
  16604. return $core.withContext(function($ctx1) {
  16605. return $self._subclassResponsibility();
  16606. }, function($ctx1) {$ctx1.fill(self,"classTag",{},$globals.TMasterBehavior)});
  16607. },
  16608. args: [],
  16609. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  16610. referencedClasses: [],
  16611. messageSends: ["subclassResponsibility"]
  16612. }),
  16613. $globals.TMasterBehavior);
  16614. $core.addMethod(
  16615. $core.method({
  16616. selector: "comment",
  16617. protocol: "accessing",
  16618. fn: function (){
  16619. var self=this,$self=this;
  16620. return $core.withContext(function($ctx1) {
  16621. var $1,$receiver;
  16622. $1=$self._basicAt_("comment");
  16623. if(($receiver = $1) == null || $receiver.a$nil){
  16624. return "";
  16625. } else {
  16626. return $1;
  16627. }
  16628. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.TMasterBehavior)});
  16629. },
  16630. args: [],
  16631. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  16632. referencedClasses: [],
  16633. messageSends: ["ifNil:", "basicAt:"]
  16634. }),
  16635. $globals.TMasterBehavior);
  16636. $core.addMethod(
  16637. $core.method({
  16638. selector: "comment:",
  16639. protocol: "accessing",
  16640. fn: function (aString){
  16641. var self=this,$self=this;
  16642. return $core.withContext(function($ctx1) {
  16643. var $1,$3,$2;
  16644. $self._basicAt_put_("comment",aString);
  16645. $1=$recv($globals.SystemAnnouncer)._current();
  16646. $3=$recv($globals.ClassCommentChanged)._new();
  16647. $recv($3)._theClass_(self);
  16648. $2=$recv($3)._yourself();
  16649. $recv($1)._announce_($2);
  16650. return self;
  16651. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.TMasterBehavior)});
  16652. },
  16653. args: ["aString"],
  16654. 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)",
  16655. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  16656. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  16657. }),
  16658. $globals.TMasterBehavior);
  16659. $core.addMethod(
  16660. $core.method({
  16661. selector: "definedMethods",
  16662. protocol: "accessing",
  16663. fn: function (){
  16664. var self=this,$self=this;
  16665. var methods;
  16666. return $core.withContext(function($ctx1) {
  16667. var $1,$receiver;
  16668. methods=$self._methods();
  16669. $ctx1.sendIdx["methods"]=1;
  16670. $1=$self._theMetaClass();
  16671. if(($receiver = $1) == null || $receiver.a$nil){
  16672. return methods;
  16673. } else {
  16674. var meta;
  16675. meta=$receiver;
  16676. return $recv(methods).__comma($recv(meta)._methods());
  16677. }
  16678. return self;
  16679. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods},$globals.TMasterBehavior)});
  16680. },
  16681. args: [],
  16682. 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 ]",
  16683. referencedClasses: [],
  16684. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  16685. }),
  16686. $globals.TMasterBehavior);
  16687. $core.addMethod(
  16688. $core.method({
  16689. selector: "enterOrganization",
  16690. protocol: "accessing",
  16691. fn: function (){
  16692. var self=this,$self=this;
  16693. return $core.withContext(function($ctx1) {
  16694. var $2,$1,$4,$3,$receiver;
  16695. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16696. $globals.Smalltalk;
  16697. } else {
  16698. $2=$self._package();
  16699. $ctx1.sendIdx["package"]=1;
  16700. $1=$recv($2)._isString();
  16701. if($core.assert($1)){
  16702. $4=$self._package();
  16703. $ctx1.sendIdx["package"]=2;
  16704. $3=$recv($globals.Package)._named_($4);
  16705. $self._basicAt_put_("pkg",$3);
  16706. }
  16707. $recv($recv($self._package())._organization())._addElement_(self);
  16708. }
  16709. return self;
  16710. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{},$globals.TMasterBehavior)});
  16711. },
  16712. args: [],
  16713. source: "enterOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package isString ifTrue: [ self basicAt: 'pkg' put: (Package named: self package) ].\x0a\x09\x09self package organization addElement: self ]",
  16714. referencedClasses: ["Smalltalk", "Package"],
  16715. messageSends: ["ifNotNil:", "ifTrue:", "isString", "package", "basicAt:put:", "named:", "addElement:", "organization"]
  16716. }),
  16717. $globals.TMasterBehavior);
  16718. $core.addMethod(
  16719. $core.method({
  16720. selector: "leaveOrganization",
  16721. protocol: "accessing",
  16722. fn: function (){
  16723. var self=this,$self=this;
  16724. return $core.withContext(function($ctx1) {
  16725. var $receiver;
  16726. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16727. $globals.Smalltalk;
  16728. } else {
  16729. $recv($recv($self._package())._organization())._removeElement_(self);
  16730. }
  16731. return self;
  16732. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{},$globals.TMasterBehavior)});
  16733. },
  16734. args: [],
  16735. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  16736. referencedClasses: ["Smalltalk"],
  16737. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  16738. }),
  16739. $globals.TMasterBehavior);
  16740. $core.addMethod(
  16741. $core.method({
  16742. selector: "name",
  16743. protocol: "accessing",
  16744. fn: function (){
  16745. var self=this,$self=this;
  16746. return $core.withContext(function($ctx1) {
  16747. return self.className;
  16748. return self;
  16749. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.TMasterBehavior)});
  16750. },
  16751. args: [],
  16752. source: "name\x0a\x09<inlineJS: 'return self.className'>",
  16753. referencedClasses: [],
  16754. messageSends: []
  16755. }),
  16756. $globals.TMasterBehavior);
  16757. $core.addMethod(
  16758. $core.method({
  16759. selector: "package",
  16760. protocol: "accessing",
  16761. fn: function (){
  16762. var self=this,$self=this;
  16763. return $core.withContext(function($ctx1) {
  16764. return $self._basicAt_("pkg");
  16765. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.TMasterBehavior)});
  16766. },
  16767. args: [],
  16768. source: "package\x0a\x09^ self basicAt: 'pkg'",
  16769. referencedClasses: [],
  16770. messageSends: ["basicAt:"]
  16771. }),
  16772. $globals.TMasterBehavior);
  16773. $core.addMethod(
  16774. $core.method({
  16775. selector: "package:",
  16776. protocol: "accessing",
  16777. fn: function (aPackage){
  16778. var self=this,$self=this;
  16779. var oldPackage;
  16780. return $core.withContext(function($ctx1) {
  16781. var $2,$1,$3,$5,$4;
  16782. $2=$self._package();
  16783. $ctx1.sendIdx["package"]=1;
  16784. $1=$recv($2).__eq(aPackage);
  16785. if($core.assert($1)){
  16786. return self;
  16787. }
  16788. oldPackage=$self._package();
  16789. $self._leaveOrganization();
  16790. $self._basicAt_put_("pkg",aPackage);
  16791. $self._enterOrganization();
  16792. $3=$recv($globals.SystemAnnouncer)._current();
  16793. $5=$recv($globals.ClassMoved)._new();
  16794. $recv($5)._theClass_(self);
  16795. $recv($5)._oldPackage_(oldPackage);
  16796. $4=$recv($5)._yourself();
  16797. $recv($3)._announce_($4);
  16798. return self;
  16799. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.TMasterBehavior)});
  16800. },
  16801. args: ["aPackage"],
  16802. 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: 'pkg' put: aPackage;\x0a\x09\x09enterOrganization.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  16803. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  16804. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  16805. }),
  16806. $globals.TMasterBehavior);
  16807. $core.addMethod(
  16808. $core.method({
  16809. selector: "theNonMetaClass",
  16810. protocol: "accessing",
  16811. fn: function (){
  16812. var self=this,$self=this;
  16813. return self;
  16814. },
  16815. args: [],
  16816. source: "theNonMetaClass\x0a\x09^ self",
  16817. referencedClasses: [],
  16818. messageSends: []
  16819. }),
  16820. $globals.TMasterBehavior);
  16821. $core.addClass("Trait", $globals.Object, ["organization"], "Kernel-Classes");
  16822. $core.addMethod(
  16823. $core.method({
  16824. selector: "-",
  16825. protocol: "composition",
  16826. fn: function (anArray){
  16827. var self=this,$self=this;
  16828. return $core.withContext(function($ctx1) {
  16829. return $recv($self._asTraitTransformation()).__minus(anArray);
  16830. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  16831. },
  16832. args: ["anArray"],
  16833. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  16834. referencedClasses: [],
  16835. messageSends: ["-", "asTraitTransformation"]
  16836. }),
  16837. $globals.Trait);
  16838. $core.addMethod(
  16839. $core.method({
  16840. selector: "@",
  16841. protocol: "composition",
  16842. fn: function (anArrayOfAssociations){
  16843. var self=this,$self=this;
  16844. return $core.withContext(function($ctx1) {
  16845. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  16846. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  16847. },
  16848. args: ["anArrayOfAssociations"],
  16849. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  16850. referencedClasses: [],
  16851. messageSends: ["@", "asTraitTransformation"]
  16852. }),
  16853. $globals.Trait);
  16854. $core.addMethod(
  16855. $core.method({
  16856. selector: "asTraitComposition",
  16857. protocol: "converting",
  16858. fn: function (){
  16859. var self=this,$self=this;
  16860. return $core.withContext(function($ctx1) {
  16861. return $recv($self._asTraitTransformation())._asTraitComposition();
  16862. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  16863. },
  16864. args: [],
  16865. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  16866. referencedClasses: [],
  16867. messageSends: ["asTraitComposition", "asTraitTransformation"]
  16868. }),
  16869. $globals.Trait);
  16870. $core.addMethod(
  16871. $core.method({
  16872. selector: "asTraitTransformation",
  16873. protocol: "converting",
  16874. fn: function (){
  16875. var self=this,$self=this;
  16876. return $core.withContext(function($ctx1) {
  16877. return $recv($globals.TraitTransformation)._on_(self);
  16878. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  16879. },
  16880. args: [],
  16881. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  16882. referencedClasses: ["TraitTransformation"],
  16883. messageSends: ["on:"]
  16884. }),
  16885. $globals.Trait);
  16886. $core.addMethod(
  16887. $core.method({
  16888. selector: "basicOrganization",
  16889. protocol: "accessing",
  16890. fn: function (){
  16891. var self=this,$self=this;
  16892. return $self["@organization"];
  16893. },
  16894. args: [],
  16895. source: "basicOrganization\x0a\x09^ organization",
  16896. referencedClasses: [],
  16897. messageSends: []
  16898. }),
  16899. $globals.Trait);
  16900. $core.addMethod(
  16901. $core.method({
  16902. selector: "basicOrganization:",
  16903. protocol: "accessing",
  16904. fn: function (aClassOrganizer){
  16905. var self=this,$self=this;
  16906. $self["@organization"]=aClassOrganizer;
  16907. return self;
  16908. },
  16909. args: ["aClassOrganizer"],
  16910. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  16911. referencedClasses: [],
  16912. messageSends: []
  16913. }),
  16914. $globals.Trait);
  16915. $core.addMethod(
  16916. $core.method({
  16917. selector: "classTag",
  16918. protocol: "accessing",
  16919. fn: function (){
  16920. var self=this,$self=this;
  16921. return "trait";
  16922. },
  16923. args: [],
  16924. source: "classTag\x0a\x09^ 'trait'",
  16925. referencedClasses: [],
  16926. messageSends: []
  16927. }),
  16928. $globals.Trait);
  16929. $core.addMethod(
  16930. $core.method({
  16931. selector: "definition",
  16932. protocol: "accessing",
  16933. fn: function (){
  16934. var self=this,$self=this;
  16935. return $core.withContext(function($ctx1) {
  16936. var $1;
  16937. return $recv($globals.String)._streamContents_((function(stream){
  16938. return $core.withContext(function($ctx2) {
  16939. $recv(stream)._write_("Trait named: ");
  16940. $ctx2.sendIdx["write:"]=1;
  16941. $recv(stream)._printSymbol_($self._name());
  16942. $recv(stream)._lf();
  16943. $ctx2.sendIdx["lf"]=1;
  16944. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  16945. return $core.withContext(function($ctx3) {
  16946. $1=$recv($globals.String)._tab();
  16947. $ctx3.sendIdx["tab"]=1;
  16948. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  16949. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  16950. })));
  16951. $ctx2.sendIdx["write:"]=2;
  16952. $recv(stream)._tab();
  16953. $recv(stream)._write_("package: ");
  16954. return $recv(stream)._print_($self._category());
  16955. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16956. }));
  16957. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  16958. },
  16959. args: [],
  16960. 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 ]",
  16961. referencedClasses: ["String"],
  16962. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  16963. }),
  16964. $globals.Trait);
  16965. $core.addMethod(
  16966. $core.method({
  16967. selector: "theMetaClass",
  16968. protocol: "accessing",
  16969. fn: function (){
  16970. var self=this,$self=this;
  16971. return nil;
  16972. },
  16973. args: [],
  16974. source: "theMetaClass\x0a\x09^ nil",
  16975. referencedClasses: [],
  16976. messageSends: []
  16977. }),
  16978. $globals.Trait);
  16979. $core.addMethod(
  16980. $core.method({
  16981. selector: "traitUsers",
  16982. protocol: "accessing",
  16983. fn: function (){
  16984. var self=this,$self=this;
  16985. return $core.withContext(function($ctx1) {
  16986. return $recv($self._basicAt_("traitUsers"))._copy();
  16987. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  16988. },
  16989. args: [],
  16990. source: "traitUsers\x0a\x09^ (self basicAt: 'traitUsers') copy",
  16991. referencedClasses: [],
  16992. messageSends: ["copy", "basicAt:"]
  16993. }),
  16994. $globals.Trait);
  16995. $core.addMethod(
  16996. $core.method({
  16997. selector: "named:package:",
  16998. protocol: "instance creation",
  16999. fn: function (aString,anotherString){
  17000. var self=this,$self=this;
  17001. return $core.withContext(function($ctx1) {
  17002. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  17003. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.a$cls)});
  17004. },
  17005. args: ["aString", "anotherString"],
  17006. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  17007. referencedClasses: ["ClassBuilder"],
  17008. messageSends: ["addTraitNamed:package:", "new"]
  17009. }),
  17010. $globals.Trait.a$cls);
  17011. $core.addMethod(
  17012. $core.method({
  17013. selector: "named:uses:package:",
  17014. protocol: "instance creation",
  17015. fn: function (aString,aTraitCompositionDescription,anotherString){
  17016. var self=this,$self=this;
  17017. var trait;
  17018. return $core.withContext(function($ctx1) {
  17019. trait=$self._named_package_(aString,anotherString);
  17020. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  17021. return trait;
  17022. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.a$cls)});
  17023. },
  17024. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  17025. 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",
  17026. referencedClasses: [],
  17027. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  17028. }),
  17029. $globals.Trait.a$cls);
  17030. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  17031. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  17032. $core.addMethod(
  17033. $core.method({
  17034. selector: "-",
  17035. protocol: "composition",
  17036. fn: function (anArray){
  17037. var self=this,$self=this;
  17038. return $core.withContext(function($ctx1) {
  17039. var $1;
  17040. $1=$self._copy();
  17041. $recv($1)._addExclusions_(anArray);
  17042. return $recv($1)._yourself();
  17043. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  17044. },
  17045. args: ["anArray"],
  17046. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  17047. referencedClasses: [],
  17048. messageSends: ["addExclusions:", "copy", "yourself"]
  17049. }),
  17050. $globals.TraitTransformation);
  17051. $core.addMethod(
  17052. $core.method({
  17053. selector: "@",
  17054. protocol: "composition",
  17055. fn: function (anArrayOfAssociations){
  17056. var self=this,$self=this;
  17057. return $core.withContext(function($ctx1) {
  17058. var $1;
  17059. $1=$self._copy();
  17060. $recv($1)._addAliases_(anArrayOfAssociations);
  17061. return $recv($1)._yourself();
  17062. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17063. },
  17064. args: ["anArrayOfAssociations"],
  17065. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  17066. referencedClasses: [],
  17067. messageSends: ["addAliases:", "copy", "yourself"]
  17068. }),
  17069. $globals.TraitTransformation);
  17070. $core.addMethod(
  17071. $core.method({
  17072. selector: "addAliases:",
  17073. protocol: "accessing",
  17074. fn: function (anArrayOfAssociations){
  17075. var self=this,$self=this;
  17076. return $core.withContext(function($ctx1) {
  17077. $recv(anArrayOfAssociations)._do_((function(each){
  17078. var key;
  17079. return $core.withContext(function($ctx2) {
  17080. key=$recv(each)._key();
  17081. key;
  17082. return $recv($self["@aliases"])._at_ifPresent_ifAbsent_(key,(function(){
  17083. return $core.withContext(function($ctx3) {
  17084. return $self._error_("Cannot use same alias name twice.");
  17085. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17086. }),(function(){
  17087. return $core.withContext(function($ctx3) {
  17088. return $recv($self["@aliases"])._at_put_(key,$recv(each)._value());
  17089. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  17090. }));
  17091. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  17092. }));
  17093. return anArrayOfAssociations;
  17094. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17095. },
  17096. args: ["anArrayOfAssociations"],
  17097. 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",
  17098. referencedClasses: [],
  17099. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  17100. }),
  17101. $globals.TraitTransformation);
  17102. $core.addMethod(
  17103. $core.method({
  17104. selector: "addExclusions:",
  17105. protocol: "accessing",
  17106. fn: function (anArray){
  17107. var self=this,$self=this;
  17108. return $core.withContext(function($ctx1) {
  17109. $recv($self["@exclusions"])._addAll_(anArray);
  17110. return anArray;
  17111. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  17112. },
  17113. args: ["anArray"],
  17114. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  17115. referencedClasses: [],
  17116. messageSends: ["addAll:"]
  17117. }),
  17118. $globals.TraitTransformation);
  17119. $core.addMethod(
  17120. $core.method({
  17121. selector: "aliases",
  17122. protocol: "accessing",
  17123. fn: function (){
  17124. var self=this,$self=this;
  17125. return $self["@aliases"];
  17126. },
  17127. args: [],
  17128. source: "aliases\x0a\x09^ aliases",
  17129. referencedClasses: [],
  17130. messageSends: []
  17131. }),
  17132. $globals.TraitTransformation);
  17133. $core.addMethod(
  17134. $core.method({
  17135. selector: "asJavaScriptObject",
  17136. protocol: "converting",
  17137. fn: function (){
  17138. var self=this,$self=this;
  17139. return $core.withContext(function($ctx1) {
  17140. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  17141. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  17142. },
  17143. args: [],
  17144. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  17145. referencedClasses: [],
  17146. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  17147. }),
  17148. $globals.TraitTransformation);
  17149. $core.addMethod(
  17150. $core.method({
  17151. selector: "asJavaScriptSource",
  17152. protocol: "converting",
  17153. fn: function (){
  17154. var self=this,$self=this;
  17155. return $core.withContext(function($ctx1) {
  17156. var $2,$3,$1;
  17157. return $recv($globals.String)._streamContents_((function(str){
  17158. return $core.withContext(function($ctx2) {
  17159. $2=$recv($self._trait())._asJavaScriptSource();
  17160. $ctx2.sendIdx["asJavaScriptSource"]=1;
  17161. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  17162. return $core.withContext(function($ctx3) {
  17163. return [", aliases: ",$recv(al)._asJSONString()];
  17164. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17165. }));
  17166. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17167. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  17168. return $core.withContext(function($ctx3) {
  17169. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  17170. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  17171. })),"}"];
  17172. return $recv(str)._write_($1);
  17173. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17174. }));
  17175. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  17176. },
  17177. args: [],
  17178. 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'}' } ]",
  17179. referencedClasses: ["String"],
  17180. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  17181. }),
  17182. $globals.TraitTransformation);
  17183. $core.addMethod(
  17184. $core.method({
  17185. selector: "asTraitComposition",
  17186. protocol: "converting",
  17187. fn: function (){
  17188. var self=this,$self=this;
  17189. return [self];
  17190. },
  17191. args: [],
  17192. source: "asTraitComposition\x0a\x09^ { self }",
  17193. referencedClasses: [],
  17194. messageSends: []
  17195. }),
  17196. $globals.TraitTransformation);
  17197. $core.addMethod(
  17198. $core.method({
  17199. selector: "asTraitTransformation",
  17200. protocol: "converting",
  17201. fn: function (){
  17202. var self=this,$self=this;
  17203. return self;
  17204. },
  17205. args: [],
  17206. source: "asTraitTransformation\x0a\x09^ self",
  17207. referencedClasses: [],
  17208. messageSends: []
  17209. }),
  17210. $globals.TraitTransformation);
  17211. $core.addMethod(
  17212. $core.method({
  17213. selector: "definition",
  17214. protocol: "accessing",
  17215. fn: function (){
  17216. var self=this,$self=this;
  17217. return $core.withContext(function($ctx1) {
  17218. return $recv($globals.String)._streamContents_((function(str){
  17219. return $core.withContext(function($ctx2) {
  17220. $recv(str)._print_($self._trait());
  17221. $recv($self._aliases())._ifNotEmpty_((function(al){
  17222. return $core.withContext(function($ctx3) {
  17223. $recv(str)._write_(" @ {");
  17224. $ctx3.sendIdx["write:"]=1;
  17225. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  17226. return $core.withContext(function($ctx4) {
  17227. $recv(str)._printSymbol_($recv(each)._key());
  17228. $ctx4.sendIdx["printSymbol:"]=1;
  17229. $recv(str)._write_(" -> ");
  17230. $ctx4.sendIdx["write:"]=2;
  17231. return $recv(str)._printSymbol_($recv(each)._value());
  17232. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17233. }),(function(){
  17234. return $core.withContext(function($ctx4) {
  17235. return $recv(str)._write_(". ");
  17236. $ctx4.sendIdx["write:"]=3;
  17237. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17238. }));
  17239. $ctx3.sendIdx["do:separatedBy:"]=1;
  17240. return $recv(str)._write_("}");
  17241. $ctx3.sendIdx["write:"]=4;
  17242. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17243. }));
  17244. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17245. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  17246. return $core.withContext(function($ctx3) {
  17247. $recv(str)._write_(" - #(");
  17248. $ctx3.sendIdx["write:"]=5;
  17249. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  17250. return $core.withContext(function($ctx4) {
  17251. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  17252. $ctx4.sendIdx["write:"]=6;
  17253. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  17254. }),(function(){
  17255. return $core.withContext(function($ctx4) {
  17256. return $recv(str)._space();
  17257. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  17258. }));
  17259. return $recv(str)._write_(")");
  17260. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  17261. }));
  17262. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17263. }));
  17264. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  17265. },
  17266. args: [],
  17267. 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: ')' ] ]",
  17268. referencedClasses: ["String"],
  17269. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  17270. }),
  17271. $globals.TraitTransformation);
  17272. $core.addMethod(
  17273. $core.method({
  17274. selector: "exclusions",
  17275. protocol: "accessing",
  17276. fn: function (){
  17277. var self=this,$self=this;
  17278. return $self["@exclusions"];
  17279. },
  17280. args: [],
  17281. source: "exclusions\x0a\x09^ exclusions",
  17282. referencedClasses: [],
  17283. messageSends: []
  17284. }),
  17285. $globals.TraitTransformation);
  17286. $core.addMethod(
  17287. $core.method({
  17288. selector: "initialize",
  17289. protocol: "initialization",
  17290. fn: function (){
  17291. var self=this,$self=this;
  17292. return $core.withContext(function($ctx1) {
  17293. (
  17294. $ctx1.supercall = true,
  17295. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17296. $ctx1.supercall = false;
  17297. $self["@aliases"]=$globals.HashedCollection._newFromPairs_([]);
  17298. $self["@exclusions"]=$recv($globals.Set)._new();
  17299. $self["@trait"]=nil;
  17300. return self;
  17301. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  17302. },
  17303. args: [],
  17304. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  17305. referencedClasses: ["Set"],
  17306. messageSends: ["initialize", "new"]
  17307. }),
  17308. $globals.TraitTransformation);
  17309. $core.addMethod(
  17310. $core.method({
  17311. selector: "postCopy",
  17312. protocol: "copying",
  17313. fn: function (){
  17314. var self=this,$self=this;
  17315. return $core.withContext(function($ctx1) {
  17316. $self["@aliases"]=$recv($self["@aliases"])._copy();
  17317. $ctx1.sendIdx["copy"]=1;
  17318. $self["@exclusions"]=$recv($self["@exclusions"])._copy();
  17319. return self;
  17320. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  17321. },
  17322. args: [],
  17323. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  17324. referencedClasses: [],
  17325. messageSends: ["copy"]
  17326. }),
  17327. $globals.TraitTransformation);
  17328. $core.addMethod(
  17329. $core.method({
  17330. selector: "trait",
  17331. protocol: "accessing",
  17332. fn: function (){
  17333. var self=this,$self=this;
  17334. return $self["@trait"];
  17335. },
  17336. args: [],
  17337. source: "trait\x0a\x09^ trait",
  17338. referencedClasses: [],
  17339. messageSends: []
  17340. }),
  17341. $globals.TraitTransformation);
  17342. $core.addMethod(
  17343. $core.method({
  17344. selector: "trait:",
  17345. protocol: "accessing",
  17346. fn: function (anObject){
  17347. var self=this,$self=this;
  17348. $self["@trait"]=anObject;
  17349. return self;
  17350. },
  17351. args: ["anObject"],
  17352. source: "trait: anObject\x0a\x09trait := anObject",
  17353. referencedClasses: [],
  17354. messageSends: []
  17355. }),
  17356. $globals.TraitTransformation);
  17357. $core.addMethod(
  17358. $core.method({
  17359. selector: "fromJSON:",
  17360. protocol: "instance creation",
  17361. fn: function (aJSObject){
  17362. var self=this,$self=this;
  17363. return $core.withContext(function($ctx1) {
  17364. var $1,$4,$3,$2;
  17365. $1=(
  17366. $ctx1.supercall = true,
  17367. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17368. $ctx1.supercall = false;
  17369. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  17370. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  17371. return $globals.HashedCollection._newFromPairs_([]);
  17372. }));
  17373. $ctx1.sendIdx["at:ifAbsent:"]=1;
  17374. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  17375. $2=$recv($3)._associations();
  17376. $recv($1)._addAliases_($2);
  17377. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  17378. return [];
  17379. })));
  17380. return $recv($1)._yourself();
  17381. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.a$cls)});
  17382. },
  17383. args: ["aJSObject"],
  17384. 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",
  17385. referencedClasses: ["Smalltalk"],
  17386. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  17387. }),
  17388. $globals.TraitTransformation.a$cls);
  17389. $core.addMethod(
  17390. $core.method({
  17391. selector: "on:",
  17392. protocol: "instance creation",
  17393. fn: function (aTrait){
  17394. var self=this,$self=this;
  17395. return $core.withContext(function($ctx1) {
  17396. var $1;
  17397. $1=(
  17398. $ctx1.supercall = true,
  17399. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17400. $ctx1.supercall = false;
  17401. $recv($1)._trait_(aTrait);
  17402. return $recv($1)._yourself();
  17403. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.a$cls)});
  17404. },
  17405. args: ["aTrait"],
  17406. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  17407. referencedClasses: [],
  17408. messageSends: ["trait:", "new", "yourself"]
  17409. }),
  17410. $globals.TraitTransformation.a$cls);
  17411. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  17412. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  17413. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  17414. $core.addMethod(
  17415. $core.method({
  17416. selector: "asTraitComposition",
  17417. protocol: "*Kernel-Classes",
  17418. fn: function (){
  17419. var self=this,$self=this;
  17420. return $core.withContext(function($ctx1) {
  17421. return $self._collect_((function(each){
  17422. return $core.withContext(function($ctx2) {
  17423. return $recv(each)._asTraitTransformation();
  17424. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17425. }));
  17426. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  17427. },
  17428. args: [],
  17429. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  17430. referencedClasses: [],
  17431. messageSends: ["collect:", "asTraitTransformation"]
  17432. }),
  17433. $globals.Array);
  17434. });
  17435. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17436. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  17437. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  17438. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17439. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  17440. $core.addPackage("Kernel-Methods");
  17441. $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  17442. $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17443. $core.addClass("BlockClosure", $globals.Object, [], "Kernel-Methods");
  17444. $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 | ... ] `";
  17445. $core.addMethod(
  17446. $core.method({
  17447. selector: "applyTo:arguments:",
  17448. protocol: "evaluating",
  17449. fn: function (anObject,aCollection){
  17450. var self=this,$self=this;
  17451. return $core.withContext(function($ctx1) {
  17452. return self.apply(anObject, aCollection);
  17453. return self;
  17454. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  17455. },
  17456. args: ["anObject", "aCollection"],
  17457. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  17458. referencedClasses: [],
  17459. messageSends: []
  17460. }),
  17461. $globals.BlockClosure);
  17462. $core.addMethod(
  17463. $core.method({
  17464. selector: "asCompiledMethod:",
  17465. protocol: "converting",
  17466. fn: function (aString){
  17467. var self=this,$self=this;
  17468. return $core.withContext(function($ctx1) {
  17469. return $core.method({selector:aString, fn:self});;
  17470. return self;
  17471. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  17472. },
  17473. args: ["aString"],
  17474. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  17475. referencedClasses: [],
  17476. messageSends: []
  17477. }),
  17478. $globals.BlockClosure);
  17479. $core.addMethod(
  17480. $core.method({
  17481. selector: "compiledSource",
  17482. protocol: "accessing",
  17483. fn: function (){
  17484. var self=this,$self=this;
  17485. return $core.withContext(function($ctx1) {
  17486. return self.toString();
  17487. return self;
  17488. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  17489. },
  17490. args: [],
  17491. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  17492. referencedClasses: [],
  17493. messageSends: []
  17494. }),
  17495. $globals.BlockClosure);
  17496. $core.addMethod(
  17497. $core.method({
  17498. selector: "currySelf",
  17499. protocol: "converting",
  17500. fn: function (){
  17501. var self=this,$self=this;
  17502. return $core.withContext(function($ctx1) {
  17503. return function () {
  17504. var args = [ this ];
  17505. args.push.apply(args, arguments);
  17506. return self.apply(null, args);
  17507. }
  17508. ;
  17509. return self;
  17510. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  17511. },
  17512. args: [],
  17513. 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'>",
  17514. referencedClasses: [],
  17515. messageSends: []
  17516. }),
  17517. $globals.BlockClosure);
  17518. $core.addMethod(
  17519. $core.method({
  17520. selector: "ensure:",
  17521. protocol: "evaluating",
  17522. fn: function (aBlock){
  17523. var self=this,$self=this;
  17524. return $core.withContext(function($ctx1) {
  17525. try{return $self._value()}finally{aBlock._value()};
  17526. return self;
  17527. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  17528. },
  17529. args: ["aBlock"],
  17530. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  17531. referencedClasses: [],
  17532. messageSends: []
  17533. }),
  17534. $globals.BlockClosure);
  17535. $core.addMethod(
  17536. $core.method({
  17537. selector: "fork",
  17538. protocol: "timeout/interval",
  17539. fn: function (){
  17540. var self=this,$self=this;
  17541. return $core.withContext(function($ctx1) {
  17542. $recv($recv($globals.ForkPool)._default())._fork_(self);
  17543. return self;
  17544. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  17545. },
  17546. args: [],
  17547. source: "fork\x0a\x09ForkPool default fork: self",
  17548. referencedClasses: ["ForkPool"],
  17549. messageSends: ["fork:", "default"]
  17550. }),
  17551. $globals.BlockClosure);
  17552. $core.addMethod(
  17553. $core.method({
  17554. selector: "new",
  17555. protocol: "evaluating",
  17556. fn: function (){
  17557. var self=this,$self=this;
  17558. return $core.withContext(function($ctx1) {
  17559. return new self();
  17560. return self;
  17561. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  17562. },
  17563. args: [],
  17564. 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()'>",
  17565. referencedClasses: [],
  17566. messageSends: []
  17567. }),
  17568. $globals.BlockClosure);
  17569. $core.addMethod(
  17570. $core.method({
  17571. selector: "newValue:",
  17572. protocol: "evaluating",
  17573. fn: function (anObject){
  17574. var self=this,$self=this;
  17575. return $core.withContext(function($ctx1) {
  17576. return $self._newWithValues_([anObject]);
  17577. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  17578. },
  17579. args: ["anObject"],
  17580. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  17581. referencedClasses: [],
  17582. messageSends: ["newWithValues:"]
  17583. }),
  17584. $globals.BlockClosure);
  17585. $core.addMethod(
  17586. $core.method({
  17587. selector: "newValue:value:",
  17588. protocol: "evaluating",
  17589. fn: function (anObject,anObject2){
  17590. var self=this,$self=this;
  17591. return $core.withContext(function($ctx1) {
  17592. return $self._newWithValues_([anObject,anObject2]);
  17593. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  17594. },
  17595. args: ["anObject", "anObject2"],
  17596. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  17597. referencedClasses: [],
  17598. messageSends: ["newWithValues:"]
  17599. }),
  17600. $globals.BlockClosure);
  17601. $core.addMethod(
  17602. $core.method({
  17603. selector: "newValue:value:value:",
  17604. protocol: "evaluating",
  17605. fn: function (anObject,anObject2,anObject3){
  17606. var self=this,$self=this;
  17607. return $core.withContext(function($ctx1) {
  17608. return $self._newWithValues_([anObject,anObject2,anObject3]);
  17609. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  17610. },
  17611. args: ["anObject", "anObject2", "anObject3"],
  17612. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  17613. referencedClasses: [],
  17614. messageSends: ["newWithValues:"]
  17615. }),
  17616. $globals.BlockClosure);
  17617. $core.addMethod(
  17618. $core.method({
  17619. selector: "newWithValues:",
  17620. protocol: "evaluating",
  17621. fn: function (aCollection){
  17622. var self=this,$self=this;
  17623. return $core.withContext(function($ctx1) {
  17624. var object = Object.create(self.prototype);
  17625. var result = self.apply(object, aCollection);
  17626. return typeof result === "object" ? result : object;
  17627. ;
  17628. return self;
  17629. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  17630. },
  17631. args: ["aCollection"],
  17632. 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'>",
  17633. referencedClasses: [],
  17634. messageSends: []
  17635. }),
  17636. $globals.BlockClosure);
  17637. $core.addMethod(
  17638. $core.method({
  17639. selector: "numArgs",
  17640. protocol: "accessing",
  17641. fn: function (){
  17642. var self=this,$self=this;
  17643. return $core.withContext(function($ctx1) {
  17644. return self.length;
  17645. return self;
  17646. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  17647. },
  17648. args: [],
  17649. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  17650. referencedClasses: [],
  17651. messageSends: []
  17652. }),
  17653. $globals.BlockClosure);
  17654. $core.addMethod(
  17655. $core.method({
  17656. selector: "on:do:",
  17657. protocol: "error handling",
  17658. fn: function (anErrorClass,aBlock){
  17659. var self=this,$self=this;
  17660. return $core.withContext(function($ctx1) {
  17661. var $1;
  17662. return $self._tryCatch_((function(error){
  17663. var smalltalkError;
  17664. return $core.withContext(function($ctx2) {
  17665. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  17666. smalltalkError;
  17667. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  17668. if($core.assert($1)){
  17669. return $recv(aBlock)._value_(smalltalkError);
  17670. } else {
  17671. return $recv(smalltalkError)._resignal();
  17672. }
  17673. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  17674. }));
  17675. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  17676. },
  17677. args: ["anErrorClass", "aBlock"],
  17678. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
  17679. referencedClasses: ["Smalltalk"],
  17680. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  17681. }),
  17682. $globals.BlockClosure);
  17683. $core.addMethod(
  17684. $core.method({
  17685. selector: "receiver",
  17686. protocol: "accessing",
  17687. fn: function (){
  17688. var self=this,$self=this;
  17689. return nil;
  17690. },
  17691. args: [],
  17692. source: "receiver\x0a\x09^ nil",
  17693. referencedClasses: [],
  17694. messageSends: []
  17695. }),
  17696. $globals.BlockClosure);
  17697. $core.addMethod(
  17698. $core.method({
  17699. selector: "timeToRun",
  17700. protocol: "evaluating",
  17701. fn: function (){
  17702. var self=this,$self=this;
  17703. return $core.withContext(function($ctx1) {
  17704. return $recv($globals.Date)._millisecondsToRun_(self);
  17705. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  17706. },
  17707. args: [],
  17708. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  17709. referencedClasses: ["Date"],
  17710. messageSends: ["millisecondsToRun:"]
  17711. }),
  17712. $globals.BlockClosure);
  17713. $core.addMethod(
  17714. $core.method({
  17715. selector: "tryCatch:",
  17716. protocol: "error handling",
  17717. fn: function (aBlock){
  17718. var self=this,$self=this;
  17719. return $core.withContext(function($ctx1) {
  17720. try {
  17721. return $self._value();
  17722. } catch(error) {
  17723. // pass non-local returns undetected
  17724. if (Array.isArray(error) && error.length === 1) throw error;
  17725. return aBlock._value_(error);
  17726. }
  17727. ;
  17728. return self;
  17729. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  17730. },
  17731. args: ["aBlock"],
  17732. 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'>",
  17733. referencedClasses: [],
  17734. messageSends: []
  17735. }),
  17736. $globals.BlockClosure);
  17737. $core.addMethod(
  17738. $core.method({
  17739. selector: "value",
  17740. protocol: "evaluating",
  17741. fn: function (){
  17742. var self=this,$self=this;
  17743. return $core.withContext(function($ctx1) {
  17744. return self();;
  17745. return self;
  17746. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  17747. },
  17748. args: [],
  17749. source: "value\x0a\x09<inlineJS: 'return self();'>",
  17750. referencedClasses: [],
  17751. messageSends: []
  17752. }),
  17753. $globals.BlockClosure);
  17754. $core.addMethod(
  17755. $core.method({
  17756. selector: "value:",
  17757. protocol: "evaluating",
  17758. fn: function (anArg){
  17759. var self=this,$self=this;
  17760. return $core.withContext(function($ctx1) {
  17761. return self(anArg);;
  17762. return self;
  17763. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  17764. },
  17765. args: ["anArg"],
  17766. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  17767. referencedClasses: [],
  17768. messageSends: []
  17769. }),
  17770. $globals.BlockClosure);
  17771. $core.addMethod(
  17772. $core.method({
  17773. selector: "value:value:",
  17774. protocol: "evaluating",
  17775. fn: function (firstArg,secondArg){
  17776. var self=this,$self=this;
  17777. return $core.withContext(function($ctx1) {
  17778. return self(firstArg, secondArg);;
  17779. return self;
  17780. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  17781. },
  17782. args: ["firstArg", "secondArg"],
  17783. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  17784. referencedClasses: [],
  17785. messageSends: []
  17786. }),
  17787. $globals.BlockClosure);
  17788. $core.addMethod(
  17789. $core.method({
  17790. selector: "value:value:value:",
  17791. protocol: "evaluating",
  17792. fn: function (firstArg,secondArg,thirdArg){
  17793. var self=this,$self=this;
  17794. return $core.withContext(function($ctx1) {
  17795. return self(firstArg, secondArg, thirdArg);;
  17796. return self;
  17797. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  17798. },
  17799. args: ["firstArg", "secondArg", "thirdArg"],
  17800. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  17801. referencedClasses: [],
  17802. messageSends: []
  17803. }),
  17804. $globals.BlockClosure);
  17805. $core.addMethod(
  17806. $core.method({
  17807. selector: "valueWithInterval:",
  17808. protocol: "timeout/interval",
  17809. fn: function (aNumber){
  17810. var self=this,$self=this;
  17811. return $core.withContext(function($ctx1) {
  17812. var interval = setInterval(self, aNumber);
  17813. return $globals.Timeout._on_(interval);
  17814. ;
  17815. return self;
  17816. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  17817. },
  17818. args: ["aNumber"],
  17819. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  17820. referencedClasses: [],
  17821. messageSends: []
  17822. }),
  17823. $globals.BlockClosure);
  17824. $core.addMethod(
  17825. $core.method({
  17826. selector: "valueWithPossibleArguments:",
  17827. protocol: "evaluating",
  17828. fn: function (aCollection){
  17829. var self=this,$self=this;
  17830. return $core.withContext(function($ctx1) {
  17831. return self.apply(null, aCollection);;
  17832. return self;
  17833. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  17834. },
  17835. args: ["aCollection"],
  17836. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  17837. referencedClasses: [],
  17838. messageSends: []
  17839. }),
  17840. $globals.BlockClosure);
  17841. $core.addMethod(
  17842. $core.method({
  17843. selector: "valueWithTimeout:",
  17844. protocol: "timeout/interval",
  17845. fn: function (aNumber){
  17846. var self=this,$self=this;
  17847. return $core.withContext(function($ctx1) {
  17848. var timeout = setTimeout(self, aNumber);
  17849. return $globals.Timeout._on_(timeout);
  17850. ;
  17851. return self;
  17852. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  17853. },
  17854. args: ["aNumber"],
  17855. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  17856. referencedClasses: [],
  17857. messageSends: []
  17858. }),
  17859. $globals.BlockClosure);
  17860. $core.addMethod(
  17861. $core.method({
  17862. selector: "whileFalse",
  17863. protocol: "controlling",
  17864. fn: function (){
  17865. var self=this,$self=this;
  17866. return $core.withContext(function($ctx1) {
  17867. $self._whileFalse_((function(){
  17868. }));
  17869. return self;
  17870. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  17871. },
  17872. args: [],
  17873. source: "whileFalse\x0a\x09self whileFalse: []",
  17874. referencedClasses: [],
  17875. messageSends: ["whileFalse:"]
  17876. }),
  17877. $globals.BlockClosure);
  17878. $core.addMethod(
  17879. $core.method({
  17880. selector: "whileFalse:",
  17881. protocol: "controlling",
  17882. fn: function (aBlock){
  17883. var self=this,$self=this;
  17884. return $core.withContext(function($ctx1) {
  17885. while(!$core.assert($self._value())) {aBlock._value()};
  17886. return self;
  17887. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  17888. },
  17889. args: ["aBlock"],
  17890. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  17891. referencedClasses: [],
  17892. messageSends: []
  17893. }),
  17894. $globals.BlockClosure);
  17895. $core.addMethod(
  17896. $core.method({
  17897. selector: "whileTrue",
  17898. protocol: "controlling",
  17899. fn: function (){
  17900. var self=this,$self=this;
  17901. return $core.withContext(function($ctx1) {
  17902. $self._whileTrue_((function(){
  17903. }));
  17904. return self;
  17905. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  17906. },
  17907. args: [],
  17908. source: "whileTrue\x0a\x09self whileTrue: []",
  17909. referencedClasses: [],
  17910. messageSends: ["whileTrue:"]
  17911. }),
  17912. $globals.BlockClosure);
  17913. $core.addMethod(
  17914. $core.method({
  17915. selector: "whileTrue:",
  17916. protocol: "controlling",
  17917. fn: function (aBlock){
  17918. var self=this,$self=this;
  17919. return $core.withContext(function($ctx1) {
  17920. while($core.assert($self._value())) {aBlock._value()};
  17921. return self;
  17922. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  17923. },
  17924. args: ["aBlock"],
  17925. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  17926. referencedClasses: [],
  17927. messageSends: []
  17928. }),
  17929. $globals.BlockClosure);
  17930. $core.addClass("CompiledMethod", $globals.Object, [], "Kernel-Methods");
  17931. $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";
  17932. $core.addMethod(
  17933. $core.method({
  17934. selector: "arguments",
  17935. protocol: "accessing",
  17936. fn: function (){
  17937. var self=this,$self=this;
  17938. return $core.withContext(function($ctx1) {
  17939. return self.args || [];
  17940. return self;
  17941. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  17942. },
  17943. args: [],
  17944. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  17945. referencedClasses: [],
  17946. messageSends: []
  17947. }),
  17948. $globals.CompiledMethod);
  17949. $core.addMethod(
  17950. $core.method({
  17951. selector: "browse",
  17952. protocol: "browsing",
  17953. fn: function (){
  17954. var self=this,$self=this;
  17955. return $core.withContext(function($ctx1) {
  17956. $recv($globals.Finder)._findMethod_(self);
  17957. return self;
  17958. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  17959. },
  17960. args: [],
  17961. source: "browse\x0a\x09Finder findMethod: self",
  17962. referencedClasses: ["Finder"],
  17963. messageSends: ["findMethod:"]
  17964. }),
  17965. $globals.CompiledMethod);
  17966. $core.addMethod(
  17967. $core.method({
  17968. selector: "category",
  17969. protocol: "accessing",
  17970. fn: function (){
  17971. var self=this,$self=this;
  17972. return $core.withContext(function($ctx1) {
  17973. return $self._protocol();
  17974. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  17975. },
  17976. args: [],
  17977. source: "category\x0a\x09^ self protocol",
  17978. referencedClasses: [],
  17979. messageSends: ["protocol"]
  17980. }),
  17981. $globals.CompiledMethod);
  17982. $core.addMethod(
  17983. $core.method({
  17984. selector: "defaultProtocol",
  17985. protocol: "defaults",
  17986. fn: function (){
  17987. var self=this,$self=this;
  17988. return "as yet unclassified";
  17989. },
  17990. args: [],
  17991. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  17992. referencedClasses: [],
  17993. messageSends: []
  17994. }),
  17995. $globals.CompiledMethod);
  17996. $core.addMethod(
  17997. $core.method({
  17998. selector: "fn",
  17999. protocol: "accessing",
  18000. fn: function (){
  18001. var self=this,$self=this;
  18002. return $core.withContext(function($ctx1) {
  18003. return $self._basicAt_("fn");
  18004. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  18005. },
  18006. args: [],
  18007. source: "fn\x0a\x09^ self basicAt: 'fn'",
  18008. referencedClasses: [],
  18009. messageSends: ["basicAt:"]
  18010. }),
  18011. $globals.CompiledMethod);
  18012. $core.addMethod(
  18013. $core.method({
  18014. selector: "fn:",
  18015. protocol: "accessing",
  18016. fn: function (aBlock){
  18017. var self=this,$self=this;
  18018. return $core.withContext(function($ctx1) {
  18019. $self._basicAt_put_("fn",aBlock);
  18020. return self;
  18021. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  18022. },
  18023. args: ["aBlock"],
  18024. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  18025. referencedClasses: [],
  18026. messageSends: ["basicAt:put:"]
  18027. }),
  18028. $globals.CompiledMethod);
  18029. $core.addMethod(
  18030. $core.method({
  18031. selector: "isCompiledMethod",
  18032. protocol: "testing",
  18033. fn: function (){
  18034. var self=this,$self=this;
  18035. return true;
  18036. },
  18037. args: [],
  18038. source: "isCompiledMethod\x0a\x09^ true",
  18039. referencedClasses: [],
  18040. messageSends: []
  18041. }),
  18042. $globals.CompiledMethod);
  18043. $core.addMethod(
  18044. $core.method({
  18045. selector: "isOverridden",
  18046. protocol: "testing",
  18047. fn: function (){
  18048. var self=this,$self=this;
  18049. var selector;
  18050. return $core.withContext(function($ctx1) {
  18051. var $1;
  18052. var $early={};
  18053. try {
  18054. selector=$self._selector();
  18055. $recv($self._methodClass())._allSubclassesDo_((function(each){
  18056. return $core.withContext(function($ctx2) {
  18057. $1=$recv(each)._includesSelector_(selector);
  18058. if($core.assert($1)){
  18059. throw $early=[true];
  18060. }
  18061. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18062. }));
  18063. return false;
  18064. }
  18065. catch(e) {if(e===$early)return e[0]; throw e}
  18066. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  18067. },
  18068. args: [],
  18069. 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",
  18070. referencedClasses: [],
  18071. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  18072. }),
  18073. $globals.CompiledMethod);
  18074. $core.addMethod(
  18075. $core.method({
  18076. selector: "isOverride",
  18077. protocol: "testing",
  18078. fn: function (){
  18079. var self=this,$self=this;
  18080. var superclass;
  18081. return $core.withContext(function($ctx1) {
  18082. var $1,$2,$receiver;
  18083. $1=$self._methodClass();
  18084. $ctx1.sendIdx["methodClass"]=1;
  18085. superclass=$recv($1)._superclass();
  18086. $ctx1.sendIdx["superclass"]=1;
  18087. $2=superclass;
  18088. if(($receiver = $2) == null || $receiver.a$nil){
  18089. return false;
  18090. } else {
  18091. $2;
  18092. }
  18093. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  18094. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  18095. },
  18096. args: [],
  18097. 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",
  18098. referencedClasses: [],
  18099. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  18100. }),
  18101. $globals.CompiledMethod);
  18102. $core.addMethod(
  18103. $core.method({
  18104. selector: "messageSends",
  18105. protocol: "accessing",
  18106. fn: function (){
  18107. var self=this,$self=this;
  18108. return $core.withContext(function($ctx1) {
  18109. return $self._basicAt_("messageSends");
  18110. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  18111. },
  18112. args: [],
  18113. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  18114. referencedClasses: [],
  18115. messageSends: ["basicAt:"]
  18116. }),
  18117. $globals.CompiledMethod);
  18118. $core.addMethod(
  18119. $core.method({
  18120. selector: "methodClass",
  18121. protocol: "accessing",
  18122. fn: function (){
  18123. var self=this,$self=this;
  18124. return $core.withContext(function($ctx1) {
  18125. return $self._basicAt_("methodClass");
  18126. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  18127. },
  18128. args: [],
  18129. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  18130. referencedClasses: [],
  18131. messageSends: ["basicAt:"]
  18132. }),
  18133. $globals.CompiledMethod);
  18134. $core.addMethod(
  18135. $core.method({
  18136. selector: "package",
  18137. protocol: "accessing",
  18138. fn: function (){
  18139. var self=this,$self=this;
  18140. return $core.withContext(function($ctx1) {
  18141. var $1,$receiver;
  18142. $1=$self._methodClass();
  18143. if(($receiver = $1) == null || $receiver.a$nil){
  18144. return $1;
  18145. } else {
  18146. var class_;
  18147. class_=$receiver;
  18148. return $recv(class_)._packageOfProtocol_($self._protocol());
  18149. }
  18150. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  18151. },
  18152. args: [],
  18153. 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 ]",
  18154. referencedClasses: [],
  18155. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  18156. }),
  18157. $globals.CompiledMethod);
  18158. $core.addMethod(
  18159. $core.method({
  18160. selector: "protocol",
  18161. protocol: "accessing",
  18162. fn: function (){
  18163. var self=this,$self=this;
  18164. return $core.withContext(function($ctx1) {
  18165. var $1,$receiver;
  18166. $1=$self._basicAt_("protocol");
  18167. if(($receiver = $1) == null || $receiver.a$nil){
  18168. return $self._defaultProtocol();
  18169. } else {
  18170. return $1;
  18171. }
  18172. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  18173. },
  18174. args: [],
  18175. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  18176. referencedClasses: [],
  18177. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  18178. }),
  18179. $globals.CompiledMethod);
  18180. $core.addMethod(
  18181. $core.method({
  18182. selector: "protocol:",
  18183. protocol: "accessing",
  18184. fn: function (aString){
  18185. var self=this,$self=this;
  18186. var oldProtocol;
  18187. return $core.withContext(function($ctx1) {
  18188. var $1,$3,$2,$4,$receiver;
  18189. oldProtocol=$self._protocol();
  18190. $self._basicAt_put_("protocol",aString);
  18191. $1=$recv($globals.SystemAnnouncer)._current();
  18192. $3=$recv($globals.MethodMoved)._new();
  18193. $recv($3)._method_(self);
  18194. $recv($3)._oldProtocol_(oldProtocol);
  18195. $2=$recv($3)._yourself();
  18196. $recv($1)._announce_($2);
  18197. $4=$self._methodClass();
  18198. if(($receiver = $4) == null || $receiver.a$nil){
  18199. $4;
  18200. } else {
  18201. var methodClass;
  18202. methodClass=$receiver;
  18203. $recv($recv(methodClass)._organization())._addElement_(aString);
  18204. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  18205. }
  18206. return self;
  18207. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  18208. },
  18209. args: ["aString"],
  18210. 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 ]",
  18211. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  18212. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  18213. }),
  18214. $globals.CompiledMethod);
  18215. $core.addMethod(
  18216. $core.method({
  18217. selector: "referencedClasses",
  18218. protocol: "accessing",
  18219. fn: function (){
  18220. var self=this,$self=this;
  18221. return $core.withContext(function($ctx1) {
  18222. return $self._basicAt_("referencedClasses");
  18223. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  18224. },
  18225. args: [],
  18226. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  18227. referencedClasses: [],
  18228. messageSends: ["basicAt:"]
  18229. }),
  18230. $globals.CompiledMethod);
  18231. $core.addMethod(
  18232. $core.method({
  18233. selector: "selector",
  18234. protocol: "accessing",
  18235. fn: function (){
  18236. var self=this,$self=this;
  18237. return $core.withContext(function($ctx1) {
  18238. return $self._basicAt_("selector");
  18239. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  18240. },
  18241. args: [],
  18242. source: "selector\x0a\x09^ self basicAt: 'selector'",
  18243. referencedClasses: [],
  18244. messageSends: ["basicAt:"]
  18245. }),
  18246. $globals.CompiledMethod);
  18247. $core.addMethod(
  18248. $core.method({
  18249. selector: "selector:",
  18250. protocol: "accessing",
  18251. fn: function (aString){
  18252. var self=this,$self=this;
  18253. return $core.withContext(function($ctx1) {
  18254. $self._basicAt_put_("selector",aString);
  18255. return self;
  18256. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  18257. },
  18258. args: ["aString"],
  18259. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  18260. referencedClasses: [],
  18261. messageSends: ["basicAt:put:"]
  18262. }),
  18263. $globals.CompiledMethod);
  18264. $core.addMethod(
  18265. $core.method({
  18266. selector: "sendTo:arguments:",
  18267. protocol: "evaluating",
  18268. fn: function (anObject,aCollection){
  18269. var self=this,$self=this;
  18270. return $core.withContext(function($ctx1) {
  18271. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  18272. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  18273. },
  18274. args: ["anObject", "aCollection"],
  18275. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  18276. referencedClasses: [],
  18277. messageSends: ["applyTo:arguments:", "fn"]
  18278. }),
  18279. $globals.CompiledMethod);
  18280. $core.addMethod(
  18281. $core.method({
  18282. selector: "source",
  18283. protocol: "accessing",
  18284. fn: function (){
  18285. var self=this,$self=this;
  18286. return $core.withContext(function($ctx1) {
  18287. var $1,$receiver;
  18288. $1=$self._basicAt_("source");
  18289. if(($receiver = $1) == null || $receiver.a$nil){
  18290. return "";
  18291. } else {
  18292. return $1;
  18293. }
  18294. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  18295. },
  18296. args: [],
  18297. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  18298. referencedClasses: [],
  18299. messageSends: ["ifNil:", "basicAt:"]
  18300. }),
  18301. $globals.CompiledMethod);
  18302. $core.addMethod(
  18303. $core.method({
  18304. selector: "source:",
  18305. protocol: "accessing",
  18306. fn: function (aString){
  18307. var self=this,$self=this;
  18308. return $core.withContext(function($ctx1) {
  18309. $self._basicAt_put_("source",aString);
  18310. return self;
  18311. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  18312. },
  18313. args: ["aString"],
  18314. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  18315. referencedClasses: [],
  18316. messageSends: ["basicAt:put:"]
  18317. }),
  18318. $globals.CompiledMethod);
  18319. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  18320. $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`";
  18321. $core.addMethod(
  18322. $core.method({
  18323. selector: "addWorker",
  18324. protocol: "private",
  18325. fn: function (){
  18326. var self=this,$self=this;
  18327. return $core.withContext(function($ctx1) {
  18328. $recv($self["@worker"])._valueWithTimeout_((0));
  18329. $self["@poolSize"]=$recv($self["@poolSize"]).__plus((1));
  18330. return self;
  18331. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  18332. },
  18333. args: [],
  18334. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  18335. referencedClasses: [],
  18336. messageSends: ["valueWithTimeout:", "+"]
  18337. }),
  18338. $globals.ForkPool);
  18339. $core.addMethod(
  18340. $core.method({
  18341. selector: "defaultMaxPoolSize",
  18342. protocol: "defaults",
  18343. fn: function (){
  18344. var self=this,$self=this;
  18345. return $core.withContext(function($ctx1) {
  18346. return $recv($self._class())._defaultMaxPoolSize();
  18347. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  18348. },
  18349. args: [],
  18350. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  18351. referencedClasses: [],
  18352. messageSends: ["defaultMaxPoolSize", "class"]
  18353. }),
  18354. $globals.ForkPool);
  18355. $core.addMethod(
  18356. $core.method({
  18357. selector: "fork:",
  18358. protocol: "actions",
  18359. fn: function (aBlock){
  18360. var self=this,$self=this;
  18361. return $core.withContext(function($ctx1) {
  18362. var $1;
  18363. $1=$recv($self["@poolSize"]).__lt($self._maxPoolSize());
  18364. if($core.assert($1)){
  18365. $self._addWorker();
  18366. }
  18367. $recv($self["@queue"])._nextPut_(aBlock);
  18368. return self;
  18369. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  18370. },
  18371. args: ["aBlock"],
  18372. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  18373. referencedClasses: [],
  18374. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  18375. }),
  18376. $globals.ForkPool);
  18377. $core.addMethod(
  18378. $core.method({
  18379. selector: "initialize",
  18380. protocol: "initialization",
  18381. fn: function (){
  18382. var self=this,$self=this;
  18383. return $core.withContext(function($ctx1) {
  18384. (
  18385. $ctx1.supercall = true,
  18386. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18387. $ctx1.supercall = false;
  18388. $self["@poolSize"]=(0);
  18389. $self["@queue"]=$recv($globals.Queue)._new();
  18390. $self["@worker"]=$self._makeWorker();
  18391. return self;
  18392. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  18393. },
  18394. args: [],
  18395. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  18396. referencedClasses: ["Queue"],
  18397. messageSends: ["initialize", "new", "makeWorker"]
  18398. }),
  18399. $globals.ForkPool);
  18400. $core.addMethod(
  18401. $core.method({
  18402. selector: "makeWorker",
  18403. protocol: "initialization",
  18404. fn: function (){
  18405. var self=this,$self=this;
  18406. var sentinel;
  18407. return $core.withContext(function($ctx1) {
  18408. var $1;
  18409. sentinel=$recv($globals.Object)._new();
  18410. return (function(){
  18411. var block;
  18412. return $core.withContext(function($ctx2) {
  18413. $self["@poolSize"]=$recv($self["@poolSize"]).__minus((1));
  18414. $self["@poolSize"];
  18415. block=$recv($self["@queue"])._nextIfAbsent_((function(){
  18416. return sentinel;
  18417. }));
  18418. block;
  18419. $1=$recv(block).__eq_eq(sentinel);
  18420. if(!$core.assert($1)){
  18421. return $recv((function(){
  18422. return $core.withContext(function($ctx3) {
  18423. return $recv(block)._value();
  18424. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  18425. }))._ensure_((function(){
  18426. return $core.withContext(function($ctx3) {
  18427. return $self._addWorker();
  18428. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  18429. }));
  18430. }
  18431. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  18432. });
  18433. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  18434. },
  18435. args: [],
  18436. 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 ] ]]",
  18437. referencedClasses: ["Object"],
  18438. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  18439. }),
  18440. $globals.ForkPool);
  18441. $core.addMethod(
  18442. $core.method({
  18443. selector: "maxPoolSize",
  18444. protocol: "accessing",
  18445. fn: function (){
  18446. var self=this,$self=this;
  18447. return $core.withContext(function($ctx1) {
  18448. var $1,$receiver;
  18449. $1=$self["@maxPoolSize"];
  18450. if(($receiver = $1) == null || $receiver.a$nil){
  18451. return $self._defaultMaxPoolSize();
  18452. } else {
  18453. return $1;
  18454. }
  18455. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  18456. },
  18457. args: [],
  18458. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  18459. referencedClasses: [],
  18460. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  18461. }),
  18462. $globals.ForkPool);
  18463. $core.addMethod(
  18464. $core.method({
  18465. selector: "maxPoolSize:",
  18466. protocol: "accessing",
  18467. fn: function (anInteger){
  18468. var self=this,$self=this;
  18469. $self["@maxPoolSize"]=anInteger;
  18470. return self;
  18471. },
  18472. args: ["anInteger"],
  18473. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  18474. referencedClasses: [],
  18475. messageSends: []
  18476. }),
  18477. $globals.ForkPool);
  18478. $globals.ForkPool.a$cls.iVarNames = ["default"];
  18479. $core.addMethod(
  18480. $core.method({
  18481. selector: "default",
  18482. protocol: "accessing",
  18483. fn: function (){
  18484. var self=this,$self=this;
  18485. return $core.withContext(function($ctx1) {
  18486. var $1,$receiver;
  18487. $1=$self["@default"];
  18488. if(($receiver = $1) == null || $receiver.a$nil){
  18489. $self["@default"]=$self._new();
  18490. return $self["@default"];
  18491. } else {
  18492. return $1;
  18493. }
  18494. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.a$cls)});
  18495. },
  18496. args: [],
  18497. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  18498. referencedClasses: [],
  18499. messageSends: ["ifNil:", "new"]
  18500. }),
  18501. $globals.ForkPool.a$cls);
  18502. $core.addMethod(
  18503. $core.method({
  18504. selector: "defaultMaxPoolSize",
  18505. protocol: "accessing",
  18506. fn: function (){
  18507. var self=this,$self=this;
  18508. return (100);
  18509. },
  18510. args: [],
  18511. source: "defaultMaxPoolSize\x0a\x09^ 100",
  18512. referencedClasses: [],
  18513. messageSends: []
  18514. }),
  18515. $globals.ForkPool.a$cls);
  18516. $core.addMethod(
  18517. $core.method({
  18518. selector: "resetDefault",
  18519. protocol: "accessing",
  18520. fn: function (){
  18521. var self=this,$self=this;
  18522. $self["@default"]=nil;
  18523. return self;
  18524. },
  18525. args: [],
  18526. source: "resetDefault\x0a\x09default := nil",
  18527. referencedClasses: [],
  18528. messageSends: []
  18529. }),
  18530. $globals.ForkPool.a$cls);
  18531. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  18532. $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.";
  18533. $core.addMethod(
  18534. $core.method({
  18535. selector: "arguments",
  18536. protocol: "accessing",
  18537. fn: function (){
  18538. var self=this,$self=this;
  18539. return $self["@arguments"];
  18540. },
  18541. args: [],
  18542. source: "arguments\x0a\x09^ arguments",
  18543. referencedClasses: [],
  18544. messageSends: []
  18545. }),
  18546. $globals.Message);
  18547. $core.addMethod(
  18548. $core.method({
  18549. selector: "arguments:",
  18550. protocol: "accessing",
  18551. fn: function (anArray){
  18552. var self=this,$self=this;
  18553. $self["@arguments"]=anArray;
  18554. return self;
  18555. },
  18556. args: ["anArray"],
  18557. source: "arguments: anArray\x0a\x09arguments := anArray",
  18558. referencedClasses: [],
  18559. messageSends: []
  18560. }),
  18561. $globals.Message);
  18562. $core.addMethod(
  18563. $core.method({
  18564. selector: "printOn:",
  18565. protocol: "printing",
  18566. fn: function (aStream){
  18567. var self=this,$self=this;
  18568. return $core.withContext(function($ctx1) {
  18569. (
  18570. $ctx1.supercall = true,
  18571. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18572. $ctx1.supercall = false;
  18573. $recv(aStream)._nextPutAll_("(");
  18574. $ctx1.sendIdx["nextPutAll:"]=1;
  18575. $recv(aStream)._nextPutAll_($self._selector());
  18576. $ctx1.sendIdx["nextPutAll:"]=2;
  18577. $recv(aStream)._nextPutAll_(")");
  18578. return self;
  18579. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  18580. },
  18581. args: ["aStream"],
  18582. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18583. referencedClasses: [],
  18584. messageSends: ["printOn:", "nextPutAll:", "selector"]
  18585. }),
  18586. $globals.Message);
  18587. $core.addMethod(
  18588. $core.method({
  18589. selector: "selector",
  18590. protocol: "accessing",
  18591. fn: function (){
  18592. var self=this,$self=this;
  18593. return $self["@selector"];
  18594. },
  18595. args: [],
  18596. source: "selector\x0a\x09^ selector",
  18597. referencedClasses: [],
  18598. messageSends: []
  18599. }),
  18600. $globals.Message);
  18601. $core.addMethod(
  18602. $core.method({
  18603. selector: "selector:",
  18604. protocol: "accessing",
  18605. fn: function (aString){
  18606. var self=this,$self=this;
  18607. $self["@selector"]=aString;
  18608. return self;
  18609. },
  18610. args: ["aString"],
  18611. source: "selector: aString\x0a\x09selector := aString",
  18612. referencedClasses: [],
  18613. messageSends: []
  18614. }),
  18615. $globals.Message);
  18616. $core.addMethod(
  18617. $core.method({
  18618. selector: "sendTo:",
  18619. protocol: "actions",
  18620. fn: function (anObject){
  18621. var self=this,$self=this;
  18622. return $core.withContext(function($ctx1) {
  18623. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  18624. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  18625. },
  18626. args: ["anObject"],
  18627. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  18628. referencedClasses: [],
  18629. messageSends: ["perform:withArguments:", "selector", "arguments"]
  18630. }),
  18631. $globals.Message);
  18632. $core.addMethod(
  18633. $core.method({
  18634. selector: "selector:arguments:",
  18635. protocol: "instance creation",
  18636. fn: function (aString,anArray){
  18637. var self=this,$self=this;
  18638. return $core.withContext(function($ctx1) {
  18639. var $1;
  18640. $1=$self._new();
  18641. $recv($1)._selector_(aString);
  18642. $recv($1)._arguments_(anArray);
  18643. return $recv($1)._yourself();
  18644. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.a$cls)});
  18645. },
  18646. args: ["aString", "anArray"],
  18647. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  18648. referencedClasses: [],
  18649. messageSends: ["selector:", "new", "arguments:", "yourself"]
  18650. }),
  18651. $globals.Message.a$cls);
  18652. $core.addMethod(
  18653. $core.method({
  18654. selector: "selector:arguments:notUnderstoodBy:",
  18655. protocol: "dnu handling",
  18656. fn: function (aString,anArray,anObject){
  18657. var self=this,$self=this;
  18658. return $core.withContext(function($ctx1) {
  18659. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  18660. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject},$globals.Message.a$cls)});
  18661. },
  18662. args: ["aString", "anArray", "anObject"],
  18663. 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)",
  18664. referencedClasses: [],
  18665. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  18666. }),
  18667. $globals.Message.a$cls);
  18668. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  18669. $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.";
  18670. $core.addMethod(
  18671. $core.method({
  18672. selector: "arguments",
  18673. protocol: "accessing",
  18674. fn: function (){
  18675. var self=this,$self=this;
  18676. return $core.withContext(function($ctx1) {
  18677. return $recv($self["@message"])._arguments();
  18678. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  18679. },
  18680. args: [],
  18681. source: "arguments\x0a\x09^ message arguments",
  18682. referencedClasses: [],
  18683. messageSends: ["arguments"]
  18684. }),
  18685. $globals.MessageSend);
  18686. $core.addMethod(
  18687. $core.method({
  18688. selector: "arguments:",
  18689. protocol: "accessing",
  18690. fn: function (aCollection){
  18691. var self=this,$self=this;
  18692. return $core.withContext(function($ctx1) {
  18693. $recv($self["@message"])._arguments_(aCollection);
  18694. return self;
  18695. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  18696. },
  18697. args: ["aCollection"],
  18698. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  18699. referencedClasses: [],
  18700. messageSends: ["arguments:"]
  18701. }),
  18702. $globals.MessageSend);
  18703. $core.addMethod(
  18704. $core.method({
  18705. selector: "initialize",
  18706. protocol: "initialization",
  18707. fn: function (){
  18708. var self=this,$self=this;
  18709. return $core.withContext(function($ctx1) {
  18710. (
  18711. $ctx1.supercall = true,
  18712. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18713. $ctx1.supercall = false;
  18714. $self["@message"]=$recv($globals.Message)._new();
  18715. return self;
  18716. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  18717. },
  18718. args: [],
  18719. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  18720. referencedClasses: ["Message"],
  18721. messageSends: ["initialize", "new"]
  18722. }),
  18723. $globals.MessageSend);
  18724. $core.addMethod(
  18725. $core.method({
  18726. selector: "printOn:",
  18727. protocol: "printing",
  18728. fn: function (aStream){
  18729. var self=this,$self=this;
  18730. return $core.withContext(function($ctx1) {
  18731. (
  18732. $ctx1.supercall = true,
  18733. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18734. $ctx1.supercall = false;
  18735. $recv(aStream)._nextPutAll_("(");
  18736. $ctx1.sendIdx["nextPutAll:"]=1;
  18737. $recv(aStream)._nextPutAll_($self._receiver());
  18738. $ctx1.sendIdx["nextPutAll:"]=2;
  18739. $recv(aStream)._nextPutAll_(" >> ");
  18740. $ctx1.sendIdx["nextPutAll:"]=3;
  18741. $recv(aStream)._nextPutAll_($self._selector());
  18742. $ctx1.sendIdx["nextPutAll:"]=4;
  18743. $recv(aStream)._nextPutAll_(")");
  18744. return self;
  18745. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  18746. },
  18747. args: ["aStream"],
  18748. 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: ')'",
  18749. referencedClasses: [],
  18750. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  18751. }),
  18752. $globals.MessageSend);
  18753. $core.addMethod(
  18754. $core.method({
  18755. selector: "receiver",
  18756. protocol: "accessing",
  18757. fn: function (){
  18758. var self=this,$self=this;
  18759. return $self["@receiver"];
  18760. },
  18761. args: [],
  18762. source: "receiver\x0a\x09^ receiver",
  18763. referencedClasses: [],
  18764. messageSends: []
  18765. }),
  18766. $globals.MessageSend);
  18767. $core.addMethod(
  18768. $core.method({
  18769. selector: "receiver:",
  18770. protocol: "accessing",
  18771. fn: function (anObject){
  18772. var self=this,$self=this;
  18773. $self["@receiver"]=anObject;
  18774. return self;
  18775. },
  18776. args: ["anObject"],
  18777. source: "receiver: anObject\x0a\x09receiver := anObject",
  18778. referencedClasses: [],
  18779. messageSends: []
  18780. }),
  18781. $globals.MessageSend);
  18782. $core.addMethod(
  18783. $core.method({
  18784. selector: "selector",
  18785. protocol: "accessing",
  18786. fn: function (){
  18787. var self=this,$self=this;
  18788. return $core.withContext(function($ctx1) {
  18789. return $recv($self["@message"])._selector();
  18790. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  18791. },
  18792. args: [],
  18793. source: "selector\x0a\x09^ message selector",
  18794. referencedClasses: [],
  18795. messageSends: ["selector"]
  18796. }),
  18797. $globals.MessageSend);
  18798. $core.addMethod(
  18799. $core.method({
  18800. selector: "selector:",
  18801. protocol: "accessing",
  18802. fn: function (aString){
  18803. var self=this,$self=this;
  18804. return $core.withContext(function($ctx1) {
  18805. $recv($self["@message"])._selector_(aString);
  18806. return self;
  18807. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  18808. },
  18809. args: ["aString"],
  18810. source: "selector: aString\x0a\x09message selector: aString",
  18811. referencedClasses: [],
  18812. messageSends: ["selector:"]
  18813. }),
  18814. $globals.MessageSend);
  18815. $core.addMethod(
  18816. $core.method({
  18817. selector: "value",
  18818. protocol: "evaluating",
  18819. fn: function (){
  18820. var self=this,$self=this;
  18821. return $core.withContext(function($ctx1) {
  18822. return $recv($self["@message"])._sendTo_($self._receiver());
  18823. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  18824. },
  18825. args: [],
  18826. source: "value\x0a\x09^ message sendTo: self receiver",
  18827. referencedClasses: [],
  18828. messageSends: ["sendTo:", "receiver"]
  18829. }),
  18830. $globals.MessageSend);
  18831. $core.addMethod(
  18832. $core.method({
  18833. selector: "value:",
  18834. protocol: "evaluating",
  18835. fn: function (anObject){
  18836. var self=this,$self=this;
  18837. return $core.withContext(function($ctx1) {
  18838. var $1;
  18839. $1=$self["@message"];
  18840. $recv($1)._arguments_([anObject]);
  18841. return $recv($1)._sendTo_($self._receiver());
  18842. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  18843. },
  18844. args: ["anObject"],
  18845. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  18846. referencedClasses: [],
  18847. messageSends: ["arguments:", "sendTo:", "receiver"]
  18848. }),
  18849. $globals.MessageSend);
  18850. $core.addMethod(
  18851. $core.method({
  18852. selector: "value:value:",
  18853. protocol: "evaluating",
  18854. fn: function (firstArgument,secondArgument){
  18855. var self=this,$self=this;
  18856. return $core.withContext(function($ctx1) {
  18857. var $1;
  18858. $1=$self["@message"];
  18859. $recv($1)._arguments_([firstArgument,secondArgument]);
  18860. return $recv($1)._sendTo_($self._receiver());
  18861. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  18862. },
  18863. args: ["firstArgument", "secondArgument"],
  18864. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  18865. referencedClasses: [],
  18866. messageSends: ["arguments:", "sendTo:", "receiver"]
  18867. }),
  18868. $globals.MessageSend);
  18869. $core.addMethod(
  18870. $core.method({
  18871. selector: "value:value:value:",
  18872. protocol: "evaluating",
  18873. fn: function (firstArgument,secondArgument,thirdArgument){
  18874. var self=this,$self=this;
  18875. return $core.withContext(function($ctx1) {
  18876. var $1;
  18877. $1=$self["@message"];
  18878. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  18879. return $recv($1)._sendTo_($self._receiver());
  18880. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  18881. },
  18882. args: ["firstArgument", "secondArgument", "thirdArgument"],
  18883. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  18884. referencedClasses: [],
  18885. messageSends: ["arguments:", "sendTo:", "receiver"]
  18886. }),
  18887. $globals.MessageSend);
  18888. $core.addMethod(
  18889. $core.method({
  18890. selector: "valueWithPossibleArguments:",
  18891. protocol: "evaluating",
  18892. fn: function (aCollection){
  18893. var self=this,$self=this;
  18894. return $core.withContext(function($ctx1) {
  18895. $self._arguments_(aCollection);
  18896. return $self._value();
  18897. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  18898. },
  18899. args: ["aCollection"],
  18900. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  18901. referencedClasses: [],
  18902. messageSends: ["arguments:", "value"]
  18903. }),
  18904. $globals.MessageSend);
  18905. $core.addClass("MethodContext", $globals.Object, [], "Kernel-Methods");
  18906. $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`.";
  18907. $core.addMethod(
  18908. $core.method({
  18909. selector: "asString",
  18910. protocol: "converting",
  18911. fn: function (){
  18912. var self=this,$self=this;
  18913. return $core.withContext(function($ctx1) {
  18914. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  18915. $2=$self._isBlockContext();
  18916. if($core.assert($2)){
  18917. $3="a block (in ".__comma($recv($self._methodContext())._asString());
  18918. $ctx1.sendIdx[","]=2;
  18919. $1=$recv($3).__comma(")");
  18920. $ctx1.sendIdx[","]=1;
  18921. } else {
  18922. var methodClass;
  18923. methodClass=$recv($self._method())._methodClass();
  18924. methodClass;
  18925. $5=methodClass;
  18926. $7=$self._receiver();
  18927. $ctx1.sendIdx["receiver"]=1;
  18928. $6=$recv($7)._class();
  18929. $ctx1.sendIdx["class"]=1;
  18930. $4=$recv($5).__eq($6);
  18931. if($core.assert($4)){
  18932. $11=$self._receiver();
  18933. $ctx1.sendIdx["receiver"]=2;
  18934. $10=$recv($11)._class();
  18935. $ctx1.sendIdx["class"]=2;
  18936. $9=$recv($10)._name();
  18937. $ctx1.sendIdx["name"]=1;
  18938. $8=$recv($9).__comma(" >> ");
  18939. $ctx1.sendIdx[","]=4;
  18940. $12=$self._selector();
  18941. $ctx1.sendIdx["selector"]=1;
  18942. $1=$recv($8).__comma($12);
  18943. $ctx1.sendIdx[","]=3;
  18944. } else {
  18945. $16=$recv($recv($self._receiver())._class())._name();
  18946. $ctx1.sendIdx["name"]=2;
  18947. $15=$recv($16).__comma("(");
  18948. $14=$recv($15).__comma($recv(methodClass)._name());
  18949. $ctx1.sendIdx[","]=7;
  18950. $13=$recv($14).__comma(") >> ");
  18951. $ctx1.sendIdx[","]=6;
  18952. $1=$recv($13).__comma($self._selector());
  18953. $ctx1.sendIdx[","]=5;
  18954. }
  18955. }
  18956. return $1;
  18957. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  18958. },
  18959. args: [],
  18960. 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 ] ]",
  18961. referencedClasses: [],
  18962. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  18963. }),
  18964. $globals.MethodContext);
  18965. $core.addMethod(
  18966. $core.method({
  18967. selector: "basicReceiver",
  18968. protocol: "accessing",
  18969. fn: function (){
  18970. var self=this,$self=this;
  18971. return $core.withContext(function($ctx1) {
  18972. return self.receiver;
  18973. return self;
  18974. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  18975. },
  18976. args: [],
  18977. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  18978. referencedClasses: [],
  18979. messageSends: []
  18980. }),
  18981. $globals.MethodContext);
  18982. $core.addMethod(
  18983. $core.method({
  18984. selector: "evaluatedSelector",
  18985. protocol: "accessing",
  18986. fn: function (){
  18987. var self=this,$self=this;
  18988. return $core.withContext(function($ctx1) {
  18989. return self.evaluatedSelector;
  18990. return self;
  18991. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  18992. },
  18993. args: [],
  18994. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  18995. referencedClasses: [],
  18996. messageSends: []
  18997. }),
  18998. $globals.MethodContext);
  18999. $core.addMethod(
  19000. $core.method({
  19001. selector: "findContextSuchThat:",
  19002. protocol: "accessing",
  19003. fn: function (testBlock){
  19004. var self=this,$self=this;
  19005. var context;
  19006. return $core.withContext(function($ctx1) {
  19007. var $1;
  19008. var $early={};
  19009. try {
  19010. context=self;
  19011. $recv((function(){
  19012. return $core.withContext(function($ctx2) {
  19013. return $recv(context)._isNil();
  19014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19015. }))._whileFalse_((function(){
  19016. return $core.withContext(function($ctx2) {
  19017. $1=$recv(testBlock)._value_(context);
  19018. if($core.assert($1)){
  19019. throw $early=[context];
  19020. }
  19021. context=$recv(context)._outerContext();
  19022. return context;
  19023. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  19024. }));
  19025. return nil;
  19026. }
  19027. catch(e) {if(e===$early)return e[0]; throw e}
  19028. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  19029. },
  19030. args: ["testBlock"],
  19031. 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",
  19032. referencedClasses: [],
  19033. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  19034. }),
  19035. $globals.MethodContext);
  19036. $core.addMethod(
  19037. $core.method({
  19038. selector: "home",
  19039. protocol: "accessing",
  19040. fn: function (){
  19041. var self=this,$self=this;
  19042. return $core.withContext(function($ctx1) {
  19043. return self.homeContext;
  19044. return self;
  19045. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  19046. },
  19047. args: [],
  19048. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  19049. referencedClasses: [],
  19050. messageSends: []
  19051. }),
  19052. $globals.MethodContext);
  19053. $core.addMethod(
  19054. $core.method({
  19055. selector: "index",
  19056. protocol: "accessing",
  19057. fn: function (){
  19058. var self=this,$self=this;
  19059. return $core.withContext(function($ctx1) {
  19060. return self.index || 0;
  19061. return self;
  19062. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  19063. },
  19064. args: [],
  19065. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  19066. referencedClasses: [],
  19067. messageSends: []
  19068. }),
  19069. $globals.MethodContext);
  19070. $core.addMethod(
  19071. $core.method({
  19072. selector: "isBlockContext",
  19073. protocol: "testing",
  19074. fn: function (){
  19075. var self=this,$self=this;
  19076. return $core.withContext(function($ctx1) {
  19077. return $recv($self._selector())._isNil();
  19078. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  19079. },
  19080. args: [],
  19081. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  19082. referencedClasses: [],
  19083. messageSends: ["isNil", "selector"]
  19084. }),
  19085. $globals.MethodContext);
  19086. $core.addMethod(
  19087. $core.method({
  19088. selector: "locals",
  19089. protocol: "accessing",
  19090. fn: function (){
  19091. var self=this,$self=this;
  19092. return $core.withContext(function($ctx1) {
  19093. return self.locals || {};
  19094. return self;
  19095. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  19096. },
  19097. args: [],
  19098. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  19099. referencedClasses: [],
  19100. messageSends: []
  19101. }),
  19102. $globals.MethodContext);
  19103. $core.addMethod(
  19104. $core.method({
  19105. selector: "method",
  19106. protocol: "accessing",
  19107. fn: function (){
  19108. var self=this,$self=this;
  19109. var method,lookupClass,receiverClass,supercall;
  19110. return $core.withContext(function($ctx1) {
  19111. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  19112. $1=$self._methodContext();
  19113. $ctx1.sendIdx["methodContext"]=1;
  19114. if(($receiver = $1) == null || $receiver.a$nil){
  19115. return nil;
  19116. } else {
  19117. $1;
  19118. }
  19119. $3=$self._methodContext();
  19120. $ctx1.sendIdx["methodContext"]=2;
  19121. $2=$recv($3)._receiver();
  19122. receiverClass=$recv($2)._class();
  19123. $4=receiverClass;
  19124. $6=$self._methodContext();
  19125. $ctx1.sendIdx["methodContext"]=3;
  19126. $5=$recv($6)._selector();
  19127. $ctx1.sendIdx["selector"]=1;
  19128. method=$recv($4)._lookupSelector_($5);
  19129. $ctx1.sendIdx["lookupSelector:"]=1;
  19130. $7=$self._outerContext();
  19131. if(($receiver = $7) == null || $receiver.a$nil){
  19132. supercall=false;
  19133. } else {
  19134. var outer;
  19135. outer=$receiver;
  19136. supercall=$recv(outer)._supercall();
  19137. }
  19138. $8=supercall;
  19139. if($core.assert($8)){
  19140. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  19141. } else {
  19142. return method;
  19143. }
  19144. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  19145. },
  19146. args: [],
  19147. 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 ]",
  19148. referencedClasses: [],
  19149. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  19150. }),
  19151. $globals.MethodContext);
  19152. $core.addMethod(
  19153. $core.method({
  19154. selector: "methodContext",
  19155. protocol: "accessing",
  19156. fn: function (){
  19157. var self=this,$self=this;
  19158. return $core.withContext(function($ctx1) {
  19159. var $1,$2,$receiver;
  19160. $1=$self._isBlockContext();
  19161. if(!$core.assert($1)){
  19162. return self;
  19163. }
  19164. $2=$self._outerContext();
  19165. if(($receiver = $2) == null || $receiver.a$nil){
  19166. return $2;
  19167. } else {
  19168. var outer;
  19169. outer=$receiver;
  19170. return $recv(outer)._methodContext();
  19171. }
  19172. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  19173. },
  19174. args: [],
  19175. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  19176. referencedClasses: [],
  19177. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  19178. }),
  19179. $globals.MethodContext);
  19180. $core.addMethod(
  19181. $core.method({
  19182. selector: "outerContext",
  19183. protocol: "accessing",
  19184. fn: function (){
  19185. var self=this,$self=this;
  19186. return $core.withContext(function($ctx1) {
  19187. return self.outerContext || self.homeContext;
  19188. return self;
  19189. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  19190. },
  19191. args: [],
  19192. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  19193. referencedClasses: [],
  19194. messageSends: []
  19195. }),
  19196. $globals.MethodContext);
  19197. $core.addMethod(
  19198. $core.method({
  19199. selector: "printOn:",
  19200. protocol: "printing",
  19201. fn: function (aStream){
  19202. var self=this,$self=this;
  19203. return $core.withContext(function($ctx1) {
  19204. (
  19205. $ctx1.supercall = true,
  19206. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19207. $ctx1.supercall = false;
  19208. $recv(aStream)._nextPutAll_("(");
  19209. $ctx1.sendIdx["nextPutAll:"]=1;
  19210. $recv(aStream)._nextPutAll_($self._asString());
  19211. $ctx1.sendIdx["nextPutAll:"]=2;
  19212. $recv(aStream)._nextPutAll_(")");
  19213. return self;
  19214. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  19215. },
  19216. args: ["aStream"],
  19217. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  19218. referencedClasses: [],
  19219. messageSends: ["printOn:", "nextPutAll:", "asString"]
  19220. }),
  19221. $globals.MethodContext);
  19222. $core.addMethod(
  19223. $core.method({
  19224. selector: "receiver",
  19225. protocol: "accessing",
  19226. fn: function (){
  19227. var self=this,$self=this;
  19228. return $core.withContext(function($ctx1) {
  19229. var $2,$1;
  19230. $1=$recv($self._isBlockContext())._and_((function(){
  19231. return $core.withContext(function($ctx2) {
  19232. $2=$self._outerContext();
  19233. $ctx2.sendIdx["outerContext"]=1;
  19234. return $recv($2)._notNil();
  19235. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19236. }));
  19237. if($core.assert($1)){
  19238. return $recv($self._outerContext())._receiver();
  19239. } else {
  19240. return $self._basicReceiver();
  19241. }
  19242. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  19243. },
  19244. args: [],
  19245. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  19246. referencedClasses: [],
  19247. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  19248. }),
  19249. $globals.MethodContext);
  19250. $core.addMethod(
  19251. $core.method({
  19252. selector: "selector",
  19253. protocol: "accessing",
  19254. fn: function (){
  19255. var self=this,$self=this;
  19256. return $core.withContext(function($ctx1) {
  19257. if(self.selector) {
  19258. return $core.js2st(self.selector);
  19259. } else {
  19260. return nil;
  19261. }
  19262. ;
  19263. return self;
  19264. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  19265. },
  19266. args: [],
  19267. 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'>",
  19268. referencedClasses: [],
  19269. messageSends: []
  19270. }),
  19271. $globals.MethodContext);
  19272. $core.addMethod(
  19273. $core.method({
  19274. selector: "sendIndexAt:",
  19275. protocol: "accessing",
  19276. fn: function (aSelector){
  19277. var self=this,$self=this;
  19278. return $core.withContext(function($ctx1) {
  19279. return self.sendIdx[aSelector] || 0;
  19280. return self;
  19281. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  19282. },
  19283. args: ["aSelector"],
  19284. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  19285. referencedClasses: [],
  19286. messageSends: []
  19287. }),
  19288. $globals.MethodContext);
  19289. $core.addMethod(
  19290. $core.method({
  19291. selector: "sendIndexes",
  19292. protocol: "accessing",
  19293. fn: function (){
  19294. var self=this,$self=this;
  19295. return $core.withContext(function($ctx1) {
  19296. return self.sendIdx;
  19297. return self;
  19298. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  19299. },
  19300. args: [],
  19301. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  19302. referencedClasses: [],
  19303. messageSends: []
  19304. }),
  19305. $globals.MethodContext);
  19306. $core.addMethod(
  19307. $core.method({
  19308. selector: "stubHere",
  19309. protocol: "accessing",
  19310. fn: function (){
  19311. var self=this,$self=this;
  19312. return $core.withContext(function($ctx1) {
  19313. self.homeContext = undefined;
  19314. return self;
  19315. }, function($ctx1) {$ctx1.fill(self,"stubHere",{},$globals.MethodContext)});
  19316. },
  19317. args: [],
  19318. source: "stubHere\x0a\x09<inlineJS: 'self.homeContext = undefined'>",
  19319. referencedClasses: [],
  19320. messageSends: []
  19321. }),
  19322. $globals.MethodContext);
  19323. $core.addMethod(
  19324. $core.method({
  19325. selector: "stubToAtMost:",
  19326. protocol: "error handling",
  19327. fn: function (anInteger){
  19328. var self=this,$self=this;
  19329. var context;
  19330. return $core.withContext(function($ctx1) {
  19331. var $1,$2,$receiver;
  19332. context=self;
  19333. $recv(anInteger)._timesRepeat_((function(){
  19334. return $core.withContext(function($ctx2) {
  19335. $1=context;
  19336. if(($receiver = $1) == null || $receiver.a$nil){
  19337. context=$1;
  19338. } else {
  19339. context=$recv(context)._home();
  19340. }
  19341. return context;
  19342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19343. }));
  19344. $2=context;
  19345. if(($receiver = $2) == null || $receiver.a$nil){
  19346. $2;
  19347. } else {
  19348. $recv(context)._stubHere();
  19349. }
  19350. return self;
  19351. }, function($ctx1) {$ctx1.fill(self,"stubToAtMost:",{anInteger:anInteger,context:context},$globals.MethodContext)});
  19352. },
  19353. args: ["anInteger"],
  19354. source: "stubToAtMost: anInteger\x0a\x09| context |\x0a\x09context := self.\x0a\x09anInteger timesRepeat: [ context := context ifNotNil: [ context home ] ].\x0a\x09context ifNotNil: [ context stubHere ]",
  19355. referencedClasses: [],
  19356. messageSends: ["timesRepeat:", "ifNotNil:", "home", "stubHere"]
  19357. }),
  19358. $globals.MethodContext);
  19359. $core.addMethod(
  19360. $core.method({
  19361. selector: "supercall",
  19362. protocol: "accessing",
  19363. fn: function (){
  19364. var self=this,$self=this;
  19365. return $core.withContext(function($ctx1) {
  19366. return self.supercall == true;
  19367. return self;
  19368. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  19369. },
  19370. args: [],
  19371. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  19372. referencedClasses: [],
  19373. messageSends: []
  19374. }),
  19375. $globals.MethodContext);
  19376. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  19377. $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' ]";
  19378. $core.addMethod(
  19379. $core.method({
  19380. selector: "constructorNamed:",
  19381. protocol: "instance creation",
  19382. fn: function (aString){
  19383. var self=this,$self=this;
  19384. return $core.withContext(function($ctx1) {
  19385. var nativeFunc=(new Function('return this'))()[aString];
  19386. return new nativeFunc();
  19387. ;
  19388. return self;
  19389. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19390. },
  19391. args: ["aString"],
  19392. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19393. referencedClasses: [],
  19394. messageSends: []
  19395. }),
  19396. $globals.NativeFunction.a$cls);
  19397. $core.addMethod(
  19398. $core.method({
  19399. selector: "constructorNamed:value:",
  19400. protocol: "instance creation",
  19401. fn: function (aString,anObject){
  19402. var self=this,$self=this;
  19403. return $core.withContext(function($ctx1) {
  19404. var nativeFunc=(new Function('return this'))()[aString];
  19405. return new nativeFunc(anObject);
  19406. ;
  19407. return self;
  19408. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19409. },
  19410. args: ["aString", "anObject"],
  19411. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19412. referencedClasses: [],
  19413. messageSends: []
  19414. }),
  19415. $globals.NativeFunction.a$cls);
  19416. $core.addMethod(
  19417. $core.method({
  19418. selector: "constructorNamed:value:value:",
  19419. protocol: "instance creation",
  19420. fn: function (aString,anObject,anObject2){
  19421. var self=this,$self=this;
  19422. return $core.withContext(function($ctx1) {
  19423. var nativeFunc=(new Function('return this'))()[aString];
  19424. return new nativeFunc(anObject,anObject2);
  19425. ;
  19426. return self;
  19427. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19428. },
  19429. args: ["aString", "anObject", "anObject2"],
  19430. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19431. referencedClasses: [],
  19432. messageSends: []
  19433. }),
  19434. $globals.NativeFunction.a$cls);
  19435. $core.addMethod(
  19436. $core.method({
  19437. selector: "constructorNamed:value:value:value:",
  19438. protocol: "instance creation",
  19439. fn: function (aString,anObject,anObject2,anObject3){
  19440. var self=this,$self=this;
  19441. return $core.withContext(function($ctx1) {
  19442. var nativeFunc=(new Function('return this'))()[aString];
  19443. return new nativeFunc(anObject,anObject2, anObject3);
  19444. ;
  19445. return self;
  19446. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19447. },
  19448. args: ["aString", "anObject", "anObject2", "anObject3"],
  19449. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19450. referencedClasses: [],
  19451. messageSends: []
  19452. }),
  19453. $globals.NativeFunction.a$cls);
  19454. $core.addMethod(
  19455. $core.method({
  19456. selector: "constructorOf:",
  19457. protocol: "instance creation",
  19458. fn: function (nativeFunc){
  19459. var self=this,$self=this;
  19460. return $core.withContext(function($ctx1) {
  19461. return new nativeFunc();
  19462. ;
  19463. return self;
  19464. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19465. },
  19466. args: ["nativeFunc"],
  19467. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19468. referencedClasses: [],
  19469. messageSends: []
  19470. }),
  19471. $globals.NativeFunction.a$cls);
  19472. $core.addMethod(
  19473. $core.method({
  19474. selector: "constructorOf:value:",
  19475. protocol: "instance creation",
  19476. fn: function (nativeFunc,anObject){
  19477. var self=this,$self=this;
  19478. return $core.withContext(function($ctx1) {
  19479. return new nativeFunc(anObject);
  19480. ;
  19481. return self;
  19482. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19483. },
  19484. args: ["nativeFunc", "anObject"],
  19485. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19486. referencedClasses: [],
  19487. messageSends: []
  19488. }),
  19489. $globals.NativeFunction.a$cls);
  19490. $core.addMethod(
  19491. $core.method({
  19492. selector: "constructorOf:value:value:",
  19493. protocol: "instance creation",
  19494. fn: function (nativeFunc,anObject,anObject2){
  19495. var self=this,$self=this;
  19496. return $core.withContext(function($ctx1) {
  19497. return new nativeFunc(anObject,anObject2);
  19498. ;
  19499. return self;
  19500. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19501. },
  19502. args: ["nativeFunc", "anObject", "anObject2"],
  19503. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19504. referencedClasses: [],
  19505. messageSends: []
  19506. }),
  19507. $globals.NativeFunction.a$cls);
  19508. $core.addMethod(
  19509. $core.method({
  19510. selector: "constructorOf:value:value:value:",
  19511. protocol: "instance creation",
  19512. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19513. var self=this,$self=this;
  19514. return $core.withContext(function($ctx1) {
  19515. return new nativeFunc(anObject,anObject2, anObject3);
  19516. ;
  19517. return self;
  19518. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19519. },
  19520. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19521. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19522. referencedClasses: [],
  19523. messageSends: []
  19524. }),
  19525. $globals.NativeFunction.a$cls);
  19526. $core.addMethod(
  19527. $core.method({
  19528. selector: "exists:",
  19529. protocol: "testing",
  19530. fn: function (aString){
  19531. var self=this,$self=this;
  19532. return $core.withContext(function($ctx1) {
  19533. return $recv($globals.Smalltalk)._existsJsGlobal_(aString);
  19534. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.a$cls)});
  19535. },
  19536. args: ["aString"],
  19537. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  19538. referencedClasses: ["Smalltalk"],
  19539. messageSends: ["existsJsGlobal:"]
  19540. }),
  19541. $globals.NativeFunction.a$cls);
  19542. $core.addMethod(
  19543. $core.method({
  19544. selector: "functionNamed:",
  19545. protocol: "function calling",
  19546. fn: function (aString){
  19547. var self=this,$self=this;
  19548. return $core.withContext(function($ctx1) {
  19549. var nativeFunc=(new Function('return this'))()[aString];
  19550. return nativeFunc();
  19551. ;
  19552. return self;
  19553. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19554. },
  19555. args: ["aString"],
  19556. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19557. referencedClasses: [],
  19558. messageSends: []
  19559. }),
  19560. $globals.NativeFunction.a$cls);
  19561. $core.addMethod(
  19562. $core.method({
  19563. selector: "functionNamed:value:",
  19564. protocol: "function calling",
  19565. fn: function (aString,anObject){
  19566. var self=this,$self=this;
  19567. return $core.withContext(function($ctx1) {
  19568. var nativeFunc=(new Function('return this'))()[aString];
  19569. return nativeFunc(anObject);
  19570. ;
  19571. return self;
  19572. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19573. },
  19574. args: ["aString", "anObject"],
  19575. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19576. referencedClasses: [],
  19577. messageSends: []
  19578. }),
  19579. $globals.NativeFunction.a$cls);
  19580. $core.addMethod(
  19581. $core.method({
  19582. selector: "functionNamed:value:value:",
  19583. protocol: "function calling",
  19584. fn: function (aString,anObject,anObject2){
  19585. var self=this,$self=this;
  19586. return $core.withContext(function($ctx1) {
  19587. var nativeFunc=(new Function('return this'))()[aString];
  19588. return nativeFunc(anObject,anObject2);
  19589. ;
  19590. return self;
  19591. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19592. },
  19593. args: ["aString", "anObject", "anObject2"],
  19594. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19595. referencedClasses: [],
  19596. messageSends: []
  19597. }),
  19598. $globals.NativeFunction.a$cls);
  19599. $core.addMethod(
  19600. $core.method({
  19601. selector: "functionNamed:value:value:value:",
  19602. protocol: "function calling",
  19603. fn: function (aString,anObject,anObject2,anObject3){
  19604. var self=this,$self=this;
  19605. return $core.withContext(function($ctx1) {
  19606. var nativeFunc=(new Function('return this'))()[aString];
  19607. return nativeFunc(anObject,anObject2, anObject3);
  19608. ;
  19609. return self;
  19610. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19611. },
  19612. args: ["aString", "anObject", "anObject2", "anObject3"],
  19613. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19614. referencedClasses: [],
  19615. messageSends: []
  19616. }),
  19617. $globals.NativeFunction.a$cls);
  19618. $core.addMethod(
  19619. $core.method({
  19620. selector: "functionNamed:valueWithArgs:",
  19621. protocol: "function calling",
  19622. fn: function (aString,args){
  19623. var self=this,$self=this;
  19624. return $core.withContext(function($ctx1) {
  19625. var nativeFunc=(new Function('return this'))()[aString];
  19626. return Function.prototype.apply.call(nativeFunc, null, args);
  19627. ;
  19628. return self;
  19629. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.a$cls)});
  19630. },
  19631. args: ["aString", "args"],
  19632. source: "functionNamed: aString valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19633. referencedClasses: [],
  19634. messageSends: []
  19635. }),
  19636. $globals.NativeFunction.a$cls);
  19637. $core.addMethod(
  19638. $core.method({
  19639. selector: "functionOf:",
  19640. protocol: "function calling",
  19641. fn: function (nativeFunc){
  19642. var self=this,$self=this;
  19643. return $core.withContext(function($ctx1) {
  19644. return nativeFunc();
  19645. ;
  19646. return self;
  19647. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19648. },
  19649. args: ["nativeFunc"],
  19650. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19651. referencedClasses: [],
  19652. messageSends: []
  19653. }),
  19654. $globals.NativeFunction.a$cls);
  19655. $core.addMethod(
  19656. $core.method({
  19657. selector: "functionOf:value:",
  19658. protocol: "function calling",
  19659. fn: function (nativeFunc,anObject){
  19660. var self=this,$self=this;
  19661. return $core.withContext(function($ctx1) {
  19662. return nativeFunc(anObject);
  19663. ;
  19664. return self;
  19665. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19666. },
  19667. args: ["nativeFunc", "anObject"],
  19668. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19669. referencedClasses: [],
  19670. messageSends: []
  19671. }),
  19672. $globals.NativeFunction.a$cls);
  19673. $core.addMethod(
  19674. $core.method({
  19675. selector: "functionOf:value:value:",
  19676. protocol: "function calling",
  19677. fn: function (nativeFunc,anObject,anObject2){
  19678. var self=this,$self=this;
  19679. return $core.withContext(function($ctx1) {
  19680. return nativeFunc(anObject,anObject2);
  19681. ;
  19682. return self;
  19683. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19684. },
  19685. args: ["nativeFunc", "anObject", "anObject2"],
  19686. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19687. referencedClasses: [],
  19688. messageSends: []
  19689. }),
  19690. $globals.NativeFunction.a$cls);
  19691. $core.addMethod(
  19692. $core.method({
  19693. selector: "functionOf:value:value:value:",
  19694. protocol: "function calling",
  19695. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19696. var self=this,$self=this;
  19697. return $core.withContext(function($ctx1) {
  19698. return nativeFunc(anObject,anObject2, anObject3);
  19699. ;
  19700. return self;
  19701. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19702. },
  19703. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19704. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19705. referencedClasses: [],
  19706. messageSends: []
  19707. }),
  19708. $globals.NativeFunction.a$cls);
  19709. $core.addMethod(
  19710. $core.method({
  19711. selector: "functionOf:valueWithArgs:",
  19712. protocol: "function calling",
  19713. fn: function (nativeFunc,args){
  19714. var self=this,$self=this;
  19715. return $core.withContext(function($ctx1) {
  19716. return Function.prototype.apply.call(nativeFunc, null, args);
  19717. ;
  19718. return self;
  19719. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.a$cls)});
  19720. },
  19721. args: ["nativeFunc", "args"],
  19722. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19723. referencedClasses: [],
  19724. messageSends: []
  19725. }),
  19726. $globals.NativeFunction.a$cls);
  19727. $core.addMethod(
  19728. $core.method({
  19729. selector: "isNativeFunction:",
  19730. protocol: "testing",
  19731. fn: function (anObject){
  19732. var self=this,$self=this;
  19733. return $core.withContext(function($ctx1) {
  19734. return typeof anObject === "function";
  19735. return self;
  19736. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject},$globals.NativeFunction.a$cls)});
  19737. },
  19738. args: ["anObject"],
  19739. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  19740. referencedClasses: [],
  19741. messageSends: []
  19742. }),
  19743. $globals.NativeFunction.a$cls);
  19744. $core.addMethod(
  19745. $core.method({
  19746. selector: "methodOf:this:",
  19747. protocol: "method calling",
  19748. fn: function (nativeFunc,thisObject){
  19749. var self=this,$self=this;
  19750. return $core.withContext(function($ctx1) {
  19751. return Function.prototype.call.call(nativeFunc, thisObject);
  19752. ;
  19753. return self;
  19754. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.a$cls)});
  19755. },
  19756. args: ["nativeFunc", "thisObject"],
  19757. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  19758. referencedClasses: [],
  19759. messageSends: []
  19760. }),
  19761. $globals.NativeFunction.a$cls);
  19762. $core.addMethod(
  19763. $core.method({
  19764. selector: "methodOf:this:value:",
  19765. protocol: "method calling",
  19766. fn: function (nativeFunc,thisObject,anObject){
  19767. var self=this,$self=this;
  19768. return $core.withContext(function($ctx1) {
  19769. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  19770. ;
  19771. return self;
  19772. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.a$cls)});
  19773. },
  19774. args: ["nativeFunc", "thisObject", "anObject"],
  19775. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  19776. referencedClasses: [],
  19777. messageSends: []
  19778. }),
  19779. $globals.NativeFunction.a$cls);
  19780. $core.addMethod(
  19781. $core.method({
  19782. selector: "methodOf:this:value:value:",
  19783. protocol: "method calling",
  19784. fn: function (nativeFunc,thisObject,anObject,anObject2){
  19785. var self=this,$self=this;
  19786. return $core.withContext(function($ctx1) {
  19787. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  19788. ;
  19789. return self;
  19790. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19791. },
  19792. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  19793. 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'>",
  19794. referencedClasses: [],
  19795. messageSends: []
  19796. }),
  19797. $globals.NativeFunction.a$cls);
  19798. $core.addMethod(
  19799. $core.method({
  19800. selector: "methodOf:this:value:value:value:",
  19801. protocol: "method calling",
  19802. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  19803. var self=this,$self=this;
  19804. return $core.withContext(function($ctx1) {
  19805. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  19806. ;
  19807. return self;
  19808. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19809. },
  19810. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  19811. 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'>",
  19812. referencedClasses: [],
  19813. messageSends: []
  19814. }),
  19815. $globals.NativeFunction.a$cls);
  19816. $core.addMethod(
  19817. $core.method({
  19818. selector: "methodOf:this:valueWithArgs:",
  19819. protocol: "method calling",
  19820. fn: function (nativeFunc,thisObject,args){
  19821. var self=this,$self=this;
  19822. return $core.withContext(function($ctx1) {
  19823. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  19824. ;
  19825. return self;
  19826. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.a$cls)});
  19827. },
  19828. args: ["nativeFunc", "thisObject", "args"],
  19829. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  19830. referencedClasses: [],
  19831. messageSends: []
  19832. }),
  19833. $globals.NativeFunction.a$cls);
  19834. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  19835. $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.";
  19836. $core.addMethod(
  19837. $core.method({
  19838. selector: "clearInterval",
  19839. protocol: "timeout/interval",
  19840. fn: function (){
  19841. var self=this,$self=this;
  19842. return $core.withContext(function($ctx1) {
  19843. var interval = $self["@rawTimeout"];
  19844. clearInterval(interval);
  19845. ;
  19846. return self;
  19847. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  19848. },
  19849. args: [],
  19850. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  19851. referencedClasses: [],
  19852. messageSends: []
  19853. }),
  19854. $globals.Timeout);
  19855. $core.addMethod(
  19856. $core.method({
  19857. selector: "clearTimeout",
  19858. protocol: "timeout/interval",
  19859. fn: function (){
  19860. var self=this,$self=this;
  19861. return $core.withContext(function($ctx1) {
  19862. var timeout = $self["@rawTimeout"];
  19863. clearTimeout(timeout);
  19864. ;
  19865. return self;
  19866. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  19867. },
  19868. args: [],
  19869. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  19870. referencedClasses: [],
  19871. messageSends: []
  19872. }),
  19873. $globals.Timeout);
  19874. $core.addMethod(
  19875. $core.method({
  19876. selector: "rawTimeout:",
  19877. protocol: "accessing",
  19878. fn: function (anObject){
  19879. var self=this,$self=this;
  19880. $self["@rawTimeout"]=anObject;
  19881. return self;
  19882. },
  19883. args: ["anObject"],
  19884. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  19885. referencedClasses: [],
  19886. messageSends: []
  19887. }),
  19888. $globals.Timeout);
  19889. $core.addMethod(
  19890. $core.method({
  19891. selector: "on:",
  19892. protocol: "instance creation",
  19893. fn: function (anObject){
  19894. var self=this,$self=this;
  19895. return $core.withContext(function($ctx1) {
  19896. var $1;
  19897. $1=$self._new();
  19898. $recv($1)._rawTimeout_(anObject);
  19899. return $recv($1)._yourself();
  19900. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.a$cls)});
  19901. },
  19902. args: ["anObject"],
  19903. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  19904. referencedClasses: [],
  19905. messageSends: ["rawTimeout:", "new", "yourself"]
  19906. }),
  19907. $globals.Timeout.a$cls);
  19908. });
  19909. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  19910. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  19911. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  19912. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  19913. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  19914. $core.addPackage("Kernel-Dag");
  19915. $core.packages["Kernel-Dag"].innerEval = function (expr) { return eval(expr); };
  19916. $core.packages["Kernel-Dag"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19917. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  19918. $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:`.";
  19919. $core.addMethod(
  19920. $core.method({
  19921. selector: "value:",
  19922. protocol: "evaluating",
  19923. fn: function (anObject){
  19924. var self=this,$self=this;
  19925. return $core.withContext(function($ctx1) {
  19926. return $self._visit_(anObject);
  19927. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  19928. },
  19929. args: ["anObject"],
  19930. source: "value: anObject\x0a\x09^ self visit: anObject",
  19931. referencedClasses: [],
  19932. messageSends: ["visit:"]
  19933. }),
  19934. $globals.AbstractDagVisitor);
  19935. $core.addMethod(
  19936. $core.method({
  19937. selector: "visit:",
  19938. protocol: "visiting",
  19939. fn: function (aNode){
  19940. var self=this,$self=this;
  19941. return $core.withContext(function($ctx1) {
  19942. return $recv(aNode)._acceptDagVisitor_(self);
  19943. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  19944. },
  19945. args: ["aNode"],
  19946. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  19947. referencedClasses: [],
  19948. messageSends: ["acceptDagVisitor:"]
  19949. }),
  19950. $globals.AbstractDagVisitor);
  19951. $core.addMethod(
  19952. $core.method({
  19953. selector: "visitAll:",
  19954. protocol: "visiting",
  19955. fn: function (aCollection){
  19956. var self=this,$self=this;
  19957. return $core.withContext(function($ctx1) {
  19958. return $recv(aCollection)._collect_((function(each){
  19959. return $core.withContext(function($ctx2) {
  19960. return $self._visit_(each);
  19961. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19962. }));
  19963. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  19964. },
  19965. args: ["aCollection"],
  19966. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  19967. referencedClasses: [],
  19968. messageSends: ["collect:", "visit:"]
  19969. }),
  19970. $globals.AbstractDagVisitor);
  19971. $core.addMethod(
  19972. $core.method({
  19973. selector: "visitAllChildren:",
  19974. protocol: "visiting",
  19975. fn: function (aDagNode){
  19976. var self=this,$self=this;
  19977. return $core.withContext(function($ctx1) {
  19978. return $self._visitAll_($recv(aDagNode)._dagChildren());
  19979. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  19980. },
  19981. args: ["aDagNode"],
  19982. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  19983. referencedClasses: [],
  19984. messageSends: ["visitAll:", "dagChildren"]
  19985. }),
  19986. $globals.AbstractDagVisitor);
  19987. $core.addMethod(
  19988. $core.method({
  19989. selector: "visitDagNode:",
  19990. protocol: "visiting",
  19991. fn: function (aNode){
  19992. var self=this,$self=this;
  19993. return $core.withContext(function($ctx1) {
  19994. $self._subclassResponsibility();
  19995. return self;
  19996. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  19997. },
  19998. args: ["aNode"],
  19999. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  20000. referencedClasses: [],
  20001. messageSends: ["subclassResponsibility"]
  20002. }),
  20003. $globals.AbstractDagVisitor);
  20004. $core.addMethod(
  20005. $core.method({
  20006. selector: "visitDagNodeVariantRedux:",
  20007. protocol: "visiting",
  20008. fn: function (aNode){
  20009. var self=this,$self=this;
  20010. var newChildren,oldChildren;
  20011. return $core.withContext(function($ctx1) {
  20012. var $2,$3,$1,$4,$5;
  20013. var $early={};
  20014. try {
  20015. oldChildren=$recv(aNode)._dagChildren();
  20016. newChildren=$self._visitAllChildren_(aNode);
  20017. $2=$recv(oldChildren)._size();
  20018. $ctx1.sendIdx["size"]=1;
  20019. $3=$recv(newChildren)._size();
  20020. $ctx1.sendIdx["size"]=2;
  20021. $1=$recv($2).__eq($3);
  20022. if($core.assert($1)){
  20023. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  20024. return $core.withContext(function($ctx2) {
  20025. $4=$recv(oldChildren)._at_(i);
  20026. $ctx2.sendIdx["at:"]=1;
  20027. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  20028. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  20029. }),(function(){
  20030. throw $early=[aNode];
  20031. }));
  20032. }
  20033. $5=$recv(aNode)._copy();
  20034. $recv($5)._dagChildren_(newChildren);
  20035. return $recv($5)._yourself();
  20036. }
  20037. catch(e) {if(e===$early)return e[0]; throw e}
  20038. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  20039. },
  20040. args: ["aNode"],
  20041. 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",
  20042. referencedClasses: [],
  20043. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  20044. }),
  20045. $globals.AbstractDagVisitor);
  20046. $core.addMethod(
  20047. $core.method({
  20048. selector: "visitDagNodeVariantSimple:",
  20049. protocol: "visiting",
  20050. fn: function (aNode){
  20051. var self=this,$self=this;
  20052. return $core.withContext(function($ctx1) {
  20053. $self._visitAllChildren_(aNode);
  20054. return aNode;
  20055. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20056. },
  20057. args: ["aNode"],
  20058. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  20059. referencedClasses: [],
  20060. messageSends: ["visitAllChildren:"]
  20061. }),
  20062. $globals.AbstractDagVisitor);
  20063. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  20064. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  20065. $core.addMethod(
  20066. $core.method({
  20067. selector: "initialize",
  20068. protocol: "initialization",
  20069. fn: function (){
  20070. var self=this,$self=this;
  20071. return $core.withContext(function($ctx1) {
  20072. (
  20073. $ctx1.supercall = true,
  20074. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  20075. $ctx1.supercall = false;
  20076. $self["@path"]=[];
  20077. return self;
  20078. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  20079. },
  20080. args: [],
  20081. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  20082. referencedClasses: [],
  20083. messageSends: ["initialize"]
  20084. }),
  20085. $globals.PathDagVisitor);
  20086. $core.addMethod(
  20087. $core.method({
  20088. selector: "path",
  20089. protocol: "accessing",
  20090. fn: function (){
  20091. var self=this,$self=this;
  20092. return $self["@path"];
  20093. },
  20094. args: [],
  20095. source: "path\x0a\x09^ path",
  20096. referencedClasses: [],
  20097. messageSends: []
  20098. }),
  20099. $globals.PathDagVisitor);
  20100. $core.addMethod(
  20101. $core.method({
  20102. selector: "visit:",
  20103. protocol: "visiting",
  20104. fn: function (aNode){
  20105. var self=this,$self=this;
  20106. var oldPath,result;
  20107. return $core.withContext(function($ctx1) {
  20108. result=aNode;
  20109. oldPath=$self["@path"];
  20110. $recv((function(){
  20111. return $core.withContext(function($ctx2) {
  20112. $self["@path"]=$recv($self["@path"]).__comma([aNode]);
  20113. $self["@path"];
  20114. result=(
  20115. $ctx2.supercall = true,
  20116. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  20117. $ctx2.supercall = false;
  20118. return result;
  20119. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20120. }))._ensure_((function(){
  20121. $self["@path"]=oldPath;
  20122. return $self["@path"];
  20123. }));
  20124. return result;
  20125. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  20126. },
  20127. args: ["aNode"],
  20128. 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",
  20129. referencedClasses: [],
  20130. messageSends: ["ensure:", ",", "visit:"]
  20131. }),
  20132. $globals.PathDagVisitor);
  20133. $core.addMethod(
  20134. $core.method({
  20135. selector: "visitDagNodeVariantRedux:",
  20136. protocol: "visiting",
  20137. fn: function (aNode){
  20138. var self=this,$self=this;
  20139. var newNode;
  20140. return $core.withContext(function($ctx1) {
  20141. var $1;
  20142. newNode=(
  20143. $ctx1.supercall = true,
  20144. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($self, [aNode]));
  20145. $ctx1.supercall = false;
  20146. $1=$recv(aNode).__eq_eq(newNode);
  20147. if(!$core.assert($1)){
  20148. $recv($self["@path"])._at_put_($recv($self["@path"])._size(),newNode);
  20149. }
  20150. return newNode;
  20151. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  20152. },
  20153. args: ["aNode"],
  20154. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  20155. referencedClasses: [],
  20156. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  20157. }),
  20158. $globals.PathDagVisitor);
  20159. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  20160. $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).";
  20161. $core.addMethod(
  20162. $core.method({
  20163. selector: "acceptDagVisitor:",
  20164. protocol: "visiting",
  20165. fn: function (aVisitor){
  20166. var self=this,$self=this;
  20167. return $core.withContext(function($ctx1) {
  20168. return $recv(aVisitor)._visitDagNode_(self);
  20169. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  20170. },
  20171. args: ["aVisitor"],
  20172. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  20173. referencedClasses: [],
  20174. messageSends: ["visitDagNode:"]
  20175. }),
  20176. $globals.DagNode);
  20177. $core.addMethod(
  20178. $core.method({
  20179. selector: "allDagChildren",
  20180. protocol: "accessing",
  20181. fn: function (){
  20182. var self=this,$self=this;
  20183. var allNodes;
  20184. return $core.withContext(function($ctx1) {
  20185. var $1;
  20186. $1=$self._dagChildren();
  20187. $ctx1.sendIdx["dagChildren"]=1;
  20188. allNodes=$recv($1)._asSet();
  20189. $recv($self._dagChildren())._do_((function(each){
  20190. return $core.withContext(function($ctx2) {
  20191. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  20192. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20193. }));
  20194. return allNodes;
  20195. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  20196. },
  20197. args: [],
  20198. 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",
  20199. referencedClasses: [],
  20200. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  20201. }),
  20202. $globals.DagNode);
  20203. $core.addMethod(
  20204. $core.method({
  20205. selector: "dagChildren",
  20206. protocol: "accessing",
  20207. fn: function (){
  20208. var self=this,$self=this;
  20209. return $core.withContext(function($ctx1) {
  20210. $self._subclassResponsibility();
  20211. return self;
  20212. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  20213. },
  20214. args: [],
  20215. source: "dagChildren\x0a\x09self subclassResponsibility",
  20216. referencedClasses: [],
  20217. messageSends: ["subclassResponsibility"]
  20218. }),
  20219. $globals.DagNode);
  20220. $core.addMethod(
  20221. $core.method({
  20222. selector: "dagChildren:",
  20223. protocol: "accessing",
  20224. fn: function (aCollection){
  20225. var self=this,$self=this;
  20226. return $core.withContext(function($ctx1) {
  20227. $self._subclassResponsibility();
  20228. return self;
  20229. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  20230. },
  20231. args: ["aCollection"],
  20232. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  20233. referencedClasses: [],
  20234. messageSends: ["subclassResponsibility"]
  20235. }),
  20236. $globals.DagNode);
  20237. $core.addMethod(
  20238. $core.method({
  20239. selector: "isDagNode",
  20240. protocol: "testing",
  20241. fn: function (){
  20242. var self=this,$self=this;
  20243. return true;
  20244. },
  20245. args: [],
  20246. source: "isDagNode\x0a\x09^ true",
  20247. referencedClasses: [],
  20248. messageSends: []
  20249. }),
  20250. $globals.DagNode);
  20251. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20252. $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.";
  20253. $core.addMethod(
  20254. $core.method({
  20255. selector: "addDagChild:",
  20256. protocol: "accessing",
  20257. fn: function (aDagNode){
  20258. var self=this,$self=this;
  20259. return $core.withContext(function($ctx1) {
  20260. $recv($self._dagChildren())._add_(aDagNode);
  20261. return self;
  20262. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  20263. },
  20264. args: ["aDagNode"],
  20265. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  20266. referencedClasses: [],
  20267. messageSends: ["add:", "dagChildren"]
  20268. }),
  20269. $globals.DagParentNode);
  20270. $core.addMethod(
  20271. $core.method({
  20272. selector: "dagChildren",
  20273. protocol: "accessing",
  20274. fn: function (){
  20275. var self=this,$self=this;
  20276. return $core.withContext(function($ctx1) {
  20277. var $1,$receiver;
  20278. $1=$self["@nodes"];
  20279. if(($receiver = $1) == null || $receiver.a$nil){
  20280. $self["@nodes"]=$recv($globals.Array)._new();
  20281. return $self["@nodes"];
  20282. } else {
  20283. return $1;
  20284. }
  20285. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  20286. },
  20287. args: [],
  20288. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  20289. referencedClasses: ["Array"],
  20290. messageSends: ["ifNil:", "new"]
  20291. }),
  20292. $globals.DagParentNode);
  20293. $core.addMethod(
  20294. $core.method({
  20295. selector: "dagChildren:",
  20296. protocol: "accessing",
  20297. fn: function (aCollection){
  20298. var self=this,$self=this;
  20299. $self["@nodes"]=aCollection;
  20300. return self;
  20301. },
  20302. args: ["aCollection"],
  20303. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  20304. referencedClasses: [],
  20305. messageSends: []
  20306. }),
  20307. $globals.DagParentNode);
  20308. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20309. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  20310. $core.addMethod(
  20311. $core.method({
  20312. selector: "dagChildren",
  20313. protocol: "accessing",
  20314. fn: function (){
  20315. var self=this,$self=this;
  20316. return [];
  20317. },
  20318. args: [],
  20319. source: "dagChildren\x0a\x09^ #()",
  20320. referencedClasses: [],
  20321. messageSends: []
  20322. }),
  20323. $globals.DagSink);
  20324. $core.addMethod(
  20325. $core.method({
  20326. selector: "dagChildren:",
  20327. protocol: "accessing",
  20328. fn: function (aCollection){
  20329. var self=this,$self=this;
  20330. return $core.withContext(function($ctx1) {
  20331. $recv(aCollection)._ifNotEmpty_((function(){
  20332. return $core.withContext(function($ctx2) {
  20333. return $self._error_("A DagSink cannot have children.");
  20334. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20335. }));
  20336. return self;
  20337. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  20338. },
  20339. args: ["aCollection"],
  20340. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  20341. referencedClasses: [],
  20342. messageSends: ["ifNotEmpty:", "error:"]
  20343. }),
  20344. $globals.DagSink);
  20345. $core.addMethod(
  20346. $core.method({
  20347. selector: "isDagNode",
  20348. protocol: "*Kernel-Dag",
  20349. fn: function (){
  20350. var self=this,$self=this;
  20351. return false;
  20352. },
  20353. args: [],
  20354. source: "isDagNode\x0a\x09^ false",
  20355. referencedClasses: [],
  20356. messageSends: []
  20357. }),
  20358. $globals.Object);
  20359. });
  20360. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20361. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  20362. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20363. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20364. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  20365. $core.addPackage("Kernel-Exceptions");
  20366. $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  20367. $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20368. $core.addClass("Error", $globals.Object, ["messageText"], "Kernel-Exceptions");
  20369. $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.";
  20370. $core.addMethod(
  20371. $core.method({
  20372. selector: "beHandled",
  20373. protocol: "accessing",
  20374. fn: function (){
  20375. var self=this,$self=this;
  20376. return $core.withContext(function($ctx1) {
  20377. self.amberHandled = true;
  20378. return self;
  20379. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  20380. },
  20381. args: [],
  20382. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  20383. referencedClasses: [],
  20384. messageSends: []
  20385. }),
  20386. $globals.Error);
  20387. $core.addMethod(
  20388. $core.method({
  20389. selector: "beUnhandled",
  20390. protocol: "accessing",
  20391. fn: function (){
  20392. var self=this,$self=this;
  20393. return $core.withContext(function($ctx1) {
  20394. self.amberHandled = false;
  20395. return self;
  20396. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  20397. },
  20398. args: [],
  20399. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  20400. referencedClasses: [],
  20401. messageSends: []
  20402. }),
  20403. $globals.Error);
  20404. $core.addMethod(
  20405. $core.method({
  20406. selector: "context",
  20407. protocol: "accessing",
  20408. fn: function (){
  20409. var self=this,$self=this;
  20410. return $core.withContext(function($ctx1) {
  20411. return self.context;
  20412. return self;
  20413. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  20414. },
  20415. args: [],
  20416. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  20417. referencedClasses: [],
  20418. messageSends: []
  20419. }),
  20420. $globals.Error);
  20421. $core.addMethod(
  20422. $core.method({
  20423. selector: "initialize",
  20424. protocol: "initialization",
  20425. fn: function (){
  20426. var self=this,$self=this;
  20427. return $core.withContext(function($ctx1) {
  20428. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  20429. return self;
  20430. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20431. },
  20432. args: [],
  20433. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20434. referencedClasses: [],
  20435. messageSends: ["messageText:", ",", "name", "class"]
  20436. }),
  20437. $globals.Error);
  20438. $core.addMethod(
  20439. $core.method({
  20440. selector: "isSmalltalkError",
  20441. protocol: "testing",
  20442. fn: function (){
  20443. var self=this,$self=this;
  20444. return $core.withContext(function($ctx1) {
  20445. return self.smalltalkError === true;
  20446. return self;
  20447. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20448. },
  20449. args: [],
  20450. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  20451. referencedClasses: [],
  20452. messageSends: []
  20453. }),
  20454. $globals.Error);
  20455. $core.addMethod(
  20456. $core.method({
  20457. selector: "jsStack",
  20458. protocol: "accessing",
  20459. fn: function (){
  20460. var self=this,$self=this;
  20461. return $core.withContext(function($ctx1) {
  20462. return self.stack;
  20463. return self;
  20464. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  20465. },
  20466. args: [],
  20467. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  20468. referencedClasses: [],
  20469. messageSends: []
  20470. }),
  20471. $globals.Error);
  20472. $core.addMethod(
  20473. $core.method({
  20474. selector: "messageText",
  20475. protocol: "accessing",
  20476. fn: function (){
  20477. var self=this,$self=this;
  20478. return $self["@messageText"];
  20479. },
  20480. args: [],
  20481. source: "messageText\x0a\x09^ messageText",
  20482. referencedClasses: [],
  20483. messageSends: []
  20484. }),
  20485. $globals.Error);
  20486. $core.addMethod(
  20487. $core.method({
  20488. selector: "messageText:",
  20489. protocol: "accessing",
  20490. fn: function (aString){
  20491. var self=this,$self=this;
  20492. $self["@messageText"]=aString;
  20493. return self;
  20494. },
  20495. args: ["aString"],
  20496. source: "messageText: aString\x0a\x09messageText := aString",
  20497. referencedClasses: [],
  20498. messageSends: []
  20499. }),
  20500. $globals.Error);
  20501. $core.addMethod(
  20502. $core.method({
  20503. selector: "resignal",
  20504. protocol: "signaling",
  20505. fn: function (){
  20506. var self=this,$self=this;
  20507. return $core.withContext(function($ctx1) {
  20508. self.amberHandled = false;
  20509. throw(self);
  20510. ;
  20511. return self;
  20512. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20513. },
  20514. args: [],
  20515. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09'>",
  20516. referencedClasses: [],
  20517. messageSends: []
  20518. }),
  20519. $globals.Error);
  20520. $core.addMethod(
  20521. $core.method({
  20522. selector: "signal",
  20523. protocol: "signaling",
  20524. fn: function (){
  20525. var self=this,$self=this;
  20526. return $core.withContext(function($ctx1) {
  20527. self.amberHandled = false;
  20528. self.context = $core.getThisContext();
  20529. self.smalltalkError = true;
  20530. throw self;
  20531. ;
  20532. return self;
  20533. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20534. },
  20535. args: [],
  20536. 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'>",
  20537. referencedClasses: [],
  20538. messageSends: []
  20539. }),
  20540. $globals.Error);
  20541. $core.addMethod(
  20542. $core.method({
  20543. selector: "signal:",
  20544. protocol: "signaling",
  20545. fn: function (aString){
  20546. var self=this,$self=this;
  20547. return $core.withContext(function($ctx1) {
  20548. $self._messageText_(aString);
  20549. $self._signal();
  20550. return self;
  20551. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20552. },
  20553. args: ["aString"],
  20554. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  20555. referencedClasses: [],
  20556. messageSends: ["messageText:", "signal"]
  20557. }),
  20558. $globals.Error);
  20559. $core.addMethod(
  20560. $core.method({
  20561. selector: "signalerContext",
  20562. protocol: "accessing",
  20563. fn: function (){
  20564. var self=this,$self=this;
  20565. return $core.withContext(function($ctx1) {
  20566. return $self._signalerContextFrom_($self._context());
  20567. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20568. },
  20569. args: [],
  20570. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20571. referencedClasses: [],
  20572. messageSends: ["signalerContextFrom:", "context"]
  20573. }),
  20574. $globals.Error);
  20575. $core.addMethod(
  20576. $core.method({
  20577. selector: "signalerContextFrom:",
  20578. protocol: "accessing",
  20579. fn: function (aContext){
  20580. var self=this,$self=this;
  20581. return $core.withContext(function($ctx1) {
  20582. var $3,$2,$1;
  20583. return $recv(aContext)._findContextSuchThat_((function(context){
  20584. return $core.withContext(function($ctx2) {
  20585. $3=$recv(context)._receiver();
  20586. $ctx2.sendIdx["receiver"]=1;
  20587. $2=$recv($3).__eq_eq(self);
  20588. $ctx2.sendIdx["=="]=1;
  20589. $1=$recv($2)._or_((function(){
  20590. return $core.withContext(function($ctx3) {
  20591. return $recv($recv(context)._receiver()).__eq_eq($self._class());
  20592. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20593. }));
  20594. return $recv($1)._not();
  20595. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20596. }));
  20597. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20598. },
  20599. args: ["aContext"],
  20600. 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 ]",
  20601. referencedClasses: [],
  20602. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20603. }),
  20604. $globals.Error);
  20605. $core.addMethod(
  20606. $core.method({
  20607. selector: "wasHandled",
  20608. protocol: "testing",
  20609. fn: function (){
  20610. var self=this,$self=this;
  20611. return $core.withContext(function($ctx1) {
  20612. return self.amberHandled || false;
  20613. return self;
  20614. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20615. },
  20616. args: [],
  20617. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  20618. referencedClasses: [],
  20619. messageSends: []
  20620. }),
  20621. $globals.Error);
  20622. $core.addMethod(
  20623. $core.method({
  20624. selector: "classTag",
  20625. protocol: "accessing",
  20626. fn: function (){
  20627. var self=this,$self=this;
  20628. return "exception";
  20629. },
  20630. args: [],
  20631. 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'",
  20632. referencedClasses: [],
  20633. messageSends: []
  20634. }),
  20635. $globals.Error.a$cls);
  20636. $core.addMethod(
  20637. $core.method({
  20638. selector: "signal",
  20639. protocol: "instance creation",
  20640. fn: function (){
  20641. var self=this,$self=this;
  20642. return $core.withContext(function($ctx1) {
  20643. return $recv($self._new())._signal();
  20644. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.a$cls)});
  20645. },
  20646. args: [],
  20647. source: "signal\x0a\x09^ self new signal",
  20648. referencedClasses: [],
  20649. messageSends: ["signal", "new"]
  20650. }),
  20651. $globals.Error.a$cls);
  20652. $core.addMethod(
  20653. $core.method({
  20654. selector: "signal:",
  20655. protocol: "instance creation",
  20656. fn: function (aString){
  20657. var self=this,$self=this;
  20658. return $core.withContext(function($ctx1) {
  20659. return $recv($self._new())._signal_(aString);
  20660. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.a$cls)});
  20661. },
  20662. args: ["aString"],
  20663. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20664. referencedClasses: [],
  20665. messageSends: ["signal:", "new"]
  20666. }),
  20667. $globals.Error.a$cls);
  20668. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  20669. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20670. $core.addMethod(
  20671. $core.method({
  20672. selector: "messageText",
  20673. protocol: "accessing",
  20674. fn: function (){
  20675. var self=this,$self=this;
  20676. return "Halt encountered";
  20677. },
  20678. args: [],
  20679. source: "messageText\x0a\x09^ 'Halt encountered'",
  20680. referencedClasses: [],
  20681. messageSends: []
  20682. }),
  20683. $globals.Halt);
  20684. $core.addMethod(
  20685. $core.method({
  20686. selector: "signalerContextFrom:",
  20687. protocol: "accessing",
  20688. fn: function (aContext){
  20689. var self=this,$self=this;
  20690. return $core.withContext(function($ctx1) {
  20691. var $3,$2,$1;
  20692. return $recv(aContext)._findContextSuchThat_((function(context){
  20693. return $core.withContext(function($ctx2) {
  20694. $3=$recv(context)._receiver();
  20695. $ctx2.sendIdx["receiver"]=1;
  20696. $2=$recv($3).__eq_eq(self);
  20697. $ctx2.sendIdx["=="]=1;
  20698. $1=$recv($2)._or_((function(){
  20699. return $core.withContext(function($ctx3) {
  20700. return $recv($recv($recv(context)._receiver()).__eq_eq($self._class()))._or_((function(){
  20701. return $core.withContext(function($ctx4) {
  20702. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  20703. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20704. }));
  20705. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20706. }));
  20707. $ctx2.sendIdx["or:"]=1;
  20708. return $recv($1)._not();
  20709. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20710. }));
  20711. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20712. },
  20713. args: ["aContext"],
  20714. 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 ]",
  20715. referencedClasses: [],
  20716. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20717. }),
  20718. $globals.Halt);
  20719. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  20720. $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:`";
  20721. $core.addMethod(
  20722. $core.method({
  20723. selector: "context:",
  20724. protocol: "accessing",
  20725. fn: function (aMethodContext){
  20726. var self=this,$self=this;
  20727. return $core.withContext(function($ctx1) {
  20728. self.context = aMethodContext;
  20729. return self;
  20730. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  20731. },
  20732. args: ["aMethodContext"],
  20733. 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'>",
  20734. referencedClasses: [],
  20735. messageSends: []
  20736. }),
  20737. $globals.JavaScriptException);
  20738. $core.addMethod(
  20739. $core.method({
  20740. selector: "exception",
  20741. protocol: "accessing",
  20742. fn: function (){
  20743. var self=this,$self=this;
  20744. return $self["@exception"];
  20745. },
  20746. args: [],
  20747. source: "exception\x0a\x09^ exception",
  20748. referencedClasses: [],
  20749. messageSends: []
  20750. }),
  20751. $globals.JavaScriptException);
  20752. $core.addMethod(
  20753. $core.method({
  20754. selector: "exception:",
  20755. protocol: "accessing",
  20756. fn: function (anException){
  20757. var self=this,$self=this;
  20758. $self["@exception"]=anException;
  20759. return self;
  20760. },
  20761. args: ["anException"],
  20762. source: "exception: anException\x0a\x09exception := anException",
  20763. referencedClasses: [],
  20764. messageSends: []
  20765. }),
  20766. $globals.JavaScriptException);
  20767. $core.addMethod(
  20768. $core.method({
  20769. selector: "messageText",
  20770. protocol: "accessing",
  20771. fn: function (){
  20772. var self=this,$self=this;
  20773. return $core.withContext(function($ctx1) {
  20774. return "JavaScript exception: " + $self["@exception"].toString();
  20775. return self;
  20776. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20777. },
  20778. args: [],
  20779. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self[\x22@exception\x22].toString()'>",
  20780. referencedClasses: [],
  20781. messageSends: []
  20782. }),
  20783. $globals.JavaScriptException);
  20784. $core.addMethod(
  20785. $core.method({
  20786. selector: "shouldBeStubbed",
  20787. protocol: "testing",
  20788. fn: function (){
  20789. var self=this,$self=this;
  20790. return $core.withContext(function($ctx1) {
  20791. return $self["@exception"] instanceof RangeError;
  20792. return self;
  20793. }, function($ctx1) {$ctx1.fill(self,"shouldBeStubbed",{},$globals.JavaScriptException)});
  20794. },
  20795. args: [],
  20796. source: "shouldBeStubbed\x0a\x09<inlineJS: 'return $self[\x22@exception\x22] instanceof RangeError'>",
  20797. referencedClasses: [],
  20798. messageSends: []
  20799. }),
  20800. $globals.JavaScriptException);
  20801. $core.addMethod(
  20802. $core.method({
  20803. selector: "wrap",
  20804. protocol: "error handling",
  20805. fn: function (){
  20806. var self=this,$self=this;
  20807. return $core.withContext(function($ctx1) {
  20808. var $1;
  20809. $recv((function(){
  20810. return $core.withContext(function($ctx2) {
  20811. return $self._signal();
  20812. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20813. }))._tryCatch_((function(){
  20814. return $core.withContext(function($ctx2) {
  20815. $1=$self._shouldBeStubbed();
  20816. if($core.assert($1)){
  20817. return $recv($self._context())._stubToAtMost_((100));
  20818. }
  20819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  20820. }));
  20821. return self;
  20822. }, function($ctx1) {$ctx1.fill(self,"wrap",{},$globals.JavaScriptException)});
  20823. },
  20824. args: [],
  20825. source: "wrap\x0a\x09[ self signal ] tryCatch:\x0a\x09\x09[ self shouldBeStubbed ifTrue: [ self context stubToAtMost: 100 ] ]",
  20826. referencedClasses: [],
  20827. messageSends: ["tryCatch:", "signal", "ifTrue:", "shouldBeStubbed", "stubToAtMost:", "context"]
  20828. }),
  20829. $globals.JavaScriptException);
  20830. $core.addMethod(
  20831. $core.method({
  20832. selector: "on:",
  20833. protocol: "instance creation",
  20834. fn: function (anException){
  20835. var self=this,$self=this;
  20836. return $core.withContext(function($ctx1) {
  20837. var $1;
  20838. $1=$self._new();
  20839. $recv($1)._exception_(anException);
  20840. return $recv($1)._yourself();
  20841. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.a$cls)});
  20842. },
  20843. args: ["anException"],
  20844. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  20845. referencedClasses: [],
  20846. messageSends: ["exception:", "new", "yourself"]
  20847. }),
  20848. $globals.JavaScriptException.a$cls);
  20849. $core.addMethod(
  20850. $core.method({
  20851. selector: "on:context:",
  20852. protocol: "instance creation",
  20853. fn: function (anException,aMethodContext){
  20854. var self=this,$self=this;
  20855. return $core.withContext(function($ctx1) {
  20856. var $1;
  20857. $1=$self._new();
  20858. $recv($1)._exception_(anException);
  20859. $recv($1)._context_(aMethodContext);
  20860. return $recv($1)._yourself();
  20861. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.a$cls)});
  20862. },
  20863. args: ["anException", "aMethodContext"],
  20864. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  20865. referencedClasses: [],
  20866. messageSends: ["exception:", "new", "context:", "yourself"]
  20867. }),
  20868. $globals.JavaScriptException.a$cls);
  20869. $core.addClass("MessageNotUnderstood", $globals.Error, ["message", "receiver"], "Kernel-Exceptions");
  20870. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  20871. $core.addMethod(
  20872. $core.method({
  20873. selector: "message",
  20874. protocol: "accessing",
  20875. fn: function (){
  20876. var self=this,$self=this;
  20877. return $self["@message"];
  20878. },
  20879. args: [],
  20880. source: "message\x0a\x09^ message",
  20881. referencedClasses: [],
  20882. messageSends: []
  20883. }),
  20884. $globals.MessageNotUnderstood);
  20885. $core.addMethod(
  20886. $core.method({
  20887. selector: "message:",
  20888. protocol: "accessing",
  20889. fn: function (aMessage){
  20890. var self=this,$self=this;
  20891. $self["@message"]=aMessage;
  20892. return self;
  20893. },
  20894. args: ["aMessage"],
  20895. source: "message: aMessage\x0a\x09message := aMessage",
  20896. referencedClasses: [],
  20897. messageSends: []
  20898. }),
  20899. $globals.MessageNotUnderstood);
  20900. $core.addMethod(
  20901. $core.method({
  20902. selector: "messageText",
  20903. protocol: "accessing",
  20904. fn: function (){
  20905. var self=this,$self=this;
  20906. return $core.withContext(function($ctx1) {
  20907. var $1;
  20908. $1=$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector());
  20909. $ctx1.sendIdx[","]=1;
  20910. return $1;
  20911. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  20912. },
  20913. args: [],
  20914. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  20915. referencedClasses: [],
  20916. messageSends: [",", "asString", "receiver", "selector", "message"]
  20917. }),
  20918. $globals.MessageNotUnderstood);
  20919. $core.addMethod(
  20920. $core.method({
  20921. selector: "receiver",
  20922. protocol: "accessing",
  20923. fn: function (){
  20924. var self=this,$self=this;
  20925. return $self["@receiver"];
  20926. },
  20927. args: [],
  20928. source: "receiver\x0a\x09^ receiver",
  20929. referencedClasses: [],
  20930. messageSends: []
  20931. }),
  20932. $globals.MessageNotUnderstood);
  20933. $core.addMethod(
  20934. $core.method({
  20935. selector: "receiver:",
  20936. protocol: "accessing",
  20937. fn: function (anObject){
  20938. var self=this,$self=this;
  20939. $self["@receiver"]=anObject;
  20940. return self;
  20941. },
  20942. args: ["anObject"],
  20943. source: "receiver: anObject\x0a\x09receiver := anObject",
  20944. referencedClasses: [],
  20945. messageSends: []
  20946. }),
  20947. $globals.MessageNotUnderstood);
  20948. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  20949. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  20950. $core.addMethod(
  20951. $core.method({
  20952. selector: "object",
  20953. protocol: "accessing",
  20954. fn: function (){
  20955. var self=this,$self=this;
  20956. return $self["@object"];
  20957. },
  20958. args: [],
  20959. source: "object\x0a\x09^ object",
  20960. referencedClasses: [],
  20961. messageSends: []
  20962. }),
  20963. $globals.NonBooleanReceiver);
  20964. $core.addMethod(
  20965. $core.method({
  20966. selector: "object:",
  20967. protocol: "accessing",
  20968. fn: function (anObject){
  20969. var self=this,$self=this;
  20970. $self["@object"]=anObject;
  20971. return self;
  20972. },
  20973. args: ["anObject"],
  20974. source: "object: anObject\x0a\x09object := anObject",
  20975. referencedClasses: [],
  20976. messageSends: []
  20977. }),
  20978. $globals.NonBooleanReceiver);
  20979. $core.addMethod(
  20980. $core.method({
  20981. selector: "signalOn:",
  20982. protocol: "instance creation",
  20983. fn: function (anObject){
  20984. var self=this,$self=this;
  20985. return $core.withContext(function($ctx1) {
  20986. var $1;
  20987. $1=$self._new();
  20988. $recv($1)._object_(anObject);
  20989. return $recv($1)._signal();
  20990. }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject},$globals.NonBooleanReceiver.a$cls)});
  20991. },
  20992. args: ["anObject"],
  20993. source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
  20994. referencedClasses: [],
  20995. messageSends: ["object:", "new", "signal"]
  20996. }),
  20997. $globals.NonBooleanReceiver.a$cls);
  20998. });
  20999. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  21000. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  21001. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21002. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21003. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  21004. $core.addPackage("Kernel-Promises");
  21005. $core.packages["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  21006. $core.packages["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21007. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  21008. $core.addMethod(
  21009. $core.method({
  21010. selector: "all:",
  21011. protocol: "composites",
  21012. fn: function (aCollection){
  21013. var self=this,$self=this;
  21014. return $core.withContext(function($ctx1) {
  21015. return Promise.all($recv(aCollection)._asArray());
  21016. return self;
  21017. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21018. },
  21019. args: ["aCollection"],
  21020. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  21021. referencedClasses: [],
  21022. messageSends: []
  21023. }),
  21024. $globals.Promise.a$cls);
  21025. $core.addMethod(
  21026. $core.method({
  21027. selector: "any:",
  21028. protocol: "composites",
  21029. fn: function (aCollection){
  21030. var self=this,$self=this;
  21031. return $core.withContext(function($ctx1) {
  21032. return Promise.race($recv(aCollection)._asArray());
  21033. return self;
  21034. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21035. },
  21036. args: ["aCollection"],
  21037. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  21038. referencedClasses: [],
  21039. messageSends: []
  21040. }),
  21041. $globals.Promise.a$cls);
  21042. $core.addMethod(
  21043. $core.method({
  21044. selector: "forBlock:",
  21045. protocol: "instance creation",
  21046. fn: function (aBlock){
  21047. var self=this,$self=this;
  21048. return $core.withContext(function($ctx1) {
  21049. return $recv($self._new())._then_(aBlock);
  21050. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21051. },
  21052. args: ["aBlock"],
  21053. 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",
  21054. referencedClasses: [],
  21055. messageSends: ["then:", "new"]
  21056. }),
  21057. $globals.Promise.a$cls);
  21058. $core.addMethod(
  21059. $core.method({
  21060. selector: "new",
  21061. protocol: "instance creation",
  21062. fn: function (){
  21063. var self=this,$self=this;
  21064. return $core.withContext(function($ctx1) {
  21065. return Promise.resolve();
  21066. return self;
  21067. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.a$cls)});
  21068. },
  21069. args: [],
  21070. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  21071. referencedClasses: [],
  21072. messageSends: []
  21073. }),
  21074. $globals.Promise.a$cls);
  21075. $core.addMethod(
  21076. $core.method({
  21077. selector: "new:",
  21078. protocol: "instance creation",
  21079. fn: function (aBlock){
  21080. var self=this,$self=this;
  21081. return $core.withContext(function($ctx1) {
  21082. return new Promise(function (resolve, reject) {
  21083. var model = {value: resolve, signal: reject}; // TODO make faster
  21084. aBlock._value_(model);
  21085. });
  21086. return self;
  21087. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21088. },
  21089. args: ["aBlock"],
  21090. 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}; // TODO make faster\x0a aBlock._value_(model);\x0a})'>",
  21091. referencedClasses: [],
  21092. messageSends: []
  21093. }),
  21094. $globals.Promise.a$cls);
  21095. $core.addMethod(
  21096. $core.method({
  21097. selector: "signal:",
  21098. protocol: "instance creation",
  21099. fn: function (anObject){
  21100. var self=this,$self=this;
  21101. return $core.withContext(function($ctx1) {
  21102. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  21103. return self;
  21104. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.a$cls)});
  21105. },
  21106. args: ["anObject"],
  21107. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  21108. referencedClasses: [],
  21109. messageSends: []
  21110. }),
  21111. $globals.Promise.a$cls);
  21112. $core.addMethod(
  21113. $core.method({
  21114. selector: "value:",
  21115. protocol: "instance creation",
  21116. fn: function (anObject){
  21117. var self=this,$self=this;
  21118. return $core.withContext(function($ctx1) {
  21119. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  21120. return self;
  21121. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.a$cls)});
  21122. },
  21123. args: ["anObject"],
  21124. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  21125. referencedClasses: [],
  21126. messageSends: []
  21127. }),
  21128. $globals.Promise.a$cls);
  21129. $core.addTrait("TThenable", "Kernel-Promises");
  21130. $core.addMethod(
  21131. $core.method({
  21132. selector: "catch:",
  21133. protocol: "promises",
  21134. fn: function (aBlock){
  21135. var self=this,$self=this;
  21136. return $core.withContext(function($ctx1) {
  21137. return self.then(null, function (err) {return $core.seamless(function () {
  21138. return aBlock._value_(err);
  21139. })});
  21140. return self;
  21141. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.TThenable)});
  21142. },
  21143. args: ["aBlock"],
  21144. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  21145. referencedClasses: [],
  21146. messageSends: []
  21147. }),
  21148. $globals.TThenable);
  21149. $core.addMethod(
  21150. $core.method({
  21151. selector: "on:do:",
  21152. protocol: "promises",
  21153. fn: function (aClass,aBlock){
  21154. var self=this,$self=this;
  21155. return $core.withContext(function($ctx1) {
  21156. return self.then(null, function (err) {return $core.seamless(function () {
  21157. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  21158. else throw err;
  21159. })});
  21160. return self;
  21161. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21162. },
  21163. args: ["aClass", "aBlock"],
  21164. 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})})'>",
  21165. referencedClasses: [],
  21166. messageSends: []
  21167. }),
  21168. $globals.TThenable);
  21169. $core.addMethod(
  21170. $core.method({
  21171. selector: "on:do:catch:",
  21172. protocol: "promises",
  21173. fn: function (aClass,aBlock,anotherBlock){
  21174. var self=this,$self=this;
  21175. return $core.withContext(function($ctx1) {
  21176. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21177. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21178. },
  21179. args: ["aClass", "aBlock", "anotherBlock"],
  21180. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  21181. referencedClasses: [],
  21182. messageSends: ["catch:", "on:do:"]
  21183. }),
  21184. $globals.TThenable);
  21185. $core.addMethod(
  21186. $core.method({
  21187. selector: "then:",
  21188. protocol: "promises",
  21189. fn: function (aBlockOrArray){
  21190. var self=this,$self=this;
  21191. return $core.withContext(function($ctx1) {
  21192. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  21193. return array.reduce(function (soFar, aBlock) {
  21194. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  21195. function (result) {return $core.seamless(function () {
  21196. if (Array.isArray(result)) {
  21197. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  21198. } else {
  21199. return aBlock._value_(result);
  21200. }
  21201. })} :
  21202. function (result) {return $core.seamless(function () {
  21203. return aBlock._value_(result);
  21204. })}
  21205. );
  21206. }, self);
  21207. return self;
  21208. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.TThenable)});
  21209. },
  21210. args: ["aBlockOrArray"],
  21211. 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)'>",
  21212. referencedClasses: [],
  21213. messageSends: []
  21214. }),
  21215. $globals.TThenable);
  21216. $core.addMethod(
  21217. $core.method({
  21218. selector: "then:catch:",
  21219. protocol: "promises",
  21220. fn: function (aBlockOrArray,anotherBlock){
  21221. var self=this,$self=this;
  21222. return $core.withContext(function($ctx1) {
  21223. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  21224. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.TThenable)});
  21225. },
  21226. args: ["aBlockOrArray", "anotherBlock"],
  21227. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  21228. referencedClasses: [],
  21229. messageSends: ["catch:", "then:"]
  21230. }),
  21231. $globals.TThenable);
  21232. $core.addMethod(
  21233. $core.method({
  21234. selector: "then:on:do:",
  21235. protocol: "promises",
  21236. fn: function (aBlockOrArray,aClass,aBlock){
  21237. var self=this,$self=this;
  21238. return $core.withContext(function($ctx1) {
  21239. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  21240. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21241. },
  21242. args: ["aBlockOrArray", "aClass", "aBlock"],
  21243. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  21244. referencedClasses: [],
  21245. messageSends: ["on:do:", "then:"]
  21246. }),
  21247. $globals.TThenable);
  21248. $core.addMethod(
  21249. $core.method({
  21250. selector: "then:on:do:catch:",
  21251. protocol: "promises",
  21252. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21253. var self=this,$self=this;
  21254. return $core.withContext(function($ctx1) {
  21255. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21256. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21257. },
  21258. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21259. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  21260. referencedClasses: [],
  21261. messageSends: ["catch:", "on:do:", "then:"]
  21262. }),
  21263. $globals.TThenable);
  21264. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  21265. });
  21266. 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";
  21267. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  21268. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21269. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21270. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  21271. $core.addPackage("Kernel-Infrastructure");
  21272. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  21273. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21274. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  21275. $core.addMethod(
  21276. $core.method({
  21277. selector: "initializeClasses",
  21278. protocol: "initialization",
  21279. fn: function (){
  21280. var self=this,$self=this;
  21281. return $core.withContext(function($ctx1) {
  21282. var $1;
  21283. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21284. return $core.withContext(function($ctx2) {
  21285. $1=$recv(each).__eq($globals.SmalltalkImage);
  21286. if(!$core.assert($1)){
  21287. return $recv(each)._initialize();
  21288. }
  21289. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21290. }));
  21291. return self;
  21292. }, function($ctx1) {$ctx1.fill(self,"initializeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21293. },
  21294. args: [],
  21295. source: "initializeClasses\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09each = SmalltalkImage ifFalse: [ each initialize ] ]",
  21296. referencedClasses: ["Smalltalk", "SmalltalkImage"],
  21297. messageSends: ["do:", "classes", "ifFalse:", "=", "initialize"]
  21298. }),
  21299. $globals.AmberBootstrapInitialization.a$cls);
  21300. $core.addMethod(
  21301. $core.method({
  21302. selector: "organizeClasses",
  21303. protocol: "organization",
  21304. fn: function (){
  21305. var self=this,$self=this;
  21306. return $core.withContext(function($ctx1) {
  21307. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21308. return $core.withContext(function($ctx2) {
  21309. return $recv(each)._enterOrganization();
  21310. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21311. }));
  21312. return self;
  21313. }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21314. },
  21315. args: [],
  21316. source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]",
  21317. referencedClasses: ["Smalltalk"],
  21318. messageSends: ["do:", "classes", "enterOrganization"]
  21319. }),
  21320. $globals.AmberBootstrapInitialization.a$cls);
  21321. $core.addMethod(
  21322. $core.method({
  21323. selector: "organizeMethods",
  21324. protocol: "organization",
  21325. fn: function (){
  21326. var self=this,$self=this;
  21327. return $core.withContext(function($ctx1) {
  21328. $recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){
  21329. return $core.withContext(function($ctx2) {
  21330. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  21331. return $core.withContext(function($ctx3) {
  21332. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  21333. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  21334. }));
  21335. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  21336. }));
  21337. $ctx1.sendIdx["do:"]=1;
  21338. return self;
  21339. }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{},$globals.AmberBootstrapInitialization.a$cls)});
  21340. },
  21341. args: [],
  21342. source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  21343. referencedClasses: ["Smalltalk"],
  21344. messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  21345. }),
  21346. $globals.AmberBootstrapInitialization.a$cls);
  21347. $core.addMethod(
  21348. $core.method({
  21349. selector: "run",
  21350. protocol: "public api",
  21351. fn: function (){
  21352. var self=this,$self=this;
  21353. return $core.withContext(function($ctx1) {
  21354. $recv($globals.SmalltalkImage)._initialize();
  21355. $recv($globals.Smalltalk)._adoptPackageDictionary();
  21356. $self._organizeClasses();
  21357. $self._organizeMethods();
  21358. $self._initializeClasses();
  21359. return self;
  21360. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.AmberBootstrapInitialization.a$cls)});
  21361. },
  21362. args: [],
  21363. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09Smalltalk adoptPackageDictionary.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods;\x0a\x09\x09initializeClasses",
  21364. referencedClasses: ["SmalltalkImage", "Smalltalk"],
  21365. messageSends: ["initialize", "adoptPackageDictionary", "organizeClasses", "organizeMethods", "initializeClasses"]
  21366. }),
  21367. $globals.AmberBootstrapInitialization.a$cls);
  21368. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  21369. $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`.";
  21370. $core.addMethod(
  21371. $core.method({
  21372. selector: "=",
  21373. protocol: "comparing",
  21374. fn: function (anObject){
  21375. var self=this,$self=this;
  21376. return $core.withContext(function($ctx1) {
  21377. var $2,$1;
  21378. $2=$recv(anObject)._class();
  21379. $ctx1.sendIdx["class"]=1;
  21380. $1=$recv($2).__eq_eq($self._class());
  21381. if(!$core.assert($1)){
  21382. return false;
  21383. }
  21384. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  21385. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  21386. },
  21387. args: ["anObject"],
  21388. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  21389. referencedClasses: ["JSObjectProxy"],
  21390. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  21391. }),
  21392. $globals.JSObjectProxy);
  21393. $core.addMethod(
  21394. $core.method({
  21395. selector: "asJavaScriptObject",
  21396. protocol: "converting",
  21397. fn: function (){
  21398. var self=this,$self=this;
  21399. return $self["@jsObject"];
  21400. },
  21401. args: [],
  21402. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  21403. referencedClasses: [],
  21404. messageSends: []
  21405. }),
  21406. $globals.JSObjectProxy);
  21407. $core.addMethod(
  21408. $core.method({
  21409. selector: "at:",
  21410. protocol: "accessing",
  21411. fn: function (aString){
  21412. var self=this,$self=this;
  21413. return $core.withContext(function($ctx1) {
  21414. return $self['@jsObject'][aString];
  21415. return self;
  21416. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  21417. },
  21418. args: ["aString"],
  21419. source: "at: aString\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString]'>",
  21420. referencedClasses: [],
  21421. messageSends: []
  21422. }),
  21423. $globals.JSObjectProxy);
  21424. $core.addMethod(
  21425. $core.method({
  21426. selector: "at:ifAbsent:",
  21427. protocol: "accessing",
  21428. fn: function (aString,aBlock){
  21429. var self=this,$self=this;
  21430. return $core.withContext(function($ctx1) {
  21431. var obj = $self['@jsObject'];
  21432. return aString in obj ? obj[aString] : aBlock._value();
  21433. ;
  21434. return self;
  21435. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21436. },
  21437. args: ["aString", "aBlock"],
  21438. 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'>",
  21439. referencedClasses: [],
  21440. messageSends: []
  21441. }),
  21442. $globals.JSObjectProxy);
  21443. $core.addMethod(
  21444. $core.method({
  21445. selector: "at:ifPresent:",
  21446. protocol: "accessing",
  21447. fn: function (aString,aBlock){
  21448. var self=this,$self=this;
  21449. return $core.withContext(function($ctx1) {
  21450. var obj = $self['@jsObject'];
  21451. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  21452. ;
  21453. return self;
  21454. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21455. },
  21456. args: ["aString", "aBlock"],
  21457. 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'>",
  21458. referencedClasses: [],
  21459. messageSends: []
  21460. }),
  21461. $globals.JSObjectProxy);
  21462. $core.addMethod(
  21463. $core.method({
  21464. selector: "at:ifPresent:ifAbsent:",
  21465. protocol: "accessing",
  21466. fn: function (aString,aBlock,anotherBlock){
  21467. var self=this,$self=this;
  21468. return $core.withContext(function($ctx1) {
  21469. var obj = $self['@jsObject'];
  21470. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  21471. ;
  21472. return self;
  21473. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21474. },
  21475. args: ["aString", "aBlock", "anotherBlock"],
  21476. 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'>",
  21477. referencedClasses: [],
  21478. messageSends: []
  21479. }),
  21480. $globals.JSObjectProxy);
  21481. $core.addMethod(
  21482. $core.method({
  21483. selector: "at:put:",
  21484. protocol: "accessing",
  21485. fn: function (aString,anObject){
  21486. var self=this,$self=this;
  21487. return $core.withContext(function($ctx1) {
  21488. return $self['@jsObject'][aString] = anObject;
  21489. return self;
  21490. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  21491. },
  21492. args: ["aString", "anObject"],
  21493. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString] = anObject'>",
  21494. referencedClasses: [],
  21495. messageSends: []
  21496. }),
  21497. $globals.JSObjectProxy);
  21498. $core.addMethod(
  21499. $core.method({
  21500. selector: "catch:",
  21501. protocol: "promises",
  21502. fn: function (aBlock){
  21503. var self=this,$self=this;
  21504. return $core.withContext(function($ctx1) {
  21505. var $1,$2;
  21506. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21507. if($core.assert($1)){
  21508. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self["@jsObject"],[aBlock]);
  21509. } else {
  21510. $2=(
  21511. $ctx1.supercall = true,
  21512. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  21513. $ctx1.supercall = false;
  21514. return $2;
  21515. }
  21516. return self;
  21517. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21518. },
  21519. args: ["aBlock"],
  21520. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  21521. referencedClasses: ["NativeFunction", "TThenable"],
  21522. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  21523. }),
  21524. $globals.JSObjectProxy);
  21525. $core.addMethod(
  21526. $core.method({
  21527. selector: "doesNotUnderstand:",
  21528. protocol: "proxy",
  21529. fn: function (aMessage){
  21530. var self=this,$self=this;
  21531. return $core.withContext(function($ctx1) {
  21532. var $1,$receiver;
  21533. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  21534. if(($receiver = $1) == null || $receiver.a$nil){
  21535. return (
  21536. $ctx1.supercall = true,
  21537. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  21538. $ctx1.supercall = false;
  21539. } else {
  21540. var jsSelector;
  21541. jsSelector=$receiver;
  21542. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  21543. }
  21544. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  21545. },
  21546. args: ["aMessage"],
  21547. 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 ]",
  21548. referencedClasses: ["JSObjectProxy"],
  21549. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  21550. }),
  21551. $globals.JSObjectProxy);
  21552. $core.addMethod(
  21553. $core.method({
  21554. selector: "in:",
  21555. protocol: "accessing",
  21556. fn: function (aValuable){
  21557. var self=this,$self=this;
  21558. return $core.withContext(function($ctx1) {
  21559. return $recv(aValuable)._value_($self["@jsObject"]);
  21560. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  21561. },
  21562. args: ["aValuable"],
  21563. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  21564. referencedClasses: [],
  21565. messageSends: ["value:"]
  21566. }),
  21567. $globals.JSObjectProxy);
  21568. $core.addMethod(
  21569. $core.method({
  21570. selector: "jsObject",
  21571. protocol: "accessing",
  21572. fn: function (){
  21573. var self=this,$self=this;
  21574. return $self["@jsObject"];
  21575. },
  21576. args: [],
  21577. source: "jsObject\x0a\x09^ jsObject",
  21578. referencedClasses: [],
  21579. messageSends: []
  21580. }),
  21581. $globals.JSObjectProxy);
  21582. $core.addMethod(
  21583. $core.method({
  21584. selector: "keysAndValuesDo:",
  21585. protocol: "enumerating",
  21586. fn: function (aBlock){
  21587. var self=this,$self=this;
  21588. return $core.withContext(function($ctx1) {
  21589. var o = $self['@jsObject'];
  21590. for(var i in o) {
  21591. aBlock._value_value_(i, o[i]);
  21592. }
  21593. ;
  21594. return self;
  21595. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21596. },
  21597. args: ["aBlock"],
  21598. 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'>",
  21599. referencedClasses: [],
  21600. messageSends: []
  21601. }),
  21602. $globals.JSObjectProxy);
  21603. $core.addMethod(
  21604. $core.method({
  21605. selector: "on:do:",
  21606. protocol: "promises",
  21607. fn: function (aClass,aBlock){
  21608. var self=this,$self=this;
  21609. return $core.withContext(function($ctx1) {
  21610. var $1,$2;
  21611. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21612. if($core.assert($1)){
  21613. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self["@jsObject"],[aClass,aBlock]);
  21614. } else {
  21615. $2=(
  21616. $ctx1.supercall = true,
  21617. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  21618. $ctx1.supercall = false;
  21619. return $2;
  21620. }
  21621. return self;
  21622. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21623. },
  21624. args: ["aClass", "aBlock"],
  21625. 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 ]",
  21626. referencedClasses: ["NativeFunction", "TThenable"],
  21627. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  21628. }),
  21629. $globals.JSObjectProxy);
  21630. $core.addMethod(
  21631. $core.method({
  21632. selector: "printOn:",
  21633. protocol: "printing",
  21634. fn: function (aStream){
  21635. var self=this,$self=this;
  21636. return $core.withContext(function($ctx1) {
  21637. $recv(aStream)._nextPutAll_($self._printString());
  21638. return self;
  21639. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21640. },
  21641. args: ["aStream"],
  21642. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  21643. referencedClasses: [],
  21644. messageSends: ["nextPutAll:", "printString"]
  21645. }),
  21646. $globals.JSObjectProxy);
  21647. $core.addMethod(
  21648. $core.method({
  21649. selector: "printString",
  21650. protocol: "printing",
  21651. fn: function (){
  21652. var self=this,$self=this;
  21653. return $core.withContext(function($ctx1) {
  21654. var js = $self['@jsObject'];
  21655. return js.toString
  21656. ? js.toString()
  21657. : Object.prototype.toString.call(js)
  21658. ;
  21659. return self;
  21660. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  21661. },
  21662. args: [],
  21663. 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'>",
  21664. referencedClasses: [],
  21665. messageSends: []
  21666. }),
  21667. $globals.JSObjectProxy);
  21668. $core.addMethod(
  21669. $core.method({
  21670. selector: "putOn:",
  21671. protocol: "streaming",
  21672. fn: function (aStream){
  21673. var self=this,$self=this;
  21674. return $core.withContext(function($ctx1) {
  21675. $recv(aStream)._nextPutJSObject_($self["@jsObject"]);
  21676. return self;
  21677. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21678. },
  21679. args: ["aStream"],
  21680. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  21681. referencedClasses: [],
  21682. messageSends: ["nextPutJSObject:"]
  21683. }),
  21684. $globals.JSObjectProxy);
  21685. $core.addMethod(
  21686. $core.method({
  21687. selector: "then:",
  21688. protocol: "promises",
  21689. fn: function (aBlockOrArray){
  21690. var self=this,$self=this;
  21691. return $core.withContext(function($ctx1) {
  21692. var $1,$2;
  21693. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21694. if($core.assert($1)){
  21695. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self["@jsObject"],[aBlockOrArray]);
  21696. } else {
  21697. $2=(
  21698. $ctx1.supercall = true,
  21699. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  21700. $ctx1.supercall = false;
  21701. return $2;
  21702. }
  21703. return self;
  21704. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  21705. },
  21706. args: ["aBlockOrArray"],
  21707. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  21708. referencedClasses: ["NativeFunction", "TThenable"],
  21709. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  21710. }),
  21711. $globals.JSObjectProxy);
  21712. $core.addMethod(
  21713. $core.method({
  21714. selector: "addObjectVariablesTo:ofProxy:",
  21715. protocol: "proxy",
  21716. fn: function (aDictionary,aProxy){
  21717. var self=this,$self=this;
  21718. return $core.withContext(function($ctx1) {
  21719. var jsObject = aProxy['@jsObject'];
  21720. for(var i in jsObject) {
  21721. aDictionary._at_put_(i, jsObject[i]);
  21722. }
  21723. ;
  21724. return self;
  21725. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21726. },
  21727. args: ["aDictionary", "aProxy"],
  21728. 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'>",
  21729. referencedClasses: [],
  21730. messageSends: []
  21731. }),
  21732. $globals.JSObjectProxy.a$cls);
  21733. $core.addMethod(
  21734. $core.method({
  21735. selector: "compareJSObjectOfProxy:withProxy:",
  21736. protocol: "proxy",
  21737. fn: function (aProxy,anotherProxy){
  21738. var self=this,$self=this;
  21739. return $core.withContext(function($ctx1) {
  21740. var anotherJSObject = anotherProxy.a$cls ? anotherProxy["@jsObject"] : anotherProxy;
  21741. return aProxy["@jsObject"] === anotherJSObject;
  21742. return self;
  21743. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.a$cls)});
  21744. },
  21745. args: ["aProxy", "anotherProxy"],
  21746. 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'>",
  21747. referencedClasses: [],
  21748. messageSends: []
  21749. }),
  21750. $globals.JSObjectProxy.a$cls);
  21751. $core.addMethod(
  21752. $core.method({
  21753. selector: "forwardMessage:withArguments:ofProxy:",
  21754. protocol: "proxy",
  21755. fn: function (aString,anArray,aProxy){
  21756. var self=this,$self=this;
  21757. return $core.withContext(function($ctx1) {
  21758. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  21759. ;
  21760. return self;
  21761. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21762. },
  21763. args: ["aString", "anArray", "aProxy"],
  21764. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  21765. referencedClasses: [],
  21766. messageSends: []
  21767. }),
  21768. $globals.JSObjectProxy.a$cls);
  21769. $core.addMethod(
  21770. $core.method({
  21771. selector: "jsObject:ofProxy:",
  21772. protocol: "proxy",
  21773. fn: function (aJSObject,aProxy){
  21774. var self=this,$self=this;
  21775. return $core.withContext(function($ctx1) {
  21776. aProxy['@jsObject'] = aJSObject;
  21777. return self;
  21778. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21779. },
  21780. args: ["aJSObject", "aProxy"],
  21781. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  21782. referencedClasses: [],
  21783. messageSends: []
  21784. }),
  21785. $globals.JSObjectProxy.a$cls);
  21786. $core.addMethod(
  21787. $core.method({
  21788. selector: "lookupProperty:ofProxy:",
  21789. protocol: "proxy",
  21790. fn: function (aString,aProxy){
  21791. var self=this,$self=this;
  21792. return $core.withContext(function($ctx1) {
  21793. return aString in aProxy._jsObject() ? aString : nil;
  21794. return self;
  21795. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21796. },
  21797. args: ["aString", "aProxy"],
  21798. 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'>",
  21799. referencedClasses: [],
  21800. messageSends: []
  21801. }),
  21802. $globals.JSObjectProxy.a$cls);
  21803. $core.addMethod(
  21804. $core.method({
  21805. selector: "on:",
  21806. protocol: "instance creation",
  21807. fn: function (aJSObject){
  21808. var self=this,$self=this;
  21809. var instance;
  21810. return $core.withContext(function($ctx1) {
  21811. instance=$self._new();
  21812. $self._jsObject_ofProxy_(aJSObject,instance);
  21813. return instance;
  21814. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.a$cls)});
  21815. },
  21816. args: ["aJSObject"],
  21817. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  21818. referencedClasses: [],
  21819. messageSends: ["new", "jsObject:ofProxy:"]
  21820. }),
  21821. $globals.JSObjectProxy.a$cls);
  21822. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  21823. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  21824. $core.addMethod(
  21825. $core.method({
  21826. selector: "addElement:",
  21827. protocol: "accessing",
  21828. fn: function (anObject){
  21829. var self=this,$self=this;
  21830. return $core.withContext(function($ctx1) {
  21831. $recv($self._elements())._add_(anObject);
  21832. return self;
  21833. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  21834. },
  21835. args: ["anObject"],
  21836. source: "addElement: anObject\x0a\x09self elements add: anObject",
  21837. referencedClasses: [],
  21838. messageSends: ["add:", "elements"]
  21839. }),
  21840. $globals.Organizer);
  21841. $core.addMethod(
  21842. $core.method({
  21843. selector: "elements",
  21844. protocol: "accessing",
  21845. fn: function (){
  21846. var self=this,$self=this;
  21847. return $self["@elements"];
  21848. },
  21849. args: [],
  21850. source: "elements\x0a\x09^ elements",
  21851. referencedClasses: [],
  21852. messageSends: []
  21853. }),
  21854. $globals.Organizer);
  21855. $core.addMethod(
  21856. $core.method({
  21857. selector: "initialize",
  21858. protocol: "initialization",
  21859. fn: function (){
  21860. var self=this,$self=this;
  21861. return $core.withContext(function($ctx1) {
  21862. (
  21863. $ctx1.supercall = true,
  21864. ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  21865. $ctx1.supercall = false;
  21866. $self["@elements"]=$recv($globals.Set)._new();
  21867. return self;
  21868. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Organizer)});
  21869. },
  21870. args: [],
  21871. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  21872. referencedClasses: ["Set"],
  21873. messageSends: ["initialize", "new"]
  21874. }),
  21875. $globals.Organizer);
  21876. $core.addMethod(
  21877. $core.method({
  21878. selector: "removeElement:",
  21879. protocol: "accessing",
  21880. fn: function (anObject){
  21881. var self=this,$self=this;
  21882. return $core.withContext(function($ctx1) {
  21883. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  21884. }));
  21885. return self;
  21886. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  21887. },
  21888. args: ["anObject"],
  21889. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  21890. referencedClasses: [],
  21891. messageSends: ["remove:ifAbsent:", "elements"]
  21892. }),
  21893. $globals.Organizer);
  21894. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  21895. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  21896. $core.addMethod(
  21897. $core.method({
  21898. selector: "addElement:",
  21899. protocol: "accessing",
  21900. fn: function (aString){
  21901. var self=this,$self=this;
  21902. return $core.withContext(function($ctx1) {
  21903. var $1,$3,$2;
  21904. (
  21905. $ctx1.supercall = true,
  21906. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  21907. $ctx1.supercall = false;
  21908. $1=$recv($globals.SystemAnnouncer)._current();
  21909. $3=$recv($globals.ProtocolAdded)._new();
  21910. $recv($3)._protocol_(aString);
  21911. $recv($3)._theClass_($self._theClass());
  21912. $2=$recv($3)._yourself();
  21913. $recv($1)._announce_($2);
  21914. return self;
  21915. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  21916. },
  21917. args: ["aString"],
  21918. 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)",
  21919. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  21920. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  21921. }),
  21922. $globals.ClassOrganizer);
  21923. $core.addMethod(
  21924. $core.method({
  21925. selector: "removeElement:",
  21926. protocol: "accessing",
  21927. fn: function (aString){
  21928. var self=this,$self=this;
  21929. return $core.withContext(function($ctx1) {
  21930. var $1,$3,$2;
  21931. (
  21932. $ctx1.supercall = true,
  21933. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  21934. $ctx1.supercall = false;
  21935. $1=$recv($globals.SystemAnnouncer)._current();
  21936. $3=$recv($globals.ProtocolRemoved)._new();
  21937. $recv($3)._protocol_(aString);
  21938. $recv($3)._theClass_($self._theClass());
  21939. $2=$recv($3)._yourself();
  21940. $recv($1)._announce_($2);
  21941. return self;
  21942. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  21943. },
  21944. args: ["aString"],
  21945. 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)",
  21946. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  21947. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  21948. }),
  21949. $globals.ClassOrganizer);
  21950. $core.addMethod(
  21951. $core.method({
  21952. selector: "theClass",
  21953. protocol: "accessing",
  21954. fn: function (){
  21955. var self=this,$self=this;
  21956. return $self["@traitOrBehavior"];
  21957. },
  21958. args: [],
  21959. source: "theClass\x0a\x09^ traitOrBehavior",
  21960. referencedClasses: [],
  21961. messageSends: []
  21962. }),
  21963. $globals.ClassOrganizer);
  21964. $core.addMethod(
  21965. $core.method({
  21966. selector: "theClass:",
  21967. protocol: "accessing",
  21968. fn: function (aClass){
  21969. var self=this,$self=this;
  21970. $self["@traitOrBehavior"]=aClass;
  21971. return self;
  21972. },
  21973. args: ["aClass"],
  21974. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  21975. referencedClasses: [],
  21976. messageSends: []
  21977. }),
  21978. $globals.ClassOrganizer);
  21979. $core.addMethod(
  21980. $core.method({
  21981. selector: "on:",
  21982. protocol: "instance creation",
  21983. fn: function (aClass){
  21984. var self=this,$self=this;
  21985. return $core.withContext(function($ctx1) {
  21986. var $1;
  21987. $1=$self._new();
  21988. $recv($1)._theClass_(aClass);
  21989. return $recv($1)._yourself();
  21990. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.ClassOrganizer.a$cls)});
  21991. },
  21992. args: ["aClass"],
  21993. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  21994. referencedClasses: [],
  21995. messageSends: ["theClass:", "new", "yourself"]
  21996. }),
  21997. $globals.ClassOrganizer.a$cls);
  21998. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  21999. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  22000. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization"], "Kernel-Infrastructure");
  22001. $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'";
  22002. $core.addMethod(
  22003. $core.method({
  22004. selector: "basicTransport",
  22005. protocol: "private",
  22006. fn: function (){
  22007. var self=this,$self=this;
  22008. return $self["@basicTransport"];
  22009. },
  22010. args: [],
  22011. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  22012. referencedClasses: [],
  22013. messageSends: []
  22014. }),
  22015. $globals.Package);
  22016. $core.addMethod(
  22017. $core.method({
  22018. selector: "beClean",
  22019. protocol: "accessing",
  22020. fn: function (){
  22021. var self=this,$self=this;
  22022. return $core.withContext(function($ctx1) {
  22023. var $1,$3,$2;
  22024. $self["@dirty"]=false;
  22025. $1=$recv($globals.SystemAnnouncer)._current();
  22026. $3=$recv($globals.PackageClean)._new();
  22027. $recv($3)._package_(self);
  22028. $2=$recv($3)._yourself();
  22029. $recv($1)._announce_($2);
  22030. return self;
  22031. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  22032. },
  22033. args: [],
  22034. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22035. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  22036. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22037. }),
  22038. $globals.Package);
  22039. $core.addMethod(
  22040. $core.method({
  22041. selector: "beDirty",
  22042. protocol: "accessing",
  22043. fn: function (){
  22044. var self=this,$self=this;
  22045. return $core.withContext(function($ctx1) {
  22046. var $1,$3,$2;
  22047. $self["@dirty"]=true;
  22048. $1=$recv($globals.SystemAnnouncer)._current();
  22049. $3=$recv($globals.PackageDirty)._new();
  22050. $recv($3)._package_(self);
  22051. $2=$recv($3)._yourself();
  22052. $recv($1)._announce_($2);
  22053. return self;
  22054. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  22055. },
  22056. args: [],
  22057. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22058. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  22059. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22060. }),
  22061. $globals.Package);
  22062. $core.addMethod(
  22063. $core.method({
  22064. selector: "classTemplate",
  22065. protocol: "accessing",
  22066. fn: function (){
  22067. var self=this,$self=this;
  22068. return $core.withContext(function($ctx1) {
  22069. return $recv($globals.String)._streamContents_((function(stream){
  22070. return $core.withContext(function($ctx2) {
  22071. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  22072. $ctx2.sendIdx["write:"]=1;
  22073. $recv(stream)._lf();
  22074. $ctx2.sendIdx["lf"]=1;
  22075. $recv(stream)._tab();
  22076. $ctx2.sendIdx["tab"]=1;
  22077. $recv(stream)._write_("instanceVariableNames: ''");
  22078. $ctx2.sendIdx["write:"]=2;
  22079. $recv(stream)._lf();
  22080. $recv(stream)._tab();
  22081. $recv(stream)._write_("package: ");
  22082. return $recv(stream)._print_($self._name());
  22083. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22084. }));
  22085. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  22086. },
  22087. args: [],
  22088. 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 ]",
  22089. referencedClasses: ["String"],
  22090. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  22091. }),
  22092. $globals.Package);
  22093. $core.addMethod(
  22094. $core.method({
  22095. selector: "classes",
  22096. protocol: "classes",
  22097. fn: function (){
  22098. var self=this,$self=this;
  22099. return $core.withContext(function($ctx1) {
  22100. return $recv($recv($self._organization())._elements())._copy();
  22101. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  22102. },
  22103. args: [],
  22104. source: "classes\x0a\x09^ self organization elements copy",
  22105. referencedClasses: [],
  22106. messageSends: ["copy", "elements", "organization"]
  22107. }),
  22108. $globals.Package);
  22109. $core.addMethod(
  22110. $core.method({
  22111. selector: "definition",
  22112. protocol: "accessing",
  22113. fn: function (){
  22114. var self=this,$self=this;
  22115. return $core.withContext(function($ctx1) {
  22116. var $1;
  22117. return $recv($globals.String)._streamContents_((function(stream){
  22118. return $core.withContext(function($ctx2) {
  22119. $1=$recv($self._class())._name();
  22120. $ctx2.sendIdx["name"]=1;
  22121. $recv(stream)._write_($1);
  22122. $ctx2.sendIdx["write:"]=1;
  22123. $recv(stream)._lf();
  22124. $ctx2.sendIdx["lf"]=1;
  22125. $recv(stream)._tab();
  22126. $ctx2.sendIdx["tab"]=1;
  22127. $recv(stream)._write_("named: ");
  22128. $ctx2.sendIdx["write:"]=2;
  22129. $recv(stream)._print_($self._name());
  22130. $recv(stream)._lf();
  22131. $ctx2.sendIdx["lf"]=2;
  22132. $recv(stream)._tab();
  22133. $ctx2.sendIdx["tab"]=2;
  22134. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  22135. $ctx2.sendIdx["write:"]=3;
  22136. $recv(stream)._lf();
  22137. $recv(stream)._tab();
  22138. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  22139. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22140. }));
  22141. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  22142. },
  22143. args: [],
  22144. 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. ')' } ]",
  22145. referencedClasses: ["String"],
  22146. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  22147. }),
  22148. $globals.Package);
  22149. $core.addMethod(
  22150. $core.method({
  22151. selector: "eval:",
  22152. protocol: "evaluating",
  22153. fn: function (aString){
  22154. var self=this,$self=this;
  22155. return $core.withContext(function($ctx1) {
  22156. var $1,$receiver;
  22157. $1=$self["@evalBlock"];
  22158. if(($receiver = $1) == null || $receiver.a$nil){
  22159. return $recv($globals.Compiler)._eval_(aString);
  22160. } else {
  22161. return $recv($self["@evalBlock"])._value_(aString);
  22162. }
  22163. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Package)});
  22164. },
  22165. args: ["aString"],
  22166. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  22167. referencedClasses: ["Compiler"],
  22168. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  22169. }),
  22170. $globals.Package);
  22171. $core.addMethod(
  22172. $core.method({
  22173. selector: "evalBlock",
  22174. protocol: "accessing",
  22175. fn: function (){
  22176. var self=this,$self=this;
  22177. return $self["@evalBlock"];
  22178. },
  22179. args: [],
  22180. source: "evalBlock\x0a\x09^ evalBlock",
  22181. referencedClasses: [],
  22182. messageSends: []
  22183. }),
  22184. $globals.Package);
  22185. $core.addMethod(
  22186. $core.method({
  22187. selector: "evalBlock:",
  22188. protocol: "accessing",
  22189. fn: function (aBlock){
  22190. var self=this,$self=this;
  22191. $self["@evalBlock"]=aBlock;
  22192. return self;
  22193. },
  22194. args: ["aBlock"],
  22195. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  22196. referencedClasses: [],
  22197. messageSends: []
  22198. }),
  22199. $globals.Package);
  22200. $core.addMethod(
  22201. $core.method({
  22202. selector: "imports",
  22203. protocol: "accessing",
  22204. fn: function (){
  22205. var self=this,$self=this;
  22206. return $core.withContext(function($ctx1) {
  22207. var $1,$receiver;
  22208. $1=$self["@imports"];
  22209. if(($receiver = $1) == null || $receiver.a$nil){
  22210. $self._imports_([]);
  22211. return $self["@imports"];
  22212. } else {
  22213. return $1;
  22214. }
  22215. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  22216. },
  22217. args: [],
  22218. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  22219. referencedClasses: [],
  22220. messageSends: ["ifNil:", "imports:"]
  22221. }),
  22222. $globals.Package);
  22223. $core.addMethod(
  22224. $core.method({
  22225. selector: "imports:",
  22226. protocol: "accessing",
  22227. fn: function (anArray){
  22228. var self=this,$self=this;
  22229. return $core.withContext(function($ctx1) {
  22230. $self._validateImports_(anArray);
  22231. $self["@imports"]=$recv(anArray)._asSet();
  22232. return self;
  22233. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  22234. },
  22235. args: ["anArray"],
  22236. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  22237. referencedClasses: [],
  22238. messageSends: ["validateImports:", "asSet"]
  22239. }),
  22240. $globals.Package);
  22241. $core.addMethod(
  22242. $core.method({
  22243. selector: "importsAsJson",
  22244. protocol: "converting",
  22245. fn: function (){
  22246. var self=this,$self=this;
  22247. return $core.withContext(function($ctx1) {
  22248. var $1;
  22249. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  22250. return $core.withContext(function($ctx2) {
  22251. $1=$recv(each)._isString();
  22252. if($core.assert($1)){
  22253. return each;
  22254. } else {
  22255. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  22256. $ctx2.sendIdx[","]=1;
  22257. }
  22258. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22259. }));
  22260. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  22261. },
  22262. args: [],
  22263. 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 ]]",
  22264. referencedClasses: [],
  22265. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  22266. }),
  22267. $globals.Package);
  22268. $core.addMethod(
  22269. $core.method({
  22270. selector: "importsDefinition",
  22271. protocol: "accessing",
  22272. fn: function (){
  22273. var self=this,$self=this;
  22274. return $core.withContext(function($ctx1) {
  22275. return $recv($globals.String)._streamContents_((function(stream){
  22276. return $core.withContext(function($ctx2) {
  22277. $recv(stream)._write_("{");
  22278. $ctx2.sendIdx["write:"]=1;
  22279. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  22280. return $core.withContext(function($ctx3) {
  22281. return $recv(stream)._print_(each);
  22282. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  22283. }),(function(){
  22284. return $core.withContext(function($ctx3) {
  22285. return $recv(stream)._write_(". ");
  22286. $ctx3.sendIdx["write:"]=2;
  22287. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  22288. }));
  22289. return $recv(stream)._write_("}");
  22290. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22291. }));
  22292. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  22293. },
  22294. args: [],
  22295. 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: '}' ]",
  22296. referencedClasses: ["String"],
  22297. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  22298. }),
  22299. $globals.Package);
  22300. $core.addMethod(
  22301. $core.method({
  22302. selector: "importsFromJson:",
  22303. protocol: "converting",
  22304. fn: function (anArray){
  22305. var self=this,$self=this;
  22306. return $core.withContext(function($ctx1) {
  22307. var $1;
  22308. return $recv(anArray)._collect_((function(each){
  22309. var split;
  22310. return $core.withContext(function($ctx2) {
  22311. split=$recv(each)._tokenize_("=");
  22312. split;
  22313. $1=$recv($recv(split)._size()).__eq((1));
  22314. if($core.assert($1)){
  22315. return $recv(split)._first();
  22316. $ctx2.sendIdx["first"]=1;
  22317. } else {
  22318. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  22319. }
  22320. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  22321. }));
  22322. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  22323. },
  22324. args: ["anArray"],
  22325. 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 ]]",
  22326. referencedClasses: [],
  22327. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  22328. }),
  22329. $globals.Package);
  22330. $core.addMethod(
  22331. $core.method({
  22332. selector: "initialize",
  22333. protocol: "initialization",
  22334. fn: function (){
  22335. var self=this,$self=this;
  22336. return $core.withContext(function($ctx1) {
  22337. (
  22338. $ctx1.supercall = true,
  22339. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22340. $ctx1.supercall = false;
  22341. $self["@organization"]=$recv($globals.PackageOrganizer)._new();
  22342. $self["@evalBlock"]=nil;
  22343. $self["@dirty"]=nil;
  22344. $self["@imports"]=nil;
  22345. $self["@transport"]=nil;
  22346. return self;
  22347. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Package)});
  22348. },
  22349. args: [],
  22350. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09organization := PackageOrganizer new.\x0a\x09evalBlock := nil.\x0a\x09dirty := nil.\x0a\x09imports := nil.\x0a\x09transport := nil",
  22351. referencedClasses: ["PackageOrganizer"],
  22352. messageSends: ["initialize", "new"]
  22353. }),
  22354. $globals.Package);
  22355. $core.addMethod(
  22356. $core.method({
  22357. selector: "isDirty",
  22358. protocol: "testing",
  22359. fn: function (){
  22360. var self=this,$self=this;
  22361. return $core.withContext(function($ctx1) {
  22362. var $1,$receiver;
  22363. $1=$self["@dirty"];
  22364. if(($receiver = $1) == null || $receiver.a$nil){
  22365. return false;
  22366. } else {
  22367. return $1;
  22368. }
  22369. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  22370. },
  22371. args: [],
  22372. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  22373. referencedClasses: [],
  22374. messageSends: ["ifNil:"]
  22375. }),
  22376. $globals.Package);
  22377. $core.addMethod(
  22378. $core.method({
  22379. selector: "isPackage",
  22380. protocol: "testing",
  22381. fn: function (){
  22382. var self=this,$self=this;
  22383. return true;
  22384. },
  22385. args: [],
  22386. source: "isPackage\x0a\x09^ true",
  22387. referencedClasses: [],
  22388. messageSends: []
  22389. }),
  22390. $globals.Package);
  22391. $core.addMethod(
  22392. $core.method({
  22393. selector: "javaScriptDescriptor:",
  22394. protocol: "accessing",
  22395. fn: function (anObject){
  22396. var self=this,$self=this;
  22397. var basicEval,basicImports;
  22398. return $core.withContext(function($ctx1) {
  22399. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  22400. return $core.withContext(function($ctx2) {
  22401. return nil._asJavaScriptObject();
  22402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22403. }));
  22404. $ctx1.sendIdx["at:ifAbsent:"]=1;
  22405. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  22406. return [];
  22407. }));
  22408. $ctx1.sendIdx["at:ifAbsent:"]=2;
  22409. $self["@basicTransport"]=$recv(anObject)._at_ifAbsent_("transport",(function(){
  22410. }));
  22411. $self._evalBlock_(basicEval);
  22412. $self._imports_($self._importsFromJson_(basicImports));
  22413. return self;
  22414. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports},$globals.Package)});
  22415. },
  22416. args: ["anObject"],
  22417. 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)",
  22418. referencedClasses: [],
  22419. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "evalBlock:", "imports:", "importsFromJson:"]
  22420. }),
  22421. $globals.Package);
  22422. $core.addMethod(
  22423. $core.method({
  22424. selector: "loadDependencies",
  22425. protocol: "dependencies",
  22426. fn: function (){
  22427. var self=this,$self=this;
  22428. var classes,packages;
  22429. return $core.withContext(function($ctx1) {
  22430. var $1;
  22431. classes=$self._loadDependencyClasses();
  22432. $1=$recv($recv(classes)._collect_((function(each){
  22433. return $core.withContext(function($ctx2) {
  22434. return $recv(each)._package();
  22435. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22436. })))._asSet();
  22437. $recv($1)._remove_ifAbsent_(self,(function(){
  22438. }));
  22439. return $recv($1)._yourself();
  22440. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  22441. },
  22442. args: [],
  22443. 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",
  22444. referencedClasses: [],
  22445. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  22446. }),
  22447. $globals.Package);
  22448. $core.addMethod(
  22449. $core.method({
  22450. selector: "loadDependencyClasses",
  22451. protocol: "dependencies",
  22452. fn: function (){
  22453. var self=this,$self=this;
  22454. var starCategoryName;
  22455. return $core.withContext(function($ctx1) {
  22456. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  22457. starCategoryName="*".__comma($self._name());
  22458. $ctx1.sendIdx[","]=1;
  22459. $3=$self._classes();
  22460. $ctx1.sendIdx["classes"]=1;
  22461. $2=$recv($3)._collect_((function(each){
  22462. return $core.withContext(function($ctx2) {
  22463. return $recv(each)._superclass();
  22464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22465. }));
  22466. $ctx1.sendIdx["collect:"]=1;
  22467. $1=$recv($2)._asSet();
  22468. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  22469. return $core.withContext(function($ctx2) {
  22470. $5=$recv(each)._protocols();
  22471. $ctx2.sendIdx["protocols"]=1;
  22472. $7=$recv(each)._theMetaClass();
  22473. if(($receiver = $7) == null || $receiver.a$nil){
  22474. $6=[];
  22475. } else {
  22476. var meta;
  22477. meta=$receiver;
  22478. $6=$recv(meta)._protocols();
  22479. }
  22480. $4=$recv($5).__comma($6);
  22481. return $recv($4)._includes_(starCategoryName);
  22482. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22483. })));
  22484. $ctx1.sendIdx["addAll:"]=1;
  22485. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  22486. return $core.withContext(function($ctx2) {
  22487. return $recv($self._traitCompositions())._valuesDo_((function(each){
  22488. return $core.withContext(function($ctx3) {
  22489. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  22490. return $core.withContext(function($ctx4) {
  22491. return $recv(eachTT)._trait();
  22492. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  22493. })));
  22494. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  22495. }));
  22496. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  22497. })));
  22498. $recv($1)._remove_ifAbsent_(nil,(function(){
  22499. }));
  22500. return $recv($1)._yourself();
  22501. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  22502. },
  22503. args: [],
  22504. 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",
  22505. referencedClasses: ["Smalltalk", "Array"],
  22506. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  22507. }),
  22508. $globals.Package);
  22509. $core.addMethod(
  22510. $core.method({
  22511. selector: "name",
  22512. protocol: "accessing",
  22513. fn: function (){
  22514. var self=this,$self=this;
  22515. return $self["@name"];
  22516. },
  22517. args: [],
  22518. source: "name\x0a\x09^ name",
  22519. referencedClasses: [],
  22520. messageSends: []
  22521. }),
  22522. $globals.Package);
  22523. $core.addMethod(
  22524. $core.method({
  22525. selector: "name:",
  22526. protocol: "accessing",
  22527. fn: function (aString){
  22528. var self=this,$self=this;
  22529. $self["@name"]=aString;
  22530. return self;
  22531. },
  22532. args: ["aString"],
  22533. source: "name: aString\x0a\x09name := aString",
  22534. referencedClasses: [],
  22535. messageSends: []
  22536. }),
  22537. $globals.Package);
  22538. $core.addMethod(
  22539. $core.method({
  22540. selector: "organization",
  22541. protocol: "accessing",
  22542. fn: function (){
  22543. var self=this,$self=this;
  22544. return $self["@organization"];
  22545. },
  22546. args: [],
  22547. source: "organization\x0a\x09^ organization",
  22548. referencedClasses: [],
  22549. messageSends: []
  22550. }),
  22551. $globals.Package);
  22552. $core.addMethod(
  22553. $core.method({
  22554. selector: "printOn:",
  22555. protocol: "printing",
  22556. fn: function (aStream){
  22557. var self=this,$self=this;
  22558. return $core.withContext(function($ctx1) {
  22559. (
  22560. $ctx1.supercall = true,
  22561. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  22562. $ctx1.supercall = false;
  22563. $recv(aStream)._nextPutAll_(" (");
  22564. $ctx1.sendIdx["nextPutAll:"]=1;
  22565. $recv(aStream)._nextPutAll_($self._name());
  22566. $ctx1.sendIdx["nextPutAll:"]=2;
  22567. $recv(aStream)._nextPutAll_(")");
  22568. return self;
  22569. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  22570. },
  22571. args: ["aStream"],
  22572. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  22573. referencedClasses: [],
  22574. messageSends: ["printOn:", "nextPutAll:", "name"]
  22575. }),
  22576. $globals.Package);
  22577. $core.addMethod(
  22578. $core.method({
  22579. selector: "setupClasses",
  22580. protocol: "classes",
  22581. fn: function (){
  22582. var self=this,$self=this;
  22583. return $core.withContext(function($ctx1) {
  22584. $recv($self._classes())._do_((function(each){
  22585. return $core.withContext(function($ctx2) {
  22586. return $recv(each)._initialize();
  22587. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22588. }));
  22589. return self;
  22590. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  22591. },
  22592. args: [],
  22593. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  22594. referencedClasses: [],
  22595. messageSends: ["do:", "classes", "initialize"]
  22596. }),
  22597. $globals.Package);
  22598. $core.addMethod(
  22599. $core.method({
  22600. selector: "sortedClasses",
  22601. protocol: "classes",
  22602. fn: function (){
  22603. var self=this,$self=this;
  22604. return $core.withContext(function($ctx1) {
  22605. return $recv($self._class())._sortedClasses_($self._classes());
  22606. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  22607. },
  22608. args: [],
  22609. 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",
  22610. referencedClasses: [],
  22611. messageSends: ["sortedClasses:", "class", "classes"]
  22612. }),
  22613. $globals.Package);
  22614. $core.addMethod(
  22615. $core.method({
  22616. selector: "sortedImportsAsArray",
  22617. protocol: "private",
  22618. fn: function (){
  22619. var self=this,$self=this;
  22620. return $core.withContext(function($ctx1) {
  22621. var $3,$2,$4,$1,$6,$5,$7;
  22622. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  22623. return $core.withContext(function($ctx2) {
  22624. $3=$recv(a)._isString();
  22625. $ctx2.sendIdx["isString"]=1;
  22626. $2=$recv($3)._not();
  22627. $4=$recv(b)._isString();
  22628. $ctx2.sendIdx["isString"]=2;
  22629. $1=$recv($2).__and($4);
  22630. return $recv($1)._or_((function(){
  22631. return $core.withContext(function($ctx3) {
  22632. $6=$recv(a)._isString();
  22633. $ctx3.sendIdx["isString"]=3;
  22634. $5=$recv($6).__eq($recv(b)._isString());
  22635. return $recv($5)._and_((function(){
  22636. return $core.withContext(function($ctx4) {
  22637. $7=$recv(a)._value();
  22638. $ctx4.sendIdx["value"]=1;
  22639. return $recv($7).__lt_eq($recv(b)._value());
  22640. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  22641. }));
  22642. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  22643. }));
  22644. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  22645. }));
  22646. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  22647. },
  22648. args: [],
  22649. 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 ]]]",
  22650. referencedClasses: [],
  22651. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  22652. }),
  22653. $globals.Package);
  22654. $core.addMethod(
  22655. $core.method({
  22656. selector: "traitCompositions",
  22657. protocol: "dependencies",
  22658. fn: function (){
  22659. var self=this,$self=this;
  22660. var traitCompositions;
  22661. return $core.withContext(function($ctx1) {
  22662. var $1,$2,$3,$receiver;
  22663. traitCompositions=$recv($globals.Dictionary)._new();
  22664. $recv($self._classes())._do_((function(each){
  22665. return $core.withContext(function($ctx2) {
  22666. $1=traitCompositions;
  22667. $2=$recv(each)._traitComposition();
  22668. $ctx2.sendIdx["traitComposition"]=1;
  22669. $recv($1)._at_put_(each,$2);
  22670. $ctx2.sendIdx["at:put:"]=1;
  22671. $3=$recv(each)._theMetaClass();
  22672. if(($receiver = $3) == null || $receiver.a$nil){
  22673. return $3;
  22674. } else {
  22675. var meta;
  22676. meta=$receiver;
  22677. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  22678. }
  22679. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22680. }));
  22681. return $recv(traitCompositions)._reject_((function(each){
  22682. return $core.withContext(function($ctx2) {
  22683. return $recv(each)._isEmpty();
  22684. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  22685. }));
  22686. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  22687. },
  22688. args: [],
  22689. 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 ]",
  22690. referencedClasses: ["Dictionary"],
  22691. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  22692. }),
  22693. $globals.Package);
  22694. $core.addMethod(
  22695. $core.method({
  22696. selector: "transport",
  22697. protocol: "accessing",
  22698. fn: function (){
  22699. var self=this,$self=this;
  22700. return $core.withContext(function($ctx1) {
  22701. var $1,$receiver;
  22702. $1=$self["@transport"];
  22703. if(($receiver = $1) == null || $receiver.a$nil){
  22704. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  22705. return $self["@transport"];
  22706. } else {
  22707. return $1;
  22708. }
  22709. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  22710. },
  22711. args: [],
  22712. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  22713. referencedClasses: ["PackageTransport"],
  22714. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  22715. }),
  22716. $globals.Package);
  22717. $core.addMethod(
  22718. $core.method({
  22719. selector: "transport:",
  22720. protocol: "accessing",
  22721. fn: function (aPackageTransport){
  22722. var self=this,$self=this;
  22723. return $core.withContext(function($ctx1) {
  22724. $self["@transport"]=aPackageTransport;
  22725. $recv(aPackageTransport)._package_(self);
  22726. return self;
  22727. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  22728. },
  22729. args: ["aPackageTransport"],
  22730. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  22731. referencedClasses: [],
  22732. messageSends: ["package:"]
  22733. }),
  22734. $globals.Package);
  22735. $core.addMethod(
  22736. $core.method({
  22737. selector: "validateImports:",
  22738. protocol: "validation",
  22739. fn: function (aCollection){
  22740. var self=this,$self=this;
  22741. return $core.withContext(function($ctx1) {
  22742. var $1,$2,$5,$4,$3,$6;
  22743. $recv(aCollection)._do_((function(import_){
  22744. return $core.withContext(function($ctx2) {
  22745. $1=$recv(import_)._isString();
  22746. $ctx2.sendIdx["isString"]=1;
  22747. if(!$core.assert($1)){
  22748. $2=$recv(import_)._respondsTo_("key");
  22749. if(!$core.assert($2)){
  22750. $self._error_("Imports must be Strings or Associations");
  22751. $ctx2.sendIdx["error:"]=1;
  22752. }
  22753. $5=$recv(import_)._key();
  22754. $ctx2.sendIdx["key"]=1;
  22755. $4=$recv($5)._isString();
  22756. $ctx2.sendIdx["isString"]=2;
  22757. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  22758. if(!$core.assert($3)){
  22759. $self._error_("Key and value must be Strings");
  22760. $ctx2.sendIdx["error:"]=2;
  22761. }
  22762. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  22763. if(!$core.assert($6)){
  22764. return $self._error_("Keys must be identifiers");
  22765. }
  22766. }
  22767. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  22768. }));
  22769. return self;
  22770. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  22771. },
  22772. args: ["aCollection"],
  22773. 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' ]]]",
  22774. referencedClasses: [],
  22775. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  22776. }),
  22777. $globals.Package);
  22778. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  22779. $core.addMethod(
  22780. $core.method({
  22781. selector: "named:",
  22782. protocol: "accessing",
  22783. fn: function (aPackageName){
  22784. var self=this,$self=this;
  22785. return $core.withContext(function($ctx1) {
  22786. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  22787. return $core.withContext(function($ctx2) {
  22788. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  22789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22790. }));
  22791. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  22792. },
  22793. args: ["aPackageName"],
  22794. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  22795. referencedClasses: ["Smalltalk"],
  22796. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  22797. }),
  22798. $globals.Package.a$cls);
  22799. $core.addMethod(
  22800. $core.method({
  22801. selector: "named:ifAbsent:",
  22802. protocol: "accessing",
  22803. fn: function (aPackageName,aBlock){
  22804. var self=this,$self=this;
  22805. return $core.withContext(function($ctx1) {
  22806. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  22807. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  22808. },
  22809. args: ["aPackageName", "aBlock"],
  22810. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  22811. referencedClasses: ["Smalltalk"],
  22812. messageSends: ["packageAt:ifAbsent:"]
  22813. }),
  22814. $globals.Package.a$cls);
  22815. $core.addMethod(
  22816. $core.method({
  22817. selector: "named:imports:transport:",
  22818. protocol: "accessing",
  22819. fn: function (aPackageName,anArray,aTransport){
  22820. var self=this,$self=this;
  22821. var package_;
  22822. return $core.withContext(function($ctx1) {
  22823. package_=$self._named_(aPackageName);
  22824. $recv(package_)._imports_(anArray);
  22825. $recv(package_)._transport_(aTransport);
  22826. return package_;
  22827. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.a$cls)});
  22828. },
  22829. args: ["aPackageName", "anArray", "aTransport"],
  22830. source: "named: aPackageName imports: anArray transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package imports: anArray.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  22831. referencedClasses: [],
  22832. messageSends: ["named:", "imports:", "transport:"]
  22833. }),
  22834. $globals.Package.a$cls);
  22835. $core.addMethod(
  22836. $core.method({
  22837. selector: "named:javaScriptDescriptor:",
  22838. protocol: "instance creation",
  22839. fn: function (aString,anObject){
  22840. var self=this,$self=this;
  22841. var package_;
  22842. return $core.withContext(function($ctx1) {
  22843. package_=$recv($globals.Smalltalk)._createPackage_(aString);
  22844. $recv(package_)._javaScriptDescriptor_(anObject);
  22845. return package_;
  22846. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,package_:package_},$globals.Package.a$cls)});
  22847. },
  22848. args: ["aString", "anObject"],
  22849. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| package |\x0a\x09\x0a\x09package := Smalltalk createPackage: aString.\x0a\x09package javaScriptDescriptor: anObject.\x0a\x09^ package",
  22850. referencedClasses: ["Smalltalk"],
  22851. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  22852. }),
  22853. $globals.Package.a$cls);
  22854. $core.addMethod(
  22855. $core.method({
  22856. selector: "named:transport:",
  22857. protocol: "accessing",
  22858. fn: function (aPackageName,aTransport){
  22859. var self=this,$self=this;
  22860. var package_;
  22861. return $core.withContext(function($ctx1) {
  22862. package_=$self._named_(aPackageName);
  22863. $recv(package_)._transport_(aTransport);
  22864. return package_;
  22865. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.a$cls)});
  22866. },
  22867. args: ["aPackageName", "aTransport"],
  22868. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  22869. referencedClasses: [],
  22870. messageSends: ["named:", "transport:"]
  22871. }),
  22872. $globals.Package.a$cls);
  22873. $core.addMethod(
  22874. $core.method({
  22875. selector: "new:",
  22876. protocol: "instance creation",
  22877. fn: function (aString){
  22878. var self=this,$self=this;
  22879. return $core.withContext(function($ctx1) {
  22880. var $1;
  22881. $1=$recv($globals.Package)._new();
  22882. $recv($1)._name_(aString);
  22883. return $recv($1)._yourself();
  22884. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.Package.a$cls)});
  22885. },
  22886. args: ["aString"],
  22887. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  22888. referencedClasses: ["Package"],
  22889. messageSends: ["name:", "new", "yourself"]
  22890. }),
  22891. $globals.Package.a$cls);
  22892. $core.addMethod(
  22893. $core.method({
  22894. selector: "sortedClasses:",
  22895. protocol: "sorting",
  22896. fn: function (classes){
  22897. var self=this,$self=this;
  22898. var children,others,nodes,expandedClasses;
  22899. return $core.withContext(function($ctx1) {
  22900. var $1,$3,$2;
  22901. children=[];
  22902. others=[];
  22903. $recv(classes)._do_((function(each){
  22904. return $core.withContext(function($ctx2) {
  22905. $1=$recv(classes)._includes_($recv(each)._superclass());
  22906. if($core.assert($1)){
  22907. return $recv(others)._add_(each);
  22908. } else {
  22909. return $recv(children)._add_(each);
  22910. $ctx2.sendIdx["add:"]=1;
  22911. }
  22912. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22913. }));
  22914. $ctx1.sendIdx["do:"]=1;
  22915. nodes=$recv(children)._collect_((function(each){
  22916. return $core.withContext(function($ctx2) {
  22917. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  22918. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  22919. }));
  22920. nodes=$recv(nodes)._sorted_((function(a,b){
  22921. return $core.withContext(function($ctx2) {
  22922. $3=$recv(a)._theClass();
  22923. $ctx2.sendIdx["theClass"]=1;
  22924. $2=$recv($3)._name();
  22925. $ctx2.sendIdx["name"]=1;
  22926. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  22927. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  22928. }));
  22929. expandedClasses=$recv($globals.Array)._new();
  22930. $recv(nodes)._do_((function(aNode){
  22931. return $core.withContext(function($ctx2) {
  22932. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  22933. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  22934. }));
  22935. return expandedClasses;
  22936. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  22937. },
  22938. args: ["classes"],
  22939. 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",
  22940. referencedClasses: ["ClassSorterNode", "Array"],
  22941. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  22942. }),
  22943. $globals.Package.a$cls);
  22944. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  22945. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  22946. $core.addMethod(
  22947. $core.method({
  22948. selector: "announcer",
  22949. protocol: "accessing",
  22950. fn: function (){
  22951. var self=this,$self=this;
  22952. return $core.withContext(function($ctx1) {
  22953. return $recv($globals.SystemAnnouncer)._current();
  22954. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  22955. },
  22956. args: [],
  22957. source: "announcer\x0a\x09^ SystemAnnouncer current",
  22958. referencedClasses: ["SystemAnnouncer"],
  22959. messageSends: ["current"]
  22960. }),
  22961. $globals.PackageStateObserver);
  22962. $core.addMethod(
  22963. $core.method({
  22964. selector: "observeSystem",
  22965. protocol: "actions",
  22966. fn: function (){
  22967. var self=this,$self=this;
  22968. return $core.withContext(function($ctx1) {
  22969. var $1;
  22970. $1=$self._announcer();
  22971. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  22972. $ctx1.sendIdx["on:send:to:"]=1;
  22973. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  22974. $ctx1.sendIdx["on:send:to:"]=2;
  22975. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  22976. $ctx1.sendIdx["on:send:to:"]=3;
  22977. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  22978. return self;
  22979. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  22980. },
  22981. args: [],
  22982. 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",
  22983. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  22984. messageSends: ["on:send:to:", "announcer"]
  22985. }),
  22986. $globals.PackageStateObserver);
  22987. $core.addMethod(
  22988. $core.method({
  22989. selector: "onClassModification:",
  22990. protocol: "reactions",
  22991. fn: function (anAnnouncement){
  22992. var self=this,$self=this;
  22993. return $core.withContext(function($ctx1) {
  22994. var $1,$receiver;
  22995. $1=$recv(anAnnouncement)._theClass();
  22996. if(($receiver = $1) == null || $receiver.a$nil){
  22997. $1;
  22998. } else {
  22999. var theClass;
  23000. theClass=$receiver;
  23001. $recv($recv(theClass)._package())._beDirty();
  23002. }
  23003. return self;
  23004. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23005. },
  23006. args: ["anAnnouncement"],
  23007. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  23008. referencedClasses: [],
  23009. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  23010. }),
  23011. $globals.PackageStateObserver);
  23012. $core.addMethod(
  23013. $core.method({
  23014. selector: "onMethodModification:",
  23015. protocol: "reactions",
  23016. fn: function (anAnnouncement){
  23017. var self=this,$self=this;
  23018. return $core.withContext(function($ctx1) {
  23019. var $1,$receiver;
  23020. $1=$recv($recv(anAnnouncement)._method())._package();
  23021. if(($receiver = $1) == null || $receiver.a$nil){
  23022. $1;
  23023. } else {
  23024. var package_;
  23025. package_=$receiver;
  23026. $recv(package_)._beDirty();
  23027. }
  23028. return self;
  23029. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23030. },
  23031. args: ["anAnnouncement"],
  23032. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  23033. referencedClasses: [],
  23034. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  23035. }),
  23036. $globals.PackageStateObserver);
  23037. $core.addMethod(
  23038. $core.method({
  23039. selector: "onPackageAdded:",
  23040. protocol: "reactions",
  23041. fn: function (anAnnouncement){
  23042. var self=this,$self=this;
  23043. return $core.withContext(function($ctx1) {
  23044. $recv($recv(anAnnouncement)._package())._beDirty();
  23045. return self;
  23046. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23047. },
  23048. args: ["anAnnouncement"],
  23049. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  23050. referencedClasses: [],
  23051. messageSends: ["beDirty", "package"]
  23052. }),
  23053. $globals.PackageStateObserver);
  23054. $core.addMethod(
  23055. $core.method({
  23056. selector: "onProtocolModification:",
  23057. protocol: "reactions",
  23058. fn: function (anAnnouncement){
  23059. var self=this,$self=this;
  23060. return $core.withContext(function($ctx1) {
  23061. var $1,$receiver;
  23062. $1=$recv(anAnnouncement)._package();
  23063. if(($receiver = $1) == null || $receiver.a$nil){
  23064. $1;
  23065. } else {
  23066. var package_;
  23067. package_=$receiver;
  23068. $recv(package_)._beDirty();
  23069. }
  23070. return self;
  23071. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23072. },
  23073. args: ["anAnnouncement"],
  23074. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  23075. referencedClasses: [],
  23076. messageSends: ["ifNotNil:", "package", "beDirty"]
  23077. }),
  23078. $globals.PackageStateObserver);
  23079. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  23080. $core.addMethod(
  23081. $core.method({
  23082. selector: "current",
  23083. protocol: "accessing",
  23084. fn: function (){
  23085. var self=this,$self=this;
  23086. return $core.withContext(function($ctx1) {
  23087. var $1,$receiver;
  23088. $1=$self["@current"];
  23089. if(($receiver = $1) == null || $receiver.a$nil){
  23090. $self["@current"]=$self._new();
  23091. return $self["@current"];
  23092. } else {
  23093. return $1;
  23094. }
  23095. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  23096. },
  23097. args: [],
  23098. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  23099. referencedClasses: [],
  23100. messageSends: ["ifNil:", "new"]
  23101. }),
  23102. $globals.PackageStateObserver.a$cls);
  23103. $core.addMethod(
  23104. $core.method({
  23105. selector: "initialize",
  23106. protocol: "initialization",
  23107. fn: function (){
  23108. var self=this,$self=this;
  23109. return $core.withContext(function($ctx1) {
  23110. $recv($self._current())._observeSystem();
  23111. return self;
  23112. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  23113. },
  23114. args: [],
  23115. source: "initialize\x0a\x09self current observeSystem",
  23116. referencedClasses: [],
  23117. messageSends: ["observeSystem", "current"]
  23118. }),
  23119. $globals.PackageStateObserver.a$cls);
  23120. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  23121. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  23122. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  23123. $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`";
  23124. $core.addMethod(
  23125. $core.method({
  23126. selector: "defaultValue",
  23127. protocol: "accessing",
  23128. fn: function (){
  23129. var self=this,$self=this;
  23130. return $self["@defaultValue"];
  23131. },
  23132. args: [],
  23133. source: "defaultValue\x0a\x09^ defaultValue",
  23134. referencedClasses: [],
  23135. messageSends: []
  23136. }),
  23137. $globals.Setting);
  23138. $core.addMethod(
  23139. $core.method({
  23140. selector: "defaultValue:",
  23141. protocol: "accessing",
  23142. fn: function (aStringifiableObject){
  23143. var self=this,$self=this;
  23144. $self["@defaultValue"]=aStringifiableObject;
  23145. return self;
  23146. },
  23147. args: ["aStringifiableObject"],
  23148. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  23149. referencedClasses: [],
  23150. messageSends: []
  23151. }),
  23152. $globals.Setting);
  23153. $core.addMethod(
  23154. $core.method({
  23155. selector: "key",
  23156. protocol: "accessing",
  23157. fn: function (){
  23158. var self=this,$self=this;
  23159. return $self["@key"];
  23160. },
  23161. args: [],
  23162. source: "key\x0a\x09^ key",
  23163. referencedClasses: [],
  23164. messageSends: []
  23165. }),
  23166. $globals.Setting);
  23167. $core.addMethod(
  23168. $core.method({
  23169. selector: "key:",
  23170. protocol: "accessing",
  23171. fn: function (aString){
  23172. var self=this,$self=this;
  23173. $self["@key"]=aString;
  23174. return self;
  23175. },
  23176. args: ["aString"],
  23177. source: "key: aString\x0a\x09key := aString",
  23178. referencedClasses: [],
  23179. messageSends: []
  23180. }),
  23181. $globals.Setting);
  23182. $core.addMethod(
  23183. $core.method({
  23184. selector: "value",
  23185. protocol: "accessing",
  23186. fn: function (){
  23187. var self=this,$self=this;
  23188. return $core.withContext(function($ctx1) {
  23189. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  23190. return $core.withContext(function($ctx2) {
  23191. return $self._defaultValue();
  23192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23193. }));
  23194. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  23195. },
  23196. args: [],
  23197. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  23198. referencedClasses: ["Smalltalk"],
  23199. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  23200. }),
  23201. $globals.Setting);
  23202. $core.addMethod(
  23203. $core.method({
  23204. selector: "value:",
  23205. protocol: "accessing",
  23206. fn: function (aStringifiableObject){
  23207. var self=this,$self=this;
  23208. return $core.withContext(function($ctx1) {
  23209. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  23210. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  23211. },
  23212. args: ["aStringifiableObject"],
  23213. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  23214. referencedClasses: ["Smalltalk"],
  23215. messageSends: ["at:put:", "settings", "key"]
  23216. }),
  23217. $globals.Setting);
  23218. $core.addMethod(
  23219. $core.method({
  23220. selector: "at:ifAbsent:",
  23221. protocol: "instance creation",
  23222. fn: function (aString,aDefaultValue){
  23223. var self=this,$self=this;
  23224. return $core.withContext(function($ctx1) {
  23225. var $1;
  23226. $1=(
  23227. $ctx1.supercall = true,
  23228. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  23229. $ctx1.supercall = false;
  23230. $recv($1)._key_(aString);
  23231. $recv($1)._defaultValue_(aDefaultValue);
  23232. return $recv($1)._yourself();
  23233. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  23234. },
  23235. args: ["aString", "aDefaultValue"],
  23236. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  23237. referencedClasses: [],
  23238. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  23239. }),
  23240. $globals.Setting.a$cls);
  23241. $core.addMethod(
  23242. $core.method({
  23243. selector: "new",
  23244. protocol: "instance creation",
  23245. fn: function (){
  23246. var self=this,$self=this;
  23247. return $core.withContext(function($ctx1) {
  23248. $self._shouldNotImplement();
  23249. return self;
  23250. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  23251. },
  23252. args: [],
  23253. source: "new\x0a\x09self shouldNotImplement",
  23254. referencedClasses: [],
  23255. messageSends: ["shouldNotImplement"]
  23256. }),
  23257. $globals.Setting.a$cls);
  23258. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  23259. $globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `$core` declared in `support/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#globals #at:` answers a specific global (usually, a class) or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `support/parser.js` parser file in order to work.";
  23260. $core.addMethod(
  23261. $core.method({
  23262. selector: "addGlobalJsVariable:",
  23263. protocol: "globals",
  23264. fn: function (aString){
  23265. var self=this,$self=this;
  23266. return $core.withContext(function($ctx1) {
  23267. $recv($self._globalJsVariables())._add_(aString);
  23268. return self;
  23269. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23270. },
  23271. args: ["aString"],
  23272. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  23273. referencedClasses: [],
  23274. messageSends: ["add:", "globalJsVariables"]
  23275. }),
  23276. $globals.SmalltalkImage);
  23277. $core.addMethod(
  23278. $core.method({
  23279. selector: "adoptPackageDictionary",
  23280. protocol: "private",
  23281. fn: function (){
  23282. var self=this,$self=this;
  23283. return $core.withContext(function($ctx1) {
  23284. $recv($recv($self._core())._packages())._keysAndValuesDo_((function(key,value){
  23285. return $core.withContext(function($ctx2) {
  23286. return $recv($globals.Package)._named_javaScriptDescriptor_(key,value);
  23287. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23288. }));
  23289. return self;
  23290. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDictionary",{},$globals.SmalltalkImage)});
  23291. },
  23292. args: [],
  23293. source: "adoptPackageDictionary\x0a\x09self core packages keysAndValuesDo: [ :key :value | Package named: key javaScriptDescriptor: value ]",
  23294. referencedClasses: ["Package"],
  23295. messageSends: ["keysAndValuesDo:", "packages", "core", "named:javaScriptDescriptor:"]
  23296. }),
  23297. $globals.SmalltalkImage);
  23298. $core.addMethod(
  23299. $core.method({
  23300. selector: "amdRequire",
  23301. protocol: "accessing amd",
  23302. fn: function (){
  23303. var self=this,$self=this;
  23304. return $core.withContext(function($ctx1) {
  23305. return $recv($self._core())._at_("amdRequire");
  23306. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  23307. },
  23308. args: [],
  23309. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  23310. referencedClasses: [],
  23311. messageSends: ["at:", "core"]
  23312. }),
  23313. $globals.SmalltalkImage);
  23314. $core.addMethod(
  23315. $core.method({
  23316. selector: "asSmalltalkException:",
  23317. protocol: "error handling",
  23318. fn: function (anObject){
  23319. var self=this,$self=this;
  23320. return $core.withContext(function($ctx1) {
  23321. var $1;
  23322. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  23323. return $core.withContext(function($ctx2) {
  23324. return $recv(anObject)._isKindOf_($globals.Error);
  23325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23326. }));
  23327. if($core.assert($1)){
  23328. return anObject;
  23329. } else {
  23330. return $recv($globals.JavaScriptException)._on_(anObject);
  23331. }
  23332. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  23333. },
  23334. args: ["anObject"],
  23335. 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 ]",
  23336. referencedClasses: ["Error", "JavaScriptException"],
  23337. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  23338. }),
  23339. $globals.SmalltalkImage);
  23340. $core.addMethod(
  23341. $core.method({
  23342. selector: "basicCreatePackage:",
  23343. protocol: "private",
  23344. fn: function (packageName){
  23345. var self=this,$self=this;
  23346. return $core.withContext(function($ctx1) {
  23347. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  23348. return $core.withContext(function($ctx2) {
  23349. return $recv($globals.Package)._new_(packageName);
  23350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23351. }));
  23352. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  23353. },
  23354. args: ["packageName"],
  23355. 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 ]",
  23356. referencedClasses: ["Package"],
  23357. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  23358. }),
  23359. $globals.SmalltalkImage);
  23360. $core.addMethod(
  23361. $core.method({
  23362. selector: "basicParse:",
  23363. protocol: "private",
  23364. fn: function (aString){
  23365. var self=this,$self=this;
  23366. return $core.withContext(function($ctx1) {
  23367. return $recv($globals.SmalltalkParser)._parse_(aString);
  23368. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  23369. },
  23370. args: ["aString"],
  23371. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  23372. referencedClasses: ["SmalltalkParser"],
  23373. messageSends: ["parse:"]
  23374. }),
  23375. $globals.SmalltalkImage);
  23376. $core.addMethod(
  23377. $core.method({
  23378. selector: "cancelOptOut:",
  23379. protocol: "accessing",
  23380. fn: function (anObject){
  23381. var self=this,$self=this;
  23382. return $core.withContext(function($ctx1) {
  23383. delete anObject.klass; delete anObject.a$cls;;
  23384. return self;
  23385. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23386. },
  23387. args: ["anObject"],
  23388. 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;'>",
  23389. referencedClasses: [],
  23390. messageSends: []
  23391. }),
  23392. $globals.SmalltalkImage);
  23393. $core.addMethod(
  23394. $core.method({
  23395. selector: "classes",
  23396. protocol: "classes",
  23397. fn: function (){
  23398. var self=this,$self=this;
  23399. return $core.withContext(function($ctx1) {
  23400. return $core.classes();
  23401. return self;
  23402. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  23403. },
  23404. args: [],
  23405. source: "classes\x0a\x09<inlineJS: 'return $core.classes()'>",
  23406. referencedClasses: [],
  23407. messageSends: []
  23408. }),
  23409. $globals.SmalltalkImage);
  23410. $core.addMethod(
  23411. $core.method({
  23412. selector: "core",
  23413. protocol: "accessing",
  23414. fn: function (){
  23415. var self=this,$self=this;
  23416. return $core.withContext(function($ctx1) {
  23417. return $core;
  23418. return self;
  23419. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  23420. },
  23421. args: [],
  23422. source: "core\x0a\x09<inlineJS: 'return $core'>",
  23423. referencedClasses: [],
  23424. messageSends: []
  23425. }),
  23426. $globals.SmalltalkImage);
  23427. $core.addMethod(
  23428. $core.method({
  23429. selector: "createPackage:",
  23430. protocol: "packages",
  23431. fn: function (packageName){
  23432. var self=this,$self=this;
  23433. var package_,announcement;
  23434. return $core.withContext(function($ctx1) {
  23435. var $1;
  23436. package_=$self._basicCreatePackage_(packageName);
  23437. $1=$recv($globals.PackageAdded)._new();
  23438. $recv($1)._package_(package_);
  23439. announcement=$recv($1)._yourself();
  23440. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  23441. return package_;
  23442. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  23443. },
  23444. args: ["packageName"],
  23445. 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",
  23446. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  23447. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  23448. }),
  23449. $globals.SmalltalkImage);
  23450. $core.addMethod(
  23451. $core.method({
  23452. selector: "defaultAmdNamespace",
  23453. protocol: "accessing amd",
  23454. fn: function (){
  23455. var self=this,$self=this;
  23456. return $core.withContext(function($ctx1) {
  23457. return "transport.defaultAmdNamespace"._settingValue();
  23458. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  23459. },
  23460. args: [],
  23461. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  23462. referencedClasses: [],
  23463. messageSends: ["settingValue"]
  23464. }),
  23465. $globals.SmalltalkImage);
  23466. $core.addMethod(
  23467. $core.method({
  23468. selector: "defaultAmdNamespace:",
  23469. protocol: "accessing amd",
  23470. fn: function (aString){
  23471. var self=this,$self=this;
  23472. return $core.withContext(function($ctx1) {
  23473. "transport.defaultAmdNamespace"._settingValue_(aString);
  23474. return self;
  23475. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  23476. },
  23477. args: ["aString"],
  23478. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  23479. referencedClasses: [],
  23480. messageSends: ["settingValue:"]
  23481. }),
  23482. $globals.SmalltalkImage);
  23483. $core.addMethod(
  23484. $core.method({
  23485. selector: "deleteClass:",
  23486. protocol: "private",
  23487. fn: function (aClass){
  23488. var self=this,$self=this;
  23489. return $core.withContext(function($ctx1) {
  23490. $core.removeClass(aClass);
  23491. return self;
  23492. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23493. },
  23494. args: ["aClass"],
  23495. 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)'>",
  23496. referencedClasses: [],
  23497. messageSends: []
  23498. }),
  23499. $globals.SmalltalkImage);
  23500. $core.addMethod(
  23501. $core.method({
  23502. selector: "deleteGlobalJsVariable:",
  23503. protocol: "globals",
  23504. fn: function (aString){
  23505. var self=this,$self=this;
  23506. return $core.withContext(function($ctx1) {
  23507. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  23508. }));
  23509. return self;
  23510. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23511. },
  23512. args: ["aString"],
  23513. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  23514. referencedClasses: [],
  23515. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  23516. }),
  23517. $globals.SmalltalkImage);
  23518. $core.addMethod(
  23519. $core.method({
  23520. selector: "existsJsGlobal:",
  23521. protocol: "testing",
  23522. fn: function (aString){
  23523. var self=this,$self=this;
  23524. return $core.withContext(function($ctx1) {
  23525. return $recv($recv($globals.Platform)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  23526. return true;
  23527. }),(function(){
  23528. return false;
  23529. }));
  23530. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  23531. },
  23532. args: ["aString"],
  23533. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  23534. referencedClasses: ["Platform"],
  23535. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  23536. }),
  23537. $globals.SmalltalkImage);
  23538. $core.addMethod(
  23539. $core.method({
  23540. selector: "globalJsVariables",
  23541. protocol: "globals",
  23542. fn: function (){
  23543. var self=this,$self=this;
  23544. return $core.withContext(function($ctx1) {
  23545. var $1,$receiver;
  23546. $1=$self["@globalJsVariables"];
  23547. if(($receiver = $1) == null || $receiver.a$nil){
  23548. $self["@globalJsVariables"]=["window", "document", "process", "global"].__comma($self._legacyGlobalJsVariables());
  23549. return $self["@globalJsVariables"];
  23550. } else {
  23551. return $1;
  23552. }
  23553. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  23554. },
  23555. args: [],
  23556. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global), self legacyGlobalJsVariables ]",
  23557. referencedClasses: [],
  23558. messageSends: ["ifNil:", ",", "legacyGlobalJsVariables"]
  23559. }),
  23560. $globals.SmalltalkImage);
  23561. $core.addMethod(
  23562. $core.method({
  23563. selector: "globals",
  23564. protocol: "accessing",
  23565. fn: function (){
  23566. var self=this,$self=this;
  23567. return $core.withContext(function($ctx1) {
  23568. return $globals;
  23569. return self;
  23570. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  23571. },
  23572. args: [],
  23573. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  23574. referencedClasses: [],
  23575. messageSends: []
  23576. }),
  23577. $globals.SmalltalkImage);
  23578. $core.addMethod(
  23579. $core.method({
  23580. selector: "includesKey:",
  23581. protocol: "accessing",
  23582. fn: function (aKey){
  23583. var self=this,$self=this;
  23584. return $core.withContext(function($ctx1) {
  23585. return $core.hasOwnProperty(aKey);
  23586. return self;
  23587. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  23588. },
  23589. args: ["aKey"],
  23590. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  23591. referencedClasses: [],
  23592. messageSends: []
  23593. }),
  23594. $globals.SmalltalkImage);
  23595. $core.addMethod(
  23596. $core.method({
  23597. selector: "isSmalltalkObject:",
  23598. protocol: "testing",
  23599. fn: function (anObject){
  23600. var self=this,$self=this;
  23601. return $core.withContext(function($ctx1) {
  23602. return anObject.a$cls != null;
  23603. return self;
  23604. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23605. },
  23606. args: ["anObject"],
  23607. 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'>",
  23608. referencedClasses: [],
  23609. messageSends: []
  23610. }),
  23611. $globals.SmalltalkImage);
  23612. $core.addMethod(
  23613. $core.method({
  23614. selector: "legacyGlobalJsVariables",
  23615. protocol: "private",
  23616. fn: function (){
  23617. var self=this,$self=this;
  23618. return $core.withContext(function($ctx1) {
  23619. return $core.globalJsVariables;
  23620. return self;
  23621. }, function($ctx1) {$ctx1.fill(self,"legacyGlobalJsVariables",{},$globals.SmalltalkImage)});
  23622. },
  23623. args: [],
  23624. source: "legacyGlobalJsVariables\x0a\x09\x22Legacy array of global JavaScript variables.\x0a\x09Only used for BW compat, to be removed.\x22\x0a\x09<inlineJS: 'return $core.globalJsVariables'>",
  23625. referencedClasses: [],
  23626. messageSends: []
  23627. }),
  23628. $globals.SmalltalkImage);
  23629. $core.addMethod(
  23630. $core.method({
  23631. selector: "optOut:",
  23632. protocol: "accessing",
  23633. fn: function (anObject){
  23634. var self=this,$self=this;
  23635. return $core.withContext(function($ctx1) {
  23636. anObject.klass = null; anObject.a$cls = null;
  23637. return self;
  23638. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23639. },
  23640. args: ["anObject"],
  23641. 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'>",
  23642. referencedClasses: [],
  23643. messageSends: []
  23644. }),
  23645. $globals.SmalltalkImage);
  23646. $core.addMethod(
  23647. $core.method({
  23648. selector: "packageAt:",
  23649. protocol: "packages",
  23650. fn: function (packageName){
  23651. var self=this,$self=this;
  23652. return $core.withContext(function($ctx1) {
  23653. $self._deprecatedAPI_("Use #packageAt:ifAbsent: directly.");
  23654. return $self._packageAt_ifAbsent_(packageName,(function(){
  23655. }));
  23656. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  23657. },
  23658. args: ["packageName"],
  23659. source: "packageAt: packageName\x0a\x09self deprecatedAPI: 'Use #packageAt:ifAbsent: directly.'.\x0a\x09^ self packageAt: packageName ifAbsent: []",
  23660. referencedClasses: [],
  23661. messageSends: ["deprecatedAPI:", "packageAt:ifAbsent:"]
  23662. }),
  23663. $globals.SmalltalkImage);
  23664. $core.addMethod(
  23665. $core.method({
  23666. selector: "packageAt:ifAbsent:",
  23667. protocol: "packages",
  23668. fn: function (packageName,aBlock){
  23669. var self=this,$self=this;
  23670. return $core.withContext(function($ctx1) {
  23671. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  23672. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23673. },
  23674. args: ["packageName", "aBlock"],
  23675. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  23676. referencedClasses: [],
  23677. messageSends: ["at:ifAbsent:", "packageDictionary"]
  23678. }),
  23679. $globals.SmalltalkImage);
  23680. $core.addMethod(
  23681. $core.method({
  23682. selector: "packageAt:ifPresent:",
  23683. protocol: "packages",
  23684. fn: function (packageName,aBlock){
  23685. var self=this,$self=this;
  23686. return $core.withContext(function($ctx1) {
  23687. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  23688. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23689. },
  23690. args: ["packageName", "aBlock"],
  23691. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  23692. referencedClasses: [],
  23693. messageSends: ["at:ifPresent:", "packageDictionary"]
  23694. }),
  23695. $globals.SmalltalkImage);
  23696. $core.addMethod(
  23697. $core.method({
  23698. selector: "packageDictionary",
  23699. protocol: "packages",
  23700. fn: function (){
  23701. var self=this,$self=this;
  23702. return $core.withContext(function($ctx1) {
  23703. var $1,$receiver;
  23704. $1=$self["@packageDictionary"];
  23705. if(($receiver = $1) == null || $receiver.a$nil){
  23706. $self["@packageDictionary"]=$recv($globals.Dictionary)._new();
  23707. return $self["@packageDictionary"];
  23708. } else {
  23709. return $1;
  23710. }
  23711. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  23712. },
  23713. args: [],
  23714. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  23715. referencedClasses: ["Dictionary"],
  23716. messageSends: ["ifNil:", "new"]
  23717. }),
  23718. $globals.SmalltalkImage);
  23719. $core.addMethod(
  23720. $core.method({
  23721. selector: "packages",
  23722. protocol: "packages",
  23723. fn: function (){
  23724. var self=this,$self=this;
  23725. return $core.withContext(function($ctx1) {
  23726. return $recv($recv($self._packageDictionary())._values())._copy();
  23727. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  23728. },
  23729. args: [],
  23730. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  23731. referencedClasses: [],
  23732. messageSends: ["copy", "values", "packageDictionary"]
  23733. }),
  23734. $globals.SmalltalkImage);
  23735. $core.addMethod(
  23736. $core.method({
  23737. selector: "parse:",
  23738. protocol: "accessing",
  23739. fn: function (aString){
  23740. var self=this,$self=this;
  23741. var result;
  23742. return $core.withContext(function($ctx1) {
  23743. var $1;
  23744. $recv((function(){
  23745. return $core.withContext(function($ctx2) {
  23746. result=$self._basicParse_(aString);
  23747. return result;
  23748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23749. }))._tryCatch_((function(ex){
  23750. return $core.withContext(function($ctx2) {
  23751. return $recv($self._parseError_parsing_(ex,aString))._signal();
  23752. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  23753. }));
  23754. $1=result;
  23755. $recv($1)._source_(aString);
  23756. return $recv($1)._yourself();
  23757. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  23758. },
  23759. args: ["aString"],
  23760. 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",
  23761. referencedClasses: [],
  23762. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  23763. }),
  23764. $globals.SmalltalkImage);
  23765. $core.addMethod(
  23766. $core.method({
  23767. selector: "parseError:parsing:",
  23768. protocol: "error handling",
  23769. fn: function (anException,aString){
  23770. var self=this,$self=this;
  23771. var pos;
  23772. return $core.withContext(function($ctx1) {
  23773. var $1,$2,$6,$5,$4,$3;
  23774. $1=$recv(anException)._basicAt_("location");
  23775. $ctx1.sendIdx["basicAt:"]=1;
  23776. pos=$recv($1)._start();
  23777. $2=$recv($globals.ParseError)._new();
  23778. $6=$recv("Parse error on line ".__comma($recv(pos)._line())).__comma(" column ");
  23779. $ctx1.sendIdx[","]=4;
  23780. $5=$recv($6).__comma($recv(pos)._column());
  23781. $ctx1.sendIdx[","]=3;
  23782. $4=$recv($5).__comma(" : Unexpected character ");
  23783. $ctx1.sendIdx[","]=2;
  23784. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  23785. $ctx1.sendIdx[","]=1;
  23786. return $recv($2)._messageText_($3);
  23787. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString,pos:pos},$globals.SmalltalkImage)});
  23788. },
  23789. args: ["anException", "aString"],
  23790. source: "parseError: anException parsing: aString\x0a\x09| pos |\x0a\x09pos := (anException basicAt: 'location') start.\x0a\x09^ ParseError new messageText: 'Parse error on line ', pos line ,' column ' , pos column ,' : Unexpected character ', (anException basicAt: 'found')",
  23791. referencedClasses: ["ParseError"],
  23792. messageSends: ["start", "basicAt:", "messageText:", "new", ",", "line", "column"]
  23793. }),
  23794. $globals.SmalltalkImage);
  23795. $core.addMethod(
  23796. $core.method({
  23797. selector: "pseudoVariableNames",
  23798. protocol: "accessing",
  23799. fn: function (){
  23800. var self=this,$self=this;
  23801. return ["self", "super", "nil", "true", "false", "thisContext"];
  23802. },
  23803. args: [],
  23804. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  23805. referencedClasses: [],
  23806. messageSends: []
  23807. }),
  23808. $globals.SmalltalkImage);
  23809. $core.addMethod(
  23810. $core.method({
  23811. selector: "readJSObject:",
  23812. protocol: "accessing",
  23813. fn: function (anObject){
  23814. var self=this,$self=this;
  23815. return $core.withContext(function($ctx1) {
  23816. return $core.readJSObject(anObject);
  23817. return self;
  23818. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23819. },
  23820. args: ["anObject"],
  23821. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  23822. referencedClasses: [],
  23823. messageSends: []
  23824. }),
  23825. $globals.SmalltalkImage);
  23826. $core.addMethod(
  23827. $core.method({
  23828. selector: "removeClass:",
  23829. protocol: "classes",
  23830. fn: function (aClass){
  23831. var self=this,$self=this;
  23832. return $core.withContext(function($ctx1) {
  23833. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  23834. $1=$recv(aClass)._isMetaclass();
  23835. if($core.assert($1)){
  23836. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  23837. $ctx1.sendIdx[","]=1;
  23838. $self._error_($2);
  23839. $ctx1.sendIdx["error:"]=1;
  23840. }
  23841. $recv(aClass)._allSubclassesDo_((function(subclass){
  23842. return $core.withContext(function($ctx2) {
  23843. $5=$recv(aClass)._name();
  23844. $ctx2.sendIdx["name"]=1;
  23845. $4=$recv($5).__comma(" has a subclass: ");
  23846. $ctx2.sendIdx[","]=3;
  23847. $6=$recv(subclass)._name();
  23848. $ctx2.sendIdx["name"]=2;
  23849. $3=$recv($4).__comma($6);
  23850. $ctx2.sendIdx[","]=2;
  23851. return $self._error_($3);
  23852. $ctx2.sendIdx["error:"]=2;
  23853. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  23854. }));
  23855. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  23856. return $core.withContext(function($ctx2) {
  23857. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  23858. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  23859. }));
  23860. $self._deleteClass_(aClass);
  23861. $recv(aClass)._setTraitComposition_([]);
  23862. $ctx1.sendIdx["setTraitComposition:"]=1;
  23863. $7=$recv(aClass)._theMetaClass();
  23864. if(($receiver = $7) == null || $receiver.a$nil){
  23865. $7;
  23866. } else {
  23867. var meta;
  23868. meta=$receiver;
  23869. $recv(meta)._setTraitComposition_([]);
  23870. }
  23871. $8=$recv($globals.SystemAnnouncer)._current();
  23872. $10=$recv($globals.ClassRemoved)._new();
  23873. $recv($10)._theClass_(aClass);
  23874. $9=$recv($10)._yourself();
  23875. $recv($8)._announce_($9);
  23876. return self;
  23877. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23878. },
  23879. args: ["aClass"],
  23880. 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)",
  23881. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  23882. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  23883. }),
  23884. $globals.SmalltalkImage);
  23885. $core.addMethod(
  23886. $core.method({
  23887. selector: "removePackage:",
  23888. protocol: "packages",
  23889. fn: function (packageName){
  23890. var self=this,$self=this;
  23891. var pkg;
  23892. return $core.withContext(function($ctx1) {
  23893. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  23894. return $core.withContext(function($ctx2) {
  23895. return $self._error_("Missing package: ".__comma(packageName));
  23896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23897. }));
  23898. $recv($recv(pkg)._classes())._do_((function(each){
  23899. return $core.withContext(function($ctx2) {
  23900. return $self._removeClass_(each);
  23901. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  23902. }));
  23903. $recv($self._packageDictionary())._removeKey_(packageName);
  23904. return self;
  23905. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  23906. },
  23907. args: ["packageName"],
  23908. 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",
  23909. referencedClasses: [],
  23910. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  23911. }),
  23912. $globals.SmalltalkImage);
  23913. $core.addMethod(
  23914. $core.method({
  23915. selector: "renamePackage:to:",
  23916. protocol: "packages",
  23917. fn: function (packageName,newName){
  23918. var self=this,$self=this;
  23919. var pkg;
  23920. return $core.withContext(function($ctx1) {
  23921. var $1,$2,$3;
  23922. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  23923. return $core.withContext(function($ctx2) {
  23924. $1="Missing package: ".__comma(packageName);
  23925. $ctx2.sendIdx[","]=1;
  23926. return $self._error_($1);
  23927. $ctx2.sendIdx["error:"]=1;
  23928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23929. }));
  23930. $self._packageAt_ifPresent_(newName,(function(){
  23931. return $core.withContext(function($ctx2) {
  23932. return $self._error_("Already exists a package called: ".__comma(newName));
  23933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  23934. }));
  23935. $2=pkg;
  23936. $recv($2)._name_(newName);
  23937. $recv($2)._beDirty();
  23938. $3=$self._packageDictionary();
  23939. $recv($3)._at_put_(newName,pkg);
  23940. $recv($3)._removeKey_(packageName);
  23941. return self;
  23942. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  23943. },
  23944. args: ["packageName", "newName"],
  23945. 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",
  23946. referencedClasses: [],
  23947. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  23948. }),
  23949. $globals.SmalltalkImage);
  23950. $core.addMethod(
  23951. $core.method({
  23952. selector: "reservedWords",
  23953. protocol: "accessing",
  23954. fn: function (){
  23955. var self=this,$self=this;
  23956. 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"];
  23957. },
  23958. args: [],
  23959. 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)",
  23960. referencedClasses: [],
  23961. messageSends: []
  23962. }),
  23963. $globals.SmalltalkImage);
  23964. $core.addMethod(
  23965. $core.method({
  23966. selector: "settings",
  23967. protocol: "accessing",
  23968. fn: function (){
  23969. var self=this,$self=this;
  23970. return $globals.SmalltalkSettings;
  23971. },
  23972. args: [],
  23973. source: "settings\x0a\x09^ SmalltalkSettings",
  23974. referencedClasses: ["SmalltalkSettings"],
  23975. messageSends: []
  23976. }),
  23977. $globals.SmalltalkImage);
  23978. $core.addMethod(
  23979. $core.method({
  23980. selector: "version",
  23981. protocol: "accessing",
  23982. fn: function (){
  23983. var self=this,$self=this;
  23984. return "0.19.1";
  23985. },
  23986. args: [],
  23987. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.19.1'",
  23988. referencedClasses: [],
  23989. messageSends: []
  23990. }),
  23991. $globals.SmalltalkImage);
  23992. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  23993. $core.addMethod(
  23994. $core.method({
  23995. selector: "current",
  23996. protocol: "instance creation",
  23997. fn: function (){
  23998. var self=this,$self=this;
  23999. return $core.withContext(function($ctx1) {
  24000. var $1,$receiver;
  24001. $1=$self["@current"];
  24002. if(($receiver = $1) == null || $receiver.a$nil){
  24003. $self["@current"]=(
  24004. $ctx1.supercall = true,
  24005. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24006. $ctx1.supercall = false;
  24007. return $self["@current"];
  24008. } else {
  24009. $self._deprecatedAPI();
  24010. return $self["@current"];
  24011. }
  24012. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  24013. },
  24014. args: [],
  24015. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  24016. referencedClasses: [],
  24017. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  24018. }),
  24019. $globals.SmalltalkImage.a$cls);
  24020. $core.addMethod(
  24021. $core.method({
  24022. selector: "initialize",
  24023. protocol: "initialization",
  24024. fn: function (){
  24025. var self=this,$self=this;
  24026. var st;
  24027. return $core.withContext(function($ctx1) {
  24028. st=$self._current();
  24029. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  24030. return self;
  24031. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  24032. },
  24033. args: [],
  24034. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  24035. referencedClasses: [],
  24036. messageSends: ["current", "at:put:", "globals"]
  24037. }),
  24038. $globals.SmalltalkImage.a$cls);
  24039. $core.addMethod(
  24040. $core.method({
  24041. selector: "new",
  24042. protocol: "instance creation",
  24043. fn: function (){
  24044. var self=this,$self=this;
  24045. return $core.withContext(function($ctx1) {
  24046. $self._shouldNotImplement();
  24047. return self;
  24048. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  24049. },
  24050. args: [],
  24051. source: "new\x0a\x09self shouldNotImplement",
  24052. referencedClasses: [],
  24053. messageSends: ["shouldNotImplement"]
  24054. }),
  24055. $globals.SmalltalkImage.a$cls);
  24056. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  24057. $core.addMethod(
  24058. $core.method({
  24059. selector: "nextPutJSObject:",
  24060. protocol: "*Kernel-Infrastructure",
  24061. fn: function (aJSObject){
  24062. var self=this,$self=this;
  24063. return $core.withContext(function($ctx1) {
  24064. $self._nextPut_(aJSObject);
  24065. return self;
  24066. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  24067. },
  24068. args: ["aJSObject"],
  24069. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  24070. referencedClasses: [],
  24071. messageSends: ["nextPut:"]
  24072. }),
  24073. $globals.ProtoStream);
  24074. $core.addMethod(
  24075. $core.method({
  24076. selector: "asJavaScriptPropertyName",
  24077. protocol: "*Kernel-Infrastructure",
  24078. fn: function (){
  24079. var self=this,$self=this;
  24080. return $core.withContext(function($ctx1) {
  24081. return $core.st2prop(self);
  24082. return self;
  24083. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  24084. },
  24085. args: [],
  24086. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  24087. referencedClasses: [],
  24088. messageSends: []
  24089. }),
  24090. $globals.String);
  24091. $core.addMethod(
  24092. $core.method({
  24093. selector: "asSetting",
  24094. protocol: "*Kernel-Infrastructure",
  24095. fn: function (){
  24096. var self=this,$self=this;
  24097. return $core.withContext(function($ctx1) {
  24098. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  24099. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  24100. },
  24101. args: [],
  24102. 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",
  24103. referencedClasses: ["Setting"],
  24104. messageSends: ["at:ifAbsent:"]
  24105. }),
  24106. $globals.String);
  24107. $core.addMethod(
  24108. $core.method({
  24109. selector: "asSettingIfAbsent:",
  24110. protocol: "*Kernel-Infrastructure",
  24111. fn: function (aDefaultValue){
  24112. var self=this,$self=this;
  24113. return $core.withContext(function($ctx1) {
  24114. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  24115. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24116. },
  24117. args: ["aDefaultValue"],
  24118. 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",
  24119. referencedClasses: ["Setting"],
  24120. messageSends: ["at:ifAbsent:"]
  24121. }),
  24122. $globals.String);
  24123. $core.addMethod(
  24124. $core.method({
  24125. selector: "settingValue",
  24126. protocol: "*Kernel-Infrastructure",
  24127. fn: function (){
  24128. var self=this,$self=this;
  24129. return $core.withContext(function($ctx1) {
  24130. return $recv($self._asSetting())._value();
  24131. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  24132. },
  24133. args: [],
  24134. source: "settingValue\x0a\x09^ self asSetting value",
  24135. referencedClasses: [],
  24136. messageSends: ["value", "asSetting"]
  24137. }),
  24138. $globals.String);
  24139. $core.addMethod(
  24140. $core.method({
  24141. selector: "settingValue:",
  24142. protocol: "*Kernel-Infrastructure",
  24143. fn: function (aValue){
  24144. var self=this,$self=this;
  24145. return $core.withContext(function($ctx1) {
  24146. return $recv($self._asSetting())._value_(aValue);
  24147. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  24148. },
  24149. args: ["aValue"],
  24150. 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",
  24151. referencedClasses: [],
  24152. messageSends: ["value:", "asSetting"]
  24153. }),
  24154. $globals.String);
  24155. $core.addMethod(
  24156. $core.method({
  24157. selector: "settingValueIfAbsent:",
  24158. protocol: "*Kernel-Infrastructure",
  24159. fn: function (aDefaultValue){
  24160. var self=this,$self=this;
  24161. return $core.withContext(function($ctx1) {
  24162. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  24163. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24164. },
  24165. args: ["aDefaultValue"],
  24166. 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",
  24167. referencedClasses: [],
  24168. messageSends: ["value", "asSettingIfAbsent:"]
  24169. }),
  24170. $globals.String);
  24171. });
  24172. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  24173. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  24174. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  24175. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24176. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  24177. $core.addPackage("Kernel-Announcements");
  24178. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  24179. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  24180. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  24181. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  24182. $core.addMethod(
  24183. $core.method({
  24184. selector: "announcementClass",
  24185. protocol: "accessing",
  24186. fn: function (){
  24187. var self=this,$self=this;
  24188. return $self["@announcementClass"];
  24189. },
  24190. args: [],
  24191. source: "announcementClass\x0a\x09^ announcementClass",
  24192. referencedClasses: [],
  24193. messageSends: []
  24194. }),
  24195. $globals.AnnouncementSubscription);
  24196. $core.addMethod(
  24197. $core.method({
  24198. selector: "announcementClass:",
  24199. protocol: "accessing",
  24200. fn: function (aClass){
  24201. var self=this,$self=this;
  24202. $self["@announcementClass"]=aClass;
  24203. return self;
  24204. },
  24205. args: ["aClass"],
  24206. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  24207. referencedClasses: [],
  24208. messageSends: []
  24209. }),
  24210. $globals.AnnouncementSubscription);
  24211. $core.addMethod(
  24212. $core.method({
  24213. selector: "deliver:",
  24214. protocol: "announcing",
  24215. fn: function (anAnnouncement){
  24216. var self=this,$self=this;
  24217. return $core.withContext(function($ctx1) {
  24218. var $1;
  24219. $1=$self._handlesAnnouncement_(anAnnouncement);
  24220. if($core.assert($1)){
  24221. $recv($self._valuable())._value_(anAnnouncement);
  24222. }
  24223. return self;
  24224. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24225. },
  24226. args: ["anAnnouncement"],
  24227. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  24228. referencedClasses: [],
  24229. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  24230. }),
  24231. $globals.AnnouncementSubscription);
  24232. $core.addMethod(
  24233. $core.method({
  24234. selector: "handlesAnnouncement:",
  24235. protocol: "announcing",
  24236. fn: function (anAnnouncement){
  24237. var self=this,$self=this;
  24238. return $core.withContext(function($ctx1) {
  24239. var $2,$3,$1,$receiver;
  24240. $2=$recv($globals.Smalltalk)._globals();
  24241. $ctx1.sendIdx["globals"]=1;
  24242. $3=$recv($self._announcementClass())._name();
  24243. $ctx1.sendIdx["name"]=1;
  24244. $1=$recv($2)._at_($3);
  24245. $ctx1.sendIdx["at:"]=1;
  24246. if(($receiver = $1) == null || $receiver.a$nil){
  24247. return false;
  24248. } else {
  24249. var class_;
  24250. class_=$receiver;
  24251. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  24252. }
  24253. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24254. },
  24255. args: ["anAnnouncement"],
  24256. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk globals at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]",
  24257. referencedClasses: ["Smalltalk"],
  24258. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  24259. }),
  24260. $globals.AnnouncementSubscription);
  24261. $core.addMethod(
  24262. $core.method({
  24263. selector: "receiver",
  24264. protocol: "accessing",
  24265. fn: function (){
  24266. var self=this,$self=this;
  24267. return $core.withContext(function($ctx1) {
  24268. return $recv($self._valuable())._receiver();
  24269. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  24270. },
  24271. args: [],
  24272. source: "receiver\x0a\x09^ self valuable receiver",
  24273. referencedClasses: [],
  24274. messageSends: ["receiver", "valuable"]
  24275. }),
  24276. $globals.AnnouncementSubscription);
  24277. $core.addMethod(
  24278. $core.method({
  24279. selector: "valuable",
  24280. protocol: "accessing",
  24281. fn: function (){
  24282. var self=this,$self=this;
  24283. return $self["@valuable"];
  24284. },
  24285. args: [],
  24286. source: "valuable\x0a\x09^ valuable",
  24287. referencedClasses: [],
  24288. messageSends: []
  24289. }),
  24290. $globals.AnnouncementSubscription);
  24291. $core.addMethod(
  24292. $core.method({
  24293. selector: "valuable:",
  24294. protocol: "accessing",
  24295. fn: function (aValuable){
  24296. var self=this,$self=this;
  24297. $self["@valuable"]=aValuable;
  24298. return self;
  24299. },
  24300. args: ["aValuable"],
  24301. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  24302. referencedClasses: [],
  24303. messageSends: []
  24304. }),
  24305. $globals.AnnouncementSubscription);
  24306. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  24307. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  24308. $core.addMethod(
  24309. $core.method({
  24310. selector: "receiver",
  24311. protocol: "accessing",
  24312. fn: function (){
  24313. var self=this,$self=this;
  24314. return $self["@receiver"];
  24315. },
  24316. args: [],
  24317. source: "receiver\x0a\x09^ receiver",
  24318. referencedClasses: [],
  24319. messageSends: []
  24320. }),
  24321. $globals.AnnouncementValuable);
  24322. $core.addMethod(
  24323. $core.method({
  24324. selector: "receiver:",
  24325. protocol: "accessing",
  24326. fn: function (anObject){
  24327. var self=this,$self=this;
  24328. $self["@receiver"]=anObject;
  24329. return self;
  24330. },
  24331. args: ["anObject"],
  24332. source: "receiver: anObject\x0a\x09receiver := anObject",
  24333. referencedClasses: [],
  24334. messageSends: []
  24335. }),
  24336. $globals.AnnouncementValuable);
  24337. $core.addMethod(
  24338. $core.method({
  24339. selector: "valuable",
  24340. protocol: "accessing",
  24341. fn: function (){
  24342. var self=this,$self=this;
  24343. return $self["@valuable"];
  24344. },
  24345. args: [],
  24346. source: "valuable\x0a\x09^ valuable",
  24347. referencedClasses: [],
  24348. messageSends: []
  24349. }),
  24350. $globals.AnnouncementValuable);
  24351. $core.addMethod(
  24352. $core.method({
  24353. selector: "valuable:",
  24354. protocol: "accessing",
  24355. fn: function (anObject){
  24356. var self=this,$self=this;
  24357. $self["@valuable"]=anObject;
  24358. return self;
  24359. },
  24360. args: ["anObject"],
  24361. source: "valuable: anObject\x0a\x09valuable := anObject",
  24362. referencedClasses: [],
  24363. messageSends: []
  24364. }),
  24365. $globals.AnnouncementValuable);
  24366. $core.addMethod(
  24367. $core.method({
  24368. selector: "value",
  24369. protocol: "evaluating",
  24370. fn: function (){
  24371. var self=this,$self=this;
  24372. return $core.withContext(function($ctx1) {
  24373. return $recv($self._valuable())._value();
  24374. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  24375. },
  24376. args: [],
  24377. source: "value\x0a\x09^ self valuable value",
  24378. referencedClasses: [],
  24379. messageSends: ["value", "valuable"]
  24380. }),
  24381. $globals.AnnouncementValuable);
  24382. $core.addMethod(
  24383. $core.method({
  24384. selector: "value:",
  24385. protocol: "evaluating",
  24386. fn: function (anObject){
  24387. var self=this,$self=this;
  24388. return $core.withContext(function($ctx1) {
  24389. return $recv($self._valuable())._value_(anObject);
  24390. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  24391. },
  24392. args: ["anObject"],
  24393. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  24394. referencedClasses: [],
  24395. messageSends: ["value:", "valuable"]
  24396. }),
  24397. $globals.AnnouncementValuable);
  24398. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  24399. $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' ].";
  24400. $core.addMethod(
  24401. $core.method({
  24402. selector: "announce:",
  24403. protocol: "announcing",
  24404. fn: function (anAnnouncement){
  24405. var self=this,$self=this;
  24406. return $core.withContext(function($ctx1) {
  24407. $recv($self["@subscriptions"])._do_((function(each){
  24408. return $core.withContext(function($ctx2) {
  24409. return $recv(each)._deliver_(anAnnouncement);
  24410. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24411. }));
  24412. return self;
  24413. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  24414. },
  24415. args: ["anAnnouncement"],
  24416. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  24417. referencedClasses: [],
  24418. messageSends: ["do:", "deliver:"]
  24419. }),
  24420. $globals.Announcer);
  24421. $core.addMethod(
  24422. $core.method({
  24423. selector: "initialize",
  24424. protocol: "initialization",
  24425. fn: function (){
  24426. var self=this,$self=this;
  24427. return $core.withContext(function($ctx1) {
  24428. (
  24429. $ctx1.supercall = true,
  24430. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  24431. $ctx1.supercall = false;
  24432. $self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  24433. return self;
  24434. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  24435. },
  24436. args: [],
  24437. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  24438. referencedClasses: ["OrderedCollection"],
  24439. messageSends: ["initialize", "new"]
  24440. }),
  24441. $globals.Announcer);
  24442. $core.addMethod(
  24443. $core.method({
  24444. selector: "on:do:",
  24445. protocol: "subscribing",
  24446. fn: function (aClass,aBlock){
  24447. var self=this,$self=this;
  24448. return $core.withContext(function($ctx1) {
  24449. $self._on_do_for_(aClass,aBlock,nil);
  24450. return self;
  24451. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  24452. },
  24453. args: ["aClass", "aBlock"],
  24454. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  24455. referencedClasses: [],
  24456. messageSends: ["on:do:for:"]
  24457. }),
  24458. $globals.Announcer);
  24459. $core.addMethod(
  24460. $core.method({
  24461. selector: "on:do:for:",
  24462. protocol: "subscribing",
  24463. fn: function (aClass,aBlock,aReceiver){
  24464. var self=this,$self=this;
  24465. return $core.withContext(function($ctx1) {
  24466. var $1,$3,$5,$6,$4,$2;
  24467. $1=$self["@subscriptions"];
  24468. $3=$recv($globals.AnnouncementSubscription)._new();
  24469. $ctx1.sendIdx["new"]=1;
  24470. $5=$recv($globals.AnnouncementValuable)._new();
  24471. $recv($5)._valuable_(aBlock);
  24472. $recv($5)._receiver_(aReceiver);
  24473. $6=$recv($5)._yourself();
  24474. $ctx1.sendIdx["yourself"]=1;
  24475. $4=$6;
  24476. $recv($3)._valuable_($4);
  24477. $ctx1.sendIdx["valuable:"]=1;
  24478. $recv($3)._announcementClass_(aClass);
  24479. $2=$recv($3)._yourself();
  24480. $recv($1)._add_($2);
  24481. return self;
  24482. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  24483. },
  24484. args: ["aClass", "aBlock", "aReceiver"],
  24485. 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)",
  24486. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  24487. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  24488. }),
  24489. $globals.Announcer);
  24490. $core.addMethod(
  24491. $core.method({
  24492. selector: "on:doOnce:",
  24493. protocol: "subscribing",
  24494. fn: function (aClass,aBlock){
  24495. var self=this,$self=this;
  24496. var subscription;
  24497. return $core.withContext(function($ctx1) {
  24498. var $1;
  24499. $1=$recv($globals.AnnouncementSubscription)._new();
  24500. $recv($1)._announcementClass_(aClass);
  24501. subscription=$recv($1)._yourself();
  24502. $recv(subscription)._valuable_((function(ann){
  24503. return $core.withContext(function($ctx2) {
  24504. $recv($self["@subscriptions"])._remove_(subscription);
  24505. return $recv(aBlock)._value_(ann);
  24506. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  24507. }));
  24508. $recv($self["@subscriptions"])._add_(subscription);
  24509. return self;
  24510. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  24511. },
  24512. args: ["aClass", "aBlock"],
  24513. 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",
  24514. referencedClasses: ["AnnouncementSubscription"],
  24515. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  24516. }),
  24517. $globals.Announcer);
  24518. $core.addMethod(
  24519. $core.method({
  24520. selector: "on:send:to:",
  24521. protocol: "subscribing",
  24522. fn: function (aClass,aSelector,anObject){
  24523. var self=this,$self=this;
  24524. return $core.withContext(function($ctx1) {
  24525. var $1,$3,$5,$6,$4,$2;
  24526. $1=$self["@subscriptions"];
  24527. $3=$recv($globals.AnnouncementSubscription)._new();
  24528. $ctx1.sendIdx["new"]=1;
  24529. $5=$recv($globals.MessageSend)._new();
  24530. $recv($5)._receiver_(anObject);
  24531. $recv($5)._selector_(aSelector);
  24532. $6=$recv($5)._yourself();
  24533. $ctx1.sendIdx["yourself"]=1;
  24534. $4=$6;
  24535. $recv($3)._valuable_($4);
  24536. $recv($3)._announcementClass_(aClass);
  24537. $2=$recv($3)._yourself();
  24538. $recv($1)._add_($2);
  24539. return self;
  24540. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  24541. },
  24542. args: ["aClass", "aSelector", "anObject"],
  24543. 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)",
  24544. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  24545. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  24546. }),
  24547. $globals.Announcer);
  24548. $core.addMethod(
  24549. $core.method({
  24550. selector: "unsubscribe:",
  24551. protocol: "subscribing",
  24552. fn: function (anObject){
  24553. var self=this,$self=this;
  24554. return $core.withContext(function($ctx1) {
  24555. $self["@subscriptions"]=$recv($self["@subscriptions"])._reject_((function(each){
  24556. return $core.withContext(function($ctx2) {
  24557. return $recv($recv(each)._receiver()).__eq(anObject);
  24558. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24559. }));
  24560. return self;
  24561. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  24562. },
  24563. args: ["anObject"],
  24564. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  24565. referencedClasses: [],
  24566. messageSends: ["reject:", "=", "receiver"]
  24567. }),
  24568. $globals.Announcer);
  24569. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  24570. $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`";
  24571. $globals.SystemAnnouncer.a$cls.iVarNames = ["current"];
  24572. $core.addMethod(
  24573. $core.method({
  24574. selector: "current",
  24575. protocol: "accessing",
  24576. fn: function (){
  24577. var self=this,$self=this;
  24578. return $core.withContext(function($ctx1) {
  24579. var $1,$receiver;
  24580. $1=$self["@current"];
  24581. if(($receiver = $1) == null || $receiver.a$nil){
  24582. $self["@current"]=(
  24583. $ctx1.supercall = true,
  24584. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24585. $ctx1.supercall = false;
  24586. return $self["@current"];
  24587. } else {
  24588. return $1;
  24589. }
  24590. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.a$cls)});
  24591. },
  24592. args: [],
  24593. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  24594. referencedClasses: [],
  24595. messageSends: ["ifNil:", "new"]
  24596. }),
  24597. $globals.SystemAnnouncer.a$cls);
  24598. $core.addMethod(
  24599. $core.method({
  24600. selector: "new",
  24601. protocol: "instance creation",
  24602. fn: function (){
  24603. var self=this,$self=this;
  24604. return $core.withContext(function($ctx1) {
  24605. $self._shouldNotImplement();
  24606. return self;
  24607. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.a$cls)});
  24608. },
  24609. args: [],
  24610. source: "new\x0a\x09self shouldNotImplement",
  24611. referencedClasses: [],
  24612. messageSends: ["shouldNotImplement"]
  24613. }),
  24614. $globals.SystemAnnouncer.a$cls);
  24615. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  24616. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  24617. $core.addMethod(
  24618. $core.method({
  24619. selector: "classTag",
  24620. protocol: "accessing",
  24621. fn: function (){
  24622. var self=this,$self=this;
  24623. return "announcement";
  24624. },
  24625. args: [],
  24626. 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'",
  24627. referencedClasses: [],
  24628. messageSends: []
  24629. }),
  24630. $globals.SystemAnnouncement.a$cls);
  24631. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  24632. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  24633. $core.addMethod(
  24634. $core.method({
  24635. selector: "theClass",
  24636. protocol: "accessing",
  24637. fn: function (){
  24638. var self=this,$self=this;
  24639. return $self["@theClass"];
  24640. },
  24641. args: [],
  24642. source: "theClass\x0a\x09^ theClass",
  24643. referencedClasses: [],
  24644. messageSends: []
  24645. }),
  24646. $globals.ClassAnnouncement);
  24647. $core.addMethod(
  24648. $core.method({
  24649. selector: "theClass:",
  24650. protocol: "accessing",
  24651. fn: function (aClass){
  24652. var self=this,$self=this;
  24653. $self["@theClass"]=aClass;
  24654. return self;
  24655. },
  24656. args: ["aClass"],
  24657. source: "theClass: aClass\x0a\x09theClass := aClass",
  24658. referencedClasses: [],
  24659. messageSends: []
  24660. }),
  24661. $globals.ClassAnnouncement);
  24662. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24663. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  24664. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24665. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  24666. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24667. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  24668. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  24669. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  24670. $core.addMethod(
  24671. $core.method({
  24672. selector: "oldClass",
  24673. protocol: "accessing",
  24674. fn: function (){
  24675. var self=this,$self=this;
  24676. return $self["@oldClass"];
  24677. },
  24678. args: [],
  24679. source: "oldClass\x0a\x09^ oldClass",
  24680. referencedClasses: [],
  24681. messageSends: []
  24682. }),
  24683. $globals.ClassMigrated);
  24684. $core.addMethod(
  24685. $core.method({
  24686. selector: "oldClass:",
  24687. protocol: "accessing",
  24688. fn: function (aClass){
  24689. var self=this,$self=this;
  24690. $self["@oldClass"]=aClass;
  24691. return self;
  24692. },
  24693. args: ["aClass"],
  24694. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  24695. referencedClasses: [],
  24696. messageSends: []
  24697. }),
  24698. $globals.ClassMigrated);
  24699. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  24700. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  24701. $core.addMethod(
  24702. $core.method({
  24703. selector: "oldPackage",
  24704. protocol: "accessing",
  24705. fn: function (){
  24706. var self=this,$self=this;
  24707. return $self["@oldPackage"];
  24708. },
  24709. args: [],
  24710. source: "oldPackage\x0a\x09^ oldPackage",
  24711. referencedClasses: [],
  24712. messageSends: []
  24713. }),
  24714. $globals.ClassMoved);
  24715. $core.addMethod(
  24716. $core.method({
  24717. selector: "oldPackage:",
  24718. protocol: "accessing",
  24719. fn: function (aPackage){
  24720. var self=this,$self=this;
  24721. $self["@oldPackage"]=aPackage;
  24722. return self;
  24723. },
  24724. args: ["aPackage"],
  24725. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  24726. referencedClasses: [],
  24727. messageSends: []
  24728. }),
  24729. $globals.ClassMoved);
  24730. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24731. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  24732. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24733. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  24734. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  24735. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  24736. $core.addMethod(
  24737. $core.method({
  24738. selector: "method",
  24739. protocol: "accessing",
  24740. fn: function (){
  24741. var self=this,$self=this;
  24742. return $self["@method"];
  24743. },
  24744. args: [],
  24745. source: "method\x0a\x09^ method",
  24746. referencedClasses: [],
  24747. messageSends: []
  24748. }),
  24749. $globals.MethodAnnouncement);
  24750. $core.addMethod(
  24751. $core.method({
  24752. selector: "method:",
  24753. protocol: "accessing",
  24754. fn: function (aCompiledMethod){
  24755. var self=this,$self=this;
  24756. $self["@method"]=aCompiledMethod;
  24757. return self;
  24758. },
  24759. args: ["aCompiledMethod"],
  24760. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  24761. referencedClasses: [],
  24762. messageSends: []
  24763. }),
  24764. $globals.MethodAnnouncement);
  24765. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24766. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  24767. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  24768. $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.";
  24769. $core.addMethod(
  24770. $core.method({
  24771. selector: "oldMethod",
  24772. protocol: "accessing",
  24773. fn: function (){
  24774. var self=this,$self=this;
  24775. return $self["@oldMethod"];
  24776. },
  24777. args: [],
  24778. source: "oldMethod\x0a\x09^ oldMethod",
  24779. referencedClasses: [],
  24780. messageSends: []
  24781. }),
  24782. $globals.MethodModified);
  24783. $core.addMethod(
  24784. $core.method({
  24785. selector: "oldMethod:",
  24786. protocol: "accessing",
  24787. fn: function (aMethod){
  24788. var self=this,$self=this;
  24789. $self["@oldMethod"]=aMethod;
  24790. return self;
  24791. },
  24792. args: ["aMethod"],
  24793. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  24794. referencedClasses: [],
  24795. messageSends: []
  24796. }),
  24797. $globals.MethodModified);
  24798. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  24799. $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.";
  24800. $core.addMethod(
  24801. $core.method({
  24802. selector: "oldProtocol",
  24803. protocol: "accessing",
  24804. fn: function (){
  24805. var self=this,$self=this;
  24806. return $self["@oldProtocol"];
  24807. },
  24808. args: [],
  24809. source: "oldProtocol\x0a\x09^ oldProtocol",
  24810. referencedClasses: [],
  24811. messageSends: []
  24812. }),
  24813. $globals.MethodMoved);
  24814. $core.addMethod(
  24815. $core.method({
  24816. selector: "oldProtocol:",
  24817. protocol: "accessing",
  24818. fn: function (aString){
  24819. var self=this,$self=this;
  24820. $self["@oldProtocol"]=aString;
  24821. return self;
  24822. },
  24823. args: ["aString"],
  24824. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  24825. referencedClasses: [],
  24826. messageSends: []
  24827. }),
  24828. $globals.MethodMoved);
  24829. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24830. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  24831. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  24832. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  24833. $core.addMethod(
  24834. $core.method({
  24835. selector: "package",
  24836. protocol: "accessing",
  24837. fn: function (){
  24838. var self=this,$self=this;
  24839. return $self["@package"];
  24840. },
  24841. args: [],
  24842. source: "package\x0a\x09^ package",
  24843. referencedClasses: [],
  24844. messageSends: []
  24845. }),
  24846. $globals.PackageAnnouncement);
  24847. $core.addMethod(
  24848. $core.method({
  24849. selector: "package:",
  24850. protocol: "accessing",
  24851. fn: function (aPackage){
  24852. var self=this,$self=this;
  24853. $self["@package"]=aPackage;
  24854. return self;
  24855. },
  24856. args: ["aPackage"],
  24857. source: "package: aPackage\x0a\x09package := aPackage",
  24858. referencedClasses: [],
  24859. messageSends: []
  24860. }),
  24861. $globals.PackageAnnouncement);
  24862. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24863. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  24864. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24865. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  24866. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24867. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  24868. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24869. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  24870. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  24871. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  24872. $core.addMethod(
  24873. $core.method({
  24874. selector: "package",
  24875. protocol: "accessing",
  24876. fn: function (){
  24877. var self=this,$self=this;
  24878. return $core.withContext(function($ctx1) {
  24879. var $1,$receiver;
  24880. $1=$self._theClass();
  24881. if(($receiver = $1) == null || $receiver.a$nil){
  24882. return $1;
  24883. } else {
  24884. var class_;
  24885. class_=$receiver;
  24886. return $recv(class_)._packageOfProtocol_($self._protocol());
  24887. }
  24888. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  24889. },
  24890. args: [],
  24891. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  24892. referencedClasses: [],
  24893. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  24894. }),
  24895. $globals.ProtocolAnnouncement);
  24896. $core.addMethod(
  24897. $core.method({
  24898. selector: "protocol",
  24899. protocol: "accessing",
  24900. fn: function (){
  24901. var self=this,$self=this;
  24902. return $self["@protocol"];
  24903. },
  24904. args: [],
  24905. source: "protocol\x0a\x09^ protocol",
  24906. referencedClasses: [],
  24907. messageSends: []
  24908. }),
  24909. $globals.ProtocolAnnouncement);
  24910. $core.addMethod(
  24911. $core.method({
  24912. selector: "protocol:",
  24913. protocol: "accessing",
  24914. fn: function (aString){
  24915. var self=this,$self=this;
  24916. $self["@protocol"]=aString;
  24917. return self;
  24918. },
  24919. args: ["aString"],
  24920. source: "protocol: aString\x0a\x09protocol := aString",
  24921. referencedClasses: [],
  24922. messageSends: []
  24923. }),
  24924. $globals.ProtocolAnnouncement);
  24925. $core.addMethod(
  24926. $core.method({
  24927. selector: "theClass",
  24928. protocol: "accessing",
  24929. fn: function (){
  24930. var self=this,$self=this;
  24931. return $self["@theClass"];
  24932. },
  24933. args: [],
  24934. source: "theClass\x0a\x09^ theClass",
  24935. referencedClasses: [],
  24936. messageSends: []
  24937. }),
  24938. $globals.ProtocolAnnouncement);
  24939. $core.addMethod(
  24940. $core.method({
  24941. selector: "theClass:",
  24942. protocol: "accessing",
  24943. fn: function (aClass){
  24944. var self=this,$self=this;
  24945. $self["@theClass"]=aClass;
  24946. return self;
  24947. },
  24948. args: ["aClass"],
  24949. source: "theClass: aClass\x0a\x09theClass := aClass",
  24950. referencedClasses: [],
  24951. messageSends: []
  24952. }),
  24953. $globals.ProtocolAnnouncement);
  24954. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  24955. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  24956. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  24957. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  24958. });
  24959. 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";
  24960. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  24961. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  24962. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24963. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  24964. $core.addPackage("Platform-Services");
  24965. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  24966. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  24967. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  24968. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  24969. $core.addMethod(
  24970. $core.method({
  24971. selector: "handleError:",
  24972. protocol: "error handling",
  24973. fn: function (anError){
  24974. var self=this,$self=this;
  24975. return $core.withContext(function($ctx1) {
  24976. var $1,$receiver;
  24977. $1=$recv(anError)._context();
  24978. $ctx1.sendIdx["context"]=1;
  24979. if(($receiver = $1) == null || $receiver.a$nil){
  24980. $1;
  24981. } else {
  24982. $self._logErrorContext_($recv(anError)._context());
  24983. }
  24984. $self._logError_(anError);
  24985. return self;
  24986. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  24987. },
  24988. args: ["anError"],
  24989. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  24990. referencedClasses: [],
  24991. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  24992. }),
  24993. $globals.ConsoleErrorHandler);
  24994. $core.addMethod(
  24995. $core.method({
  24996. selector: "log:",
  24997. protocol: "private",
  24998. fn: function (aString){
  24999. var self=this,$self=this;
  25000. return $core.withContext(function($ctx1) {
  25001. $recv(console)._log_(aString);
  25002. return self;
  25003. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  25004. },
  25005. args: ["aString"],
  25006. source: "log: aString\x0a\x09console log: aString",
  25007. referencedClasses: [],
  25008. messageSends: ["log:"]
  25009. }),
  25010. $globals.ConsoleErrorHandler);
  25011. $core.addMethod(
  25012. $core.method({
  25013. selector: "logContext:",
  25014. protocol: "private",
  25015. fn: function (aContext){
  25016. var self=this,$self=this;
  25017. return $core.withContext(function($ctx1) {
  25018. var $1,$receiver;
  25019. $1=$recv(aContext)._home();
  25020. $ctx1.sendIdx["home"]=1;
  25021. if(($receiver = $1) == null || $receiver.a$nil){
  25022. $1;
  25023. } else {
  25024. $self._logContext_($recv(aContext)._home());
  25025. }
  25026. $self._log_($recv(aContext)._asString());
  25027. return self;
  25028. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25029. },
  25030. args: ["aContext"],
  25031. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  25032. referencedClasses: [],
  25033. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  25034. }),
  25035. $globals.ConsoleErrorHandler);
  25036. $core.addMethod(
  25037. $core.method({
  25038. selector: "logError:",
  25039. protocol: "private",
  25040. fn: function (anError){
  25041. var self=this,$self=this;
  25042. return $core.withContext(function($ctx1) {
  25043. $self._log_($recv(anError)._messageText());
  25044. return self;
  25045. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25046. },
  25047. args: ["anError"],
  25048. source: "logError: anError\x0a\x09self log: anError messageText",
  25049. referencedClasses: [],
  25050. messageSends: ["log:", "messageText"]
  25051. }),
  25052. $globals.ConsoleErrorHandler);
  25053. $core.addMethod(
  25054. $core.method({
  25055. selector: "logErrorContext:",
  25056. protocol: "private",
  25057. fn: function (aContext){
  25058. var self=this,$self=this;
  25059. return $core.withContext(function($ctx1) {
  25060. var $1,$receiver;
  25061. if(($receiver = aContext) == null || $receiver.a$nil){
  25062. aContext;
  25063. } else {
  25064. $1=$recv(aContext)._home();
  25065. $ctx1.sendIdx["home"]=1;
  25066. if(($receiver = $1) == null || $receiver.a$nil){
  25067. $1;
  25068. } else {
  25069. $self._logContext_($recv(aContext)._home());
  25070. }
  25071. }
  25072. return self;
  25073. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25074. },
  25075. args: ["aContext"],
  25076. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  25077. referencedClasses: [],
  25078. messageSends: ["ifNotNil:", "home", "logContext:"]
  25079. }),
  25080. $globals.ConsoleErrorHandler);
  25081. $globals.ConsoleErrorHandler.a$cls.iVarNames = ["current"];
  25082. $core.addMethod(
  25083. $core.method({
  25084. selector: "initialize",
  25085. protocol: "initialization",
  25086. fn: function (){
  25087. var self=this,$self=this;
  25088. return $core.withContext(function($ctx1) {
  25089. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  25090. return self;
  25091. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.a$cls)});
  25092. },
  25093. args: [],
  25094. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  25095. referencedClasses: ["ErrorHandler"],
  25096. messageSends: ["registerIfNone:", "new"]
  25097. }),
  25098. $globals.ConsoleErrorHandler.a$cls);
  25099. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  25100. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  25101. $core.addMethod(
  25102. $core.method({
  25103. selector: "clear",
  25104. protocol: "printing",
  25105. fn: function (){
  25106. var self=this,$self=this;
  25107. return self;
  25108. },
  25109. args: [],
  25110. source: "clear\x0a\x09\x22no op\x22",
  25111. referencedClasses: [],
  25112. messageSends: []
  25113. }),
  25114. $globals.ConsoleTranscript);
  25115. $core.addMethod(
  25116. $core.method({
  25117. selector: "cr",
  25118. protocol: "printing",
  25119. fn: function (){
  25120. var self=this,$self=this;
  25121. return self;
  25122. },
  25123. args: [],
  25124. source: "cr\x0a\x09\x22no op\x22",
  25125. referencedClasses: [],
  25126. messageSends: []
  25127. }),
  25128. $globals.ConsoleTranscript);
  25129. $core.addMethod(
  25130. $core.method({
  25131. selector: "open",
  25132. protocol: "actions",
  25133. fn: function (){
  25134. var self=this,$self=this;
  25135. return self;
  25136. },
  25137. args: [],
  25138. source: "open",
  25139. referencedClasses: [],
  25140. messageSends: []
  25141. }),
  25142. $globals.ConsoleTranscript);
  25143. $core.addMethod(
  25144. $core.method({
  25145. selector: "show:",
  25146. protocol: "printing",
  25147. fn: function (anObject){
  25148. var self=this,$self=this;
  25149. return $core.withContext(function($ctx1) {
  25150. console.log(String($recv(anObject)._asString()));
  25151. return self;
  25152. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  25153. },
  25154. args: ["anObject"],
  25155. 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()))'>",
  25156. referencedClasses: [],
  25157. messageSends: []
  25158. }),
  25159. $globals.ConsoleTranscript);
  25160. $core.addMethod(
  25161. $core.method({
  25162. selector: "initialize",
  25163. protocol: "initialization",
  25164. fn: function (){
  25165. var self=this,$self=this;
  25166. return $core.withContext(function($ctx1) {
  25167. $recv($globals.Transcript)._registerIfNone_($self._new());
  25168. return self;
  25169. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.a$cls)});
  25170. },
  25171. args: [],
  25172. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  25173. referencedClasses: ["Transcript"],
  25174. messageSends: ["registerIfNone:", "new"]
  25175. }),
  25176. $globals.ConsoleTranscript.a$cls);
  25177. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  25178. $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.";
  25179. $core.addMethod(
  25180. $core.method({
  25181. selector: "addInstVarNamed:to:",
  25182. protocol: "compiling",
  25183. fn: function (aString,aClass){
  25184. var self=this,$self=this;
  25185. return $core.withContext(function($ctx1) {
  25186. var $1,$2,$3,$5,$4;
  25187. $1=$self._classBuilder();
  25188. $2=$recv(aClass)._superclass();
  25189. $3=$recv(aClass)._name();
  25190. $ctx1.sendIdx["name"]=1;
  25191. $5=$recv($recv(aClass)._instanceVariableNames())._copy();
  25192. $recv($5)._add_(aString);
  25193. $4=$recv($5)._yourself();
  25194. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$recv($recv(aClass)._package())._name());
  25195. return self;
  25196. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  25197. },
  25198. args: ["aString", "aClass"],
  25199. source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name",
  25200. referencedClasses: [],
  25201. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  25202. }),
  25203. $globals.Environment);
  25204. $core.addMethod(
  25205. $core.method({
  25206. selector: "allSelectors",
  25207. protocol: "accessing",
  25208. fn: function (){
  25209. var self=this,$self=this;
  25210. return $core.withContext(function($ctx1) {
  25211. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  25212. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  25213. },
  25214. args: [],
  25215. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  25216. referencedClasses: ["Smalltalk"],
  25217. messageSends: ["allSelectors", "core"]
  25218. }),
  25219. $globals.Environment);
  25220. $core.addMethod(
  25221. $core.method({
  25222. selector: "availableClassNames",
  25223. protocol: "accessing",
  25224. fn: function (){
  25225. var self=this,$self=this;
  25226. return $core.withContext(function($ctx1) {
  25227. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  25228. return $core.withContext(function($ctx2) {
  25229. return $recv(each)._name();
  25230. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25231. }));
  25232. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  25233. },
  25234. args: [],
  25235. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  25236. referencedClasses: ["Smalltalk"],
  25237. messageSends: ["collect:", "classes", "name"]
  25238. }),
  25239. $globals.Environment);
  25240. $core.addMethod(
  25241. $core.method({
  25242. selector: "availablePackageNames",
  25243. protocol: "accessing",
  25244. fn: function (){
  25245. var self=this,$self=this;
  25246. return $core.withContext(function($ctx1) {
  25247. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  25248. return $core.withContext(function($ctx2) {
  25249. return $recv(each)._name();
  25250. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25251. }));
  25252. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  25253. },
  25254. args: [],
  25255. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  25256. referencedClasses: ["Smalltalk"],
  25257. messageSends: ["collect:", "packages", "name"]
  25258. }),
  25259. $globals.Environment);
  25260. $core.addMethod(
  25261. $core.method({
  25262. selector: "availableProtocolsFor:",
  25263. protocol: "accessing",
  25264. fn: function (aClass){
  25265. var self=this,$self=this;
  25266. var protocols;
  25267. return $core.withContext(function($ctx1) {
  25268. var $1,$receiver;
  25269. protocols=$recv(aClass)._protocols();
  25270. $1=$recv(aClass)._superclass();
  25271. $ctx1.sendIdx["superclass"]=1;
  25272. if(($receiver = $1) == null || $receiver.a$nil){
  25273. $1;
  25274. } else {
  25275. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  25276. }
  25277. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  25278. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  25279. },
  25280. args: ["aClass"],
  25281. 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",
  25282. referencedClasses: [],
  25283. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  25284. }),
  25285. $globals.Environment);
  25286. $core.addMethod(
  25287. $core.method({
  25288. selector: "classBuilder",
  25289. protocol: "accessing",
  25290. fn: function (){
  25291. var self=this,$self=this;
  25292. return $core.withContext(function($ctx1) {
  25293. return $recv($globals.ClassBuilder)._new();
  25294. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  25295. },
  25296. args: [],
  25297. source: "classBuilder\x0a\x09^ ClassBuilder new",
  25298. referencedClasses: ["ClassBuilder"],
  25299. messageSends: ["new"]
  25300. }),
  25301. $globals.Environment);
  25302. $core.addMethod(
  25303. $core.method({
  25304. selector: "classNamed:",
  25305. protocol: "accessing",
  25306. fn: function (aString){
  25307. var self=this,$self=this;
  25308. return $core.withContext(function($ctx1) {
  25309. var $1,$receiver;
  25310. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  25311. if(($receiver = $1) == null || $receiver.a$nil){
  25312. return $self._error_("Invalid class name");
  25313. } else {
  25314. return $1;
  25315. }
  25316. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  25317. },
  25318. args: ["aString"],
  25319. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  25320. referencedClasses: ["Smalltalk"],
  25321. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  25322. }),
  25323. $globals.Environment);
  25324. $core.addMethod(
  25325. $core.method({
  25326. selector: "classes",
  25327. protocol: "accessing",
  25328. fn: function (){
  25329. var self=this,$self=this;
  25330. return $core.withContext(function($ctx1) {
  25331. return $recv($globals.Smalltalk)._classes();
  25332. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  25333. },
  25334. args: [],
  25335. source: "classes\x0a\x09^ Smalltalk classes",
  25336. referencedClasses: ["Smalltalk"],
  25337. messageSends: ["classes"]
  25338. }),
  25339. $globals.Environment);
  25340. $core.addMethod(
  25341. $core.method({
  25342. selector: "commitPackage:onSuccess:onError:",
  25343. protocol: "actions",
  25344. fn: function (aPackage,aBlock,anotherBlock){
  25345. var self=this,$self=this;
  25346. return $core.withContext(function($ctx1) {
  25347. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  25348. return self;
  25349. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  25350. },
  25351. args: ["aPackage", "aBlock", "anotherBlock"],
  25352. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  25353. referencedClasses: [],
  25354. messageSends: ["commitOnSuccess:onError:", "transport"]
  25355. }),
  25356. $globals.Environment);
  25357. $core.addMethod(
  25358. $core.method({
  25359. selector: "compileClassComment:for:",
  25360. protocol: "compiling",
  25361. fn: function (aString,aClass){
  25362. var self=this,$self=this;
  25363. return $core.withContext(function($ctx1) {
  25364. $recv(aClass)._comment_(aString);
  25365. return self;
  25366. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  25367. },
  25368. args: ["aString", "aClass"],
  25369. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  25370. referencedClasses: [],
  25371. messageSends: ["comment:"]
  25372. }),
  25373. $globals.Environment);
  25374. $core.addMethod(
  25375. $core.method({
  25376. selector: "compileClassDefinition:",
  25377. protocol: "compiling",
  25378. fn: function (aString){
  25379. var self=this,$self=this;
  25380. return $core.withContext(function($ctx1) {
  25381. $recv((function(){
  25382. return $core.withContext(function($ctx2) {
  25383. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  25384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25385. }))._on_do_($globals.Error,(function(error){
  25386. return $core.withContext(function($ctx2) {
  25387. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  25388. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  25389. }));
  25390. return self;
  25391. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  25392. },
  25393. args: ["aString"],
  25394. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  25395. referencedClasses: ["DoIt", "Error", "Terminal"],
  25396. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  25397. }),
  25398. $globals.Environment);
  25399. $core.addMethod(
  25400. $core.method({
  25401. selector: "compileMethod:for:protocol:",
  25402. protocol: "compiling",
  25403. fn: function (sourceCode,class_,protocol){
  25404. var self=this,$self=this;
  25405. return $core.withContext(function($ctx1) {
  25406. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  25407. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  25408. },
  25409. args: ["sourceCode", "class", "protocol"],
  25410. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  25411. referencedClasses: [],
  25412. messageSends: ["compile:protocol:"]
  25413. }),
  25414. $globals.Environment);
  25415. $core.addMethod(
  25416. $core.method({
  25417. selector: "copyClass:to:",
  25418. protocol: "actions",
  25419. fn: function (aClass,aClassName){
  25420. var self=this,$self=this;
  25421. return $core.withContext(function($ctx1) {
  25422. var $1,$2,$receiver;
  25423. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25424. if(($receiver = $1) == null || $receiver.a$nil){
  25425. $1;
  25426. } else {
  25427. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25428. $ctx1.sendIdx[","]=1;
  25429. $self._error_($2);
  25430. }
  25431. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  25432. return self;
  25433. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25434. },
  25435. args: ["aClass", "aClassName"],
  25436. 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",
  25437. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25438. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  25439. }),
  25440. $globals.Environment);
  25441. $core.addMethod(
  25442. $core.method({
  25443. selector: "doItReceiver",
  25444. protocol: "accessing",
  25445. fn: function (){
  25446. var self=this,$self=this;
  25447. return $core.withContext(function($ctx1) {
  25448. return $recv($globals.DoIt)._new();
  25449. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  25450. },
  25451. args: [],
  25452. source: "doItReceiver\x0a\x09^ DoIt new",
  25453. referencedClasses: ["DoIt"],
  25454. messageSends: ["new"]
  25455. }),
  25456. $globals.Environment);
  25457. $core.addMethod(
  25458. $core.method({
  25459. selector: "evaluate:for:",
  25460. protocol: "evaluating",
  25461. fn: function (aString,anObject){
  25462. var self=this,$self=this;
  25463. return $core.withContext(function($ctx1) {
  25464. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  25465. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  25466. },
  25467. args: ["aString", "anObject"],
  25468. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  25469. referencedClasses: ["Evaluator"],
  25470. messageSends: ["evaluate:for:"]
  25471. }),
  25472. $globals.Environment);
  25473. $core.addMethod(
  25474. $core.method({
  25475. selector: "evaluate:on:do:",
  25476. protocol: "error handling",
  25477. fn: function (aBlock,anErrorClass,exceptionBlock){
  25478. var self=this,$self=this;
  25479. return $core.withContext(function($ctx1) {
  25480. var $1;
  25481. $recv(aBlock)._tryCatch_((function(exception){
  25482. return $core.withContext(function($ctx2) {
  25483. $1=$recv(exception)._isKindOf_($self._classNamed_($recv(anErrorClass)._name()));
  25484. if($core.assert($1)){
  25485. return $recv(exceptionBlock)._value_(exception);
  25486. } else {
  25487. return $recv(exception)._resignal();
  25488. }
  25489. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  25490. }));
  25491. return self;
  25492. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  25493. },
  25494. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  25495. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception resignal ] ]",
  25496. referencedClasses: [],
  25497. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  25498. }),
  25499. $globals.Environment);
  25500. $core.addMethod(
  25501. $core.method({
  25502. selector: "inspect:",
  25503. protocol: "actions",
  25504. fn: function (anObject){
  25505. var self=this,$self=this;
  25506. return $core.withContext(function($ctx1) {
  25507. $recv($globals.Inspector)._inspect_(anObject);
  25508. return self;
  25509. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  25510. },
  25511. args: ["anObject"],
  25512. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  25513. referencedClasses: ["Inspector"],
  25514. messageSends: ["inspect:"]
  25515. }),
  25516. $globals.Environment);
  25517. $core.addMethod(
  25518. $core.method({
  25519. selector: "moveClass:toPackage:",
  25520. protocol: "actions",
  25521. fn: function (aClass,aPackageName){
  25522. var self=this,$self=this;
  25523. var package_;
  25524. return $core.withContext(function($ctx1) {
  25525. var $1,$2,$receiver;
  25526. package_=$recv($globals.Package)._named_(aPackageName);
  25527. $1=package_;
  25528. if(($receiver = $1) == null || $receiver.a$nil){
  25529. $self._error_("Invalid package name");
  25530. } else {
  25531. $1;
  25532. }
  25533. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  25534. if($core.assert($2)){
  25535. return self;
  25536. }
  25537. $recv(aClass)._package_(package_);
  25538. $recv(aClass)._recompile();
  25539. return self;
  25540. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  25541. },
  25542. args: ["aClass", "aPackageName"],
  25543. 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",
  25544. referencedClasses: ["Package"],
  25545. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  25546. }),
  25547. $globals.Environment);
  25548. $core.addMethod(
  25549. $core.method({
  25550. selector: "moveMethod:toClass:",
  25551. protocol: "actions",
  25552. fn: function (aMethod,aClassName){
  25553. var self=this,$self=this;
  25554. var destinationClass;
  25555. return $core.withContext(function($ctx1) {
  25556. var $2,$3,$1,$5,$4;
  25557. destinationClass=$self._classNamed_(aClassName);
  25558. $2=destinationClass;
  25559. $3=$recv(aMethod)._methodClass();
  25560. $ctx1.sendIdx["methodClass"]=1;
  25561. $1=$recv($2).__eq_eq($3);
  25562. if($core.assert($1)){
  25563. return self;
  25564. }
  25565. $5=$recv(aMethod)._methodClass();
  25566. $ctx1.sendIdx["methodClass"]=2;
  25567. $4=$recv($5)._isMetaclass();
  25568. if($core.assert($4)){
  25569. destinationClass=$recv(destinationClass)._theMetaClass();
  25570. destinationClass;
  25571. }
  25572. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25573. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25574. return self;
  25575. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  25576. },
  25577. args: ["aMethod", "aClassName"],
  25578. 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",
  25579. referencedClasses: [],
  25580. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  25581. }),
  25582. $globals.Environment);
  25583. $core.addMethod(
  25584. $core.method({
  25585. selector: "moveMethod:toProtocol:",
  25586. protocol: "actions",
  25587. fn: function (aMethod,aProtocol){
  25588. var self=this,$self=this;
  25589. return $core.withContext(function($ctx1) {
  25590. $recv(aMethod)._protocol_(aProtocol);
  25591. $recv($recv(aMethod)._methodClass())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25592. return self;
  25593. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  25594. },
  25595. args: ["aMethod", "aProtocol"],
  25596. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod methodClass\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  25597. referencedClasses: [],
  25598. messageSends: ["protocol:", "compile:protocol:", "methodClass", "source", "protocol"]
  25599. }),
  25600. $globals.Environment);
  25601. $core.addMethod(
  25602. $core.method({
  25603. selector: "packages",
  25604. protocol: "accessing",
  25605. fn: function (){
  25606. var self=this,$self=this;
  25607. return $core.withContext(function($ctx1) {
  25608. return $recv($globals.Smalltalk)._packages();
  25609. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  25610. },
  25611. args: [],
  25612. source: "packages\x0a\x09^ Smalltalk packages",
  25613. referencedClasses: ["Smalltalk"],
  25614. messageSends: ["packages"]
  25615. }),
  25616. $globals.Environment);
  25617. $core.addMethod(
  25618. $core.method({
  25619. selector: "registerErrorHandler:",
  25620. protocol: "services",
  25621. fn: function (anErrorHandler){
  25622. var self=this,$self=this;
  25623. return $core.withContext(function($ctx1) {
  25624. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  25625. return self;
  25626. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  25627. },
  25628. args: ["anErrorHandler"],
  25629. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  25630. referencedClasses: ["ErrorHandler"],
  25631. messageSends: ["register:"]
  25632. }),
  25633. $globals.Environment);
  25634. $core.addMethod(
  25635. $core.method({
  25636. selector: "registerFinder:",
  25637. protocol: "services",
  25638. fn: function (aFinder){
  25639. var self=this,$self=this;
  25640. return $core.withContext(function($ctx1) {
  25641. $recv($globals.Finder)._register_(aFinder);
  25642. return self;
  25643. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  25644. },
  25645. args: ["aFinder"],
  25646. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  25647. referencedClasses: ["Finder"],
  25648. messageSends: ["register:"]
  25649. }),
  25650. $globals.Environment);
  25651. $core.addMethod(
  25652. $core.method({
  25653. selector: "registerInspector:",
  25654. protocol: "services",
  25655. fn: function (anInspector){
  25656. var self=this,$self=this;
  25657. return $core.withContext(function($ctx1) {
  25658. $recv($globals.Inspector)._register_(anInspector);
  25659. return self;
  25660. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  25661. },
  25662. args: ["anInspector"],
  25663. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  25664. referencedClasses: ["Inspector"],
  25665. messageSends: ["register:"]
  25666. }),
  25667. $globals.Environment);
  25668. $core.addMethod(
  25669. $core.method({
  25670. selector: "registerProgressHandler:",
  25671. protocol: "services",
  25672. fn: function (aProgressHandler){
  25673. var self=this,$self=this;
  25674. return $core.withContext(function($ctx1) {
  25675. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  25676. return self;
  25677. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  25678. },
  25679. args: ["aProgressHandler"],
  25680. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  25681. referencedClasses: ["ProgressHandler"],
  25682. messageSends: ["register:"]
  25683. }),
  25684. $globals.Environment);
  25685. $core.addMethod(
  25686. $core.method({
  25687. selector: "registerTranscript:",
  25688. protocol: "services",
  25689. fn: function (aTranscript){
  25690. var self=this,$self=this;
  25691. return $core.withContext(function($ctx1) {
  25692. $recv($globals.Transcript)._register_(aTranscript);
  25693. return self;
  25694. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  25695. },
  25696. args: ["aTranscript"],
  25697. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  25698. referencedClasses: ["Transcript"],
  25699. messageSends: ["register:"]
  25700. }),
  25701. $globals.Environment);
  25702. $core.addMethod(
  25703. $core.method({
  25704. selector: "removeClass:",
  25705. protocol: "actions",
  25706. fn: function (aClass){
  25707. var self=this,$self=this;
  25708. return $core.withContext(function($ctx1) {
  25709. $recv($globals.Smalltalk)._removeClass_(aClass);
  25710. return self;
  25711. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  25712. },
  25713. args: ["aClass"],
  25714. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  25715. referencedClasses: ["Smalltalk"],
  25716. messageSends: ["removeClass:"]
  25717. }),
  25718. $globals.Environment);
  25719. $core.addMethod(
  25720. $core.method({
  25721. selector: "removeMethod:",
  25722. protocol: "actions",
  25723. fn: function (aMethod){
  25724. var self=this,$self=this;
  25725. return $core.withContext(function($ctx1) {
  25726. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25727. return self;
  25728. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  25729. },
  25730. args: ["aMethod"],
  25731. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  25732. referencedClasses: [],
  25733. messageSends: ["removeCompiledMethod:", "methodClass"]
  25734. }),
  25735. $globals.Environment);
  25736. $core.addMethod(
  25737. $core.method({
  25738. selector: "removeProtocol:from:",
  25739. protocol: "actions",
  25740. fn: function (aString,aClass){
  25741. var self=this,$self=this;
  25742. return $core.withContext(function($ctx1) {
  25743. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25744. return $core.withContext(function($ctx2) {
  25745. return $recv(aClass)._removeCompiledMethod_(each);
  25746. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25747. }));
  25748. return self;
  25749. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  25750. },
  25751. args: ["aString", "aClass"],
  25752. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  25753. referencedClasses: [],
  25754. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  25755. }),
  25756. $globals.Environment);
  25757. $core.addMethod(
  25758. $core.method({
  25759. selector: "renameClass:to:",
  25760. protocol: "actions",
  25761. fn: function (aClass,aClassName){
  25762. var self=this,$self=this;
  25763. return $core.withContext(function($ctx1) {
  25764. var $1,$2,$receiver;
  25765. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25766. if(($receiver = $1) == null || $receiver.a$nil){
  25767. $1;
  25768. } else {
  25769. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25770. $ctx1.sendIdx[","]=1;
  25771. $self._error_($2);
  25772. }
  25773. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  25774. return self;
  25775. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25776. },
  25777. args: ["aClass", "aClassName"],
  25778. 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",
  25779. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25780. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  25781. }),
  25782. $globals.Environment);
  25783. $core.addMethod(
  25784. $core.method({
  25785. selector: "renamePackage:to:",
  25786. protocol: "actions",
  25787. fn: function (aPackageName,aNewPackageName){
  25788. var self=this,$self=this;
  25789. return $core.withContext(function($ctx1) {
  25790. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  25791. return self;
  25792. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  25793. },
  25794. args: ["aPackageName", "aNewPackageName"],
  25795. source: "renamePackage: aPackageName to: aNewPackageName\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  25796. referencedClasses: ["Smalltalk"],
  25797. messageSends: ["renamePackage:to:"]
  25798. }),
  25799. $globals.Environment);
  25800. $core.addMethod(
  25801. $core.method({
  25802. selector: "renameProtocol:to:in:",
  25803. protocol: "actions",
  25804. fn: function (aString,anotherString,aClass){
  25805. var self=this,$self=this;
  25806. return $core.withContext(function($ctx1) {
  25807. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25808. return $core.withContext(function($ctx2) {
  25809. return $recv(each)._protocol_(anotherString);
  25810. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25811. }));
  25812. return self;
  25813. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  25814. },
  25815. args: ["aString", "anotherString", "aClass"],
  25816. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  25817. referencedClasses: [],
  25818. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  25819. }),
  25820. $globals.Environment);
  25821. $core.addMethod(
  25822. $core.method({
  25823. selector: "setClassCommentOf:to:",
  25824. protocol: "actions",
  25825. fn: function (aClass,aString){
  25826. var self=this,$self=this;
  25827. return $core.withContext(function($ctx1) {
  25828. $recv(aClass)._comment_(aString);
  25829. return self;
  25830. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  25831. },
  25832. args: ["aClass", "aString"],
  25833. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  25834. referencedClasses: [],
  25835. messageSends: ["comment:"]
  25836. }),
  25837. $globals.Environment);
  25838. $core.addMethod(
  25839. $core.method({
  25840. selector: "systemAnnouncer",
  25841. protocol: "accessing",
  25842. fn: function (){
  25843. var self=this,$self=this;
  25844. return $core.withContext(function($ctx1) {
  25845. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  25846. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  25847. },
  25848. args: [],
  25849. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  25850. referencedClasses: ["Smalltalk"],
  25851. messageSends: ["current", "at:", "globals"]
  25852. }),
  25853. $globals.Environment);
  25854. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  25855. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  25856. $core.addMethod(
  25857. $core.method({
  25858. selector: "do:on:displaying:",
  25859. protocol: "progress handling",
  25860. fn: function (aBlock,aCollection,aString){
  25861. var self=this,$self=this;
  25862. return $core.withContext(function($ctx1) {
  25863. $recv(aCollection)._do_(aBlock);
  25864. return self;
  25865. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  25866. },
  25867. args: ["aBlock", "aCollection", "aString"],
  25868. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  25869. referencedClasses: [],
  25870. messageSends: ["do:"]
  25871. }),
  25872. $globals.NullProgressHandler);
  25873. $globals.NullProgressHandler.a$cls.iVarNames = ["current"];
  25874. $core.addMethod(
  25875. $core.method({
  25876. selector: "initialize",
  25877. protocol: "initialization",
  25878. fn: function (){
  25879. var self=this,$self=this;
  25880. return $core.withContext(function($ctx1) {
  25881. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  25882. return self;
  25883. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.a$cls)});
  25884. },
  25885. args: [],
  25886. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  25887. referencedClasses: ["ProgressHandler"],
  25888. messageSends: ["registerIfNone:", "new"]
  25889. }),
  25890. $globals.NullProgressHandler.a$cls);
  25891. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  25892. $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.";
  25893. $globals.Service.a$cls.iVarNames = ["current"];
  25894. $core.addMethod(
  25895. $core.method({
  25896. selector: "current",
  25897. protocol: "accessing",
  25898. fn: function (){
  25899. var self=this,$self=this;
  25900. return $self["@current"];
  25901. },
  25902. args: [],
  25903. source: "current\x0a\x09^ current",
  25904. referencedClasses: [],
  25905. messageSends: []
  25906. }),
  25907. $globals.Service.a$cls);
  25908. $core.addMethod(
  25909. $core.method({
  25910. selector: "new",
  25911. protocol: "instance creation",
  25912. fn: function (){
  25913. var self=this,$self=this;
  25914. return $core.withContext(function($ctx1) {
  25915. $self._shouldNotImplement();
  25916. return self;
  25917. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.a$cls)});
  25918. },
  25919. args: [],
  25920. source: "new\x0a\x09self shouldNotImplement",
  25921. referencedClasses: [],
  25922. messageSends: ["shouldNotImplement"]
  25923. }),
  25924. $globals.Service.a$cls);
  25925. $core.addMethod(
  25926. $core.method({
  25927. selector: "register:",
  25928. protocol: "registration",
  25929. fn: function (anObject){
  25930. var self=this,$self=this;
  25931. $self["@current"]=anObject;
  25932. return self;
  25933. },
  25934. args: ["anObject"],
  25935. source: "register: anObject\x0a\x09current := anObject",
  25936. referencedClasses: [],
  25937. messageSends: []
  25938. }),
  25939. $globals.Service.a$cls);
  25940. $core.addMethod(
  25941. $core.method({
  25942. selector: "registerIfNone:",
  25943. protocol: "registration",
  25944. fn: function (anObject){
  25945. var self=this,$self=this;
  25946. return $core.withContext(function($ctx1) {
  25947. var $1,$receiver;
  25948. $1=$self._current();
  25949. if(($receiver = $1) == null || $receiver.a$nil){
  25950. $self._register_(anObject);
  25951. } else {
  25952. $1;
  25953. }
  25954. return self;
  25955. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.a$cls)});
  25956. },
  25957. args: ["anObject"],
  25958. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  25959. referencedClasses: [],
  25960. messageSends: ["ifNil:", "current", "register:"]
  25961. }),
  25962. $globals.Service.a$cls);
  25963. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  25964. $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.";
  25965. $core.addMethod(
  25966. $core.method({
  25967. selector: "handleError:",
  25968. protocol: "error handling",
  25969. fn: function (anError){
  25970. var self=this,$self=this;
  25971. return $core.withContext(function($ctx1) {
  25972. var $1;
  25973. $1=$recv((function(){
  25974. return $core.withContext(function($ctx2) {
  25975. return $recv(anError)._isSmalltalkError();
  25976. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25977. }))._tryCatch_((function(){
  25978. return false;
  25979. }));
  25980. if($core.assert($1)){
  25981. $self._handleUnhandledError_(anError);
  25982. $ctx1.sendIdx["handleUnhandledError:"]=1;
  25983. } else {
  25984. var smalltalkError;
  25985. smalltalkError=$recv($globals.JavaScriptException)._on_(anError);
  25986. smalltalkError;
  25987. $recv(smalltalkError)._wrap();
  25988. $self._handleUnhandledError_(smalltalkError);
  25989. }
  25990. return self;
  25991. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  25992. },
  25993. args: ["anError"],
  25994. 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 ]",
  25995. referencedClasses: ["JavaScriptException"],
  25996. messageSends: ["ifTrue:ifFalse:", "tryCatch:", "isSmalltalkError", "handleUnhandledError:", "on:", "wrap"]
  25997. }),
  25998. $globals.ErrorHandler.a$cls);
  25999. $core.addMethod(
  26000. $core.method({
  26001. selector: "handleUnhandledError:",
  26002. protocol: "error handling",
  26003. fn: function (anError){
  26004. var self=this,$self=this;
  26005. return $core.withContext(function($ctx1) {
  26006. var $1;
  26007. $1=$recv(anError)._wasHandled();
  26008. if(!$core.assert($1)){
  26009. $recv($self._current())._handleError_(anError);
  26010. $recv(anError)._beHandled();
  26011. }
  26012. return self;
  26013. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26014. },
  26015. args: ["anError"],
  26016. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifFalse: [\x0a\x09\x09self current handleError: anError.\x0a\x09\x09anError beHandled ]",
  26017. referencedClasses: [],
  26018. messageSends: ["ifFalse:", "wasHandled", "handleError:", "current", "beHandled"]
  26019. }),
  26020. $globals.ErrorHandler.a$cls);
  26021. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  26022. $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.";
  26023. $core.addMethod(
  26024. $core.method({
  26025. selector: "findClass:",
  26026. protocol: "finding",
  26027. fn: function (aClass){
  26028. var self=this,$self=this;
  26029. return $core.withContext(function($ctx1) {
  26030. return $recv($self._current())._findClass_(aClass);
  26031. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.a$cls)});
  26032. },
  26033. args: ["aClass"],
  26034. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  26035. referencedClasses: [],
  26036. messageSends: ["findClass:", "current"]
  26037. }),
  26038. $globals.Finder.a$cls);
  26039. $core.addMethod(
  26040. $core.method({
  26041. selector: "findMethod:",
  26042. protocol: "finding",
  26043. fn: function (aCompiledMethod){
  26044. var self=this,$self=this;
  26045. return $core.withContext(function($ctx1) {
  26046. return $recv($self._current())._findMethod_(aCompiledMethod);
  26047. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.a$cls)});
  26048. },
  26049. args: ["aCompiledMethod"],
  26050. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  26051. referencedClasses: [],
  26052. messageSends: ["findMethod:", "current"]
  26053. }),
  26054. $globals.Finder.a$cls);
  26055. $core.addMethod(
  26056. $core.method({
  26057. selector: "findString:",
  26058. protocol: "finding",
  26059. fn: function (aString){
  26060. var self=this,$self=this;
  26061. return $core.withContext(function($ctx1) {
  26062. return $recv($self._current())._findString_(aString);
  26063. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.a$cls)});
  26064. },
  26065. args: ["aString"],
  26066. source: "findString: aString\x0a\x09^ self current findString: aString",
  26067. referencedClasses: [],
  26068. messageSends: ["findString:", "current"]
  26069. }),
  26070. $globals.Finder.a$cls);
  26071. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  26072. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  26073. $core.addMethod(
  26074. $core.method({
  26075. selector: "inspect:",
  26076. protocol: "inspecting",
  26077. fn: function (anObject){
  26078. var self=this,$self=this;
  26079. return $core.withContext(function($ctx1) {
  26080. return $recv($self._current())._inspect_(anObject);
  26081. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.a$cls)});
  26082. },
  26083. args: ["anObject"],
  26084. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  26085. referencedClasses: [],
  26086. messageSends: ["inspect:", "current"]
  26087. }),
  26088. $globals.Inspector.a$cls);
  26089. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  26090. $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";
  26091. $core.addMethod(
  26092. $core.method({
  26093. selector: "globals",
  26094. protocol: "accessing",
  26095. fn: function (){
  26096. var self=this,$self=this;
  26097. return $core.withContext(function($ctx1) {
  26098. return $recv($self._current())._globals();
  26099. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.a$cls)});
  26100. },
  26101. args: [],
  26102. source: "globals\x0a\x09^ self current globals",
  26103. referencedClasses: [],
  26104. messageSends: ["globals", "current"]
  26105. }),
  26106. $globals.Platform.a$cls);
  26107. $core.addMethod(
  26108. $core.method({
  26109. selector: "newXhr",
  26110. protocol: "accessing",
  26111. fn: function (){
  26112. var self=this,$self=this;
  26113. return $core.withContext(function($ctx1) {
  26114. return $recv($self._current())._newXhr();
  26115. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.a$cls)});
  26116. },
  26117. args: [],
  26118. source: "newXhr\x0a\x09^ self current newXhr",
  26119. referencedClasses: [],
  26120. messageSends: ["newXhr", "current"]
  26121. }),
  26122. $globals.Platform.a$cls);
  26123. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  26124. $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`.";
  26125. $core.addMethod(
  26126. $core.method({
  26127. selector: "do:on:displaying:",
  26128. protocol: "progress handling",
  26129. fn: function (aBlock,aCollection,aString){
  26130. var self=this,$self=this;
  26131. return $core.withContext(function($ctx1) {
  26132. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  26133. return self;
  26134. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.a$cls)});
  26135. },
  26136. args: ["aBlock", "aCollection", "aString"],
  26137. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  26138. referencedClasses: [],
  26139. messageSends: ["do:on:displaying:", "current"]
  26140. }),
  26141. $globals.ProgressHandler.a$cls);
  26142. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  26143. $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:'.";
  26144. $core.addMethod(
  26145. $core.method({
  26146. selector: "alert:",
  26147. protocol: "dialogs",
  26148. fn: function (aString){
  26149. var self=this,$self=this;
  26150. return $core.withContext(function($ctx1) {
  26151. return $recv($self._current())._alert_(aString);
  26152. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.a$cls)});
  26153. },
  26154. args: ["aString"],
  26155. source: "alert: aString\x0a\x09^ self current alert: aString",
  26156. referencedClasses: [],
  26157. messageSends: ["alert:", "current"]
  26158. }),
  26159. $globals.Terminal.a$cls);
  26160. $core.addMethod(
  26161. $core.method({
  26162. selector: "confirm:",
  26163. protocol: "dialogs",
  26164. fn: function (aString){
  26165. var self=this,$self=this;
  26166. return $core.withContext(function($ctx1) {
  26167. return $recv($self._current())._confirm_(aString);
  26168. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.a$cls)});
  26169. },
  26170. args: ["aString"],
  26171. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  26172. referencedClasses: [],
  26173. messageSends: ["confirm:", "current"]
  26174. }),
  26175. $globals.Terminal.a$cls);
  26176. $core.addMethod(
  26177. $core.method({
  26178. selector: "prompt:",
  26179. protocol: "dialogs",
  26180. fn: function (aString){
  26181. var self=this,$self=this;
  26182. return $core.withContext(function($ctx1) {
  26183. return $recv($self._current())._prompt_(aString);
  26184. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.a$cls)});
  26185. },
  26186. args: ["aString"],
  26187. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  26188. referencedClasses: [],
  26189. messageSends: ["prompt:", "current"]
  26190. }),
  26191. $globals.Terminal.a$cls);
  26192. $core.addMethod(
  26193. $core.method({
  26194. selector: "prompt:default:",
  26195. protocol: "dialogs",
  26196. fn: function (aString,defaultString){
  26197. var self=this,$self=this;
  26198. return $core.withContext(function($ctx1) {
  26199. return $recv($self._current())._prompt_default_(aString,defaultString);
  26200. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.a$cls)});
  26201. },
  26202. args: ["aString", "defaultString"],
  26203. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  26204. referencedClasses: [],
  26205. messageSends: ["prompt:default:", "current"]
  26206. }),
  26207. $globals.Terminal.a$cls);
  26208. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  26209. $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.";
  26210. $core.addMethod(
  26211. $core.method({
  26212. selector: "clear",
  26213. protocol: "printing",
  26214. fn: function (){
  26215. var self=this,$self=this;
  26216. return $core.withContext(function($ctx1) {
  26217. $recv($self._current())._clear();
  26218. return self;
  26219. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.a$cls)});
  26220. },
  26221. args: [],
  26222. source: "clear\x0a\x09self current clear",
  26223. referencedClasses: [],
  26224. messageSends: ["clear", "current"]
  26225. }),
  26226. $globals.Transcript.a$cls);
  26227. $core.addMethod(
  26228. $core.method({
  26229. selector: "cr",
  26230. protocol: "printing",
  26231. fn: function (){
  26232. var self=this,$self=this;
  26233. return $core.withContext(function($ctx1) {
  26234. $recv($self._current())._show_($recv($globals.String)._cr());
  26235. return self;
  26236. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.a$cls)});
  26237. },
  26238. args: [],
  26239. source: "cr\x0a\x09self current show: String cr",
  26240. referencedClasses: ["String"],
  26241. messageSends: ["show:", "current", "cr"]
  26242. }),
  26243. $globals.Transcript.a$cls);
  26244. $core.addMethod(
  26245. $core.method({
  26246. selector: "inspect:",
  26247. protocol: "printing",
  26248. fn: function (anObject){
  26249. var self=this,$self=this;
  26250. return $core.withContext(function($ctx1) {
  26251. $self._show_(anObject);
  26252. return self;
  26253. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.a$cls)});
  26254. },
  26255. args: ["anObject"],
  26256. source: "inspect: anObject\x0a\x09self show: anObject",
  26257. referencedClasses: [],
  26258. messageSends: ["show:"]
  26259. }),
  26260. $globals.Transcript.a$cls);
  26261. $core.addMethod(
  26262. $core.method({
  26263. selector: "open",
  26264. protocol: "instance creation",
  26265. fn: function (){
  26266. var self=this,$self=this;
  26267. return $core.withContext(function($ctx1) {
  26268. $recv($self._current())._open();
  26269. return self;
  26270. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.a$cls)});
  26271. },
  26272. args: [],
  26273. source: "open\x0a\x09self current open",
  26274. referencedClasses: [],
  26275. messageSends: ["open", "current"]
  26276. }),
  26277. $globals.Transcript.a$cls);
  26278. $core.addMethod(
  26279. $core.method({
  26280. selector: "show:",
  26281. protocol: "printing",
  26282. fn: function (anObject){
  26283. var self=this,$self=this;
  26284. return $core.withContext(function($ctx1) {
  26285. $recv($self._current())._show_(anObject);
  26286. return self;
  26287. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.a$cls)});
  26288. },
  26289. args: ["anObject"],
  26290. source: "show: anObject\x0a\x09self current show: anObject",
  26291. referencedClasses: [],
  26292. messageSends: ["show:", "current"]
  26293. }),
  26294. $globals.Transcript.a$cls);
  26295. $core.addMethod(
  26296. $core.method({
  26297. selector: "inspectOn:",
  26298. protocol: "*Platform-Services",
  26299. fn: function (anInspector){
  26300. var self=this,$self=this;
  26301. var variables;
  26302. return $core.withContext(function($ctx1) {
  26303. variables=$recv($globals.Dictionary)._new();
  26304. $recv(variables)._at_put_("#self",self);
  26305. $ctx1.sendIdx["at:put:"]=1;
  26306. $recv(variables)._at_put_("#keys",$self._keys());
  26307. $ctx1.sendIdx["at:put:"]=2;
  26308. $self._keysAndValuesDo_((function(key,value){
  26309. return $core.withContext(function($ctx2) {
  26310. return $recv(variables)._at_put_(key,value);
  26311. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  26312. }));
  26313. $recv(anInspector)._setLabel_($self._printString());
  26314. $recv(anInspector)._setVariables_(variables);
  26315. return self;
  26316. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  26317. },
  26318. args: ["anInspector"],
  26319. 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",
  26320. referencedClasses: ["Dictionary"],
  26321. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  26322. }),
  26323. $globals.AssociativeCollection);
  26324. $core.addMethod(
  26325. $core.method({
  26326. selector: "inspectOn:",
  26327. protocol: "*Platform-Services",
  26328. fn: function (anInspector){
  26329. var self=this,$self=this;
  26330. var variables;
  26331. return $core.withContext(function($ctx1) {
  26332. variables=$recv($globals.Dictionary)._new();
  26333. $recv(variables)._at_put_("#self",self);
  26334. $ctx1.sendIdx["at:put:"]=1;
  26335. $self._withIndexDo_((function(each,i){
  26336. return $core.withContext(function($ctx2) {
  26337. return $recv(variables)._at_put_(i,each);
  26338. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  26339. }));
  26340. $recv(anInspector)._setLabel_($self._printString());
  26341. $recv(anInspector)._setVariables_(variables);
  26342. return self;
  26343. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  26344. },
  26345. args: ["anInspector"],
  26346. 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",
  26347. referencedClasses: ["Dictionary"],
  26348. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  26349. }),
  26350. $globals.Collection);
  26351. $core.addMethod(
  26352. $core.method({
  26353. selector: "inspectOn:",
  26354. protocol: "*Platform-Services",
  26355. fn: function (anInspector){
  26356. var self=this,$self=this;
  26357. var variables;
  26358. return $core.withContext(function($ctx1) {
  26359. variables=$recv($globals.Dictionary)._new();
  26360. $recv(variables)._at_put_("#self",self);
  26361. $ctx1.sendIdx["at:put:"]=1;
  26362. $recv(variables)._at_put_("#year",$self._year());
  26363. $ctx1.sendIdx["at:put:"]=2;
  26364. $recv(variables)._at_put_("#month",$self._month());
  26365. $ctx1.sendIdx["at:put:"]=3;
  26366. $recv(variables)._at_put_("#day",$self._day());
  26367. $ctx1.sendIdx["at:put:"]=4;
  26368. $recv(variables)._at_put_("#hours",$self._hours());
  26369. $ctx1.sendIdx["at:put:"]=5;
  26370. $recv(variables)._at_put_("#minutes",$self._minutes());
  26371. $ctx1.sendIdx["at:put:"]=6;
  26372. $recv(variables)._at_put_("#seconds",$self._seconds());
  26373. $ctx1.sendIdx["at:put:"]=7;
  26374. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  26375. $recv(anInspector)._setLabel_($self._printString());
  26376. $recv(anInspector)._setVariables_(variables);
  26377. return self;
  26378. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  26379. },
  26380. args: ["anInspector"],
  26381. 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",
  26382. referencedClasses: ["Dictionary"],
  26383. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  26384. }),
  26385. $globals.Date);
  26386. $core.addMethod(
  26387. $core.method({
  26388. selector: "inspectOn:",
  26389. protocol: "*Platform-Services",
  26390. fn: function (anInspector){
  26391. var self=this,$self=this;
  26392. var variables;
  26393. return $core.withContext(function($ctx1) {
  26394. variables=$recv($globals.Dictionary)._new();
  26395. $recv(variables)._at_put_("#self",$self._jsObject());
  26396. $recv(anInspector)._setLabel_($self._printString());
  26397. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  26398. $recv(anInspector)._setVariables_(variables);
  26399. return self;
  26400. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  26401. },
  26402. args: ["anInspector"],
  26403. 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",
  26404. referencedClasses: ["Dictionary", "JSObjectProxy"],
  26405. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  26406. }),
  26407. $globals.JSObjectProxy);
  26408. $core.addMethod(
  26409. $core.method({
  26410. selector: "inspectOn:",
  26411. protocol: "*Platform-Services",
  26412. fn: function (anInspector){
  26413. var self=this,$self=this;
  26414. var variables;
  26415. return $core.withContext(function($ctx1) {
  26416. variables=$recv($globals.Dictionary)._new();
  26417. $recv(variables)._at_put_("#self",self);
  26418. $ctx1.sendIdx["at:put:"]=1;
  26419. $recv(variables)._at_put_("#home",$self._home());
  26420. $ctx1.sendIdx["at:put:"]=2;
  26421. $recv(variables)._at_put_("#receiver",$self._receiver());
  26422. $ctx1.sendIdx["at:put:"]=3;
  26423. $recv(variables)._at_put_("#selector",$self._selector());
  26424. $ctx1.sendIdx["at:put:"]=4;
  26425. $recv(variables)._at_put_("#locals",$self._locals());
  26426. $ctx1.sendIdx["at:put:"]=5;
  26427. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  26428. return $core.withContext(function($ctx2) {
  26429. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26430. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26431. }));
  26432. $recv(anInspector)._setLabel_($self._printString());
  26433. $recv(anInspector)._setVariables_(variables);
  26434. return self;
  26435. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  26436. },
  26437. args: ["anInspector"],
  26438. 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",
  26439. referencedClasses: ["Dictionary"],
  26440. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26441. }),
  26442. $globals.MethodContext);
  26443. $core.addMethod(
  26444. $core.method({
  26445. selector: "inspectOn:",
  26446. protocol: "*Platform-Services",
  26447. fn: function (anInspector){
  26448. var self=this,$self=this;
  26449. var variables;
  26450. return $core.withContext(function($ctx1) {
  26451. variables=$recv($globals.Dictionary)._new();
  26452. $recv(variables)._at_put_("#self",self);
  26453. $ctx1.sendIdx["at:put:"]=1;
  26454. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  26455. return $core.withContext(function($ctx2) {
  26456. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26457. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26458. }));
  26459. $recv(anInspector)._setLabel_($self._printString());
  26460. $recv(anInspector)._setVariables_(variables);
  26461. return self;
  26462. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  26463. },
  26464. args: ["anInspector"],
  26465. 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",
  26466. referencedClasses: ["Dictionary"],
  26467. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26468. }),
  26469. $globals.Object);
  26470. $core.addMethod(
  26471. $core.method({
  26472. selector: "do:displayingProgress:",
  26473. protocol: "*Platform-Services",
  26474. fn: function (aBlock,aString){
  26475. var self=this,$self=this;
  26476. return $core.withContext(function($ctx1) {
  26477. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  26478. return self;
  26479. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  26480. },
  26481. args: ["aBlock", "aString"],
  26482. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  26483. referencedClasses: ["ProgressHandler"],
  26484. messageSends: ["do:on:displaying:"]
  26485. }),
  26486. $globals.SequenceableCollection);
  26487. $core.addMethod(
  26488. $core.method({
  26489. selector: "inspectOn:",
  26490. protocol: "*Platform-Services",
  26491. fn: function (anInspector){
  26492. var self=this,$self=this;
  26493. var variables,i;
  26494. return $core.withContext(function($ctx1) {
  26495. variables=$recv($globals.Dictionary)._new();
  26496. $recv(variables)._at_put_("#self",self);
  26497. $ctx1.sendIdx["at:put:"]=1;
  26498. i=(1);
  26499. $self._do_((function(each){
  26500. return $core.withContext(function($ctx2) {
  26501. $recv(variables)._at_put_(i,each);
  26502. i=$recv(i).__plus((1));
  26503. return i;
  26504. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26505. }));
  26506. $recv(anInspector)._setLabel_($self._printString());
  26507. $recv(anInspector)._setVariables_(variables);
  26508. return self;
  26509. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  26510. },
  26511. args: ["anInspector"],
  26512. 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",
  26513. referencedClasses: ["Dictionary"],
  26514. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  26515. }),
  26516. $globals.Set);
  26517. $core.addMethod(
  26518. $core.method({
  26519. selector: "inspectOn:",
  26520. protocol: "*Platform-Services",
  26521. fn: function (anInspector){
  26522. var self=this,$self=this;
  26523. var label;
  26524. return $core.withContext(function($ctx1) {
  26525. var $3,$2,$1,$5,$4;
  26526. (
  26527. $ctx1.supercall = true,
  26528. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($self, [anInspector]));
  26529. $ctx1.supercall = false;
  26530. $3=$self._printString();
  26531. $ctx1.sendIdx["printString"]=1;
  26532. $2=$recv($3)._size();
  26533. $1=$recv($2).__gt((30));
  26534. if($core.assert($1)){
  26535. $5=$self._printString();
  26536. $ctx1.sendIdx["printString"]=2;
  26537. $4=$recv($5)._copyFrom_to_((1),(30));
  26538. label=$recv($4).__comma("...'");
  26539. label;
  26540. } else {
  26541. label=$self._printString();
  26542. label;
  26543. }
  26544. $recv(anInspector)._setLabel_(label);
  26545. return self;
  26546. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  26547. },
  26548. args: ["anInspector"],
  26549. 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",
  26550. referencedClasses: [],
  26551. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  26552. }),
  26553. $globals.String);
  26554. });
  26555. /* stub */;
  26556. define("amber/Platform", function(){});
  26557. define('amber/deploy',[
  26558. './helpers',
  26559. './boot', // pre-fetch, dep of ./helpers
  26560. // --- packages of the core Amber begin here ---
  26561. 'amber_core/Kernel-Helpers',
  26562. 'amber_core/Kernel-Objects',
  26563. 'amber_core/Kernel-Classes',
  26564. 'amber_core/Kernel-Methods',
  26565. 'amber_core/Kernel-Collections',
  26566. 'amber_core/Kernel-Dag',
  26567. 'amber_core/Kernel-Infrastructure',
  26568. 'amber_core/Kernel-Promises',
  26569. 'amber_core/Kernel-Exceptions',
  26570. 'amber_core/Kernel-Announcements',
  26571. 'amber_core/Platform-Services',
  26572. 'amber/Platform' // TODO remove
  26573. // --- packages of the core Amber end here ---
  26574. ], function (amber) {
  26575. return amber;
  26576. });
  26577. define('amber/parser',['./boot'], function($boot) {
  26578. var $globals = $boot.globals;
  26579. $globals.SmalltalkParser = (function() {
  26580. "use strict";
  26581. /*
  26582. * Generated by PEG.js 0.9.0.
  26583. *
  26584. * http://pegjs.org/
  26585. */
  26586. function peg$subclass(child, parent) {
  26587. function ctor() { this.constructor = child; }
  26588. ctor.prototype = parent.prototype;
  26589. child.prototype = new ctor();
  26590. }
  26591. function peg$SyntaxError(message, expected, found, location) {
  26592. this.message = message;
  26593. this.expected = expected;
  26594. this.found = found;
  26595. this.location = location;
  26596. this.name = "SyntaxError";
  26597. if (typeof Error.captureStackTrace === "function") {
  26598. Error.captureStackTrace(this, peg$SyntaxError);
  26599. }
  26600. }
  26601. peg$subclass(peg$SyntaxError, Error);
  26602. function peg$parse(input) {
  26603. var options = arguments.length > 1 ? arguments[1] : {},
  26604. parser = this,
  26605. peg$FAILED = {},
  26606. peg$startRuleFunctions = { start: peg$parsestart },
  26607. peg$startRuleFunction = peg$parsestart,
  26608. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  26609. 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]" },
  26610. peg$c2 = "\"",
  26611. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  26612. peg$c4 = /^[^"]/,
  26613. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  26614. peg$c6 = ".",
  26615. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  26616. peg$c8 = /^[a-zA-Z]/,
  26617. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  26618. peg$c10 = /^[a-zA-Z0-9]/,
  26619. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  26620. peg$c12 = ":",
  26621. peg$c13 = { type: "literal", value: ":", description: "\":\"" },
  26622. peg$c14 = /^[A-Z]/,
  26623. peg$c15 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  26624. peg$c16 = function(val) {
  26625. return $globals.ValueNode._new()
  26626. ._location_(location())
  26627. ._source_(text())
  26628. ._value_(val);
  26629. },
  26630. peg$c17 = "'",
  26631. peg$c18 = { type: "literal", value: "'", description: "\"'\"" },
  26632. peg$c19 = "''",
  26633. peg$c20 = { type: "literal", value: "''", description: "\"''\"" },
  26634. peg$c21 = function() {return '\'';},
  26635. peg$c22 = /^[^']/,
  26636. peg$c23 = { type: "class", value: "[^']", description: "[^']" },
  26637. peg$c24 = function(val) {return val.join('');},
  26638. peg$c25 = "$",
  26639. peg$c26 = { type: "literal", value: "$", description: "\"$\"" },
  26640. peg$c27 = { type: "any", description: "any character" },
  26641. peg$c28 = function(char) {
  26642. return $globals.ValueNode._new()
  26643. ._location_(location())
  26644. ._source_(text())
  26645. ._value_(char);
  26646. },
  26647. peg$c29 = "#",
  26648. peg$c30 = { type: "literal", value: "#", description: "\"#\"" },
  26649. peg$c31 = function(rest) {return rest;},
  26650. peg$c32 = "e",
  26651. peg$c33 = { type: "literal", value: "e", description: "\"e\"" },
  26652. peg$c34 = function(n) {return parseFloat(n);},
  26653. peg$c35 = "-",
  26654. peg$c36 = { type: "literal", value: "-", description: "\"-\"" },
  26655. peg$c37 = "16r",
  26656. peg$c38 = { type: "literal", value: "16r", description: "\"16r\"" },
  26657. peg$c39 = /^[0-9a-fA-F]/,
  26658. peg$c40 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  26659. peg$c41 = function(neg, num) {
  26660. return parseInt(((neg || '') + num), 16);
  26661. },
  26662. peg$c42 = /^[0-9]/,
  26663. peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
  26664. peg$c44 = function(n) {return parseFloat(n, 10);},
  26665. peg$c45 = function(n) {return parseInt(n, 10);},
  26666. peg$c46 = "#(",
  26667. peg$c47 = { type: "literal", value: "#(", description: "\"#(\"" },
  26668. peg$c48 = ")",
  26669. peg$c49 = { type: "literal", value: ")", description: "\")\"" },
  26670. peg$c50 = function(rest) {
  26671. return rest
  26672. ._location_(location())
  26673. ._source_(text());
  26674. },
  26675. peg$c51 = "(",
  26676. peg$c52 = { type: "literal", value: "(", description: "\"(\"" },
  26677. peg$c53 = function(lit) {return lit._value();},
  26678. peg$c54 = function(lits) {
  26679. return $globals.ValueNode._new()
  26680. ._value_(lits);
  26681. },
  26682. peg$c55 = "{",
  26683. peg$c56 = { type: "literal", value: "{", description: "\"{\"" },
  26684. peg$c57 = "}",
  26685. peg$c58 = { type: "literal", value: "}", description: "\"}\"" },
  26686. peg$c59 = function(expressions) {
  26687. return $globals.DynamicArrayNode._new()
  26688. ._location_(location())
  26689. ._source_(text())
  26690. ._dagChildren_(expressions || []);
  26691. },
  26692. peg$c60 = "#{",
  26693. peg$c61 = { type: "literal", value: "#{", description: "\"#{\"" },
  26694. peg$c62 = function(expressions) {
  26695. return $globals.DynamicDictionaryNode._new()
  26696. ._location_(location())
  26697. ._source_(text())
  26698. ._dagChildren_(expressions || []);
  26699. },
  26700. peg$c63 = "true",
  26701. peg$c64 = { type: "literal", value: "true", description: "\"true\"" },
  26702. peg$c65 = function() {return true;},
  26703. peg$c66 = "false",
  26704. peg$c67 = { type: "literal", value: "false", description: "\"false\"" },
  26705. peg$c68 = function() {return false;},
  26706. peg$c69 = "nil",
  26707. peg$c70 = { type: "literal", value: "nil", description: "\"nil\"" },
  26708. peg$c71 = function() {return null;},
  26709. peg$c72 = function(identifier) {
  26710. return $globals.VariableNode._new()
  26711. ._location_(location())
  26712. ._source_(text())
  26713. ._value_(identifier);
  26714. },
  26715. peg$c73 = /^[\\+*\/=><,@%~|&\-]/,
  26716. peg$c74 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  26717. peg$c75 = function(key, arg) {return {key:key, arg:arg};},
  26718. peg$c76 = function(pairs) {
  26719. var selector = '';
  26720. var params = [];
  26721. for(var i = 0; i < pairs.length; i++) {
  26722. selector += pairs[i].key;
  26723. params.push(pairs[i].arg);
  26724. }
  26725. return [selector, params];
  26726. },
  26727. peg$c77 = function(selector, arg) {
  26728. return [selector, [arg]];
  26729. },
  26730. peg$c78 = function(selector) {return [selector, []];},
  26731. peg$c79 = function(expression) {
  26732. return expression;
  26733. },
  26734. peg$c80 = function(first, others) {
  26735. return [first].concat(others);
  26736. },
  26737. peg$c81 = ":=",
  26738. peg$c82 = { type: "literal", value: ":=", description: "\":=\"" },
  26739. peg$c83 = function(variable, expression) {
  26740. return $globals.AssignmentNode._new()
  26741. ._location_(location())
  26742. ._source_(text())
  26743. ._left_(variable)
  26744. ._right_(expression);
  26745. },
  26746. peg$c84 = "^",
  26747. peg$c85 = { type: "literal", value: "^", description: "\"^\"" },
  26748. peg$c86 = function(expression) {
  26749. return $globals.ReturnNode._new()
  26750. ._location_(location())
  26751. ._source_(text())
  26752. ._dagChildren_([expression]);
  26753. },
  26754. peg$c87 = "|",
  26755. peg$c88 = { type: "literal", value: "|", description: "\"|\"" },
  26756. peg$c89 = function(variable) {return variable;},
  26757. peg$c90 = function(vars) {
  26758. return vars;
  26759. },
  26760. peg$c91 = function(param) {return param;},
  26761. peg$c92 = function(params) {
  26762. return params;
  26763. },
  26764. peg$c93 = function(ret) {return [ret];},
  26765. peg$c94 = function(exps, ret) {
  26766. var expressions = exps;
  26767. expressions.push(ret);
  26768. return expressions;
  26769. },
  26770. peg$c95 = function(expressions) {return expressions || [];},
  26771. peg$c96 = function(js) {return js;},
  26772. peg$c97 = function(temps, statements) {
  26773. return $globals.SequenceNode._new()
  26774. ._location_(location())
  26775. ._source_(text())
  26776. ._temps_(temps || [])
  26777. ._dagChildren_(statements || []);
  26778. },
  26779. peg$c98 = "[",
  26780. peg$c99 = { type: "literal", value: "[", description: "\"[\"" },
  26781. peg$c100 = "]",
  26782. peg$c101 = { type: "literal", value: "]", description: "\"]\"" },
  26783. peg$c102 = function(params, sequence) {
  26784. return $globals.BlockNode._new()
  26785. ._location_(location())
  26786. ._source_(text())
  26787. ._parameters_(params || [])
  26788. ._dagChildren_([sequence._asBlockSequenceNode()]);
  26789. },
  26790. peg$c103 = function(selector) {
  26791. return $globals.SendNode._new()
  26792. ._location_(location())
  26793. ._source_(text())
  26794. ._selector_(selector);
  26795. },
  26796. peg$c104 = function(receiver, tail) {
  26797. return receiver._withTail_(tail);
  26798. },
  26799. peg$c105 = function(selector, arg) {
  26800. return $globals.SendNode._new()
  26801. ._location_(location())
  26802. ._source_(text())
  26803. ._selector_(selector)
  26804. ._arguments_([arg]);
  26805. },
  26806. peg$c106 = function(pairs) {
  26807. var selector = '';
  26808. var args = [];
  26809. for(var i = 0; i < pairs.length; i++) {
  26810. selector += pairs[i].key;
  26811. args.push(pairs[i].arg);
  26812. }
  26813. return $globals.SendNode._new()
  26814. ._location_(location())
  26815. ._source_(text())
  26816. ._selector_(selector)
  26817. ._arguments_(args);
  26818. },
  26819. peg$c107 = function(receiver, tail) {
  26820. return tail ? receiver._withTail_([tail]) : receiver;
  26821. },
  26822. peg$c108 = function(send) {return send._isSendNode();},
  26823. peg$c109 = ";",
  26824. peg$c110 = { type: "literal", value: ";", description: "\";\"" },
  26825. peg$c111 = function(send, mess) {return mess;},
  26826. peg$c112 = function(send, messages) {
  26827. messages.unshift(send);
  26828. return $globals.CascadeNode._new()
  26829. ._location_(location())
  26830. ._source_(text())
  26831. ._dagChildren_(messages);
  26832. },
  26833. peg$c113 = "<",
  26834. peg$c114 = { type: "literal", value: "<", description: "\"<\"" },
  26835. peg$c115 = ">>",
  26836. peg$c116 = { type: "literal", value: ">>", description: "\">>\"" },
  26837. peg$c117 = function() {return '>';},
  26838. peg$c118 = /^[^>]/,
  26839. peg$c119 = { type: "class", value: "[^>]", description: "[^>]" },
  26840. peg$c120 = ">",
  26841. peg$c121 = { type: "literal", value: ">", description: "\">\"" },
  26842. peg$c122 = function(val) {return !/^\s*inlineJS/.test(val.join(''));},
  26843. peg$c123 = function(val) {
  26844. console.warn('Use of <...js code...> is deprecated, in:\n' + val.join(''));
  26845. return $globals.JSStatementNode._new()
  26846. ._location_(location())
  26847. ._source_(val.join(''))
  26848. },
  26849. peg$c124 = "inlineJS:",
  26850. peg$c125 = { type: "literal", value: "inlineJS:", description: "\"inlineJS:\"" },
  26851. peg$c126 = function(val) {
  26852. return $globals.JSStatementNode._new()
  26853. ._location_(location())
  26854. ._source_(val)
  26855. },
  26856. peg$c127 = function(pattern, sequence) {
  26857. return $globals.MethodNode._new()
  26858. ._location_(location())
  26859. ._source_(text())
  26860. ._selector_(pattern[0])
  26861. ._arguments_(pattern[1])
  26862. ._dagChildren_([sequence]);
  26863. },
  26864. peg$c128 = function(send) { return send._isSendNode() && send._selector() === '->' },
  26865. peg$c129 = function(send) {
  26866. return [send._receiver(), send._arguments()[0]];
  26867. },
  26868. peg$c130 = function(first, others) {
  26869. return first.concat.apply(first, others);
  26870. },
  26871. peg$currPos = 0,
  26872. peg$savedPos = 0,
  26873. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  26874. peg$maxFailPos = 0,
  26875. peg$maxFailExpected = [],
  26876. peg$silentFails = 0,
  26877. peg$resultsCache = {},
  26878. peg$result;
  26879. if ("startRule" in options) {
  26880. if (!(options.startRule in peg$startRuleFunctions)) {
  26881. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  26882. }
  26883. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  26884. }
  26885. function text() {
  26886. return input.substring(peg$savedPos, peg$currPos);
  26887. }
  26888. function location() {
  26889. return peg$computeLocation(peg$savedPos, peg$currPos);
  26890. }
  26891. function expected(description) {
  26892. throw peg$buildException(
  26893. null,
  26894. [{ type: "other", description: description }],
  26895. input.substring(peg$savedPos, peg$currPos),
  26896. peg$computeLocation(peg$savedPos, peg$currPos)
  26897. );
  26898. }
  26899. function error(message) {
  26900. throw peg$buildException(
  26901. message,
  26902. null,
  26903. input.substring(peg$savedPos, peg$currPos),
  26904. peg$computeLocation(peg$savedPos, peg$currPos)
  26905. );
  26906. }
  26907. function peg$computePosDetails(pos) {
  26908. var details = peg$posDetailsCache[pos],
  26909. p, ch;
  26910. if (details) {
  26911. return details;
  26912. } else {
  26913. p = pos - 1;
  26914. while (!peg$posDetailsCache[p]) {
  26915. p--;
  26916. }
  26917. details = peg$posDetailsCache[p];
  26918. details = {
  26919. line: details.line,
  26920. column: details.column,
  26921. seenCR: details.seenCR
  26922. };
  26923. while (p < pos) {
  26924. ch = input.charAt(p);
  26925. if (ch === "\n") {
  26926. if (!details.seenCR) { details.line++; }
  26927. details.column = 1;
  26928. details.seenCR = false;
  26929. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  26930. details.line++;
  26931. details.column = 1;
  26932. details.seenCR = true;
  26933. } else {
  26934. details.column++;
  26935. details.seenCR = false;
  26936. }
  26937. p++;
  26938. }
  26939. peg$posDetailsCache[pos] = details;
  26940. return details;
  26941. }
  26942. }
  26943. function peg$computeLocation(startPos, endPos) {
  26944. var startPosDetails = peg$computePosDetails(startPos),
  26945. endPosDetails = peg$computePosDetails(endPos);
  26946. return {
  26947. start: {
  26948. offset: startPos,
  26949. line: startPosDetails.line,
  26950. column: startPosDetails.column
  26951. },
  26952. end: {
  26953. offset: endPos,
  26954. line: endPosDetails.line,
  26955. column: endPosDetails.column
  26956. }
  26957. };
  26958. }
  26959. function peg$fail(expected) {
  26960. if (peg$currPos < peg$maxFailPos) { return; }
  26961. if (peg$currPos > peg$maxFailPos) {
  26962. peg$maxFailPos = peg$currPos;
  26963. peg$maxFailExpected = [];
  26964. }
  26965. peg$maxFailExpected.push(expected);
  26966. }
  26967. function peg$buildException(message, expected, found, location) {
  26968. function cleanupExpected(expected) {
  26969. var i = 1;
  26970. expected.sort(function(a, b) {
  26971. if (a.description < b.description) {
  26972. return -1;
  26973. } else if (a.description > b.description) {
  26974. return 1;
  26975. } else {
  26976. return 0;
  26977. }
  26978. });
  26979. while (i < expected.length) {
  26980. if (expected[i - 1] === expected[i]) {
  26981. expected.splice(i, 1);
  26982. } else {
  26983. i++;
  26984. }
  26985. }
  26986. }
  26987. function buildMessage(expected, found) {
  26988. function stringEscape(s) {
  26989. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  26990. return s
  26991. .replace(/\\/g, '\\\\')
  26992. .replace(/"/g, '\\"')
  26993. .replace(/\x08/g, '\\b')
  26994. .replace(/\t/g, '\\t')
  26995. .replace(/\n/g, '\\n')
  26996. .replace(/\f/g, '\\f')
  26997. .replace(/\r/g, '\\r')
  26998. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  26999. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  27000. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  27001. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  27002. }
  27003. var expectedDescs = new Array(expected.length),
  27004. expectedDesc, foundDesc, i;
  27005. for (i = 0; i < expected.length; i++) {
  27006. expectedDescs[i] = expected[i].description;
  27007. }
  27008. expectedDesc = expected.length > 1
  27009. ? expectedDescs.slice(0, -1).join(", ")
  27010. + " or "
  27011. + expectedDescs[expected.length - 1]
  27012. : expectedDescs[0];
  27013. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  27014. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  27015. }
  27016. if (expected !== null) {
  27017. cleanupExpected(expected);
  27018. }
  27019. return new peg$SyntaxError(
  27020. message !== null ? message : buildMessage(expected, found),
  27021. expected,
  27022. found,
  27023. location
  27024. );
  27025. }
  27026. function peg$parsestart() {
  27027. var s0;
  27028. var key = peg$currPos * 62 + 0,
  27029. cached = peg$resultsCache[key];
  27030. if (cached) {
  27031. peg$currPos = cached.nextPos;
  27032. return cached.result;
  27033. }
  27034. s0 = peg$parsemethod();
  27035. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27036. return s0;
  27037. }
  27038. function peg$parseseparator() {
  27039. var s0, s1;
  27040. var key = peg$currPos * 62 + 1,
  27041. cached = peg$resultsCache[key];
  27042. if (cached) {
  27043. peg$currPos = cached.nextPos;
  27044. return cached.result;
  27045. }
  27046. s0 = [];
  27047. if (peg$c0.test(input.charAt(peg$currPos))) {
  27048. s1 = input.charAt(peg$currPos);
  27049. peg$currPos++;
  27050. } else {
  27051. s1 = peg$FAILED;
  27052. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27053. }
  27054. if (s1 !== peg$FAILED) {
  27055. while (s1 !== peg$FAILED) {
  27056. s0.push(s1);
  27057. if (peg$c0.test(input.charAt(peg$currPos))) {
  27058. s1 = input.charAt(peg$currPos);
  27059. peg$currPos++;
  27060. } else {
  27061. s1 = peg$FAILED;
  27062. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27063. }
  27064. }
  27065. } else {
  27066. s0 = peg$FAILED;
  27067. }
  27068. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27069. return s0;
  27070. }
  27071. function peg$parsecomments() {
  27072. var s0, s1, s2, s3, s4;
  27073. var key = peg$currPos * 62 + 2,
  27074. cached = peg$resultsCache[key];
  27075. if (cached) {
  27076. peg$currPos = cached.nextPos;
  27077. return cached.result;
  27078. }
  27079. s0 = [];
  27080. s1 = peg$currPos;
  27081. if (input.charCodeAt(peg$currPos) === 34) {
  27082. s2 = peg$c2;
  27083. peg$currPos++;
  27084. } else {
  27085. s2 = peg$FAILED;
  27086. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27087. }
  27088. if (s2 !== peg$FAILED) {
  27089. s3 = [];
  27090. if (peg$c4.test(input.charAt(peg$currPos))) {
  27091. s4 = input.charAt(peg$currPos);
  27092. peg$currPos++;
  27093. } else {
  27094. s4 = peg$FAILED;
  27095. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27096. }
  27097. while (s4 !== peg$FAILED) {
  27098. s3.push(s4);
  27099. if (peg$c4.test(input.charAt(peg$currPos))) {
  27100. s4 = input.charAt(peg$currPos);
  27101. peg$currPos++;
  27102. } else {
  27103. s4 = peg$FAILED;
  27104. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27105. }
  27106. }
  27107. if (s3 !== peg$FAILED) {
  27108. if (input.charCodeAt(peg$currPos) === 34) {
  27109. s4 = peg$c2;
  27110. peg$currPos++;
  27111. } else {
  27112. s4 = peg$FAILED;
  27113. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27114. }
  27115. if (s4 !== peg$FAILED) {
  27116. s2 = [s2, s3, s4];
  27117. s1 = s2;
  27118. } else {
  27119. peg$currPos = s1;
  27120. s1 = peg$FAILED;
  27121. }
  27122. } else {
  27123. peg$currPos = s1;
  27124. s1 = peg$FAILED;
  27125. }
  27126. } else {
  27127. peg$currPos = s1;
  27128. s1 = peg$FAILED;
  27129. }
  27130. if (s1 !== peg$FAILED) {
  27131. while (s1 !== peg$FAILED) {
  27132. s0.push(s1);
  27133. s1 = peg$currPos;
  27134. if (input.charCodeAt(peg$currPos) === 34) {
  27135. s2 = peg$c2;
  27136. peg$currPos++;
  27137. } else {
  27138. s2 = peg$FAILED;
  27139. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27140. }
  27141. if (s2 !== peg$FAILED) {
  27142. s3 = [];
  27143. if (peg$c4.test(input.charAt(peg$currPos))) {
  27144. s4 = input.charAt(peg$currPos);
  27145. peg$currPos++;
  27146. } else {
  27147. s4 = peg$FAILED;
  27148. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27149. }
  27150. while (s4 !== peg$FAILED) {
  27151. s3.push(s4);
  27152. if (peg$c4.test(input.charAt(peg$currPos))) {
  27153. s4 = input.charAt(peg$currPos);
  27154. peg$currPos++;
  27155. } else {
  27156. s4 = peg$FAILED;
  27157. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27158. }
  27159. }
  27160. if (s3 !== peg$FAILED) {
  27161. if (input.charCodeAt(peg$currPos) === 34) {
  27162. s4 = peg$c2;
  27163. peg$currPos++;
  27164. } else {
  27165. s4 = peg$FAILED;
  27166. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27167. }
  27168. if (s4 !== peg$FAILED) {
  27169. s2 = [s2, s3, s4];
  27170. s1 = s2;
  27171. } else {
  27172. peg$currPos = s1;
  27173. s1 = peg$FAILED;
  27174. }
  27175. } else {
  27176. peg$currPos = s1;
  27177. s1 = peg$FAILED;
  27178. }
  27179. } else {
  27180. peg$currPos = s1;
  27181. s1 = peg$FAILED;
  27182. }
  27183. }
  27184. } else {
  27185. s0 = peg$FAILED;
  27186. }
  27187. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27188. return s0;
  27189. }
  27190. function peg$parsews() {
  27191. var s0, s1;
  27192. var key = peg$currPos * 62 + 3,
  27193. cached = peg$resultsCache[key];
  27194. if (cached) {
  27195. peg$currPos = cached.nextPos;
  27196. return cached.result;
  27197. }
  27198. s0 = [];
  27199. s1 = peg$parseseparator();
  27200. if (s1 === peg$FAILED) {
  27201. s1 = peg$parsecomments();
  27202. }
  27203. while (s1 !== peg$FAILED) {
  27204. s0.push(s1);
  27205. s1 = peg$parseseparator();
  27206. if (s1 === peg$FAILED) {
  27207. s1 = peg$parsecomments();
  27208. }
  27209. }
  27210. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27211. return s0;
  27212. }
  27213. function peg$parsemaybeDotsWs() {
  27214. var s0, s1;
  27215. var key = peg$currPos * 62 + 4,
  27216. cached = peg$resultsCache[key];
  27217. if (cached) {
  27218. peg$currPos = cached.nextPos;
  27219. return cached.result;
  27220. }
  27221. s0 = [];
  27222. if (input.charCodeAt(peg$currPos) === 46) {
  27223. s1 = peg$c6;
  27224. peg$currPos++;
  27225. } else {
  27226. s1 = peg$FAILED;
  27227. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27228. }
  27229. if (s1 === peg$FAILED) {
  27230. s1 = peg$parseseparator();
  27231. if (s1 === peg$FAILED) {
  27232. s1 = peg$parsecomments();
  27233. }
  27234. }
  27235. while (s1 !== peg$FAILED) {
  27236. s0.push(s1);
  27237. if (input.charCodeAt(peg$currPos) === 46) {
  27238. s1 = peg$c6;
  27239. peg$currPos++;
  27240. } else {
  27241. s1 = peg$FAILED;
  27242. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27243. }
  27244. if (s1 === peg$FAILED) {
  27245. s1 = peg$parseseparator();
  27246. if (s1 === peg$FAILED) {
  27247. s1 = peg$parsecomments();
  27248. }
  27249. }
  27250. }
  27251. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27252. return s0;
  27253. }
  27254. function peg$parseidentifier() {
  27255. var s0, s1, s2, s3, s4;
  27256. var key = peg$currPos * 62 + 5,
  27257. cached = peg$resultsCache[key];
  27258. if (cached) {
  27259. peg$currPos = cached.nextPos;
  27260. return cached.result;
  27261. }
  27262. s0 = peg$currPos;
  27263. s1 = peg$currPos;
  27264. if (peg$c8.test(input.charAt(peg$currPos))) {
  27265. s2 = input.charAt(peg$currPos);
  27266. peg$currPos++;
  27267. } else {
  27268. s2 = peg$FAILED;
  27269. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  27270. }
  27271. if (s2 !== peg$FAILED) {
  27272. s3 = [];
  27273. if (peg$c10.test(input.charAt(peg$currPos))) {
  27274. s4 = input.charAt(peg$currPos);
  27275. peg$currPos++;
  27276. } else {
  27277. s4 = peg$FAILED;
  27278. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27279. }
  27280. while (s4 !== peg$FAILED) {
  27281. s3.push(s4);
  27282. if (peg$c10.test(input.charAt(peg$currPos))) {
  27283. s4 = input.charAt(peg$currPos);
  27284. peg$currPos++;
  27285. } else {
  27286. s4 = peg$FAILED;
  27287. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27288. }
  27289. }
  27290. if (s3 !== peg$FAILED) {
  27291. s2 = [s2, s3];
  27292. s1 = s2;
  27293. } else {
  27294. peg$currPos = s1;
  27295. s1 = peg$FAILED;
  27296. }
  27297. } else {
  27298. peg$currPos = s1;
  27299. s1 = peg$FAILED;
  27300. }
  27301. if (s1 !== peg$FAILED) {
  27302. s0 = input.substring(s0, peg$currPos);
  27303. } else {
  27304. s0 = s1;
  27305. }
  27306. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27307. return s0;
  27308. }
  27309. function peg$parsekeyword() {
  27310. var s0, s1, s2, s3;
  27311. var key = peg$currPos * 62 + 6,
  27312. cached = peg$resultsCache[key];
  27313. if (cached) {
  27314. peg$currPos = cached.nextPos;
  27315. return cached.result;
  27316. }
  27317. s0 = peg$currPos;
  27318. s1 = peg$currPos;
  27319. s2 = peg$parseidentifier();
  27320. if (s2 !== peg$FAILED) {
  27321. if (input.charCodeAt(peg$currPos) === 58) {
  27322. s3 = peg$c12;
  27323. peg$currPos++;
  27324. } else {
  27325. s3 = peg$FAILED;
  27326. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27327. }
  27328. if (s3 !== peg$FAILED) {
  27329. s2 = [s2, s3];
  27330. s1 = s2;
  27331. } else {
  27332. peg$currPos = s1;
  27333. s1 = peg$FAILED;
  27334. }
  27335. } else {
  27336. peg$currPos = s1;
  27337. s1 = peg$FAILED;
  27338. }
  27339. if (s1 !== peg$FAILED) {
  27340. s0 = input.substring(s0, peg$currPos);
  27341. } else {
  27342. s0 = s1;
  27343. }
  27344. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27345. return s0;
  27346. }
  27347. function peg$parseclassName() {
  27348. var s0, s1, s2, s3, s4;
  27349. var key = peg$currPos * 62 + 7,
  27350. cached = peg$resultsCache[key];
  27351. if (cached) {
  27352. peg$currPos = cached.nextPos;
  27353. return cached.result;
  27354. }
  27355. s0 = peg$currPos;
  27356. s1 = peg$currPos;
  27357. if (peg$c14.test(input.charAt(peg$currPos))) {
  27358. s2 = input.charAt(peg$currPos);
  27359. peg$currPos++;
  27360. } else {
  27361. s2 = peg$FAILED;
  27362. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  27363. }
  27364. if (s2 !== peg$FAILED) {
  27365. s3 = [];
  27366. if (peg$c10.test(input.charAt(peg$currPos))) {
  27367. s4 = input.charAt(peg$currPos);
  27368. peg$currPos++;
  27369. } else {
  27370. s4 = peg$FAILED;
  27371. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27372. }
  27373. while (s4 !== peg$FAILED) {
  27374. s3.push(s4);
  27375. if (peg$c10.test(input.charAt(peg$currPos))) {
  27376. s4 = input.charAt(peg$currPos);
  27377. peg$currPos++;
  27378. } else {
  27379. s4 = peg$FAILED;
  27380. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27381. }
  27382. }
  27383. if (s3 !== peg$FAILED) {
  27384. s2 = [s2, s3];
  27385. s1 = s2;
  27386. } else {
  27387. peg$currPos = s1;
  27388. s1 = peg$FAILED;
  27389. }
  27390. } else {
  27391. peg$currPos = s1;
  27392. s1 = peg$FAILED;
  27393. }
  27394. if (s1 !== peg$FAILED) {
  27395. s0 = input.substring(s0, peg$currPos);
  27396. } else {
  27397. s0 = s1;
  27398. }
  27399. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27400. return s0;
  27401. }
  27402. function peg$parsestring() {
  27403. var s0, s1;
  27404. var key = peg$currPos * 62 + 8,
  27405. cached = peg$resultsCache[key];
  27406. if (cached) {
  27407. peg$currPos = cached.nextPos;
  27408. return cached.result;
  27409. }
  27410. s0 = peg$currPos;
  27411. s1 = peg$parserawString();
  27412. if (s1 !== peg$FAILED) {
  27413. peg$savedPos = s0;
  27414. s1 = peg$c16(s1);
  27415. }
  27416. s0 = s1;
  27417. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27418. return s0;
  27419. }
  27420. function peg$parserawString() {
  27421. var s0, s1, s2, s3, s4;
  27422. var key = peg$currPos * 62 + 9,
  27423. cached = peg$resultsCache[key];
  27424. if (cached) {
  27425. peg$currPos = cached.nextPos;
  27426. return cached.result;
  27427. }
  27428. s0 = peg$currPos;
  27429. if (input.charCodeAt(peg$currPos) === 39) {
  27430. s1 = peg$c17;
  27431. peg$currPos++;
  27432. } else {
  27433. s1 = peg$FAILED;
  27434. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27435. }
  27436. if (s1 !== peg$FAILED) {
  27437. s2 = [];
  27438. s3 = peg$currPos;
  27439. if (input.substr(peg$currPos, 2) === peg$c19) {
  27440. s4 = peg$c19;
  27441. peg$currPos += 2;
  27442. } else {
  27443. s4 = peg$FAILED;
  27444. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27445. }
  27446. if (s4 !== peg$FAILED) {
  27447. peg$savedPos = s3;
  27448. s4 = peg$c21();
  27449. }
  27450. s3 = s4;
  27451. if (s3 === peg$FAILED) {
  27452. if (peg$c22.test(input.charAt(peg$currPos))) {
  27453. s3 = input.charAt(peg$currPos);
  27454. peg$currPos++;
  27455. } else {
  27456. s3 = peg$FAILED;
  27457. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27458. }
  27459. }
  27460. while (s3 !== peg$FAILED) {
  27461. s2.push(s3);
  27462. s3 = peg$currPos;
  27463. if (input.substr(peg$currPos, 2) === peg$c19) {
  27464. s4 = peg$c19;
  27465. peg$currPos += 2;
  27466. } else {
  27467. s4 = peg$FAILED;
  27468. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27469. }
  27470. if (s4 !== peg$FAILED) {
  27471. peg$savedPos = s3;
  27472. s4 = peg$c21();
  27473. }
  27474. s3 = s4;
  27475. if (s3 === peg$FAILED) {
  27476. if (peg$c22.test(input.charAt(peg$currPos))) {
  27477. s3 = input.charAt(peg$currPos);
  27478. peg$currPos++;
  27479. } else {
  27480. s3 = peg$FAILED;
  27481. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27482. }
  27483. }
  27484. }
  27485. if (s2 !== peg$FAILED) {
  27486. if (input.charCodeAt(peg$currPos) === 39) {
  27487. s3 = peg$c17;
  27488. peg$currPos++;
  27489. } else {
  27490. s3 = peg$FAILED;
  27491. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27492. }
  27493. if (s3 !== peg$FAILED) {
  27494. peg$savedPos = s0;
  27495. s1 = peg$c24(s2);
  27496. s0 = s1;
  27497. } else {
  27498. peg$currPos = s0;
  27499. s0 = peg$FAILED;
  27500. }
  27501. } else {
  27502. peg$currPos = s0;
  27503. s0 = peg$FAILED;
  27504. }
  27505. } else {
  27506. peg$currPos = s0;
  27507. s0 = peg$FAILED;
  27508. }
  27509. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27510. return s0;
  27511. }
  27512. function peg$parsecharacter() {
  27513. var s0, s1, s2;
  27514. var key = peg$currPos * 62 + 10,
  27515. cached = peg$resultsCache[key];
  27516. if (cached) {
  27517. peg$currPos = cached.nextPos;
  27518. return cached.result;
  27519. }
  27520. s0 = peg$currPos;
  27521. if (input.charCodeAt(peg$currPos) === 36) {
  27522. s1 = peg$c25;
  27523. peg$currPos++;
  27524. } else {
  27525. s1 = peg$FAILED;
  27526. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  27527. }
  27528. if (s1 !== peg$FAILED) {
  27529. if (input.length > peg$currPos) {
  27530. s2 = input.charAt(peg$currPos);
  27531. peg$currPos++;
  27532. } else {
  27533. s2 = peg$FAILED;
  27534. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  27535. }
  27536. if (s2 !== peg$FAILED) {
  27537. peg$savedPos = s0;
  27538. s1 = peg$c28(s2);
  27539. s0 = s1;
  27540. } else {
  27541. peg$currPos = s0;
  27542. s0 = peg$FAILED;
  27543. }
  27544. } else {
  27545. peg$currPos = s0;
  27546. s0 = peg$FAILED;
  27547. }
  27548. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27549. return s0;
  27550. }
  27551. function peg$parsesymbol() {
  27552. var s0, s1, s2;
  27553. var key = peg$currPos * 62 + 11,
  27554. cached = peg$resultsCache[key];
  27555. if (cached) {
  27556. peg$currPos = cached.nextPos;
  27557. return cached.result;
  27558. }
  27559. s0 = peg$currPos;
  27560. if (input.charCodeAt(peg$currPos) === 35) {
  27561. s1 = peg$c29;
  27562. peg$currPos++;
  27563. } else {
  27564. s1 = peg$FAILED;
  27565. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  27566. }
  27567. if (s1 !== peg$FAILED) {
  27568. s2 = peg$parsebareSymbol();
  27569. if (s2 !== peg$FAILED) {
  27570. peg$savedPos = s0;
  27571. s1 = peg$c31(s2);
  27572. s0 = s1;
  27573. } else {
  27574. peg$currPos = s0;
  27575. s0 = peg$FAILED;
  27576. }
  27577. } else {
  27578. peg$currPos = s0;
  27579. s0 = peg$FAILED;
  27580. }
  27581. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27582. return s0;
  27583. }
  27584. function peg$parsebareSymbol() {
  27585. var s0, s1, s2, s3;
  27586. var key = peg$currPos * 62 + 12,
  27587. cached = peg$resultsCache[key];
  27588. if (cached) {
  27589. peg$currPos = cached.nextPos;
  27590. return cached.result;
  27591. }
  27592. s0 = peg$currPos;
  27593. s1 = peg$currPos;
  27594. s2 = [];
  27595. s3 = peg$parsekeyword();
  27596. if (s3 !== peg$FAILED) {
  27597. while (s3 !== peg$FAILED) {
  27598. s2.push(s3);
  27599. s3 = peg$parsekeyword();
  27600. }
  27601. } else {
  27602. s2 = peg$FAILED;
  27603. }
  27604. if (s2 !== peg$FAILED) {
  27605. s1 = input.substring(s1, peg$currPos);
  27606. } else {
  27607. s1 = s2;
  27608. }
  27609. if (s1 === peg$FAILED) {
  27610. s1 = peg$parsebinarySelector();
  27611. if (s1 === peg$FAILED) {
  27612. s1 = peg$parseidentifier();
  27613. if (s1 === peg$FAILED) {
  27614. s1 = peg$parserawString();
  27615. }
  27616. }
  27617. }
  27618. if (s1 !== peg$FAILED) {
  27619. peg$savedPos = s0;
  27620. s1 = peg$c16(s1);
  27621. }
  27622. s0 = s1;
  27623. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27624. return s0;
  27625. }
  27626. function peg$parsenumber() {
  27627. var s0, s1;
  27628. var key = peg$currPos * 62 + 13,
  27629. cached = peg$resultsCache[key];
  27630. if (cached) {
  27631. peg$currPos = cached.nextPos;
  27632. return cached.result;
  27633. }
  27634. s0 = peg$currPos;
  27635. s1 = peg$parserawNumber();
  27636. if (s1 !== peg$FAILED) {
  27637. peg$savedPos = s0;
  27638. s1 = peg$c16(s1);
  27639. }
  27640. s0 = s1;
  27641. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27642. return s0;
  27643. }
  27644. function peg$parserawNumber() {
  27645. var s0;
  27646. var key = peg$currPos * 62 + 14,
  27647. cached = peg$resultsCache[key];
  27648. if (cached) {
  27649. peg$currPos = cached.nextPos;
  27650. return cached.result;
  27651. }
  27652. s0 = peg$parsenumberExp();
  27653. if (s0 === peg$FAILED) {
  27654. s0 = peg$parsehex();
  27655. if (s0 === peg$FAILED) {
  27656. s0 = peg$parsefloat();
  27657. if (s0 === peg$FAILED) {
  27658. s0 = peg$parseinteger();
  27659. }
  27660. }
  27661. }
  27662. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27663. return s0;
  27664. }
  27665. function peg$parsenumberExp() {
  27666. var s0, s1, s2, s3, s4, s5;
  27667. var key = peg$currPos * 62 + 15,
  27668. cached = peg$resultsCache[key];
  27669. if (cached) {
  27670. peg$currPos = cached.nextPos;
  27671. return cached.result;
  27672. }
  27673. s0 = peg$currPos;
  27674. s1 = peg$currPos;
  27675. s2 = peg$currPos;
  27676. s3 = peg$parsefloat();
  27677. if (s3 === peg$FAILED) {
  27678. s3 = peg$parseinteger();
  27679. }
  27680. if (s3 !== peg$FAILED) {
  27681. if (input.charCodeAt(peg$currPos) === 101) {
  27682. s4 = peg$c32;
  27683. peg$currPos++;
  27684. } else {
  27685. s4 = peg$FAILED;
  27686. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  27687. }
  27688. if (s4 !== peg$FAILED) {
  27689. s5 = peg$parseinteger();
  27690. if (s5 !== peg$FAILED) {
  27691. s3 = [s3, s4, s5];
  27692. s2 = s3;
  27693. } else {
  27694. peg$currPos = s2;
  27695. s2 = peg$FAILED;
  27696. }
  27697. } else {
  27698. peg$currPos = s2;
  27699. s2 = peg$FAILED;
  27700. }
  27701. } else {
  27702. peg$currPos = s2;
  27703. s2 = peg$FAILED;
  27704. }
  27705. if (s2 !== peg$FAILED) {
  27706. s1 = input.substring(s1, peg$currPos);
  27707. } else {
  27708. s1 = s2;
  27709. }
  27710. if (s1 !== peg$FAILED) {
  27711. peg$savedPos = s0;
  27712. s1 = peg$c34(s1);
  27713. }
  27714. s0 = s1;
  27715. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27716. return s0;
  27717. }
  27718. function peg$parsehex() {
  27719. var s0, s1, s2, s3, s4, s5;
  27720. var key = peg$currPos * 62 + 16,
  27721. cached = peg$resultsCache[key];
  27722. if (cached) {
  27723. peg$currPos = cached.nextPos;
  27724. return cached.result;
  27725. }
  27726. s0 = peg$currPos;
  27727. if (input.charCodeAt(peg$currPos) === 45) {
  27728. s1 = peg$c35;
  27729. peg$currPos++;
  27730. } else {
  27731. s1 = peg$FAILED;
  27732. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27733. }
  27734. if (s1 === peg$FAILED) {
  27735. s1 = null;
  27736. }
  27737. if (s1 !== peg$FAILED) {
  27738. if (input.substr(peg$currPos, 3) === peg$c37) {
  27739. s2 = peg$c37;
  27740. peg$currPos += 3;
  27741. } else {
  27742. s2 = peg$FAILED;
  27743. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  27744. }
  27745. if (s2 !== peg$FAILED) {
  27746. s3 = peg$currPos;
  27747. s4 = [];
  27748. if (peg$c39.test(input.charAt(peg$currPos))) {
  27749. s5 = input.charAt(peg$currPos);
  27750. peg$currPos++;
  27751. } else {
  27752. s5 = peg$FAILED;
  27753. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27754. }
  27755. if (s5 !== peg$FAILED) {
  27756. while (s5 !== peg$FAILED) {
  27757. s4.push(s5);
  27758. if (peg$c39.test(input.charAt(peg$currPos))) {
  27759. s5 = input.charAt(peg$currPos);
  27760. peg$currPos++;
  27761. } else {
  27762. s5 = peg$FAILED;
  27763. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27764. }
  27765. }
  27766. } else {
  27767. s4 = peg$FAILED;
  27768. }
  27769. if (s4 !== peg$FAILED) {
  27770. s3 = input.substring(s3, peg$currPos);
  27771. } else {
  27772. s3 = s4;
  27773. }
  27774. if (s3 !== peg$FAILED) {
  27775. peg$savedPos = s0;
  27776. s1 = peg$c41(s1, s3);
  27777. s0 = s1;
  27778. } else {
  27779. peg$currPos = s0;
  27780. s0 = peg$FAILED;
  27781. }
  27782. } else {
  27783. peg$currPos = s0;
  27784. s0 = peg$FAILED;
  27785. }
  27786. } else {
  27787. peg$currPos = s0;
  27788. s0 = peg$FAILED;
  27789. }
  27790. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27791. return s0;
  27792. }
  27793. function peg$parsefloat() {
  27794. var s0, s1, s2, s3, s4, s5, s6, s7;
  27795. var key = peg$currPos * 62 + 17,
  27796. cached = peg$resultsCache[key];
  27797. if (cached) {
  27798. peg$currPos = cached.nextPos;
  27799. return cached.result;
  27800. }
  27801. s0 = peg$currPos;
  27802. s1 = peg$currPos;
  27803. s2 = peg$currPos;
  27804. if (input.charCodeAt(peg$currPos) === 45) {
  27805. s3 = peg$c35;
  27806. peg$currPos++;
  27807. } else {
  27808. s3 = peg$FAILED;
  27809. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27810. }
  27811. if (s3 === peg$FAILED) {
  27812. s3 = null;
  27813. }
  27814. if (s3 !== peg$FAILED) {
  27815. s4 = [];
  27816. if (peg$c42.test(input.charAt(peg$currPos))) {
  27817. s5 = input.charAt(peg$currPos);
  27818. peg$currPos++;
  27819. } else {
  27820. s5 = peg$FAILED;
  27821. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27822. }
  27823. if (s5 !== peg$FAILED) {
  27824. while (s5 !== peg$FAILED) {
  27825. s4.push(s5);
  27826. if (peg$c42.test(input.charAt(peg$currPos))) {
  27827. s5 = input.charAt(peg$currPos);
  27828. peg$currPos++;
  27829. } else {
  27830. s5 = peg$FAILED;
  27831. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27832. }
  27833. }
  27834. } else {
  27835. s4 = peg$FAILED;
  27836. }
  27837. if (s4 !== peg$FAILED) {
  27838. if (input.charCodeAt(peg$currPos) === 46) {
  27839. s5 = peg$c6;
  27840. peg$currPos++;
  27841. } else {
  27842. s5 = peg$FAILED;
  27843. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27844. }
  27845. if (s5 !== peg$FAILED) {
  27846. s6 = [];
  27847. if (peg$c42.test(input.charAt(peg$currPos))) {
  27848. s7 = input.charAt(peg$currPos);
  27849. peg$currPos++;
  27850. } else {
  27851. s7 = peg$FAILED;
  27852. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27853. }
  27854. if (s7 !== peg$FAILED) {
  27855. while (s7 !== peg$FAILED) {
  27856. s6.push(s7);
  27857. if (peg$c42.test(input.charAt(peg$currPos))) {
  27858. s7 = input.charAt(peg$currPos);
  27859. peg$currPos++;
  27860. } else {
  27861. s7 = peg$FAILED;
  27862. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27863. }
  27864. }
  27865. } else {
  27866. s6 = peg$FAILED;
  27867. }
  27868. if (s6 !== peg$FAILED) {
  27869. s3 = [s3, s4, s5, s6];
  27870. s2 = s3;
  27871. } else {
  27872. peg$currPos = s2;
  27873. s2 = peg$FAILED;
  27874. }
  27875. } else {
  27876. peg$currPos = s2;
  27877. s2 = peg$FAILED;
  27878. }
  27879. } else {
  27880. peg$currPos = s2;
  27881. s2 = peg$FAILED;
  27882. }
  27883. } else {
  27884. peg$currPos = s2;
  27885. s2 = peg$FAILED;
  27886. }
  27887. if (s2 !== peg$FAILED) {
  27888. s1 = input.substring(s1, peg$currPos);
  27889. } else {
  27890. s1 = s2;
  27891. }
  27892. if (s1 !== peg$FAILED) {
  27893. peg$savedPos = s0;
  27894. s1 = peg$c44(s1);
  27895. }
  27896. s0 = s1;
  27897. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27898. return s0;
  27899. }
  27900. function peg$parseinteger() {
  27901. var s0, s1, s2, s3, s4, s5;
  27902. var key = peg$currPos * 62 + 18,
  27903. cached = peg$resultsCache[key];
  27904. if (cached) {
  27905. peg$currPos = cached.nextPos;
  27906. return cached.result;
  27907. }
  27908. s0 = peg$currPos;
  27909. s1 = peg$currPos;
  27910. s2 = peg$currPos;
  27911. if (input.charCodeAt(peg$currPos) === 45) {
  27912. s3 = peg$c35;
  27913. peg$currPos++;
  27914. } else {
  27915. s3 = peg$FAILED;
  27916. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27917. }
  27918. if (s3 === peg$FAILED) {
  27919. s3 = null;
  27920. }
  27921. if (s3 !== peg$FAILED) {
  27922. s4 = [];
  27923. if (peg$c42.test(input.charAt(peg$currPos))) {
  27924. s5 = input.charAt(peg$currPos);
  27925. peg$currPos++;
  27926. } else {
  27927. s5 = peg$FAILED;
  27928. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27929. }
  27930. if (s5 !== peg$FAILED) {
  27931. while (s5 !== peg$FAILED) {
  27932. s4.push(s5);
  27933. if (peg$c42.test(input.charAt(peg$currPos))) {
  27934. s5 = input.charAt(peg$currPos);
  27935. peg$currPos++;
  27936. } else {
  27937. s5 = peg$FAILED;
  27938. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27939. }
  27940. }
  27941. } else {
  27942. s4 = peg$FAILED;
  27943. }
  27944. if (s4 !== peg$FAILED) {
  27945. s3 = [s3, s4];
  27946. s2 = s3;
  27947. } else {
  27948. peg$currPos = s2;
  27949. s2 = peg$FAILED;
  27950. }
  27951. } else {
  27952. peg$currPos = s2;
  27953. s2 = peg$FAILED;
  27954. }
  27955. if (s2 !== peg$FAILED) {
  27956. s1 = input.substring(s1, peg$currPos);
  27957. } else {
  27958. s1 = s2;
  27959. }
  27960. if (s1 !== peg$FAILED) {
  27961. peg$savedPos = s0;
  27962. s1 = peg$c45(s1);
  27963. }
  27964. s0 = s1;
  27965. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27966. return s0;
  27967. }
  27968. function peg$parseliteralArray() {
  27969. var s0, s1, s2, s3, s4;
  27970. var key = peg$currPos * 62 + 19,
  27971. cached = peg$resultsCache[key];
  27972. if (cached) {
  27973. peg$currPos = cached.nextPos;
  27974. return cached.result;
  27975. }
  27976. s0 = peg$currPos;
  27977. if (input.substr(peg$currPos, 2) === peg$c46) {
  27978. s1 = peg$c46;
  27979. peg$currPos += 2;
  27980. } else {
  27981. s1 = peg$FAILED;
  27982. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  27983. }
  27984. if (s1 !== peg$FAILED) {
  27985. s2 = peg$parsewsLiteralArrayContents();
  27986. if (s2 !== peg$FAILED) {
  27987. s3 = peg$parsews();
  27988. if (s3 !== peg$FAILED) {
  27989. if (input.charCodeAt(peg$currPos) === 41) {
  27990. s4 = peg$c48;
  27991. peg$currPos++;
  27992. } else {
  27993. s4 = peg$FAILED;
  27994. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  27995. }
  27996. if (s4 !== peg$FAILED) {
  27997. peg$savedPos = s0;
  27998. s1 = peg$c50(s2);
  27999. s0 = s1;
  28000. } else {
  28001. peg$currPos = s0;
  28002. s0 = peg$FAILED;
  28003. }
  28004. } else {
  28005. peg$currPos = s0;
  28006. s0 = peg$FAILED;
  28007. }
  28008. } else {
  28009. peg$currPos = s0;
  28010. s0 = peg$FAILED;
  28011. }
  28012. } else {
  28013. peg$currPos = s0;
  28014. s0 = peg$FAILED;
  28015. }
  28016. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28017. return s0;
  28018. }
  28019. function peg$parsebareLiteralArray() {
  28020. var s0, s1, s2, s3, s4;
  28021. var key = peg$currPos * 62 + 20,
  28022. cached = peg$resultsCache[key];
  28023. if (cached) {
  28024. peg$currPos = cached.nextPos;
  28025. return cached.result;
  28026. }
  28027. s0 = peg$currPos;
  28028. if (input.charCodeAt(peg$currPos) === 40) {
  28029. s1 = peg$c51;
  28030. peg$currPos++;
  28031. } else {
  28032. s1 = peg$FAILED;
  28033. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  28034. }
  28035. if (s1 !== peg$FAILED) {
  28036. s2 = peg$parsewsLiteralArrayContents();
  28037. if (s2 !== peg$FAILED) {
  28038. s3 = peg$parsews();
  28039. if (s3 !== peg$FAILED) {
  28040. if (input.charCodeAt(peg$currPos) === 41) {
  28041. s4 = peg$c48;
  28042. peg$currPos++;
  28043. } else {
  28044. s4 = peg$FAILED;
  28045. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28046. }
  28047. if (s4 !== peg$FAILED) {
  28048. peg$savedPos = s0;
  28049. s1 = peg$c50(s2);
  28050. s0 = s1;
  28051. } else {
  28052. peg$currPos = s0;
  28053. s0 = peg$FAILED;
  28054. }
  28055. } else {
  28056. peg$currPos = s0;
  28057. s0 = peg$FAILED;
  28058. }
  28059. } else {
  28060. peg$currPos = s0;
  28061. s0 = peg$FAILED;
  28062. }
  28063. } else {
  28064. peg$currPos = s0;
  28065. s0 = peg$FAILED;
  28066. }
  28067. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28068. return s0;
  28069. }
  28070. function peg$parseliteralArrayElement() {
  28071. var s0;
  28072. var key = peg$currPos * 62 + 21,
  28073. cached = peg$resultsCache[key];
  28074. if (cached) {
  28075. peg$currPos = cached.nextPos;
  28076. return cached.result;
  28077. }
  28078. s0 = peg$parseparseTimeLiteral();
  28079. if (s0 === peg$FAILED) {
  28080. s0 = peg$parsebareLiteralArray();
  28081. if (s0 === peg$FAILED) {
  28082. s0 = peg$parsebareSymbol();
  28083. }
  28084. }
  28085. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28086. return s0;
  28087. }
  28088. function peg$parsewsLiteralArrayContents() {
  28089. var s0, s1, s2, s3, s4;
  28090. var key = peg$currPos * 62 + 22,
  28091. cached = peg$resultsCache[key];
  28092. if (cached) {
  28093. peg$currPos = cached.nextPos;
  28094. return cached.result;
  28095. }
  28096. s0 = peg$currPos;
  28097. s1 = [];
  28098. s2 = peg$currPos;
  28099. s3 = peg$parsews();
  28100. if (s3 !== peg$FAILED) {
  28101. s4 = peg$parseliteralArrayElement();
  28102. if (s4 !== peg$FAILED) {
  28103. peg$savedPos = s2;
  28104. s3 = peg$c53(s4);
  28105. s2 = s3;
  28106. } else {
  28107. peg$currPos = s2;
  28108. s2 = peg$FAILED;
  28109. }
  28110. } else {
  28111. peg$currPos = s2;
  28112. s2 = peg$FAILED;
  28113. }
  28114. while (s2 !== peg$FAILED) {
  28115. s1.push(s2);
  28116. s2 = peg$currPos;
  28117. s3 = peg$parsews();
  28118. if (s3 !== peg$FAILED) {
  28119. s4 = peg$parseliteralArrayElement();
  28120. if (s4 !== peg$FAILED) {
  28121. peg$savedPos = s2;
  28122. s3 = peg$c53(s4);
  28123. s2 = s3;
  28124. } else {
  28125. peg$currPos = s2;
  28126. s2 = peg$FAILED;
  28127. }
  28128. } else {
  28129. peg$currPos = s2;
  28130. s2 = peg$FAILED;
  28131. }
  28132. }
  28133. if (s1 !== peg$FAILED) {
  28134. peg$savedPos = s0;
  28135. s1 = peg$c54(s1);
  28136. }
  28137. s0 = s1;
  28138. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28139. return s0;
  28140. }
  28141. function peg$parsedynamicArray() {
  28142. var s0, s1, s2, s3, s4;
  28143. var key = peg$currPos * 62 + 23,
  28144. cached = peg$resultsCache[key];
  28145. if (cached) {
  28146. peg$currPos = cached.nextPos;
  28147. return cached.result;
  28148. }
  28149. s0 = peg$currPos;
  28150. if (input.charCodeAt(peg$currPos) === 123) {
  28151. s1 = peg$c55;
  28152. peg$currPos++;
  28153. } else {
  28154. s1 = peg$FAILED;
  28155. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  28156. }
  28157. if (s1 !== peg$FAILED) {
  28158. s2 = peg$parsewsExpressions();
  28159. if (s2 === peg$FAILED) {
  28160. s2 = null;
  28161. }
  28162. if (s2 !== peg$FAILED) {
  28163. s3 = peg$parsemaybeDotsWs();
  28164. if (s3 !== peg$FAILED) {
  28165. if (input.charCodeAt(peg$currPos) === 125) {
  28166. s4 = peg$c57;
  28167. peg$currPos++;
  28168. } else {
  28169. s4 = peg$FAILED;
  28170. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28171. }
  28172. if (s4 !== peg$FAILED) {
  28173. peg$savedPos = s0;
  28174. s1 = peg$c59(s2);
  28175. s0 = s1;
  28176. } else {
  28177. peg$currPos = s0;
  28178. s0 = peg$FAILED;
  28179. }
  28180. } else {
  28181. peg$currPos = s0;
  28182. s0 = peg$FAILED;
  28183. }
  28184. } else {
  28185. peg$currPos = s0;
  28186. s0 = peg$FAILED;
  28187. }
  28188. } else {
  28189. peg$currPos = s0;
  28190. s0 = peg$FAILED;
  28191. }
  28192. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28193. return s0;
  28194. }
  28195. function peg$parsedynamicDictionary() {
  28196. var s0, s1, s2, s3, s4;
  28197. var key = peg$currPos * 62 + 24,
  28198. cached = peg$resultsCache[key];
  28199. if (cached) {
  28200. peg$currPos = cached.nextPos;
  28201. return cached.result;
  28202. }
  28203. s0 = peg$currPos;
  28204. if (input.substr(peg$currPos, 2) === peg$c60) {
  28205. s1 = peg$c60;
  28206. peg$currPos += 2;
  28207. } else {
  28208. s1 = peg$FAILED;
  28209. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  28210. }
  28211. if (s1 !== peg$FAILED) {
  28212. s2 = peg$parsewsAssociations();
  28213. if (s2 === peg$FAILED) {
  28214. s2 = null;
  28215. }
  28216. if (s2 !== peg$FAILED) {
  28217. s3 = peg$parsemaybeDotsWs();
  28218. if (s3 !== peg$FAILED) {
  28219. if (input.charCodeAt(peg$currPos) === 125) {
  28220. s4 = peg$c57;
  28221. peg$currPos++;
  28222. } else {
  28223. s4 = peg$FAILED;
  28224. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28225. }
  28226. if (s4 !== peg$FAILED) {
  28227. peg$savedPos = s0;
  28228. s1 = peg$c62(s2);
  28229. s0 = s1;
  28230. } else {
  28231. peg$currPos = s0;
  28232. s0 = peg$FAILED;
  28233. }
  28234. } else {
  28235. peg$currPos = s0;
  28236. s0 = peg$FAILED;
  28237. }
  28238. } else {
  28239. peg$currPos = s0;
  28240. s0 = peg$FAILED;
  28241. }
  28242. } else {
  28243. peg$currPos = s0;
  28244. s0 = peg$FAILED;
  28245. }
  28246. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28247. return s0;
  28248. }
  28249. function peg$parsepseudoVariable() {
  28250. var s0, s1, s2;
  28251. var key = peg$currPos * 62 + 25,
  28252. cached = peg$resultsCache[key];
  28253. if (cached) {
  28254. peg$currPos = cached.nextPos;
  28255. return cached.result;
  28256. }
  28257. s0 = peg$currPos;
  28258. s1 = peg$currPos;
  28259. if (input.substr(peg$currPos, 4) === peg$c63) {
  28260. s2 = peg$c63;
  28261. peg$currPos += 4;
  28262. } else {
  28263. s2 = peg$FAILED;
  28264. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  28265. }
  28266. if (s2 !== peg$FAILED) {
  28267. peg$savedPos = s1;
  28268. s2 = peg$c65();
  28269. }
  28270. s1 = s2;
  28271. if (s1 === peg$FAILED) {
  28272. s1 = peg$currPos;
  28273. if (input.substr(peg$currPos, 5) === peg$c66) {
  28274. s2 = peg$c66;
  28275. peg$currPos += 5;
  28276. } else {
  28277. s2 = peg$FAILED;
  28278. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  28279. }
  28280. if (s2 !== peg$FAILED) {
  28281. peg$savedPos = s1;
  28282. s2 = peg$c68();
  28283. }
  28284. s1 = s2;
  28285. if (s1 === peg$FAILED) {
  28286. s1 = peg$currPos;
  28287. if (input.substr(peg$currPos, 3) === peg$c69) {
  28288. s2 = peg$c69;
  28289. peg$currPos += 3;
  28290. } else {
  28291. s2 = peg$FAILED;
  28292. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  28293. }
  28294. if (s2 !== peg$FAILED) {
  28295. peg$savedPos = s1;
  28296. s2 = peg$c71();
  28297. }
  28298. s1 = s2;
  28299. }
  28300. }
  28301. if (s1 !== peg$FAILED) {
  28302. peg$savedPos = s0;
  28303. s1 = peg$c16(s1);
  28304. }
  28305. s0 = s1;
  28306. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28307. return s0;
  28308. }
  28309. function peg$parseparseTimeLiteral() {
  28310. var s0;
  28311. var key = peg$currPos * 62 + 26,
  28312. cached = peg$resultsCache[key];
  28313. if (cached) {
  28314. peg$currPos = cached.nextPos;
  28315. return cached.result;
  28316. }
  28317. s0 = peg$parsepseudoVariable();
  28318. if (s0 === peg$FAILED) {
  28319. s0 = peg$parsenumber();
  28320. if (s0 === peg$FAILED) {
  28321. s0 = peg$parseliteralArray();
  28322. if (s0 === peg$FAILED) {
  28323. s0 = peg$parsestring();
  28324. if (s0 === peg$FAILED) {
  28325. s0 = peg$parsesymbol();
  28326. if (s0 === peg$FAILED) {
  28327. s0 = peg$parsecharacter();
  28328. }
  28329. }
  28330. }
  28331. }
  28332. }
  28333. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28334. return s0;
  28335. }
  28336. function peg$parseruntimeLiteral() {
  28337. var s0;
  28338. var key = peg$currPos * 62 + 27,
  28339. cached = peg$resultsCache[key];
  28340. if (cached) {
  28341. peg$currPos = cached.nextPos;
  28342. return cached.result;
  28343. }
  28344. s0 = peg$parsedynamicDictionary();
  28345. if (s0 === peg$FAILED) {
  28346. s0 = peg$parsedynamicArray();
  28347. if (s0 === peg$FAILED) {
  28348. s0 = peg$parseblock();
  28349. }
  28350. }
  28351. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28352. return s0;
  28353. }
  28354. function peg$parseliteral() {
  28355. var s0;
  28356. var key = peg$currPos * 62 + 28,
  28357. cached = peg$resultsCache[key];
  28358. if (cached) {
  28359. peg$currPos = cached.nextPos;
  28360. return cached.result;
  28361. }
  28362. s0 = peg$parseruntimeLiteral();
  28363. if (s0 === peg$FAILED) {
  28364. s0 = peg$parseparseTimeLiteral();
  28365. }
  28366. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28367. return s0;
  28368. }
  28369. function peg$parsevariable() {
  28370. var s0, s1;
  28371. var key = peg$currPos * 62 + 29,
  28372. cached = peg$resultsCache[key];
  28373. if (cached) {
  28374. peg$currPos = cached.nextPos;
  28375. return cached.result;
  28376. }
  28377. s0 = peg$currPos;
  28378. s1 = peg$parseidentifier();
  28379. if (s1 !== peg$FAILED) {
  28380. peg$savedPos = s0;
  28381. s1 = peg$c72(s1);
  28382. }
  28383. s0 = s1;
  28384. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28385. return s0;
  28386. }
  28387. function peg$parsebinarySelector() {
  28388. var s0, s1, s2;
  28389. var key = peg$currPos * 62 + 30,
  28390. cached = peg$resultsCache[key];
  28391. if (cached) {
  28392. peg$currPos = cached.nextPos;
  28393. return cached.result;
  28394. }
  28395. s0 = peg$currPos;
  28396. s1 = [];
  28397. if (peg$c73.test(input.charAt(peg$currPos))) {
  28398. s2 = input.charAt(peg$currPos);
  28399. peg$currPos++;
  28400. } else {
  28401. s2 = peg$FAILED;
  28402. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28403. }
  28404. if (s2 !== peg$FAILED) {
  28405. while (s2 !== peg$FAILED) {
  28406. s1.push(s2);
  28407. if (peg$c73.test(input.charAt(peg$currPos))) {
  28408. s2 = input.charAt(peg$currPos);
  28409. peg$currPos++;
  28410. } else {
  28411. s2 = peg$FAILED;
  28412. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28413. }
  28414. }
  28415. } else {
  28416. s1 = peg$FAILED;
  28417. }
  28418. if (s1 !== peg$FAILED) {
  28419. s0 = input.substring(s0, peg$currPos);
  28420. } else {
  28421. s0 = s1;
  28422. }
  28423. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28424. return s0;
  28425. }
  28426. function peg$parsewsKeywordPattern() {
  28427. var s0, s1, s2, s3, s4, s5, s6;
  28428. var key = peg$currPos * 62 + 31,
  28429. cached = peg$resultsCache[key];
  28430. if (cached) {
  28431. peg$currPos = cached.nextPos;
  28432. return cached.result;
  28433. }
  28434. s0 = peg$currPos;
  28435. s1 = [];
  28436. s2 = peg$currPos;
  28437. s3 = peg$parsews();
  28438. if (s3 !== peg$FAILED) {
  28439. s4 = peg$parsekeyword();
  28440. if (s4 !== peg$FAILED) {
  28441. s5 = peg$parsews();
  28442. if (s5 !== peg$FAILED) {
  28443. s6 = peg$parseidentifier();
  28444. if (s6 !== peg$FAILED) {
  28445. peg$savedPos = s2;
  28446. s3 = peg$c75(s4, s6);
  28447. s2 = s3;
  28448. } else {
  28449. peg$currPos = s2;
  28450. s2 = peg$FAILED;
  28451. }
  28452. } else {
  28453. peg$currPos = s2;
  28454. s2 = peg$FAILED;
  28455. }
  28456. } else {
  28457. peg$currPos = s2;
  28458. s2 = peg$FAILED;
  28459. }
  28460. } else {
  28461. peg$currPos = s2;
  28462. s2 = peg$FAILED;
  28463. }
  28464. if (s2 !== peg$FAILED) {
  28465. while (s2 !== peg$FAILED) {
  28466. s1.push(s2);
  28467. s2 = peg$currPos;
  28468. s3 = peg$parsews();
  28469. if (s3 !== peg$FAILED) {
  28470. s4 = peg$parsekeyword();
  28471. if (s4 !== peg$FAILED) {
  28472. s5 = peg$parsews();
  28473. if (s5 !== peg$FAILED) {
  28474. s6 = peg$parseidentifier();
  28475. if (s6 !== peg$FAILED) {
  28476. peg$savedPos = s2;
  28477. s3 = peg$c75(s4, s6);
  28478. s2 = s3;
  28479. } else {
  28480. peg$currPos = s2;
  28481. s2 = peg$FAILED;
  28482. }
  28483. } else {
  28484. peg$currPos = s2;
  28485. s2 = peg$FAILED;
  28486. }
  28487. } else {
  28488. peg$currPos = s2;
  28489. s2 = peg$FAILED;
  28490. }
  28491. } else {
  28492. peg$currPos = s2;
  28493. s2 = peg$FAILED;
  28494. }
  28495. }
  28496. } else {
  28497. s1 = peg$FAILED;
  28498. }
  28499. if (s1 !== peg$FAILED) {
  28500. peg$savedPos = s0;
  28501. s1 = peg$c76(s1);
  28502. }
  28503. s0 = s1;
  28504. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28505. return s0;
  28506. }
  28507. function peg$parsewsBinaryPattern() {
  28508. var s0, s1, s2, s3, s4;
  28509. var key = peg$currPos * 62 + 32,
  28510. cached = peg$resultsCache[key];
  28511. if (cached) {
  28512. peg$currPos = cached.nextPos;
  28513. return cached.result;
  28514. }
  28515. s0 = peg$currPos;
  28516. s1 = peg$parsews();
  28517. if (s1 !== peg$FAILED) {
  28518. s2 = peg$parsebinarySelector();
  28519. if (s2 !== peg$FAILED) {
  28520. s3 = peg$parsews();
  28521. if (s3 !== peg$FAILED) {
  28522. s4 = peg$parseidentifier();
  28523. if (s4 !== peg$FAILED) {
  28524. peg$savedPos = s0;
  28525. s1 = peg$c77(s2, s4);
  28526. s0 = s1;
  28527. } else {
  28528. peg$currPos = s0;
  28529. s0 = peg$FAILED;
  28530. }
  28531. } else {
  28532. peg$currPos = s0;
  28533. s0 = peg$FAILED;
  28534. }
  28535. } else {
  28536. peg$currPos = s0;
  28537. s0 = peg$FAILED;
  28538. }
  28539. } else {
  28540. peg$currPos = s0;
  28541. s0 = peg$FAILED;
  28542. }
  28543. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28544. return s0;
  28545. }
  28546. function peg$parsewsUnaryPattern() {
  28547. var s0, s1, s2;
  28548. var key = peg$currPos * 62 + 33,
  28549. cached = peg$resultsCache[key];
  28550. if (cached) {
  28551. peg$currPos = cached.nextPos;
  28552. return cached.result;
  28553. }
  28554. s0 = peg$currPos;
  28555. s1 = peg$parsews();
  28556. if (s1 !== peg$FAILED) {
  28557. s2 = peg$parseidentifier();
  28558. if (s2 !== peg$FAILED) {
  28559. peg$savedPos = s0;
  28560. s1 = peg$c78(s2);
  28561. s0 = s1;
  28562. } else {
  28563. peg$currPos = s0;
  28564. s0 = peg$FAILED;
  28565. }
  28566. } else {
  28567. peg$currPos = s0;
  28568. s0 = peg$FAILED;
  28569. }
  28570. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28571. return s0;
  28572. }
  28573. function peg$parseexpression() {
  28574. var s0;
  28575. var key = peg$currPos * 62 + 34,
  28576. cached = peg$resultsCache[key];
  28577. if (cached) {
  28578. peg$currPos = cached.nextPos;
  28579. return cached.result;
  28580. }
  28581. s0 = peg$parseassignment();
  28582. if (s0 === peg$FAILED) {
  28583. s0 = peg$parsecascade();
  28584. if (s0 === peg$FAILED) {
  28585. s0 = peg$parsekeywordSend();
  28586. }
  28587. }
  28588. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28589. return s0;
  28590. }
  28591. function peg$parsewsExpressionsRest() {
  28592. var s0, s1, s2, s3, s4;
  28593. var key = peg$currPos * 62 + 35,
  28594. cached = peg$resultsCache[key];
  28595. if (cached) {
  28596. peg$currPos = cached.nextPos;
  28597. return cached.result;
  28598. }
  28599. s0 = peg$currPos;
  28600. s1 = peg$parsews();
  28601. if (s1 !== peg$FAILED) {
  28602. if (input.charCodeAt(peg$currPos) === 46) {
  28603. s2 = peg$c6;
  28604. peg$currPos++;
  28605. } else {
  28606. s2 = peg$FAILED;
  28607. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  28608. }
  28609. if (s2 !== peg$FAILED) {
  28610. s3 = peg$parsemaybeDotsWs();
  28611. if (s3 !== peg$FAILED) {
  28612. s4 = peg$parseexpression();
  28613. if (s4 !== peg$FAILED) {
  28614. peg$savedPos = s0;
  28615. s1 = peg$c79(s4);
  28616. s0 = s1;
  28617. } else {
  28618. peg$currPos = s0;
  28619. s0 = peg$FAILED;
  28620. }
  28621. } else {
  28622. peg$currPos = s0;
  28623. s0 = peg$FAILED;
  28624. }
  28625. } else {
  28626. peg$currPos = s0;
  28627. s0 = peg$FAILED;
  28628. }
  28629. } else {
  28630. peg$currPos = s0;
  28631. s0 = peg$FAILED;
  28632. }
  28633. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28634. return s0;
  28635. }
  28636. function peg$parsewsExpressions() {
  28637. var s0, s1, s2, s3, s4;
  28638. var key = peg$currPos * 62 + 36,
  28639. cached = peg$resultsCache[key];
  28640. if (cached) {
  28641. peg$currPos = cached.nextPos;
  28642. return cached.result;
  28643. }
  28644. s0 = peg$currPos;
  28645. s1 = peg$parsemaybeDotsWs();
  28646. if (s1 !== peg$FAILED) {
  28647. s2 = peg$parseexpression();
  28648. if (s2 !== peg$FAILED) {
  28649. s3 = [];
  28650. s4 = peg$parsewsExpressionsRest();
  28651. while (s4 !== peg$FAILED) {
  28652. s3.push(s4);
  28653. s4 = peg$parsewsExpressionsRest();
  28654. }
  28655. if (s3 !== peg$FAILED) {
  28656. peg$savedPos = s0;
  28657. s1 = peg$c80(s2, s3);
  28658. s0 = s1;
  28659. } else {
  28660. peg$currPos = s0;
  28661. s0 = peg$FAILED;
  28662. }
  28663. } else {
  28664. peg$currPos = s0;
  28665. s0 = peg$FAILED;
  28666. }
  28667. } else {
  28668. peg$currPos = s0;
  28669. s0 = peg$FAILED;
  28670. }
  28671. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28672. return s0;
  28673. }
  28674. function peg$parseassignment() {
  28675. var s0, s1, s2, s3, s4, s5;
  28676. var key = peg$currPos * 62 + 37,
  28677. cached = peg$resultsCache[key];
  28678. if (cached) {
  28679. peg$currPos = cached.nextPos;
  28680. return cached.result;
  28681. }
  28682. s0 = peg$currPos;
  28683. s1 = peg$parsevariable();
  28684. if (s1 !== peg$FAILED) {
  28685. s2 = peg$parsews();
  28686. if (s2 !== peg$FAILED) {
  28687. if (input.substr(peg$currPos, 2) === peg$c81) {
  28688. s3 = peg$c81;
  28689. peg$currPos += 2;
  28690. } else {
  28691. s3 = peg$FAILED;
  28692. if (peg$silentFails === 0) { peg$fail(peg$c82); }
  28693. }
  28694. if (s3 !== peg$FAILED) {
  28695. s4 = peg$parsews();
  28696. if (s4 !== peg$FAILED) {
  28697. s5 = peg$parseexpression();
  28698. if (s5 !== peg$FAILED) {
  28699. peg$savedPos = s0;
  28700. s1 = peg$c83(s1, s5);
  28701. s0 = s1;
  28702. } else {
  28703. peg$currPos = s0;
  28704. s0 = peg$FAILED;
  28705. }
  28706. } else {
  28707. peg$currPos = s0;
  28708. s0 = peg$FAILED;
  28709. }
  28710. } else {
  28711. peg$currPos = s0;
  28712. s0 = peg$FAILED;
  28713. }
  28714. } else {
  28715. peg$currPos = s0;
  28716. s0 = peg$FAILED;
  28717. }
  28718. } else {
  28719. peg$currPos = s0;
  28720. s0 = peg$FAILED;
  28721. }
  28722. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28723. return s0;
  28724. }
  28725. function peg$parseret() {
  28726. var s0, s1, s2, s3;
  28727. var key = peg$currPos * 62 + 38,
  28728. cached = peg$resultsCache[key];
  28729. if (cached) {
  28730. peg$currPos = cached.nextPos;
  28731. return cached.result;
  28732. }
  28733. s0 = peg$currPos;
  28734. if (input.charCodeAt(peg$currPos) === 94) {
  28735. s1 = peg$c84;
  28736. peg$currPos++;
  28737. } else {
  28738. s1 = peg$FAILED;
  28739. if (peg$silentFails === 0) { peg$fail(peg$c85); }
  28740. }
  28741. if (s1 !== peg$FAILED) {
  28742. s2 = peg$parsews();
  28743. if (s2 !== peg$FAILED) {
  28744. s3 = peg$parseexpression();
  28745. if (s3 !== peg$FAILED) {
  28746. peg$savedPos = s0;
  28747. s1 = peg$c86(s3);
  28748. s0 = s1;
  28749. } else {
  28750. peg$currPos = s0;
  28751. s0 = peg$FAILED;
  28752. }
  28753. } else {
  28754. peg$currPos = s0;
  28755. s0 = peg$FAILED;
  28756. }
  28757. } else {
  28758. peg$currPos = s0;
  28759. s0 = peg$FAILED;
  28760. }
  28761. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28762. return s0;
  28763. }
  28764. function peg$parsetemps() {
  28765. var s0, s1, s2, s3, s4, s5;
  28766. var key = peg$currPos * 62 + 39,
  28767. cached = peg$resultsCache[key];
  28768. if (cached) {
  28769. peg$currPos = cached.nextPos;
  28770. return cached.result;
  28771. }
  28772. s0 = peg$currPos;
  28773. if (input.charCodeAt(peg$currPos) === 124) {
  28774. s1 = peg$c87;
  28775. peg$currPos++;
  28776. } else {
  28777. s1 = peg$FAILED;
  28778. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  28779. }
  28780. if (s1 !== peg$FAILED) {
  28781. s2 = [];
  28782. s3 = peg$currPos;
  28783. s4 = peg$parsews();
  28784. if (s4 !== peg$FAILED) {
  28785. s5 = peg$parseidentifier();
  28786. if (s5 !== peg$FAILED) {
  28787. peg$savedPos = s3;
  28788. s4 = peg$c89(s5);
  28789. s3 = s4;
  28790. } else {
  28791. peg$currPos = s3;
  28792. s3 = peg$FAILED;
  28793. }
  28794. } else {
  28795. peg$currPos = s3;
  28796. s3 = peg$FAILED;
  28797. }
  28798. while (s3 !== peg$FAILED) {
  28799. s2.push(s3);
  28800. s3 = peg$currPos;
  28801. s4 = peg$parsews();
  28802. if (s4 !== peg$FAILED) {
  28803. s5 = peg$parseidentifier();
  28804. if (s5 !== peg$FAILED) {
  28805. peg$savedPos = s3;
  28806. s4 = peg$c89(s5);
  28807. s3 = s4;
  28808. } else {
  28809. peg$currPos = s3;
  28810. s3 = peg$FAILED;
  28811. }
  28812. } else {
  28813. peg$currPos = s3;
  28814. s3 = peg$FAILED;
  28815. }
  28816. }
  28817. if (s2 !== peg$FAILED) {
  28818. s3 = peg$parsews();
  28819. if (s3 !== peg$FAILED) {
  28820. if (input.charCodeAt(peg$currPos) === 124) {
  28821. s4 = peg$c87;
  28822. peg$currPos++;
  28823. } else {
  28824. s4 = peg$FAILED;
  28825. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  28826. }
  28827. if (s4 !== peg$FAILED) {
  28828. peg$savedPos = s0;
  28829. s1 = peg$c90(s2);
  28830. s0 = s1;
  28831. } else {
  28832. peg$currPos = s0;
  28833. s0 = peg$FAILED;
  28834. }
  28835. } else {
  28836. peg$currPos = s0;
  28837. s0 = peg$FAILED;
  28838. }
  28839. } else {
  28840. peg$currPos = s0;
  28841. s0 = peg$FAILED;
  28842. }
  28843. } else {
  28844. peg$currPos = s0;
  28845. s0 = peg$FAILED;
  28846. }
  28847. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28848. return s0;
  28849. }
  28850. function peg$parsewsBlockParamList() {
  28851. var s0, s1, s2, s3, s4, s5, s6;
  28852. var key = peg$currPos * 62 + 40,
  28853. cached = peg$resultsCache[key];
  28854. if (cached) {
  28855. peg$currPos = cached.nextPos;
  28856. return cached.result;
  28857. }
  28858. s0 = peg$currPos;
  28859. s1 = [];
  28860. s2 = peg$currPos;
  28861. s3 = peg$parsews();
  28862. if (s3 !== peg$FAILED) {
  28863. if (input.charCodeAt(peg$currPos) === 58) {
  28864. s4 = peg$c12;
  28865. peg$currPos++;
  28866. } else {
  28867. s4 = peg$FAILED;
  28868. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  28869. }
  28870. if (s4 !== peg$FAILED) {
  28871. s5 = peg$parsews();
  28872. if (s5 !== peg$FAILED) {
  28873. s6 = peg$parseidentifier();
  28874. if (s6 !== peg$FAILED) {
  28875. peg$savedPos = s2;
  28876. s3 = peg$c91(s6);
  28877. s2 = s3;
  28878. } else {
  28879. peg$currPos = s2;
  28880. s2 = peg$FAILED;
  28881. }
  28882. } else {
  28883. peg$currPos = s2;
  28884. s2 = peg$FAILED;
  28885. }
  28886. } else {
  28887. peg$currPos = s2;
  28888. s2 = peg$FAILED;
  28889. }
  28890. } else {
  28891. peg$currPos = s2;
  28892. s2 = peg$FAILED;
  28893. }
  28894. if (s2 !== peg$FAILED) {
  28895. while (s2 !== peg$FAILED) {
  28896. s1.push(s2);
  28897. s2 = peg$currPos;
  28898. s3 = peg$parsews();
  28899. if (s3 !== peg$FAILED) {
  28900. if (input.charCodeAt(peg$currPos) === 58) {
  28901. s4 = peg$c12;
  28902. peg$currPos++;
  28903. } else {
  28904. s4 = peg$FAILED;
  28905. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  28906. }
  28907. if (s4 !== peg$FAILED) {
  28908. s5 = peg$parsews();
  28909. if (s5 !== peg$FAILED) {
  28910. s6 = peg$parseidentifier();
  28911. if (s6 !== peg$FAILED) {
  28912. peg$savedPos = s2;
  28913. s3 = peg$c91(s6);
  28914. s2 = s3;
  28915. } else {
  28916. peg$currPos = s2;
  28917. s2 = peg$FAILED;
  28918. }
  28919. } else {
  28920. peg$currPos = s2;
  28921. s2 = peg$FAILED;
  28922. }
  28923. } else {
  28924. peg$currPos = s2;
  28925. s2 = peg$FAILED;
  28926. }
  28927. } else {
  28928. peg$currPos = s2;
  28929. s2 = peg$FAILED;
  28930. }
  28931. }
  28932. } else {
  28933. s1 = peg$FAILED;
  28934. }
  28935. if (s1 !== peg$FAILED) {
  28936. s2 = peg$parsews();
  28937. if (s2 !== peg$FAILED) {
  28938. if (input.charCodeAt(peg$currPos) === 124) {
  28939. s3 = peg$c87;
  28940. peg$currPos++;
  28941. } else {
  28942. s3 = peg$FAILED;
  28943. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  28944. }
  28945. if (s3 !== peg$FAILED) {
  28946. peg$savedPos = s0;
  28947. s1 = peg$c92(s1);
  28948. s0 = s1;
  28949. } else {
  28950. peg$currPos = s0;
  28951. s0 = peg$FAILED;
  28952. }
  28953. } else {
  28954. peg$currPos = s0;
  28955. s0 = peg$FAILED;
  28956. }
  28957. } else {
  28958. peg$currPos = s0;
  28959. s0 = peg$FAILED;
  28960. }
  28961. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28962. return s0;
  28963. }
  28964. function peg$parsesubexpression() {
  28965. var s0, s1, s2, s3, s4, s5;
  28966. var key = peg$currPos * 62 + 41,
  28967. cached = peg$resultsCache[key];
  28968. if (cached) {
  28969. peg$currPos = cached.nextPos;
  28970. return cached.result;
  28971. }
  28972. s0 = peg$currPos;
  28973. if (input.charCodeAt(peg$currPos) === 40) {
  28974. s1 = peg$c51;
  28975. peg$currPos++;
  28976. } else {
  28977. s1 = peg$FAILED;
  28978. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  28979. }
  28980. if (s1 !== peg$FAILED) {
  28981. s2 = peg$parsews();
  28982. if (s2 !== peg$FAILED) {
  28983. s3 = peg$parseexpression();
  28984. if (s3 !== peg$FAILED) {
  28985. s4 = peg$parsews();
  28986. if (s4 !== peg$FAILED) {
  28987. if (input.charCodeAt(peg$currPos) === 41) {
  28988. s5 = peg$c48;
  28989. peg$currPos++;
  28990. } else {
  28991. s5 = peg$FAILED;
  28992. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28993. }
  28994. if (s5 !== peg$FAILED) {
  28995. peg$savedPos = s0;
  28996. s1 = peg$c79(s3);
  28997. s0 = s1;
  28998. } else {
  28999. peg$currPos = s0;
  29000. s0 = peg$FAILED;
  29001. }
  29002. } else {
  29003. peg$currPos = s0;
  29004. s0 = peg$FAILED;
  29005. }
  29006. } else {
  29007. peg$currPos = s0;
  29008. s0 = peg$FAILED;
  29009. }
  29010. } else {
  29011. peg$currPos = s0;
  29012. s0 = peg$FAILED;
  29013. }
  29014. } else {
  29015. peg$currPos = s0;
  29016. s0 = peg$FAILED;
  29017. }
  29018. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29019. return s0;
  29020. }
  29021. function peg$parsewsStatementsWs() {
  29022. var s0, s1, s2, s3, s4, s5, s6;
  29023. var key = peg$currPos * 62 + 42,
  29024. cached = peg$resultsCache[key];
  29025. if (cached) {
  29026. peg$currPos = cached.nextPos;
  29027. return cached.result;
  29028. }
  29029. s0 = peg$currPos;
  29030. s1 = peg$parsemaybeDotsWs();
  29031. if (s1 !== peg$FAILED) {
  29032. s2 = peg$parseret();
  29033. if (s2 !== peg$FAILED) {
  29034. s3 = peg$parsemaybeDotsWs();
  29035. if (s3 !== peg$FAILED) {
  29036. peg$savedPos = s0;
  29037. s1 = peg$c93(s2);
  29038. s0 = s1;
  29039. } else {
  29040. peg$currPos = s0;
  29041. s0 = peg$FAILED;
  29042. }
  29043. } else {
  29044. peg$currPos = s0;
  29045. s0 = peg$FAILED;
  29046. }
  29047. } else {
  29048. peg$currPos = s0;
  29049. s0 = peg$FAILED;
  29050. }
  29051. if (s0 === peg$FAILED) {
  29052. s0 = peg$currPos;
  29053. s1 = peg$parsewsExpressions();
  29054. if (s1 !== peg$FAILED) {
  29055. s2 = peg$parsews();
  29056. if (s2 !== peg$FAILED) {
  29057. if (input.charCodeAt(peg$currPos) === 46) {
  29058. s3 = peg$c6;
  29059. peg$currPos++;
  29060. } else {
  29061. s3 = peg$FAILED;
  29062. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  29063. }
  29064. if (s3 !== peg$FAILED) {
  29065. s4 = peg$parsemaybeDotsWs();
  29066. if (s4 !== peg$FAILED) {
  29067. s5 = peg$parseret();
  29068. if (s5 !== peg$FAILED) {
  29069. s6 = peg$parsemaybeDotsWs();
  29070. if (s6 !== peg$FAILED) {
  29071. peg$savedPos = s0;
  29072. s1 = peg$c94(s1, s5);
  29073. s0 = s1;
  29074. } else {
  29075. peg$currPos = s0;
  29076. s0 = peg$FAILED;
  29077. }
  29078. } else {
  29079. peg$currPos = s0;
  29080. s0 = peg$FAILED;
  29081. }
  29082. } else {
  29083. peg$currPos = s0;
  29084. s0 = peg$FAILED;
  29085. }
  29086. } else {
  29087. peg$currPos = s0;
  29088. s0 = peg$FAILED;
  29089. }
  29090. } else {
  29091. peg$currPos = s0;
  29092. s0 = peg$FAILED;
  29093. }
  29094. } else {
  29095. peg$currPos = s0;
  29096. s0 = peg$FAILED;
  29097. }
  29098. if (s0 === peg$FAILED) {
  29099. s0 = peg$currPos;
  29100. s1 = peg$parsewsExpressions();
  29101. if (s1 === peg$FAILED) {
  29102. s1 = null;
  29103. }
  29104. if (s1 !== peg$FAILED) {
  29105. s2 = peg$parsemaybeDotsWs();
  29106. if (s2 !== peg$FAILED) {
  29107. peg$savedPos = s0;
  29108. s1 = peg$c95(s1);
  29109. s0 = s1;
  29110. } else {
  29111. peg$currPos = s0;
  29112. s0 = peg$FAILED;
  29113. }
  29114. } else {
  29115. peg$currPos = s0;
  29116. s0 = peg$FAILED;
  29117. }
  29118. }
  29119. }
  29120. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29121. return s0;
  29122. }
  29123. function peg$parsewsSequenceWs() {
  29124. var s0, s1, s2, s3;
  29125. var key = peg$currPos * 62 + 43,
  29126. cached = peg$resultsCache[key];
  29127. if (cached) {
  29128. peg$currPos = cached.nextPos;
  29129. return cached.result;
  29130. }
  29131. s0 = peg$currPos;
  29132. s1 = peg$parsews();
  29133. if (s1 !== peg$FAILED) {
  29134. s2 = peg$parsejsStatement();
  29135. if (s2 !== peg$FAILED) {
  29136. s3 = peg$parsews();
  29137. if (s3 !== peg$FAILED) {
  29138. peg$savedPos = s0;
  29139. s1 = peg$c96(s2);
  29140. s0 = s1;
  29141. } else {
  29142. peg$currPos = s0;
  29143. s0 = peg$FAILED;
  29144. }
  29145. } else {
  29146. peg$currPos = s0;
  29147. s0 = peg$FAILED;
  29148. }
  29149. } else {
  29150. peg$currPos = s0;
  29151. s0 = peg$FAILED;
  29152. }
  29153. if (s0 === peg$FAILED) {
  29154. s0 = peg$parsewsStSequenceWs();
  29155. }
  29156. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29157. return s0;
  29158. }
  29159. function peg$parsewsStSequenceWs() {
  29160. var s0, s1, s2, s3;
  29161. var key = peg$currPos * 62 + 44,
  29162. cached = peg$resultsCache[key];
  29163. if (cached) {
  29164. peg$currPos = cached.nextPos;
  29165. return cached.result;
  29166. }
  29167. s0 = peg$currPos;
  29168. s1 = peg$parsews();
  29169. if (s1 !== peg$FAILED) {
  29170. s2 = peg$parsetemps();
  29171. if (s2 === peg$FAILED) {
  29172. s2 = null;
  29173. }
  29174. if (s2 !== peg$FAILED) {
  29175. s3 = peg$parsewsStatementsWs();
  29176. if (s3 === peg$FAILED) {
  29177. s3 = null;
  29178. }
  29179. if (s3 !== peg$FAILED) {
  29180. peg$savedPos = s0;
  29181. s1 = peg$c97(s2, s3);
  29182. s0 = s1;
  29183. } else {
  29184. peg$currPos = s0;
  29185. s0 = peg$FAILED;
  29186. }
  29187. } else {
  29188. peg$currPos = s0;
  29189. s0 = peg$FAILED;
  29190. }
  29191. } else {
  29192. peg$currPos = s0;
  29193. s0 = peg$FAILED;
  29194. }
  29195. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29196. return s0;
  29197. }
  29198. function peg$parseblock() {
  29199. var s0, s1, s2, s3, s4;
  29200. var key = peg$currPos * 62 + 45,
  29201. cached = peg$resultsCache[key];
  29202. if (cached) {
  29203. peg$currPos = cached.nextPos;
  29204. return cached.result;
  29205. }
  29206. s0 = peg$currPos;
  29207. if (input.charCodeAt(peg$currPos) === 91) {
  29208. s1 = peg$c98;
  29209. peg$currPos++;
  29210. } else {
  29211. s1 = peg$FAILED;
  29212. if (peg$silentFails === 0) { peg$fail(peg$c99); }
  29213. }
  29214. if (s1 !== peg$FAILED) {
  29215. s2 = peg$parsewsBlockParamList();
  29216. if (s2 === peg$FAILED) {
  29217. s2 = null;
  29218. }
  29219. if (s2 !== peg$FAILED) {
  29220. s3 = peg$parsewsSequenceWs();
  29221. if (s3 !== peg$FAILED) {
  29222. if (input.charCodeAt(peg$currPos) === 93) {
  29223. s4 = peg$c100;
  29224. peg$currPos++;
  29225. } else {
  29226. s4 = peg$FAILED;
  29227. if (peg$silentFails === 0) { peg$fail(peg$c101); }
  29228. }
  29229. if (s4 !== peg$FAILED) {
  29230. peg$savedPos = s0;
  29231. s1 = peg$c102(s2, s3);
  29232. s0 = s1;
  29233. } else {
  29234. peg$currPos = s0;
  29235. s0 = peg$FAILED;
  29236. }
  29237. } else {
  29238. peg$currPos = s0;
  29239. s0 = peg$FAILED;
  29240. }
  29241. } else {
  29242. peg$currPos = s0;
  29243. s0 = peg$FAILED;
  29244. }
  29245. } else {
  29246. peg$currPos = s0;
  29247. s0 = peg$FAILED;
  29248. }
  29249. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29250. return s0;
  29251. }
  29252. function peg$parseoperand() {
  29253. var s0;
  29254. var key = peg$currPos * 62 + 46,
  29255. cached = peg$resultsCache[key];
  29256. if (cached) {
  29257. peg$currPos = cached.nextPos;
  29258. return cached.result;
  29259. }
  29260. s0 = peg$parseliteral();
  29261. if (s0 === peg$FAILED) {
  29262. s0 = peg$parsevariable();
  29263. if (s0 === peg$FAILED) {
  29264. s0 = peg$parsesubexpression();
  29265. }
  29266. }
  29267. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29268. return s0;
  29269. }
  29270. function peg$parsewsUnaryMessage() {
  29271. var s0, s1, s2, s3, s4;
  29272. var key = peg$currPos * 62 + 47,
  29273. cached = peg$resultsCache[key];
  29274. if (cached) {
  29275. peg$currPos = cached.nextPos;
  29276. return cached.result;
  29277. }
  29278. s0 = peg$currPos;
  29279. s1 = peg$parsews();
  29280. if (s1 !== peg$FAILED) {
  29281. s2 = peg$parseidentifier();
  29282. if (s2 !== peg$FAILED) {
  29283. s3 = peg$currPos;
  29284. peg$silentFails++;
  29285. if (input.charCodeAt(peg$currPos) === 58) {
  29286. s4 = peg$c12;
  29287. peg$currPos++;
  29288. } else {
  29289. s4 = peg$FAILED;
  29290. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29291. }
  29292. peg$silentFails--;
  29293. if (s4 === peg$FAILED) {
  29294. s3 = void 0;
  29295. } else {
  29296. peg$currPos = s3;
  29297. s3 = peg$FAILED;
  29298. }
  29299. if (s3 !== peg$FAILED) {
  29300. peg$savedPos = s0;
  29301. s1 = peg$c103(s2);
  29302. s0 = s1;
  29303. } else {
  29304. peg$currPos = s0;
  29305. s0 = peg$FAILED;
  29306. }
  29307. } else {
  29308. peg$currPos = s0;
  29309. s0 = peg$FAILED;
  29310. }
  29311. } else {
  29312. peg$currPos = s0;
  29313. s0 = peg$FAILED;
  29314. }
  29315. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29316. return s0;
  29317. }
  29318. function peg$parseunarySend() {
  29319. var s0, s1, s2, s3;
  29320. var key = peg$currPos * 62 + 48,
  29321. cached = peg$resultsCache[key];
  29322. if (cached) {
  29323. peg$currPos = cached.nextPos;
  29324. return cached.result;
  29325. }
  29326. s0 = peg$currPos;
  29327. s1 = peg$parseoperand();
  29328. if (s1 !== peg$FAILED) {
  29329. s2 = [];
  29330. s3 = peg$parsewsUnaryMessage();
  29331. while (s3 !== peg$FAILED) {
  29332. s2.push(s3);
  29333. s3 = peg$parsewsUnaryMessage();
  29334. }
  29335. if (s2 !== peg$FAILED) {
  29336. peg$savedPos = s0;
  29337. s1 = peg$c104(s1, s2);
  29338. s0 = s1;
  29339. } else {
  29340. peg$currPos = s0;
  29341. s0 = peg$FAILED;
  29342. }
  29343. } else {
  29344. peg$currPos = s0;
  29345. s0 = peg$FAILED;
  29346. }
  29347. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29348. return s0;
  29349. }
  29350. function peg$parsewsBinaryMessage() {
  29351. var s0, s1, s2, s3, s4;
  29352. var key = peg$currPos * 62 + 49,
  29353. cached = peg$resultsCache[key];
  29354. if (cached) {
  29355. peg$currPos = cached.nextPos;
  29356. return cached.result;
  29357. }
  29358. s0 = peg$currPos;
  29359. s1 = peg$parsews();
  29360. if (s1 !== peg$FAILED) {
  29361. s2 = peg$parsebinarySelector();
  29362. if (s2 !== peg$FAILED) {
  29363. s3 = peg$parsews();
  29364. if (s3 !== peg$FAILED) {
  29365. s4 = peg$parseunarySend();
  29366. if (s4 !== peg$FAILED) {
  29367. peg$savedPos = s0;
  29368. s1 = peg$c105(s2, s4);
  29369. s0 = s1;
  29370. } else {
  29371. peg$currPos = s0;
  29372. s0 = peg$FAILED;
  29373. }
  29374. } else {
  29375. peg$currPos = s0;
  29376. s0 = peg$FAILED;
  29377. }
  29378. } else {
  29379. peg$currPos = s0;
  29380. s0 = peg$FAILED;
  29381. }
  29382. } else {
  29383. peg$currPos = s0;
  29384. s0 = peg$FAILED;
  29385. }
  29386. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29387. return s0;
  29388. }
  29389. function peg$parsebinarySend() {
  29390. var s0, s1, s2, s3;
  29391. var key = peg$currPos * 62 + 50,
  29392. cached = peg$resultsCache[key];
  29393. if (cached) {
  29394. peg$currPos = cached.nextPos;
  29395. return cached.result;
  29396. }
  29397. s0 = peg$currPos;
  29398. s1 = peg$parseunarySend();
  29399. if (s1 !== peg$FAILED) {
  29400. s2 = [];
  29401. s3 = peg$parsewsBinaryMessage();
  29402. while (s3 !== peg$FAILED) {
  29403. s2.push(s3);
  29404. s3 = peg$parsewsBinaryMessage();
  29405. }
  29406. if (s2 !== peg$FAILED) {
  29407. peg$savedPos = s0;
  29408. s1 = peg$c104(s1, s2);
  29409. s0 = s1;
  29410. } else {
  29411. peg$currPos = s0;
  29412. s0 = peg$FAILED;
  29413. }
  29414. } else {
  29415. peg$currPos = s0;
  29416. s0 = peg$FAILED;
  29417. }
  29418. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29419. return s0;
  29420. }
  29421. function peg$parsewsKeywordMessage() {
  29422. var s0, s1, s2, s3, s4, s5, s6;
  29423. var key = peg$currPos * 62 + 51,
  29424. cached = peg$resultsCache[key];
  29425. if (cached) {
  29426. peg$currPos = cached.nextPos;
  29427. return cached.result;
  29428. }
  29429. s0 = peg$currPos;
  29430. s1 = [];
  29431. s2 = peg$currPos;
  29432. s3 = peg$parsews();
  29433. if (s3 !== peg$FAILED) {
  29434. s4 = peg$parsekeyword();
  29435. if (s4 !== peg$FAILED) {
  29436. s5 = peg$parsews();
  29437. if (s5 !== peg$FAILED) {
  29438. s6 = peg$parsebinarySend();
  29439. if (s6 !== peg$FAILED) {
  29440. peg$savedPos = s2;
  29441. s3 = peg$c75(s4, s6);
  29442. s2 = s3;
  29443. } else {
  29444. peg$currPos = s2;
  29445. s2 = peg$FAILED;
  29446. }
  29447. } else {
  29448. peg$currPos = s2;
  29449. s2 = peg$FAILED;
  29450. }
  29451. } else {
  29452. peg$currPos = s2;
  29453. s2 = peg$FAILED;
  29454. }
  29455. } else {
  29456. peg$currPos = s2;
  29457. s2 = peg$FAILED;
  29458. }
  29459. if (s2 !== peg$FAILED) {
  29460. while (s2 !== peg$FAILED) {
  29461. s1.push(s2);
  29462. s2 = peg$currPos;
  29463. s3 = peg$parsews();
  29464. if (s3 !== peg$FAILED) {
  29465. s4 = peg$parsekeyword();
  29466. if (s4 !== peg$FAILED) {
  29467. s5 = peg$parsews();
  29468. if (s5 !== peg$FAILED) {
  29469. s6 = peg$parsebinarySend();
  29470. if (s6 !== peg$FAILED) {
  29471. peg$savedPos = s2;
  29472. s3 = peg$c75(s4, s6);
  29473. s2 = s3;
  29474. } else {
  29475. peg$currPos = s2;
  29476. s2 = peg$FAILED;
  29477. }
  29478. } else {
  29479. peg$currPos = s2;
  29480. s2 = peg$FAILED;
  29481. }
  29482. } else {
  29483. peg$currPos = s2;
  29484. s2 = peg$FAILED;
  29485. }
  29486. } else {
  29487. peg$currPos = s2;
  29488. s2 = peg$FAILED;
  29489. }
  29490. }
  29491. } else {
  29492. s1 = peg$FAILED;
  29493. }
  29494. if (s1 !== peg$FAILED) {
  29495. peg$savedPos = s0;
  29496. s1 = peg$c106(s1);
  29497. }
  29498. s0 = s1;
  29499. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29500. return s0;
  29501. }
  29502. function peg$parsekeywordSend() {
  29503. var s0, s1, s2;
  29504. var key = peg$currPos * 62 + 52,
  29505. cached = peg$resultsCache[key];
  29506. if (cached) {
  29507. peg$currPos = cached.nextPos;
  29508. return cached.result;
  29509. }
  29510. s0 = peg$currPos;
  29511. s1 = peg$parsebinarySend();
  29512. if (s1 !== peg$FAILED) {
  29513. s2 = peg$parsewsKeywordMessage();
  29514. if (s2 === peg$FAILED) {
  29515. s2 = null;
  29516. }
  29517. if (s2 !== peg$FAILED) {
  29518. peg$savedPos = s0;
  29519. s1 = peg$c107(s1, s2);
  29520. s0 = s1;
  29521. } else {
  29522. peg$currPos = s0;
  29523. s0 = peg$FAILED;
  29524. }
  29525. } else {
  29526. peg$currPos = s0;
  29527. s0 = peg$FAILED;
  29528. }
  29529. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29530. return s0;
  29531. }
  29532. function peg$parsewsMessage() {
  29533. var s0;
  29534. var key = peg$currPos * 62 + 53,
  29535. cached = peg$resultsCache[key];
  29536. if (cached) {
  29537. peg$currPos = cached.nextPos;
  29538. return cached.result;
  29539. }
  29540. s0 = peg$parsewsBinaryMessage();
  29541. if (s0 === peg$FAILED) {
  29542. s0 = peg$parsewsUnaryMessage();
  29543. if (s0 === peg$FAILED) {
  29544. s0 = peg$parsewsKeywordMessage();
  29545. }
  29546. }
  29547. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29548. return s0;
  29549. }
  29550. function peg$parsecascade() {
  29551. var s0, s1, s2, s3, s4, s5, s6, s7;
  29552. var key = peg$currPos * 62 + 54,
  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$parsekeywordSend();
  29560. if (s1 !== peg$FAILED) {
  29561. peg$savedPos = peg$currPos;
  29562. s2 = peg$c108(s1);
  29563. if (s2) {
  29564. s2 = void 0;
  29565. } else {
  29566. s2 = peg$FAILED;
  29567. }
  29568. if (s2 !== peg$FAILED) {
  29569. s3 = [];
  29570. s4 = peg$currPos;
  29571. s5 = peg$parsews();
  29572. if (s5 !== peg$FAILED) {
  29573. if (input.charCodeAt(peg$currPos) === 59) {
  29574. s6 = peg$c109;
  29575. peg$currPos++;
  29576. } else {
  29577. s6 = peg$FAILED;
  29578. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  29579. }
  29580. if (s6 !== peg$FAILED) {
  29581. s7 = peg$parsewsMessage();
  29582. if (s7 !== peg$FAILED) {
  29583. peg$savedPos = s4;
  29584. s5 = peg$c111(s1, s7);
  29585. s4 = s5;
  29586. } else {
  29587. peg$currPos = s4;
  29588. s4 = peg$FAILED;
  29589. }
  29590. } else {
  29591. peg$currPos = s4;
  29592. s4 = peg$FAILED;
  29593. }
  29594. } else {
  29595. peg$currPos = s4;
  29596. s4 = peg$FAILED;
  29597. }
  29598. if (s4 !== peg$FAILED) {
  29599. while (s4 !== peg$FAILED) {
  29600. s3.push(s4);
  29601. s4 = peg$currPos;
  29602. s5 = peg$parsews();
  29603. if (s5 !== peg$FAILED) {
  29604. if (input.charCodeAt(peg$currPos) === 59) {
  29605. s6 = peg$c109;
  29606. peg$currPos++;
  29607. } else {
  29608. s6 = peg$FAILED;
  29609. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  29610. }
  29611. if (s6 !== peg$FAILED) {
  29612. s7 = peg$parsewsMessage();
  29613. if (s7 !== peg$FAILED) {
  29614. peg$savedPos = s4;
  29615. s5 = peg$c111(s1, s7);
  29616. s4 = s5;
  29617. } else {
  29618. peg$currPos = s4;
  29619. s4 = peg$FAILED;
  29620. }
  29621. } else {
  29622. peg$currPos = s4;
  29623. s4 = peg$FAILED;
  29624. }
  29625. } else {
  29626. peg$currPos = s4;
  29627. s4 = peg$FAILED;
  29628. }
  29629. }
  29630. } else {
  29631. s3 = peg$FAILED;
  29632. }
  29633. if (s3 !== peg$FAILED) {
  29634. peg$savedPos = s0;
  29635. s1 = peg$c112(s1, s3);
  29636. s0 = s1;
  29637. } else {
  29638. peg$currPos = s0;
  29639. s0 = peg$FAILED;
  29640. }
  29641. } else {
  29642. peg$currPos = s0;
  29643. s0 = peg$FAILED;
  29644. }
  29645. } else {
  29646. peg$currPos = s0;
  29647. s0 = peg$FAILED;
  29648. }
  29649. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29650. return s0;
  29651. }
  29652. function peg$parsejsStatement() {
  29653. var s0;
  29654. var key = peg$currPos * 62 + 55,
  29655. cached = peg$resultsCache[key];
  29656. if (cached) {
  29657. peg$currPos = cached.nextPos;
  29658. return cached.result;
  29659. }
  29660. s0 = peg$parsepragmaJsStatement();
  29661. if (s0 === peg$FAILED) {
  29662. s0 = peg$parselegacyJsStatement();
  29663. }
  29664. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29665. return s0;
  29666. }
  29667. function peg$parselegacyJsStatement() {
  29668. var s0, s1, s2, s3, s4;
  29669. var key = peg$currPos * 62 + 56,
  29670. cached = peg$resultsCache[key];
  29671. if (cached) {
  29672. peg$currPos = cached.nextPos;
  29673. return cached.result;
  29674. }
  29675. s0 = peg$currPos;
  29676. if (input.charCodeAt(peg$currPos) === 60) {
  29677. s1 = peg$c113;
  29678. peg$currPos++;
  29679. } else {
  29680. s1 = peg$FAILED;
  29681. if (peg$silentFails === 0) { peg$fail(peg$c114); }
  29682. }
  29683. if (s1 !== peg$FAILED) {
  29684. s2 = [];
  29685. s3 = peg$currPos;
  29686. if (input.substr(peg$currPos, 2) === peg$c115) {
  29687. s4 = peg$c115;
  29688. peg$currPos += 2;
  29689. } else {
  29690. s4 = peg$FAILED;
  29691. if (peg$silentFails === 0) { peg$fail(peg$c116); }
  29692. }
  29693. if (s4 !== peg$FAILED) {
  29694. peg$savedPos = s3;
  29695. s4 = peg$c117();
  29696. }
  29697. s3 = s4;
  29698. if (s3 === peg$FAILED) {
  29699. if (peg$c118.test(input.charAt(peg$currPos))) {
  29700. s3 = input.charAt(peg$currPos);
  29701. peg$currPos++;
  29702. } else {
  29703. s3 = peg$FAILED;
  29704. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  29705. }
  29706. }
  29707. while (s3 !== peg$FAILED) {
  29708. s2.push(s3);
  29709. s3 = peg$currPos;
  29710. if (input.substr(peg$currPos, 2) === peg$c115) {
  29711. s4 = peg$c115;
  29712. peg$currPos += 2;
  29713. } else {
  29714. s4 = peg$FAILED;
  29715. if (peg$silentFails === 0) { peg$fail(peg$c116); }
  29716. }
  29717. if (s4 !== peg$FAILED) {
  29718. peg$savedPos = s3;
  29719. s4 = peg$c117();
  29720. }
  29721. s3 = s4;
  29722. if (s3 === peg$FAILED) {
  29723. if (peg$c118.test(input.charAt(peg$currPos))) {
  29724. s3 = input.charAt(peg$currPos);
  29725. peg$currPos++;
  29726. } else {
  29727. s3 = peg$FAILED;
  29728. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  29729. }
  29730. }
  29731. }
  29732. if (s2 !== peg$FAILED) {
  29733. if (input.charCodeAt(peg$currPos) === 62) {
  29734. s3 = peg$c120;
  29735. peg$currPos++;
  29736. } else {
  29737. s3 = peg$FAILED;
  29738. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  29739. }
  29740. if (s3 !== peg$FAILED) {
  29741. peg$savedPos = peg$currPos;
  29742. s4 = peg$c122(s2);
  29743. if (s4) {
  29744. s4 = void 0;
  29745. } else {
  29746. s4 = peg$FAILED;
  29747. }
  29748. if (s4 !== peg$FAILED) {
  29749. peg$savedPos = s0;
  29750. s1 = peg$c123(s2);
  29751. s0 = s1;
  29752. } else {
  29753. peg$currPos = s0;
  29754. s0 = peg$FAILED;
  29755. }
  29756. } else {
  29757. peg$currPos = s0;
  29758. s0 = peg$FAILED;
  29759. }
  29760. } else {
  29761. peg$currPos = s0;
  29762. s0 = peg$FAILED;
  29763. }
  29764. } else {
  29765. peg$currPos = s0;
  29766. s0 = peg$FAILED;
  29767. }
  29768. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29769. return s0;
  29770. }
  29771. function peg$parsepragmaJsStatement() {
  29772. var s0, s1, s2, s3, s4, s5, s6, s7;
  29773. var key = peg$currPos * 62 + 57,
  29774. cached = peg$resultsCache[key];
  29775. if (cached) {
  29776. peg$currPos = cached.nextPos;
  29777. return cached.result;
  29778. }
  29779. s0 = peg$currPos;
  29780. if (input.charCodeAt(peg$currPos) === 60) {
  29781. s1 = peg$c113;
  29782. peg$currPos++;
  29783. } else {
  29784. s1 = peg$FAILED;
  29785. if (peg$silentFails === 0) { peg$fail(peg$c114); }
  29786. }
  29787. if (s1 !== peg$FAILED) {
  29788. s2 = peg$parsews();
  29789. if (s2 !== peg$FAILED) {
  29790. if (input.substr(peg$currPos, 9) === peg$c124) {
  29791. s3 = peg$c124;
  29792. peg$currPos += 9;
  29793. } else {
  29794. s3 = peg$FAILED;
  29795. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  29796. }
  29797. if (s3 !== peg$FAILED) {
  29798. s4 = peg$parsews();
  29799. if (s4 !== peg$FAILED) {
  29800. s5 = peg$parserawString();
  29801. if (s5 !== peg$FAILED) {
  29802. s6 = peg$parsews();
  29803. if (s6 !== peg$FAILED) {
  29804. if (input.charCodeAt(peg$currPos) === 62) {
  29805. s7 = peg$c120;
  29806. peg$currPos++;
  29807. } else {
  29808. s7 = peg$FAILED;
  29809. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  29810. }
  29811. if (s7 !== peg$FAILED) {
  29812. peg$savedPos = s0;
  29813. s1 = peg$c126(s5);
  29814. s0 = s1;
  29815. } else {
  29816. peg$currPos = s0;
  29817. s0 = peg$FAILED;
  29818. }
  29819. } else {
  29820. peg$currPos = s0;
  29821. s0 = peg$FAILED;
  29822. }
  29823. } else {
  29824. peg$currPos = s0;
  29825. s0 = peg$FAILED;
  29826. }
  29827. } else {
  29828. peg$currPos = s0;
  29829. s0 = peg$FAILED;
  29830. }
  29831. } else {
  29832. peg$currPos = s0;
  29833. s0 = peg$FAILED;
  29834. }
  29835. } else {
  29836. peg$currPos = s0;
  29837. s0 = peg$FAILED;
  29838. }
  29839. } else {
  29840. peg$currPos = s0;
  29841. s0 = peg$FAILED;
  29842. }
  29843. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29844. return s0;
  29845. }
  29846. function peg$parsemethod() {
  29847. var s0, s1, s2;
  29848. var key = peg$currPos * 62 + 58,
  29849. cached = peg$resultsCache[key];
  29850. if (cached) {
  29851. peg$currPos = cached.nextPos;
  29852. return cached.result;
  29853. }
  29854. s0 = peg$currPos;
  29855. s1 = peg$parsewsKeywordPattern();
  29856. if (s1 === peg$FAILED) {
  29857. s1 = peg$parsewsBinaryPattern();
  29858. if (s1 === peg$FAILED) {
  29859. s1 = peg$parsewsUnaryPattern();
  29860. }
  29861. }
  29862. if (s1 !== peg$FAILED) {
  29863. s2 = peg$parsewsSequenceWs();
  29864. if (s2 !== peg$FAILED) {
  29865. peg$savedPos = s0;
  29866. s1 = peg$c127(s1, s2);
  29867. s0 = s1;
  29868. } else {
  29869. peg$currPos = s0;
  29870. s0 = peg$FAILED;
  29871. }
  29872. } else {
  29873. peg$currPos = s0;
  29874. s0 = peg$FAILED;
  29875. }
  29876. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29877. return s0;
  29878. }
  29879. function peg$parseassociationSend() {
  29880. var s0, s1, s2;
  29881. var key = peg$currPos * 62 + 59,
  29882. cached = peg$resultsCache[key];
  29883. if (cached) {
  29884. peg$currPos = cached.nextPos;
  29885. return cached.result;
  29886. }
  29887. s0 = peg$currPos;
  29888. s1 = peg$parsebinarySend();
  29889. if (s1 !== peg$FAILED) {
  29890. peg$savedPos = peg$currPos;
  29891. s2 = peg$c128(s1);
  29892. if (s2) {
  29893. s2 = void 0;
  29894. } else {
  29895. s2 = peg$FAILED;
  29896. }
  29897. if (s2 !== peg$FAILED) {
  29898. peg$savedPos = s0;
  29899. s1 = peg$c129(s1);
  29900. s0 = s1;
  29901. } else {
  29902. peg$currPos = s0;
  29903. s0 = peg$FAILED;
  29904. }
  29905. } else {
  29906. peg$currPos = s0;
  29907. s0 = peg$FAILED;
  29908. }
  29909. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29910. return s0;
  29911. }
  29912. function peg$parsewsAssociationsRest() {
  29913. var s0, s1, s2, s3, s4;
  29914. var key = peg$currPos * 62 + 60,
  29915. cached = peg$resultsCache[key];
  29916. if (cached) {
  29917. peg$currPos = cached.nextPos;
  29918. return cached.result;
  29919. }
  29920. s0 = peg$currPos;
  29921. s1 = peg$parsews();
  29922. if (s1 !== peg$FAILED) {
  29923. if (input.charCodeAt(peg$currPos) === 46) {
  29924. s2 = peg$c6;
  29925. peg$currPos++;
  29926. } else {
  29927. s2 = peg$FAILED;
  29928. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  29929. }
  29930. if (s2 !== peg$FAILED) {
  29931. s3 = peg$parsemaybeDotsWs();
  29932. if (s3 !== peg$FAILED) {
  29933. s4 = peg$parseassociationSend();
  29934. if (s4 !== peg$FAILED) {
  29935. peg$savedPos = s0;
  29936. s1 = peg$c79(s4);
  29937. s0 = s1;
  29938. } else {
  29939. peg$currPos = s0;
  29940. s0 = peg$FAILED;
  29941. }
  29942. } else {
  29943. peg$currPos = s0;
  29944. s0 = peg$FAILED;
  29945. }
  29946. } else {
  29947. peg$currPos = s0;
  29948. s0 = peg$FAILED;
  29949. }
  29950. } else {
  29951. peg$currPos = s0;
  29952. s0 = peg$FAILED;
  29953. }
  29954. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29955. return s0;
  29956. }
  29957. function peg$parsewsAssociations() {
  29958. var s0, s1, s2, s3, s4;
  29959. var key = peg$currPos * 62 + 61,
  29960. cached = peg$resultsCache[key];
  29961. if (cached) {
  29962. peg$currPos = cached.nextPos;
  29963. return cached.result;
  29964. }
  29965. s0 = peg$currPos;
  29966. s1 = peg$parsemaybeDotsWs();
  29967. if (s1 !== peg$FAILED) {
  29968. s2 = peg$parseassociationSend();
  29969. if (s2 !== peg$FAILED) {
  29970. s3 = [];
  29971. s4 = peg$parsewsAssociationsRest();
  29972. while (s4 !== peg$FAILED) {
  29973. s3.push(s4);
  29974. s4 = peg$parsewsAssociationsRest();
  29975. }
  29976. if (s3 !== peg$FAILED) {
  29977. peg$savedPos = s0;
  29978. s1 = peg$c130(s2, s3);
  29979. s0 = s1;
  29980. } else {
  29981. peg$currPos = s0;
  29982. s0 = peg$FAILED;
  29983. }
  29984. } else {
  29985. peg$currPos = s0;
  29986. s0 = peg$FAILED;
  29987. }
  29988. } else {
  29989. peg$currPos = s0;
  29990. s0 = peg$FAILED;
  29991. }
  29992. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29993. return s0;
  29994. }
  29995. peg$result = peg$startRuleFunction();
  29996. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  29997. return peg$result;
  29998. } else {
  29999. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  30000. peg$fail({ type: "end", description: "end of input" });
  30001. }
  30002. throw peg$buildException(
  30003. null,
  30004. peg$maxFailExpected,
  30005. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  30006. peg$maxFailPos < input.length
  30007. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  30008. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  30009. );
  30010. }
  30011. }
  30012. return {
  30013. SyntaxError: peg$SyntaxError,
  30014. parse: peg$parse
  30015. };
  30016. })();
  30017. });
  30018. 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";
  30019. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  30020. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  30021. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30022. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  30023. $core.addPackage("Platform-ImportExport");
  30024. $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  30025. $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30026. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  30027. $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.";
  30028. $core.addMethod(
  30029. $core.method({
  30030. selector: "exportPackage:on:",
  30031. protocol: "output",
  30032. fn: function (aPackage,aStream){
  30033. var self=this,$self=this;
  30034. return $core.withContext(function($ctx1) {
  30035. $self._subclassResponsibility();
  30036. return self;
  30037. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  30038. },
  30039. args: ["aPackage", "aStream"],
  30040. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  30041. referencedClasses: [],
  30042. messageSends: ["subclassResponsibility"]
  30043. }),
  30044. $globals.AbstractExporter);
  30045. $core.addMethod(
  30046. $core.method({
  30047. selector: "extensionMethodsOfPackage:",
  30048. protocol: "accessing",
  30049. fn: function (aPackage){
  30050. var self=this,$self=this;
  30051. var result;
  30052. return $core.withContext(function($ctx1) {
  30053. result=$recv($globals.OrderedCollection)._new();
  30054. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  30055. return $core.withContext(function($ctx2) {
  30056. return $recv(result)._addAll_($recv(each)._ownMethods());
  30057. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30058. }));
  30059. return result;
  30060. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  30061. },
  30062. args: ["aPackage"],
  30063. 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",
  30064. referencedClasses: ["OrderedCollection"],
  30065. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  30066. }),
  30067. $globals.AbstractExporter);
  30068. $core.addMethod(
  30069. $core.method({
  30070. selector: "extensionProtocolsOfPackage:",
  30071. protocol: "accessing",
  30072. fn: function (aPackage){
  30073. var self=this,$self=this;
  30074. var extensionName,result;
  30075. return $core.withContext(function($ctx1) {
  30076. var $1,$2,$3;
  30077. $1=$recv(aPackage)._name();
  30078. $ctx1.sendIdx["name"]=1;
  30079. extensionName="*".__comma($1);
  30080. result=$recv($globals.OrderedCollection)._new();
  30081. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  30082. return $core.withContext(function($ctx2) {
  30083. $2=$recv(a)._name();
  30084. $ctx2.sendIdx["name"]=2;
  30085. return $recv($2).__lt($recv(b)._name());
  30086. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30087. })))._do_((function(each){
  30088. return $core.withContext(function($ctx2) {
  30089. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._do_((function(behavior){
  30090. return $core.withContext(function($ctx3) {
  30091. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  30092. if($core.assert($3)){
  30093. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  30094. }
  30095. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  30096. }));
  30097. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30098. }));
  30099. $ctx1.sendIdx["do:"]=1;
  30100. return result;
  30101. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  30102. },
  30103. args: ["aPackage"],
  30104. 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",
  30105. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  30106. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "copyWithout:", "theMetaClass", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  30107. }),
  30108. $globals.AbstractExporter);
  30109. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30110. $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.";
  30111. $core.addMethod(
  30112. $core.method({
  30113. selector: "chunkEscape:",
  30114. protocol: "convenience",
  30115. fn: function (aString){
  30116. var self=this,$self=this;
  30117. return $core.withContext(function($ctx1) {
  30118. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  30119. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  30120. },
  30121. args: ["aString"],
  30122. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  30123. referencedClasses: [],
  30124. messageSends: ["trimBoth", "replace:with:"]
  30125. }),
  30126. $globals.ChunkExporter);
  30127. $core.addMethod(
  30128. $core.method({
  30129. selector: "exportBehavior:on:",
  30130. protocol: "output",
  30131. fn: function (aBehavior,aStream){
  30132. var self=this,$self=this;
  30133. return $core.withContext(function($ctx1) {
  30134. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30135. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  30136. return self;
  30137. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30138. },
  30139. args: ["aBehavior", "aStream"],
  30140. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  30141. referencedClasses: [],
  30142. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  30143. }),
  30144. $globals.ChunkExporter);
  30145. $core.addMethod(
  30146. $core.method({
  30147. selector: "exportCategoryEpilogueOf:on:",
  30148. protocol: "output",
  30149. fn: function (aCategory,aStream){
  30150. var self=this,$self=this;
  30151. return $core.withContext(function($ctx1) {
  30152. $recv(aStream)._write_(" !");
  30153. $recv(aStream)._lf();
  30154. $ctx1.sendIdx["lf"]=1;
  30155. $recv(aStream)._lf();
  30156. return self;
  30157. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30158. },
  30159. args: ["aCategory", "aStream"],
  30160. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30161. referencedClasses: [],
  30162. messageSends: ["write:", "lf"]
  30163. }),
  30164. $globals.ChunkExporter);
  30165. $core.addMethod(
  30166. $core.method({
  30167. selector: "exportCategoryPrologueOf:on:",
  30168. protocol: "output",
  30169. fn: function (aCategory,aStream){
  30170. var self=this,$self=this;
  30171. return $core.withContext(function($ctx1) {
  30172. $recv(aStream)._write_("!");
  30173. $ctx1.sendIdx["write:"]=1;
  30174. $recv(aStream)._print_($recv(aCategory)._theClass());
  30175. $ctx1.sendIdx["print:"]=1;
  30176. $recv(aStream)._write_(" methodsFor: ");
  30177. $ctx1.sendIdx["write:"]=2;
  30178. $recv(aStream)._print_(aCategory);
  30179. $recv(aStream)._write_("!");
  30180. return self;
  30181. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30182. },
  30183. args: ["aCategory", "aStream"],
  30184. 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: '!'",
  30185. referencedClasses: [],
  30186. messageSends: ["write:", "print:", "theClass"]
  30187. }),
  30188. $globals.ChunkExporter);
  30189. $core.addMethod(
  30190. $core.method({
  30191. selector: "exportDefinitionOf:on:",
  30192. protocol: "output",
  30193. fn: function (aClass,aStream){
  30194. var self=this,$self=this;
  30195. return $core.withContext(function($ctx1) {
  30196. var $1,$2,$3,$4;
  30197. $recv(aStream)._print_($recv(aClass)._superclass());
  30198. $ctx1.sendIdx["print:"]=1;
  30199. $recv(aStream)._write_(" subclass: ");
  30200. $ctx1.sendIdx["write:"]=1;
  30201. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30202. $1=$recv(aStream)._lf();
  30203. $ctx1.sendIdx["lf"]=1;
  30204. $recv(aStream)._tab();
  30205. $ctx1.sendIdx["tab"]=1;
  30206. $recv(aStream)._write_("instanceVariableNames: ");
  30207. $ctx1.sendIdx["write:"]=2;
  30208. $recv(aStream)._print_(" "._join_($recv(aClass)._instanceVariableNames()));
  30209. $ctx1.sendIdx["print:"]=2;
  30210. $recv(aStream)._lf();
  30211. $ctx1.sendIdx["lf"]=2;
  30212. $recv(aStream)._tab();
  30213. $recv(aStream)._write_("package: ");
  30214. $ctx1.sendIdx["write:"]=3;
  30215. $recv(aStream)._print_($recv(aClass)._category());
  30216. $ctx1.sendIdx["print:"]=3;
  30217. $recv(aStream)._write_("!");
  30218. $ctx1.sendIdx["write:"]=4;
  30219. $2=$recv(aStream)._lf();
  30220. $ctx1.sendIdx["lf"]=3;
  30221. $3=$recv(aClass)._comment();
  30222. $ctx1.sendIdx["comment"]=1;
  30223. $recv($3)._ifNotEmpty_((function(){
  30224. return $core.withContext(function($ctx2) {
  30225. $recv(aStream)._write_("!");
  30226. $ctx2.sendIdx["write:"]=5;
  30227. $recv(aStream)._print_(aClass);
  30228. $recv(aStream)._write_(" commentStamp!");
  30229. $ctx2.sendIdx["write:"]=6;
  30230. $recv(aStream)._lf();
  30231. $ctx2.sendIdx["lf"]=4;
  30232. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30233. $4=$recv(aStream)._lf();
  30234. $ctx2.sendIdx["lf"]=5;
  30235. return $4;
  30236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30237. }));
  30238. $recv(aStream)._lf();
  30239. return self;
  30240. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30241. },
  30242. args: ["aClass", "aStream"],
  30243. 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",
  30244. referencedClasses: [],
  30245. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30246. }),
  30247. $globals.ChunkExporter);
  30248. $core.addMethod(
  30249. $core.method({
  30250. selector: "exportMetaDefinitionOf:on:",
  30251. protocol: "output",
  30252. fn: function (aClass,aStream){
  30253. var self=this,$self=this;
  30254. var classIvars,classTraitComposition;
  30255. return $core.withContext(function($ctx1) {
  30256. var $1,$2;
  30257. $1=$recv(aClass)._class();
  30258. $ctx1.sendIdx["class"]=1;
  30259. classIvars=$recv($1)._instanceVariableNames();
  30260. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  30261. $2=$recv(classIvars)._notEmpty();
  30262. if($core.assert($2)){
  30263. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  30264. $ctx1.sendIdx["print:"]=1;
  30265. $recv(aStream)._space();
  30266. $recv(aStream)._write_("instanceVariableNames: ");
  30267. $ctx1.sendIdx["write:"]=1;
  30268. $recv(aStream)._print_(" "._join_(classIvars));
  30269. $recv(aStream)._write_("!");
  30270. $recv(aStream)._lf();
  30271. $ctx1.sendIdx["lf"]=1;
  30272. $recv(aStream)._lf();
  30273. }
  30274. return self;
  30275. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition},$globals.ChunkExporter)});
  30276. },
  30277. args: ["aClass", "aStream"],
  30278. 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 ]",
  30279. referencedClasses: [],
  30280. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "lf"]
  30281. }),
  30282. $globals.ChunkExporter);
  30283. $core.addMethod(
  30284. $core.method({
  30285. selector: "exportMethod:on:",
  30286. protocol: "output",
  30287. fn: function (aMethod,aStream){
  30288. var self=this,$self=this;
  30289. return $core.withContext(function($ctx1) {
  30290. $recv(aStream)._lf();
  30291. $ctx1.sendIdx["lf"]=1;
  30292. $recv(aStream)._lf();
  30293. $ctx1.sendIdx["lf"]=2;
  30294. $recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()));
  30295. $ctx1.sendIdx["write:"]=1;
  30296. $recv(aStream)._lf();
  30297. $recv(aStream)._write_("!");
  30298. return self;
  30299. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  30300. },
  30301. args: ["aMethod", "aStream"],
  30302. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  30303. referencedClasses: [],
  30304. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  30305. }),
  30306. $globals.ChunkExporter);
  30307. $core.addMethod(
  30308. $core.method({
  30309. selector: "exportPackage:on:",
  30310. protocol: "output",
  30311. fn: function (aPackage,aStream){
  30312. var self=this,$self=this;
  30313. return $core.withContext(function($ctx1) {
  30314. var $1,$receiver;
  30315. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  30316. $self._exportPackageImportsOf_on_(aPackage,aStream);
  30317. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  30318. return $core.withContext(function($ctx2) {
  30319. $self._exportBehavior_on_(each,aStream);
  30320. $ctx2.sendIdx["exportBehavior:on:"]=1;
  30321. $1=$recv(each)._theMetaClass();
  30322. if(($receiver = $1) == null || $receiver.a$nil){
  30323. return $1;
  30324. } else {
  30325. var meta;
  30326. meta=$receiver;
  30327. return $self._exportBehavior_on_(meta,aStream);
  30328. }
  30329. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30330. }));
  30331. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  30332. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  30333. return self;
  30334. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30335. },
  30336. args: ["aPackage", "aStream"],
  30337. 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",
  30338. referencedClasses: [],
  30339. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  30340. }),
  30341. $globals.ChunkExporter);
  30342. $core.addMethod(
  30343. $core.method({
  30344. selector: "exportPackageDefinitionOf:on:",
  30345. protocol: "output",
  30346. fn: function (aPackage,aStream){
  30347. var self=this,$self=this;
  30348. return $core.withContext(function($ctx1) {
  30349. $recv(aStream)._write_("Smalltalk createPackage: ");
  30350. $ctx1.sendIdx["write:"]=1;
  30351. $recv(aStream)._print_($recv(aPackage)._name());
  30352. $recv(aStream)._write_("!");
  30353. $recv(aStream)._lf();
  30354. return self;
  30355. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30356. },
  30357. args: ["aPackage", "aStream"],
  30358. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  30359. referencedClasses: [],
  30360. messageSends: ["write:", "print:", "name", "lf"]
  30361. }),
  30362. $globals.ChunkExporter);
  30363. $core.addMethod(
  30364. $core.method({
  30365. selector: "exportPackageImportsOf:on:",
  30366. protocol: "output",
  30367. fn: function (aPackage,aStream){
  30368. var self=this,$self=this;
  30369. return $core.withContext(function($ctx1) {
  30370. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  30371. return $core.withContext(function($ctx2) {
  30372. $recv(aStream)._write_("(Smalltalk packageAt: ");
  30373. $ctx2.sendIdx["write:"]=1;
  30374. $recv(aStream)._print_($recv(aPackage)._name());
  30375. $recv(aStream)._write_([") imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  30376. return $recv(aStream)._lf();
  30377. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  30378. }));
  30379. return self;
  30380. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30381. },
  30382. args: ["aPackage", "aStream"],
  30383. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage imports ifNotEmpty: [ :imports | aStream\x0a\x09\x09write: '(Smalltalk packageAt: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: { ') imports: '. self chunkEscape: aPackage importsDefinition. '!' };\x0a\x09\x09lf ]",
  30384. referencedClasses: [],
  30385. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", "chunkEscape:", "importsDefinition", "lf"]
  30386. }),
  30387. $globals.ChunkExporter);
  30388. $core.addMethod(
  30389. $core.method({
  30390. selector: "exportPackageTraitCompositionsOf:on:",
  30391. protocol: "output",
  30392. fn: function (aPackage,aStream){
  30393. var self=this,$self=this;
  30394. return $core.withContext(function($ctx1) {
  30395. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  30396. return $core.withContext(function($ctx2) {
  30397. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  30398. return $core.withContext(function($ctx3) {
  30399. return $self._exportTraitComposition_of_on_(value,key,aStream);
  30400. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  30401. }));
  30402. $recv(aStream)._write_("! !");
  30403. $recv(aStream)._lf();
  30404. $ctx2.sendIdx["lf"]=1;
  30405. return $recv(aStream)._lf();
  30406. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  30407. }));
  30408. return self;
  30409. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30410. },
  30411. args: ["aPackage", "aStream"],
  30412. 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 ]",
  30413. referencedClasses: [],
  30414. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  30415. }),
  30416. $globals.ChunkExporter);
  30417. $core.addMethod(
  30418. $core.method({
  30419. selector: "exportProtocol:on:",
  30420. protocol: "output",
  30421. fn: function (aProtocol,aStream){
  30422. var self=this,$self=this;
  30423. return $core.withContext(function($ctx1) {
  30424. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  30425. return $core.withContext(function($ctx2) {
  30426. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  30427. $recv(methods)._do_((function(method){
  30428. return $core.withContext(function($ctx3) {
  30429. return $self._exportMethod_on_(method,aStream);
  30430. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  30431. }));
  30432. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  30433. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  30434. }));
  30435. return self;
  30436. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30437. },
  30438. args: ["aProtocol", "aStream"],
  30439. 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 ]",
  30440. referencedClasses: [],
  30441. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  30442. }),
  30443. $globals.ChunkExporter);
  30444. $core.addMethod(
  30445. $core.method({
  30446. selector: "exportProtocolEpilogueOf:on:",
  30447. protocol: "output",
  30448. fn: function (aProtocol,aStream){
  30449. var self=this,$self=this;
  30450. return $core.withContext(function($ctx1) {
  30451. $recv(aStream)._write_(" !");
  30452. $recv(aStream)._lf();
  30453. $ctx1.sendIdx["lf"]=1;
  30454. $recv(aStream)._lf();
  30455. return self;
  30456. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30457. },
  30458. args: ["aProtocol", "aStream"],
  30459. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30460. referencedClasses: [],
  30461. messageSends: ["write:", "lf"]
  30462. }),
  30463. $globals.ChunkExporter);
  30464. $core.addMethod(
  30465. $core.method({
  30466. selector: "exportProtocolPrologueOf:on:",
  30467. protocol: "output",
  30468. fn: function (aProtocol,aStream){
  30469. var self=this,$self=this;
  30470. return $core.withContext(function($ctx1) {
  30471. $recv(aStream)._write_("!");
  30472. $ctx1.sendIdx["write:"]=1;
  30473. $recv(aStream)._print_($recv(aProtocol)._theClass());
  30474. $ctx1.sendIdx["print:"]=1;
  30475. $recv(aStream)._write_(" methodsFor: ");
  30476. $ctx1.sendIdx["write:"]=2;
  30477. $recv(aStream)._print_($recv(aProtocol)._name());
  30478. $recv(aStream)._write_("!");
  30479. return self;
  30480. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30481. },
  30482. args: ["aProtocol", "aStream"],
  30483. 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: '!'",
  30484. referencedClasses: [],
  30485. messageSends: ["write:", "print:", "theClass", "name"]
  30486. }),
  30487. $globals.ChunkExporter);
  30488. $core.addMethod(
  30489. $core.method({
  30490. selector: "exportProtocols:on:",
  30491. protocol: "output",
  30492. fn: function (aCollection,aStream){
  30493. var self=this,$self=this;
  30494. return $core.withContext(function($ctx1) {
  30495. $recv(aCollection)._do_((function(each){
  30496. return $core.withContext(function($ctx2) {
  30497. return $self._exportProtocol_on_(each,aStream);
  30498. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30499. }));
  30500. return self;
  30501. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  30502. },
  30503. args: ["aCollection", "aStream"],
  30504. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  30505. referencedClasses: [],
  30506. messageSends: ["do:", "exportProtocol:on:"]
  30507. }),
  30508. $globals.ChunkExporter);
  30509. $core.addMethod(
  30510. $core.method({
  30511. selector: "exportTraitComposition:of:on:",
  30512. protocol: "output",
  30513. fn: function (aTraitComposition,aBehavior,aStream){
  30514. var self=this,$self=this;
  30515. return $core.withContext(function($ctx1) {
  30516. $recv(aStream)._print_(aBehavior);
  30517. $recv(aStream)._write_(" setTraitComposition: ");
  30518. $ctx1.sendIdx["write:"]=1;
  30519. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  30520. $ctx1.sendIdx["write:"]=2;
  30521. $recv(aStream)._write_(" asTraitComposition!");
  30522. $recv(aStream)._lf();
  30523. return self;
  30524. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30525. },
  30526. args: ["aTraitComposition", "aBehavior", "aStream"],
  30527. 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",
  30528. referencedClasses: [],
  30529. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  30530. }),
  30531. $globals.ChunkExporter);
  30532. $core.addMethod(
  30533. $core.method({
  30534. selector: "exportTraitDefinitionOf:on:",
  30535. protocol: "output",
  30536. fn: function (aClass,aStream){
  30537. var self=this,$self=this;
  30538. return $core.withContext(function($ctx1) {
  30539. var $1,$2,$3,$4;
  30540. $recv(aStream)._write_("Trait named: ");
  30541. $ctx1.sendIdx["write:"]=1;
  30542. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30543. $1=$recv(aStream)._lf();
  30544. $ctx1.sendIdx["lf"]=1;
  30545. $recv(aStream)._tab();
  30546. $recv(aStream)._write_("package: ");
  30547. $ctx1.sendIdx["write:"]=2;
  30548. $recv(aStream)._print_($recv(aClass)._category());
  30549. $ctx1.sendIdx["print:"]=1;
  30550. $recv(aStream)._write_("!");
  30551. $ctx1.sendIdx["write:"]=3;
  30552. $2=$recv(aStream)._lf();
  30553. $ctx1.sendIdx["lf"]=2;
  30554. $3=$recv(aClass)._comment();
  30555. $ctx1.sendIdx["comment"]=1;
  30556. $recv($3)._ifNotEmpty_((function(){
  30557. return $core.withContext(function($ctx2) {
  30558. $recv(aStream)._write_("!");
  30559. $ctx2.sendIdx["write:"]=4;
  30560. $recv(aStream)._print_(aClass);
  30561. $recv(aStream)._write_(" commentStamp!");
  30562. $ctx2.sendIdx["write:"]=5;
  30563. $recv(aStream)._lf();
  30564. $ctx2.sendIdx["lf"]=3;
  30565. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30566. $4=$recv(aStream)._lf();
  30567. $ctx2.sendIdx["lf"]=4;
  30568. return $4;
  30569. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30570. }));
  30571. $recv(aStream)._lf();
  30572. return self;
  30573. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30574. },
  30575. args: ["aClass", "aStream"],
  30576. 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",
  30577. referencedClasses: [],
  30578. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30579. }),
  30580. $globals.ChunkExporter);
  30581. $core.addMethod(
  30582. $core.method({
  30583. selector: "extensionCategoriesOfPackage:",
  30584. protocol: "accessing",
  30585. fn: function (aPackage){
  30586. var self=this,$self=this;
  30587. var name,map,result;
  30588. return $core.withContext(function($ctx1) {
  30589. var $1;
  30590. name=$recv(aPackage)._name();
  30591. result=$recv($globals.OrderedCollection)._new();
  30592. $ctx1.sendIdx["new"]=1;
  30593. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  30594. return $core.withContext(function($ctx2) {
  30595. return $recv([each,$recv(each)._theMetaClass()])._do_((function(aClass){
  30596. return $core.withContext(function($ctx3) {
  30597. map=$recv($globals.Dictionary)._new();
  30598. map;
  30599. $recv(aClass)._protocolsDo_((function(category,methods){
  30600. return $core.withContext(function($ctx4) {
  30601. $1=$recv(category).__eq("*".__comma(name));
  30602. if($core.assert($1)){
  30603. return $recv(map)._at_put_(category,methods);
  30604. }
  30605. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  30606. }));
  30607. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30608. return $core.withContext(function($ctx4) {
  30609. return $recv(a).__lt_eq(b);
  30610. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  30611. })))._collect_((function(category){
  30612. return $core.withContext(function($ctx4) {
  30613. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  30614. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  30615. })));
  30616. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  30617. }));
  30618. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30619. }));
  30620. $ctx1.sendIdx["do:"]=1;
  30621. return result;
  30622. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  30623. },
  30624. args: ["aPackage"],
  30625. 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",
  30626. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  30627. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "theMetaClass", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30628. }),
  30629. $globals.ChunkExporter);
  30630. $core.addMethod(
  30631. $core.method({
  30632. selector: "ownCategoriesOfClass:",
  30633. protocol: "accessing",
  30634. fn: function (aClass){
  30635. var self=this,$self=this;
  30636. var map;
  30637. return $core.withContext(function($ctx1) {
  30638. var $1;
  30639. map=$recv($globals.Dictionary)._new();
  30640. $recv(aClass)._protocolsDo_((function(each,methods){
  30641. return $core.withContext(function($ctx2) {
  30642. $1=$recv(each)._match_("^\x5c*");
  30643. if(!$core.assert($1)){
  30644. return $recv(map)._at_put_(each,methods);
  30645. }
  30646. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  30647. }));
  30648. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30649. return $core.withContext(function($ctx2) {
  30650. return $recv(a).__lt_eq(b);
  30651. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  30652. })))._collect_((function(each){
  30653. return $core.withContext(function($ctx2) {
  30654. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  30655. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  30656. }));
  30657. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  30658. },
  30659. args: ["aClass"],
  30660. 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) ]",
  30661. referencedClasses: ["Dictionary", "MethodCategory"],
  30662. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30663. }),
  30664. $globals.ChunkExporter);
  30665. $core.addMethod(
  30666. $core.method({
  30667. selector: "ownCategoriesOfMetaClass:",
  30668. protocol: "accessing",
  30669. fn: function (aClass){
  30670. var self=this,$self=this;
  30671. return $core.withContext(function($ctx1) {
  30672. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  30673. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  30674. },
  30675. args: ["aClass"],
  30676. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  30677. referencedClasses: [],
  30678. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  30679. }),
  30680. $globals.ChunkExporter);
  30681. $core.addMethod(
  30682. $core.method({
  30683. selector: "ownMethodProtocolsOfClass:",
  30684. protocol: "accessing",
  30685. fn: function (aClass){
  30686. var self=this,$self=this;
  30687. return $core.withContext(function($ctx1) {
  30688. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  30689. return $core.withContext(function($ctx2) {
  30690. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  30691. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30692. }));
  30693. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  30694. },
  30695. args: ["aClass"],
  30696. 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 ]",
  30697. referencedClasses: ["ExportMethodProtocol"],
  30698. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  30699. }),
  30700. $globals.ChunkExporter);
  30701. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30702. $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.).";
  30703. $core.addMethod(
  30704. $core.method({
  30705. selector: "exportBehavior:on:",
  30706. protocol: "output",
  30707. fn: function (aBehavior,aStream){
  30708. var self=this,$self=this;
  30709. return $core.withContext(function($ctx1) {
  30710. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30711. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  30712. return $core.withContext(function($ctx2) {
  30713. return $self._exportMethod_on_(method,aStream);
  30714. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  30715. }));
  30716. return self;
  30717. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  30718. },
  30719. args: ["aBehavior", "aStream"],
  30720. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  30721. referencedClasses: [],
  30722. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  30723. }),
  30724. $globals.Exporter);
  30725. $core.addMethod(
  30726. $core.method({
  30727. selector: "exportDefinitionOf:on:",
  30728. protocol: "output",
  30729. fn: function (aClass,aStream){
  30730. var self=this,$self=this;
  30731. return $core.withContext(function($ctx1) {
  30732. var $3,$5,$4,$6,$7,$2,$1,$8,$10,$9,$receiver;
  30733. $recv(aStream)._lf();
  30734. $ctx1.sendIdx["lf"]=1;
  30735. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  30736. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30737. $5=$recv(aClass)._superclass();
  30738. if(($receiver = $5) == null || $receiver.a$nil){
  30739. $4="null";
  30740. } else {
  30741. var superclass;
  30742. superclass=$receiver;
  30743. $4=$recv(superclass)._asJavaScriptSource();
  30744. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30745. }
  30746. $6=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  30747. $ctx1.sendIdx["asJavaScriptSource"]=3;
  30748. $7=$recv($recv(aClass)._category())._asJavaScriptSource();
  30749. $ctx1.sendIdx["asJavaScriptSource"]=4;
  30750. $2=["$core.addClass(",$3,", ",$4,", ",$6,", ",$7,");"];
  30751. $1=$recv(aStream)._write_($2);
  30752. $ctx1.sendIdx["write:"]=1;
  30753. $8=$recv(aClass)._comment();
  30754. $ctx1.sendIdx["comment"]=1;
  30755. $recv($8)._ifNotEmpty_((function(){
  30756. return $core.withContext(function($ctx2) {
  30757. $recv(aStream)._lf();
  30758. $ctx2.sendIdx["lf"]=2;
  30759. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  30760. $ctx2.sendIdx["write:"]=2;
  30761. $recv(aStream)._lf();
  30762. $ctx2.sendIdx["lf"]=3;
  30763. $10=$recv(aClass)._asJavaScriptSource();
  30764. $ctx2.sendIdx["asJavaScriptSource"]=5;
  30765. $9=[$10,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  30766. $recv(aStream)._write_($9);
  30767. $ctx2.sendIdx["write:"]=3;
  30768. $recv(aStream)._lf();
  30769. $ctx2.sendIdx["lf"]=4;
  30770. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  30771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  30772. }));
  30773. $recv(aStream)._lf();
  30774. return self;
  30775. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30776. },
  30777. args: ["aClass", "aStream"],
  30778. 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",
  30779. referencedClasses: [],
  30780. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  30781. }),
  30782. $globals.Exporter);
  30783. $core.addMethod(
  30784. $core.method({
  30785. selector: "exportMetaDefinitionOf:on:",
  30786. protocol: "output",
  30787. fn: function (aClass,aStream){
  30788. var self=this,$self=this;
  30789. return $core.withContext(function($ctx1) {
  30790. var $2,$1,$4,$3;
  30791. $recv(aStream)._lf();
  30792. $ctx1.sendIdx["lf"]=1;
  30793. $2=$recv(aClass)._theMetaClass();
  30794. $ctx1.sendIdx["theMetaClass"]=1;
  30795. $1=$recv($2)._instanceVariableNames();
  30796. $recv($1)._ifNotEmpty_((function(classIvars){
  30797. return $core.withContext(function($ctx2) {
  30798. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  30799. $ctx2.sendIdx["asJavaScriptSource"]=1;
  30800. $3=[$4,".iVarNames = ",$recv(classIvars)._asJavaScriptSource(),";"];
  30801. $recv(aStream)._write_($3);
  30802. return $recv(aStream)._lf();
  30803. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  30804. }));
  30805. return self;
  30806. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30807. },
  30808. args: ["aClass", "aStream"],
  30809. 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 ]",
  30810. referencedClasses: [],
  30811. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  30812. }),
  30813. $globals.Exporter);
  30814. $core.addMethod(
  30815. $core.method({
  30816. selector: "exportMethod:on:",
  30817. protocol: "output",
  30818. fn: function (aMethod,aStream){
  30819. var self=this,$self=this;
  30820. return $core.withContext(function($ctx1) {
  30821. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  30822. $recv(aStream)._write_("$core.addMethod(");
  30823. $ctx1.sendIdx["write:"]=1;
  30824. $recv(aStream)._lf();
  30825. $ctx1.sendIdx["lf"]=1;
  30826. $recv(aStream)._write_("$core.method({");
  30827. $ctx1.sendIdx["write:"]=2;
  30828. $recv(aStream)._lf();
  30829. $ctx1.sendIdx["lf"]=2;
  30830. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  30831. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30832. $1=["selector: ",$2,","];
  30833. $recv(aStream)._write_($1);
  30834. $ctx1.sendIdx["write:"]=3;
  30835. $recv(aStream)._lf();
  30836. $ctx1.sendIdx["lf"]=3;
  30837. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  30838. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30839. $3=["protocol: ",$4,","];
  30840. $recv(aStream)._write_($3);
  30841. $ctx1.sendIdx["write:"]=4;
  30842. $recv(aStream)._lf();
  30843. $ctx1.sendIdx["lf"]=4;
  30844. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  30845. $ctx1.sendIdx["write:"]=5;
  30846. $recv(aStream)._lf();
  30847. $ctx1.sendIdx["lf"]=5;
  30848. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  30849. $ctx1.sendIdx["write:"]=6;
  30850. $recv(aStream)._lf();
  30851. $ctx1.sendIdx["lf"]=6;
  30852. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  30853. $ctx1.sendIdx["asJavaScriptSource"]=3;
  30854. $5=["args: ",$6,","];
  30855. $recv(aStream)._write_($5);
  30856. $ctx1.sendIdx["write:"]=7;
  30857. $recv(aStream)._lf();
  30858. $ctx1.sendIdx["lf"]=7;
  30859. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  30860. $ctx1.sendIdx["asJavaScriptSource"]=4;
  30861. $7=["source: ",$8,","];
  30862. $recv(aStream)._write_($7);
  30863. $ctx1.sendIdx["write:"]=8;
  30864. $recv(aStream)._lf();
  30865. $ctx1.sendIdx["lf"]=8;
  30866. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  30867. $ctx1.sendIdx["asJavaScriptSource"]=5;
  30868. $9=["referencedClasses: ",$10,","];
  30869. $recv(aStream)._write_($9);
  30870. $ctx1.sendIdx["write:"]=9;
  30871. $recv(aStream)._lf();
  30872. $ctx1.sendIdx["lf"]=9;
  30873. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  30874. $ctx1.sendIdx["write:"]=10;
  30875. $recv(aStream)._lf();
  30876. $ctx1.sendIdx["lf"]=10;
  30877. $12=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  30878. $ctx1.sendIdx["asJavaScriptSource"]=6;
  30879. $11=["messageSends: ",$12];
  30880. $recv(aStream)._write_($11);
  30881. $ctx1.sendIdx["write:"]=11;
  30882. $recv(aStream)._lf();
  30883. $ctx1.sendIdx["lf"]=11;
  30884. $recv(aStream)._write_("}),");
  30885. $ctx1.sendIdx["write:"]=12;
  30886. $recv(aStream)._lf();
  30887. $ctx1.sendIdx["lf"]=12;
  30888. $recv(aStream)._write_([$recv($recv(aMethod)._methodClass())._asJavaScriptSource(),");"]);
  30889. $recv(aStream)._lf();
  30890. $ctx1.sendIdx["lf"]=13;
  30891. $recv(aStream)._lf();
  30892. return self;
  30893. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  30894. },
  30895. args: ["aMethod", "aStream"],
  30896. 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",
  30897. referencedClasses: [],
  30898. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "methodClass"]
  30899. }),
  30900. $globals.Exporter);
  30901. $core.addMethod(
  30902. $core.method({
  30903. selector: "exportPackage:on:",
  30904. protocol: "output",
  30905. fn: function (aPackage,aStream){
  30906. var self=this,$self=this;
  30907. return $core.withContext(function($ctx1) {
  30908. var $1,$receiver;
  30909. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  30910. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  30911. $self._exportPackageContextOf_on_(aPackage,aStream);
  30912. $self._exportPackageImportsOf_on_(aPackage,aStream);
  30913. $self._exportPackageTransportOf_on_(aPackage,aStream);
  30914. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  30915. return $core.withContext(function($ctx2) {
  30916. $self._exportBehavior_on_(each,aStream);
  30917. $ctx2.sendIdx["exportBehavior:on:"]=1;
  30918. $1=$recv(each)._theMetaClass();
  30919. if(($receiver = $1) == null || $receiver.a$nil){
  30920. return $1;
  30921. } else {
  30922. var meta;
  30923. meta=$receiver;
  30924. return $self._exportBehavior_on_(meta,aStream);
  30925. }
  30926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30927. }));
  30928. $ctx1.sendIdx["do:"]=1;
  30929. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  30930. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  30931. return $core.withContext(function($ctx2) {
  30932. return $self._exportMethod_on_(each,aStream);
  30933. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  30934. }));
  30935. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  30936. return self;
  30937. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  30938. },
  30939. args: ["aPackage", "aStream"],
  30940. 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",
  30941. referencedClasses: [],
  30942. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  30943. }),
  30944. $globals.Exporter);
  30945. $core.addMethod(
  30946. $core.method({
  30947. selector: "exportPackageBodyBlockPrologueOf:on:",
  30948. protocol: "output",
  30949. fn: function (aPackage,aStream){
  30950. var self=this,$self=this;
  30951. return $core.withContext(function($ctx1) {
  30952. $recv(aStream)._write_("if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;");
  30953. $ctx1.sendIdx["write:"]=1;
  30954. $recv(aStream)._lf();
  30955. $ctx1.sendIdx["lf"]=1;
  30956. $recv(aStream)._write_("if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;");
  30957. $ctx1.sendIdx["write:"]=2;
  30958. $recv(aStream)._lf();
  30959. $ctx1.sendIdx["lf"]=2;
  30960. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  30961. $ctx1.sendIdx["write:"]=3;
  30962. $recv(aStream)._lf();
  30963. $ctx1.sendIdx["lf"]=3;
  30964. $recv(aStream)._write_("if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;");
  30965. $recv(aStream)._lf();
  30966. return self;
  30967. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  30968. },
  30969. args: ["aPackage", "aStream"],
  30970. source: "exportPackageBodyBlockPrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;'; lf;\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;\x0a\x09\x09write: 'if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;'; lf",
  30971. referencedClasses: [],
  30972. messageSends: ["write:", "lf"]
  30973. }),
  30974. $globals.Exporter);
  30975. $core.addMethod(
  30976. $core.method({
  30977. selector: "exportPackageContextOf:on:",
  30978. protocol: "output",
  30979. fn: function (aPackage,aStream){
  30980. var self=this,$self=this;
  30981. return $core.withContext(function($ctx1) {
  30982. $recv(aStream)._write_(["$core.packages[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].innerEval = ","function (expr) { return eval(expr); }",";"]);
  30983. $recv(aStream)._lf();
  30984. return self;
  30985. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  30986. },
  30987. args: ["aPackage", "aStream"],
  30988. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'$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",
  30989. referencedClasses: [],
  30990. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  30991. }),
  30992. $globals.Exporter);
  30993. $core.addMethod(
  30994. $core.method({
  30995. selector: "exportPackageDefinitionOf:on:",
  30996. protocol: "output",
  30997. fn: function (aPackage,aStream){
  30998. var self=this,$self=this;
  30999. return $core.withContext(function($ctx1) {
  31000. $recv(aStream)._write_(["$core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  31001. $recv(aStream)._lf();
  31002. return self;
  31003. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31004. },
  31005. args: ["aPackage", "aStream"],
  31006. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  31007. referencedClasses: [],
  31008. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31009. }),
  31010. $globals.Exporter);
  31011. $core.addMethod(
  31012. $core.method({
  31013. selector: "exportPackageEpilogueOf:on:",
  31014. protocol: "output",
  31015. fn: function (aPackage,aStream){
  31016. var self=this,$self=this;
  31017. return $core.withContext(function($ctx1) {
  31018. $self._subclassResponsibility();
  31019. return self;
  31020. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31021. },
  31022. args: ["aPackage", "aStream"],
  31023. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31024. referencedClasses: [],
  31025. messageSends: ["subclassResponsibility"]
  31026. }),
  31027. $globals.Exporter);
  31028. $core.addMethod(
  31029. $core.method({
  31030. selector: "exportPackageImportsOf:on:",
  31031. protocol: "output",
  31032. fn: function (aPackage,aStream){
  31033. var self=this,$self=this;
  31034. return $core.withContext(function($ctx1) {
  31035. var $2,$1;
  31036. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  31037. return $core.withContext(function($ctx2) {
  31038. $2=$recv($recv(aPackage)._name())._asJavaScriptSource();
  31039. $ctx2.sendIdx["asJavaScriptSource"]=1;
  31040. $1=["$core.packages[",$2,"].imports = ",$recv(imports)._asJavaScriptSource(),";"];
  31041. $recv(aStream)._write_($1);
  31042. return $recv(aStream)._lf();
  31043. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  31044. }));
  31045. return self;
  31046. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31047. },
  31048. args: ["aPackage", "aStream"],
  31049. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09write: {\x0a\x09\x09\x09\x09'$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 ]",
  31050. referencedClasses: [],
  31051. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "name", "lf"]
  31052. }),
  31053. $globals.Exporter);
  31054. $core.addMethod(
  31055. $core.method({
  31056. selector: "exportPackagePrologueOf:on:",
  31057. protocol: "output",
  31058. fn: function (aPackage,aStream){
  31059. var self=this,$self=this;
  31060. return $core.withContext(function($ctx1) {
  31061. $self._subclassResponsibility();
  31062. return self;
  31063. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31064. },
  31065. args: ["aPackage", "aStream"],
  31066. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31067. referencedClasses: [],
  31068. messageSends: ["subclassResponsibility"]
  31069. }),
  31070. $globals.Exporter);
  31071. $core.addMethod(
  31072. $core.method({
  31073. selector: "exportPackageTraitCompositionsOf:on:",
  31074. protocol: "output",
  31075. fn: function (aPackage,aStream){
  31076. var self=this,$self=this;
  31077. return $core.withContext(function($ctx1) {
  31078. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  31079. return $core.withContext(function($ctx2) {
  31080. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  31081. return $core.withContext(function($ctx3) {
  31082. return $self._exportTraitComposition_of_on_(value,key,aStream);
  31083. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  31084. }));
  31085. return $recv(aStream)._lf();
  31086. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  31087. }));
  31088. return self;
  31089. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31090. },
  31091. args: ["aPackage", "aStream"],
  31092. 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 ]",
  31093. referencedClasses: [],
  31094. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  31095. }),
  31096. $globals.Exporter);
  31097. $core.addMethod(
  31098. $core.method({
  31099. selector: "exportPackageTransportOf:on:",
  31100. protocol: "output",
  31101. fn: function (aPackage,aStream){
  31102. var self=this,$self=this;
  31103. return $core.withContext(function($ctx1) {
  31104. $recv(aStream)._write_(["$core.packages[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  31105. $recv(aStream)._lf();
  31106. return self;
  31107. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31108. },
  31109. args: ["aPackage", "aStream"],
  31110. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'$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",
  31111. referencedClasses: [],
  31112. messageSends: ["write:", "asJavaScriptSource", "name", "asJSONString", "transport", "lf"]
  31113. }),
  31114. $globals.Exporter);
  31115. $core.addMethod(
  31116. $core.method({
  31117. selector: "exportTraitComposition:of:on:",
  31118. protocol: "output",
  31119. fn: function (aTraitComposition,aBehavior,aStream){
  31120. var self=this,$self=this;
  31121. return $core.withContext(function($ctx1) {
  31122. var $2,$1;
  31123. $2=$recv(aTraitComposition)._asJavaScriptSource();
  31124. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31125. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  31126. $recv(aStream)._write_($1);
  31127. $recv(aStream)._lf();
  31128. return self;
  31129. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  31130. },
  31131. args: ["aTraitComposition", "aBehavior", "aStream"],
  31132. 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",
  31133. referencedClasses: [],
  31134. messageSends: ["write:", "asJavaScriptSource", "lf"]
  31135. }),
  31136. $globals.Exporter);
  31137. $core.addMethod(
  31138. $core.method({
  31139. selector: "exportTraitDefinitionOf:on:",
  31140. protocol: "output",
  31141. fn: function (aClass,aStream){
  31142. var self=this,$self=this;
  31143. return $core.withContext(function($ctx1) {
  31144. var $3,$4,$2,$1,$5,$7,$6;
  31145. $recv(aStream)._lf();
  31146. $ctx1.sendIdx["lf"]=1;
  31147. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31148. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31149. $4=$recv($recv(aClass)._category())._asJavaScriptSource();
  31150. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31151. $2=["$core.addTrait(",$3,", ",$4,");"];
  31152. $1=$recv(aStream)._write_($2);
  31153. $ctx1.sendIdx["write:"]=1;
  31154. $5=$recv(aClass)._comment();
  31155. $ctx1.sendIdx["comment"]=1;
  31156. $recv($5)._ifNotEmpty_((function(){
  31157. return $core.withContext(function($ctx2) {
  31158. $recv(aStream)._lf();
  31159. $ctx2.sendIdx["lf"]=2;
  31160. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31161. $ctx2.sendIdx["write:"]=2;
  31162. $recv(aStream)._lf();
  31163. $ctx2.sendIdx["lf"]=3;
  31164. $7=$recv(aClass)._asJavaScriptSource();
  31165. $ctx2.sendIdx["asJavaScriptSource"]=3;
  31166. $6=[$7,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31167. $recv(aStream)._write_($6);
  31168. $ctx2.sendIdx["write:"]=3;
  31169. $recv(aStream)._lf();
  31170. $ctx2.sendIdx["lf"]=4;
  31171. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31173. }));
  31174. $recv(aStream)._lf();
  31175. return self;
  31176. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31177. },
  31178. args: ["aClass", "aStream"],
  31179. 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",
  31180. referencedClasses: [],
  31181. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31182. }),
  31183. $globals.Exporter);
  31184. $core.addMethod(
  31185. $core.method({
  31186. selector: "ownMethodsOfClass:",
  31187. protocol: "accessing",
  31188. fn: function (aClass){
  31189. var self=this,$self=this;
  31190. return $core.withContext(function($ctx1) {
  31191. var $1;
  31192. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  31193. return $core.withContext(function($ctx2) {
  31194. $1=$recv(a)._selector();
  31195. $ctx2.sendIdx["selector"]=1;
  31196. return $recv($1).__lt_eq($recv(b)._selector());
  31197. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31198. })))._reject_((function(each){
  31199. return $core.withContext(function($ctx2) {
  31200. return $recv($recv(each)._protocol())._match_("^\x5c*");
  31201. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31202. }));
  31203. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  31204. },
  31205. args: ["aClass"],
  31206. 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*') ]",
  31207. referencedClasses: [],
  31208. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  31209. }),
  31210. $globals.Exporter);
  31211. $core.addMethod(
  31212. $core.method({
  31213. selector: "ownMethodsOfMetaClass:",
  31214. protocol: "accessing",
  31215. fn: function (aClass){
  31216. var self=this,$self=this;
  31217. return $core.withContext(function($ctx1) {
  31218. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  31219. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  31220. },
  31221. args: ["aClass"],
  31222. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  31223. referencedClasses: [],
  31224. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  31225. }),
  31226. $globals.Exporter);
  31227. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  31228. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  31229. $core.addMethod(
  31230. $core.method({
  31231. selector: "amdNamesOfPackages:",
  31232. protocol: "private",
  31233. fn: function (anArray){
  31234. var self=this,$self=this;
  31235. return $core.withContext(function($ctx1) {
  31236. var $1;
  31237. return $recv($recv(anArray)._select_((function(each){
  31238. return $core.withContext(function($ctx2) {
  31239. $1=$self._amdNamespaceOfPackage_(each);
  31240. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  31241. return $recv($1)._notNil();
  31242. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31243. })))._collect_((function(each){
  31244. return $core.withContext(function($ctx2) {
  31245. return $recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  31246. $ctx2.sendIdx[","]=1;
  31247. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31248. }));
  31249. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  31250. },
  31251. args: ["anArray"],
  31252. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  31253. referencedClasses: [],
  31254. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  31255. }),
  31256. $globals.AmdExporter);
  31257. $core.addMethod(
  31258. $core.method({
  31259. selector: "amdNamespaceOfPackage:",
  31260. protocol: "private",
  31261. fn: function (aPackage){
  31262. var self=this,$self=this;
  31263. return $core.withContext(function($ctx1) {
  31264. var $3,$2,$1;
  31265. $3=$recv(aPackage)._transport();
  31266. $ctx1.sendIdx["transport"]=1;
  31267. $2=$recv($3)._type();
  31268. $1=$recv($2).__eq("amd");
  31269. if($core.assert($1)){
  31270. return $recv($recv(aPackage)._transport())._namespace();
  31271. } else {
  31272. return nil;
  31273. }
  31274. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  31275. },
  31276. args: ["aPackage"],
  31277. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  31278. referencedClasses: [],
  31279. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  31280. }),
  31281. $globals.AmdExporter);
  31282. $core.addMethod(
  31283. $core.method({
  31284. selector: "exportPackageEpilogueOf:on:",
  31285. protocol: "output",
  31286. fn: function (aPackage,aStream){
  31287. var self=this,$self=this;
  31288. return $core.withContext(function($ctx1) {
  31289. $recv(aStream)._write_("});");
  31290. $recv(aStream)._lf();
  31291. return self;
  31292. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  31293. },
  31294. args: ["aPackage", "aStream"],
  31295. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  31296. referencedClasses: [],
  31297. messageSends: ["write:", "lf"]
  31298. }),
  31299. $globals.AmdExporter);
  31300. $core.addMethod(
  31301. $core.method({
  31302. selector: "exportPackagePrologueOf:on:",
  31303. protocol: "output",
  31304. fn: function (aPackage,aStream){
  31305. var self=this,$self=this;
  31306. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  31307. return $core.withContext(function($ctx1) {
  31308. var $1,$3,$2,$4,$6,$5,$7,$14,$13,$12,$11,$10,$9,$18,$17,$16,$15,$8;
  31309. pragmaStart="";
  31310. pragmaEnd="";
  31311. importsForOutput=$self._importsForOutput_(aPackage);
  31312. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  31313. $1=$recv(importsForOutput)._value();
  31314. $ctx1.sendIdx["value"]=1;
  31315. $recv($1)._ifNotEmpty_((function(){
  31316. return $core.withContext(function($ctx2) {
  31317. $3=$recv($globals.String)._lf();
  31318. $ctx2.sendIdx["lf"]=1;
  31319. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  31320. $ctx2.sendIdx[","]=2;
  31321. $4=$recv($globals.String)._lf();
  31322. $ctx2.sendIdx["lf"]=2;
  31323. pragmaStart=$recv($2).__comma($4);
  31324. $ctx2.sendIdx[","]=1;
  31325. pragmaStart;
  31326. $6=$recv($globals.String)._lf();
  31327. $ctx2.sendIdx["lf"]=3;
  31328. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  31329. $ctx2.sendIdx[","]=4;
  31330. $7=$recv($globals.String)._lf();
  31331. $ctx2.sendIdx["lf"]=4;
  31332. pragmaEnd=$recv($5).__comma($7);
  31333. $ctx2.sendIdx[","]=3;
  31334. return pragmaEnd;
  31335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31336. }));
  31337. $14=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  31338. $ctx1.sendIdx[","]=7;
  31339. $13=$recv($14).__comma([":2:"]);
  31340. $ctx1.sendIdx[","]=6;
  31341. $12=$recv($13).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  31342. $ctx1.sendIdx[","]=5;
  31343. $11=$recv($12)._asJavaScriptSource();
  31344. $10=$recv($11)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  31345. $ctx1.sendIdx["replace:with:"]=2;
  31346. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  31347. $ctx1.sendIdx["replace:with:"]=1;
  31348. $18=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  31349. $ctx1.sendIdx[","]=8;
  31350. $17=$recv($18)._join_(",");
  31351. $16=$recv($17)._replace_with_(",\x5cs*:1:",pragmaStart);
  31352. $15=$recv($16)._replace_with_(",\x5cs*:2:",pragmaEnd);
  31353. $ctx1.sendIdx["replace:with:"]=3;
  31354. $8=["define(",$9,", function(",$15,"){\x22use strict\x22;"];
  31355. $recv(aStream)._write_($8);
  31356. $recv(aStream)._lf();
  31357. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  31358. return self;
  31359. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  31360. },
  31361. args: ["aPackage", "aStream"],
  31362. 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",
  31363. referencedClasses: ["String"],
  31364. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "write:", "replace:with:", "asJavaScriptSource", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  31365. }),
  31366. $globals.AmdExporter);
  31367. $core.addMethod(
  31368. $core.method({
  31369. selector: "importsForOutput:",
  31370. protocol: "private",
  31371. fn: function (aPackage){
  31372. var self=this,$self=this;
  31373. var namedImports,anonImports,importVarNames;
  31374. return $core.withContext(function($ctx1) {
  31375. var $1;
  31376. namedImports=[];
  31377. anonImports=[];
  31378. importVarNames=[];
  31379. $recv($recv(aPackage)._imports())._do_((function(each){
  31380. return $core.withContext(function($ctx2) {
  31381. $1=$recv(each)._isString();
  31382. if($core.assert($1)){
  31383. return $recv(anonImports)._add_(each);
  31384. $ctx2.sendIdx["add:"]=1;
  31385. } else {
  31386. $recv(namedImports)._add_($recv(each)._value());
  31387. $ctx2.sendIdx["add:"]=2;
  31388. return $recv(importVarNames)._add_($recv(each)._key());
  31389. }
  31390. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31391. }));
  31392. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  31393. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  31394. },
  31395. args: ["aPackage"],
  31396. 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)",
  31397. referencedClasses: [],
  31398. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  31399. }),
  31400. $globals.AmdExporter);
  31401. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  31402. $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";
  31403. $core.addMethod(
  31404. $core.method({
  31405. selector: "last",
  31406. protocol: "accessing",
  31407. fn: function (){
  31408. var self=this,$self=this;
  31409. return $self["@last"];
  31410. },
  31411. args: [],
  31412. source: "last\x0a\x09^ last",
  31413. referencedClasses: [],
  31414. messageSends: []
  31415. }),
  31416. $globals.ChunkParser);
  31417. $core.addMethod(
  31418. $core.method({
  31419. selector: "nextChunk",
  31420. protocol: "reading",
  31421. fn: function (){
  31422. var self=this,$self=this;
  31423. var char,result,chunk;
  31424. return $core.withContext(function($ctx1) {
  31425. var $1,$2,$3,$4;
  31426. var $early={};
  31427. try {
  31428. result=""._writeStream();
  31429. $recv((function(){
  31430. return $core.withContext(function($ctx2) {
  31431. char=$recv($self["@stream"])._next();
  31432. $ctx2.sendIdx["next"]=1;
  31433. char;
  31434. return $recv(char)._notNil();
  31435. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31436. }))._whileTrue_((function(){
  31437. return $core.withContext(function($ctx2) {
  31438. $1=$recv(char).__eq("!");
  31439. $ctx2.sendIdx["="]=1;
  31440. if($core.assert($1)){
  31441. $2=$recv($recv($self["@stream"])._peek()).__eq("!");
  31442. if($core.assert($2)){
  31443. $recv($self["@stream"])._next();
  31444. } else {
  31445. $self["@last"]=$recv($recv(result)._contents())._trimBoth();
  31446. $3=$self["@last"];
  31447. throw $early=[$3];
  31448. }
  31449. }
  31450. return $recv(result)._nextPut_(char);
  31451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31452. }));
  31453. $self["@last"]=nil;
  31454. $4=$self["@last"];
  31455. return $4;
  31456. }
  31457. catch(e) {if(e===$early)return e[0]; throw e}
  31458. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  31459. },
  31460. args: [],
  31461. 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",
  31462. referencedClasses: [],
  31463. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  31464. }),
  31465. $globals.ChunkParser);
  31466. $core.addMethod(
  31467. $core.method({
  31468. selector: "stream:",
  31469. protocol: "accessing",
  31470. fn: function (aStream){
  31471. var self=this,$self=this;
  31472. $self["@stream"]=aStream;
  31473. return self;
  31474. },
  31475. args: ["aStream"],
  31476. source: "stream: aStream\x0a\x09stream := aStream",
  31477. referencedClasses: [],
  31478. messageSends: []
  31479. }),
  31480. $globals.ChunkParser);
  31481. $core.addMethod(
  31482. $core.method({
  31483. selector: "on:",
  31484. protocol: "instance creation",
  31485. fn: function (aStream){
  31486. var self=this,$self=this;
  31487. return $core.withContext(function($ctx1) {
  31488. return $recv($self._new())._stream_(aStream);
  31489. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.a$cls)});
  31490. },
  31491. args: ["aStream"],
  31492. source: "on: aStream\x0a\x09^ self new stream: aStream",
  31493. referencedClasses: [],
  31494. messageSends: ["stream:", "new"]
  31495. }),
  31496. $globals.ChunkParser.a$cls);
  31497. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  31498. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  31499. $core.addMethod(
  31500. $core.method({
  31501. selector: "class:",
  31502. protocol: "accessing",
  31503. fn: function (aClass){
  31504. var self=this,$self=this;
  31505. $self["@class"]=aClass;
  31506. return self;
  31507. },
  31508. args: ["aClass"],
  31509. source: "class: aClass\x0a\x09class := aClass",
  31510. referencedClasses: [],
  31511. messageSends: []
  31512. }),
  31513. $globals.ClassCommentReader);
  31514. $core.addMethod(
  31515. $core.method({
  31516. selector: "initialize",
  31517. protocol: "initialization",
  31518. fn: function (){
  31519. var self=this,$self=this;
  31520. return $core.withContext(function($ctx1) {
  31521. (
  31522. $ctx1.supercall = true,
  31523. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31524. $ctx1.supercall = false;
  31525. return self;
  31526. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  31527. },
  31528. args: [],
  31529. source: "initialize\x0a\x09super initialize.",
  31530. referencedClasses: [],
  31531. messageSends: ["initialize"]
  31532. }),
  31533. $globals.ClassCommentReader);
  31534. $core.addMethod(
  31535. $core.method({
  31536. selector: "scanFrom:",
  31537. protocol: "fileIn",
  31538. fn: function (aChunkParser){
  31539. var self=this,$self=this;
  31540. var chunk;
  31541. return $core.withContext(function($ctx1) {
  31542. chunk=$recv(aChunkParser)._nextChunk();
  31543. $recv(chunk)._ifNotEmpty_((function(){
  31544. return $core.withContext(function($ctx2) {
  31545. return $self._setComment_(chunk);
  31546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31547. }));
  31548. return self;
  31549. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  31550. },
  31551. args: ["aChunkParser"],
  31552. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  31553. referencedClasses: [],
  31554. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  31555. }),
  31556. $globals.ClassCommentReader);
  31557. $core.addMethod(
  31558. $core.method({
  31559. selector: "setComment:",
  31560. protocol: "private",
  31561. fn: function (aString){
  31562. var self=this,$self=this;
  31563. return $core.withContext(function($ctx1) {
  31564. $recv($self["@class"])._comment_(aString);
  31565. return self;
  31566. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  31567. },
  31568. args: ["aString"],
  31569. source: "setComment: aString\x0a\x09class comment: aString",
  31570. referencedClasses: [],
  31571. messageSends: ["comment:"]
  31572. }),
  31573. $globals.ClassCommentReader);
  31574. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  31575. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  31576. $core.addMethod(
  31577. $core.method({
  31578. selector: "class:category:",
  31579. protocol: "accessing",
  31580. fn: function (aClass,aString){
  31581. var self=this,$self=this;
  31582. $self["@class"]=aClass;
  31583. $self["@category"]=aString;
  31584. return self;
  31585. },
  31586. args: ["aClass", "aString"],
  31587. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  31588. referencedClasses: [],
  31589. messageSends: []
  31590. }),
  31591. $globals.ClassProtocolReader);
  31592. $core.addMethod(
  31593. $core.method({
  31594. selector: "compileMethod:",
  31595. protocol: "private",
  31596. fn: function (aString){
  31597. var self=this,$self=this;
  31598. return $core.withContext(function($ctx1) {
  31599. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self["@class"],$self["@category"]);
  31600. return self;
  31601. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  31602. },
  31603. args: ["aString"],
  31604. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  31605. referencedClasses: ["Compiler"],
  31606. messageSends: ["install:forClass:protocol:", "new"]
  31607. }),
  31608. $globals.ClassProtocolReader);
  31609. $core.addMethod(
  31610. $core.method({
  31611. selector: "initialize",
  31612. protocol: "initialization",
  31613. fn: function (){
  31614. var self=this,$self=this;
  31615. return $core.withContext(function($ctx1) {
  31616. (
  31617. $ctx1.supercall = true,
  31618. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31619. $ctx1.supercall = false;
  31620. return self;
  31621. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  31622. },
  31623. args: [],
  31624. source: "initialize\x0a\x09super initialize.",
  31625. referencedClasses: [],
  31626. messageSends: ["initialize"]
  31627. }),
  31628. $globals.ClassProtocolReader);
  31629. $core.addMethod(
  31630. $core.method({
  31631. selector: "scanFrom:",
  31632. protocol: "fileIn",
  31633. fn: function (aChunkParser){
  31634. var self=this,$self=this;
  31635. var chunk;
  31636. return $core.withContext(function($ctx1) {
  31637. $recv((function(){
  31638. return $core.withContext(function($ctx2) {
  31639. chunk=$recv(aChunkParser)._nextChunk();
  31640. chunk;
  31641. return $recv(chunk)._isEmpty();
  31642. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31643. }))._whileFalse_((function(){
  31644. return $core.withContext(function($ctx2) {
  31645. return $self._compileMethod_(chunk);
  31646. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31647. }));
  31648. return self;
  31649. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  31650. },
  31651. args: ["aChunkParser"],
  31652. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  31653. referencedClasses: [],
  31654. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  31655. }),
  31656. $globals.ClassProtocolReader);
  31657. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  31658. $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.";
  31659. $core.addMethod(
  31660. $core.method({
  31661. selector: "methods",
  31662. protocol: "accessing",
  31663. fn: function (){
  31664. var self=this,$self=this;
  31665. return $core.withContext(function($ctx1) {
  31666. var $1;
  31667. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  31668. return $core.withContext(function($ctx2) {
  31669. $1=$recv(a)._selector();
  31670. $ctx2.sendIdx["selector"]=1;
  31671. return $recv($1).__lt_eq($recv(b)._selector());
  31672. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31673. }));
  31674. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  31675. },
  31676. args: [],
  31677. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31678. referencedClasses: [],
  31679. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  31680. }),
  31681. $globals.ExportMethodProtocol);
  31682. $core.addMethod(
  31683. $core.method({
  31684. selector: "name",
  31685. protocol: "accessing",
  31686. fn: function (){
  31687. var self=this,$self=this;
  31688. return $self["@name"];
  31689. },
  31690. args: [],
  31691. source: "name\x0a\x09^ name",
  31692. referencedClasses: [],
  31693. messageSends: []
  31694. }),
  31695. $globals.ExportMethodProtocol);
  31696. $core.addMethod(
  31697. $core.method({
  31698. selector: "name:",
  31699. protocol: "accessing",
  31700. fn: function (aString){
  31701. var self=this,$self=this;
  31702. $self["@name"]=aString;
  31703. return self;
  31704. },
  31705. args: ["aString"],
  31706. source: "name: aString\x0a\x09name := aString",
  31707. referencedClasses: [],
  31708. messageSends: []
  31709. }),
  31710. $globals.ExportMethodProtocol);
  31711. $core.addMethod(
  31712. $core.method({
  31713. selector: "ownMethods",
  31714. protocol: "accessing",
  31715. fn: function (){
  31716. var self=this,$self=this;
  31717. return $core.withContext(function($ctx1) {
  31718. var $1;
  31719. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  31720. return $core.withContext(function($ctx2) {
  31721. $1=$recv(a)._selector();
  31722. $ctx2.sendIdx["selector"]=1;
  31723. return $recv($1).__lt_eq($recv(b)._selector());
  31724. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31725. }));
  31726. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.ExportMethodProtocol)});
  31727. },
  31728. args: [],
  31729. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31730. referencedClasses: [],
  31731. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  31732. }),
  31733. $globals.ExportMethodProtocol);
  31734. $core.addMethod(
  31735. $core.method({
  31736. selector: "theClass",
  31737. protocol: "accessing",
  31738. fn: function (){
  31739. var self=this,$self=this;
  31740. return $self["@theClass"];
  31741. },
  31742. args: [],
  31743. source: "theClass\x0a\x09^ theClass",
  31744. referencedClasses: [],
  31745. messageSends: []
  31746. }),
  31747. $globals.ExportMethodProtocol);
  31748. $core.addMethod(
  31749. $core.method({
  31750. selector: "theClass:",
  31751. protocol: "accessing",
  31752. fn: function (aClass){
  31753. var self=this,$self=this;
  31754. $self["@theClass"]=aClass;
  31755. return self;
  31756. },
  31757. args: ["aClass"],
  31758. source: "theClass: aClass\x0a\x09theClass := aClass",
  31759. referencedClasses: [],
  31760. messageSends: []
  31761. }),
  31762. $globals.ExportMethodProtocol);
  31763. $core.addMethod(
  31764. $core.method({
  31765. selector: "name:theClass:",
  31766. protocol: "instance creation",
  31767. fn: function (aString,aClass){
  31768. var self=this,$self=this;
  31769. return $core.withContext(function($ctx1) {
  31770. var $1;
  31771. $1=$self._new();
  31772. $recv($1)._name_(aString);
  31773. $recv($1)._theClass_(aClass);
  31774. return $recv($1)._yourself();
  31775. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.a$cls)});
  31776. },
  31777. args: ["aString", "aClass"],
  31778. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  31779. referencedClasses: [],
  31780. messageSends: ["name:", "new", "theClass:", "yourself"]
  31781. }),
  31782. $globals.ExportMethodProtocol.a$cls);
  31783. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  31784. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  31785. $core.addMethod(
  31786. $core.method({
  31787. selector: "import:",
  31788. protocol: "fileIn",
  31789. fn: function (aStream){
  31790. var self=this,$self=this;
  31791. var chunk,result,parser,lastEmpty;
  31792. return $core.withContext(function($ctx1) {
  31793. var $1;
  31794. parser=$recv($globals.ChunkParser)._on_(aStream);
  31795. lastEmpty=false;
  31796. $self["@lastSection"]="n/a, not started";
  31797. $self["@lastChunk"]=nil;
  31798. $recv((function(){
  31799. return $core.withContext(function($ctx2) {
  31800. $recv((function(){
  31801. return $core.withContext(function($ctx3) {
  31802. chunk=$recv(parser)._nextChunk();
  31803. chunk;
  31804. return $recv(chunk)._isNil();
  31805. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31806. }))._whileFalse_((function(){
  31807. return $core.withContext(function($ctx3) {
  31808. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  31809. lastEmpty=true;
  31810. return lastEmpty;
  31811. }),(function(){
  31812. return $core.withContext(function($ctx4) {
  31813. $self["@lastSection"]=chunk;
  31814. $self["@lastSection"];
  31815. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  31816. result;
  31817. $1=lastEmpty;
  31818. if($core.assert($1)){
  31819. lastEmpty=false;
  31820. lastEmpty;
  31821. return $recv(result)._scanFrom_(parser);
  31822. }
  31823. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  31824. }));
  31825. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  31826. }));
  31827. $self["@lastSection"]="n/a, finished";
  31828. return $self["@lastSection"];
  31829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31830. }))._on_do_($globals.Error,(function(e){
  31831. return $core.withContext(function($ctx2) {
  31832. $self["@lastChunk"]=$recv(parser)._last();
  31833. $self["@lastChunk"];
  31834. return $recv(e)._resignal();
  31835. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  31836. }));
  31837. return self;
  31838. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  31839. },
  31840. args: ["aStream"],
  31841. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk\x0a\x09\x09\x09ifEmpty: [ lastEmpty := true ]\x0a\x09\x09\x09ifNotEmpty: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e resignal ].",
  31842. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  31843. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  31844. }),
  31845. $globals.Importer);
  31846. $core.addMethod(
  31847. $core.method({
  31848. selector: "lastChunk",
  31849. protocol: "accessing",
  31850. fn: function (){
  31851. var self=this,$self=this;
  31852. return $self["@lastChunk"];
  31853. },
  31854. args: [],
  31855. source: "lastChunk\x0a\x09^ lastChunk",
  31856. referencedClasses: [],
  31857. messageSends: []
  31858. }),
  31859. $globals.Importer);
  31860. $core.addMethod(
  31861. $core.method({
  31862. selector: "lastSection",
  31863. protocol: "accessing",
  31864. fn: function (){
  31865. var self=this,$self=this;
  31866. return $self["@lastSection"];
  31867. },
  31868. args: [],
  31869. source: "lastSection\x0a\x09^ lastSection",
  31870. referencedClasses: [],
  31871. messageSends: []
  31872. }),
  31873. $globals.Importer);
  31874. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  31875. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  31876. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  31877. $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.";
  31878. $core.addMethod(
  31879. $core.method({
  31880. selector: "ajaxPutAt:data:onSuccess:onError:",
  31881. protocol: "private",
  31882. fn: function (aURL,aString,aBlock,anotherBlock){
  31883. var self=this,$self=this;
  31884. var xhr;
  31885. return $core.withContext(function($ctx1) {
  31886. var $1,$4,$3,$2;
  31887. xhr=$recv($globals.Platform)._newXhr();
  31888. $recv(xhr)._open_url_async_("PUT",aURL,true);
  31889. $recv(xhr)._onreadystatechange_((function(){
  31890. return $core.withContext(function($ctx2) {
  31891. $1=$recv($recv(xhr)._readyState()).__eq((4));
  31892. if($core.assert($1)){
  31893. $4=$recv(xhr)._status();
  31894. $ctx2.sendIdx["status"]=1;
  31895. $3=$recv($4).__gt_eq((200));
  31896. $2=$recv($3)._and_((function(){
  31897. return $core.withContext(function($ctx3) {
  31898. return $recv($recv(xhr)._status()).__lt((300));
  31899. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  31900. }));
  31901. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  31902. }
  31903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31904. }));
  31905. $recv(xhr)._send_(aString);
  31906. return self;
  31907. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  31908. },
  31909. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  31910. 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",
  31911. referencedClasses: ["Platform"],
  31912. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  31913. }),
  31914. $globals.PackageHandler);
  31915. $core.addMethod(
  31916. $core.method({
  31917. selector: "chunkContentsFor:",
  31918. protocol: "accessing",
  31919. fn: function (aPackage){
  31920. var self=this,$self=this;
  31921. return $core.withContext(function($ctx1) {
  31922. return $recv($globals.String)._streamContents_((function(str){
  31923. return $core.withContext(function($ctx2) {
  31924. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  31925. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  31926. }));
  31927. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  31928. },
  31929. args: ["aPackage"],
  31930. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  31931. referencedClasses: ["String"],
  31932. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  31933. }),
  31934. $globals.PackageHandler);
  31935. $core.addMethod(
  31936. $core.method({
  31937. selector: "chunkExporter",
  31938. protocol: "factory",
  31939. fn: function (){
  31940. var self=this,$self=this;
  31941. return $core.withContext(function($ctx1) {
  31942. return $recv($self._chunkExporterClass())._new();
  31943. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  31944. },
  31945. args: [],
  31946. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  31947. referencedClasses: [],
  31948. messageSends: ["new", "chunkExporterClass"]
  31949. }),
  31950. $globals.PackageHandler);
  31951. $core.addMethod(
  31952. $core.method({
  31953. selector: "chunkExporterClass",
  31954. protocol: "accessing",
  31955. fn: function (){
  31956. var self=this,$self=this;
  31957. return $globals.ChunkExporter;
  31958. },
  31959. args: [],
  31960. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  31961. referencedClasses: ["ChunkExporter"],
  31962. messageSends: []
  31963. }),
  31964. $globals.PackageHandler);
  31965. $core.addMethod(
  31966. $core.method({
  31967. selector: "commit:",
  31968. protocol: "committing",
  31969. fn: function (aPackage){
  31970. var self=this,$self=this;
  31971. return $core.withContext(function($ctx1) {
  31972. var $1,$2;
  31973. $self._commit_onSuccess_onError_(aPackage,(function(){
  31974. }),(function(error){
  31975. return $core.withContext(function($ctx2) {
  31976. $1=$recv($globals.PackageCommitError)._new();
  31977. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  31978. $ctx2.sendIdx[","]=1;
  31979. $recv($1)._messageText_($2);
  31980. return $recv($1)._signal();
  31981. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  31982. }));
  31983. return self;
  31984. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  31985. },
  31986. args: ["aPackage"],
  31987. 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 ]",
  31988. referencedClasses: ["PackageCommitError"],
  31989. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  31990. }),
  31991. $globals.PackageHandler);
  31992. $core.addMethod(
  31993. $core.method({
  31994. selector: "commit:onSuccess:onError:",
  31995. protocol: "committing",
  31996. fn: function (aPackage,aBlock,anotherBlock){
  31997. var self=this,$self=this;
  31998. return $core.withContext(function($ctx1) {
  31999. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  32000. return $core.withContext(function($ctx2) {
  32001. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  32002. return $core.withContext(function($ctx3) {
  32003. $recv(aPackage)._beClean();
  32004. return $recv(aBlock)._value();
  32005. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32006. }),anotherBlock);
  32007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32008. }),anotherBlock);
  32009. return self;
  32010. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32011. },
  32012. args: ["aPackage", "aBlock", "anotherBlock"],
  32013. 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",
  32014. referencedClasses: [],
  32015. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  32016. }),
  32017. $globals.PackageHandler);
  32018. $core.addMethod(
  32019. $core.method({
  32020. selector: "commitJsFileFor:onSuccess:onError:",
  32021. protocol: "committing",
  32022. fn: function (aPackage,aBlock,anotherBlock){
  32023. var self=this,$self=this;
  32024. return $core.withContext(function($ctx1) {
  32025. var $2,$1;
  32026. $2=$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32027. $ctx1.sendIdx[","]=2;
  32028. $1=$recv($2).__comma(".js");
  32029. $ctx1.sendIdx[","]=1;
  32030. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._contentsFor_(aPackage),aBlock,anotherBlock);
  32031. return self;
  32032. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32033. },
  32034. args: ["aPackage", "aBlock", "anotherBlock"],
  32035. 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",
  32036. referencedClasses: [],
  32037. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  32038. }),
  32039. $globals.PackageHandler);
  32040. $core.addMethod(
  32041. $core.method({
  32042. selector: "commitPathJsFor:",
  32043. protocol: "accessing",
  32044. fn: function (aPackage){
  32045. var self=this,$self=this;
  32046. return $core.withContext(function($ctx1) {
  32047. $self._subclassResponsibility();
  32048. return self;
  32049. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32050. },
  32051. args: ["aPackage"],
  32052. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  32053. referencedClasses: [],
  32054. messageSends: ["subclassResponsibility"]
  32055. }),
  32056. $globals.PackageHandler);
  32057. $core.addMethod(
  32058. $core.method({
  32059. selector: "commitPathStFor:",
  32060. protocol: "accessing",
  32061. fn: function (aPackage){
  32062. var self=this,$self=this;
  32063. return $core.withContext(function($ctx1) {
  32064. $self._subclassResponsibility();
  32065. return self;
  32066. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32067. },
  32068. args: ["aPackage"],
  32069. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  32070. referencedClasses: [],
  32071. messageSends: ["subclassResponsibility"]
  32072. }),
  32073. $globals.PackageHandler);
  32074. $core.addMethod(
  32075. $core.method({
  32076. selector: "commitStFileFor:onSuccess:onError:",
  32077. protocol: "committing",
  32078. fn: function (aPackage,aBlock,anotherBlock){
  32079. var self=this,$self=this;
  32080. return $core.withContext(function($ctx1) {
  32081. var $2,$1;
  32082. $2=$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32083. $ctx1.sendIdx[","]=2;
  32084. $1=$recv($2).__comma(".st");
  32085. $ctx1.sendIdx[","]=1;
  32086. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  32087. return self;
  32088. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32089. },
  32090. args: ["aPackage", "aBlock", "anotherBlock"],
  32091. 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",
  32092. referencedClasses: [],
  32093. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  32094. }),
  32095. $globals.PackageHandler);
  32096. $core.addMethod(
  32097. $core.method({
  32098. selector: "contentsFor:",
  32099. protocol: "accessing",
  32100. fn: function (aPackage){
  32101. var self=this,$self=this;
  32102. return $core.withContext(function($ctx1) {
  32103. return $recv($globals.String)._streamContents_((function(str){
  32104. return $core.withContext(function($ctx2) {
  32105. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  32106. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32107. }));
  32108. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32109. },
  32110. args: ["aPackage"],
  32111. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  32112. referencedClasses: ["String"],
  32113. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  32114. }),
  32115. $globals.PackageHandler);
  32116. $core.addMethod(
  32117. $core.method({
  32118. selector: "exporter",
  32119. protocol: "factory",
  32120. fn: function (){
  32121. var self=this,$self=this;
  32122. return $core.withContext(function($ctx1) {
  32123. return $recv($self._exporterClass())._new();
  32124. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  32125. },
  32126. args: [],
  32127. source: "exporter\x0a\x09^ self exporterClass new",
  32128. referencedClasses: [],
  32129. messageSends: ["new", "exporterClass"]
  32130. }),
  32131. $globals.PackageHandler);
  32132. $core.addMethod(
  32133. $core.method({
  32134. selector: "exporterClass",
  32135. protocol: "accessing",
  32136. fn: function (){
  32137. var self=this,$self=this;
  32138. return $core.withContext(function($ctx1) {
  32139. $self._subclassResponsibility();
  32140. return self;
  32141. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  32142. },
  32143. args: [],
  32144. source: "exporterClass\x0a\x09self subclassResponsibility",
  32145. referencedClasses: [],
  32146. messageSends: ["subclassResponsibility"]
  32147. }),
  32148. $globals.PackageHandler);
  32149. $core.addMethod(
  32150. $core.method({
  32151. selector: "load:",
  32152. protocol: "loading",
  32153. fn: function (aPackage){
  32154. var self=this,$self=this;
  32155. return $core.withContext(function($ctx1) {
  32156. $self._subclassResponsibility();
  32157. return self;
  32158. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  32159. },
  32160. args: ["aPackage"],
  32161. source: "load: aPackage\x0a\x09self subclassResponsibility",
  32162. referencedClasses: [],
  32163. messageSends: ["subclassResponsibility"]
  32164. }),
  32165. $globals.PackageHandler);
  32166. $core.addMethod(
  32167. $core.method({
  32168. selector: "onCommitError:",
  32169. protocol: "error handling",
  32170. fn: function (anError){
  32171. var self=this,$self=this;
  32172. return $core.withContext(function($ctx1) {
  32173. var $1,$2;
  32174. $1=$recv($globals.PackageCommitError)._new();
  32175. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  32176. $ctx1.sendIdx[","]=1;
  32177. $recv($1)._messageText_($2);
  32178. $recv($1)._signal();
  32179. return self;
  32180. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  32181. },
  32182. args: ["anError"],
  32183. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  32184. referencedClasses: ["PackageCommitError"],
  32185. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  32186. }),
  32187. $globals.PackageHandler);
  32188. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  32189. $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.";
  32190. $core.addMethod(
  32191. $core.method({
  32192. selector: "commitPathJsFor:",
  32193. protocol: "accessing",
  32194. fn: function (aPackage){
  32195. var self=this,$self=this;
  32196. return $core.withContext(function($ctx1) {
  32197. return $self._toUrl_($self._namespaceFor_(aPackage));
  32198. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32199. },
  32200. args: ["aPackage"],
  32201. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  32202. referencedClasses: [],
  32203. messageSends: ["toUrl:", "namespaceFor:"]
  32204. }),
  32205. $globals.AmdPackageHandler);
  32206. $core.addMethod(
  32207. $core.method({
  32208. selector: "commitPathStFor:",
  32209. protocol: "accessing",
  32210. fn: function (aPackage){
  32211. var self=this,$self=this;
  32212. var path,pathWithout;
  32213. return $core.withContext(function($ctx1) {
  32214. var $1,$2;
  32215. $1=$recv($self._namespaceFor_(aPackage)).__comma("/_source");
  32216. $ctx1.sendIdx[","]=1;
  32217. path=$self._toUrl_($1);
  32218. pathWithout=$self._commitPathJsFor_(aPackage);
  32219. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  32220. if($core.assert($2)){
  32221. return pathWithout;
  32222. } else {
  32223. return path;
  32224. }
  32225. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  32226. },
  32227. args: ["aPackage"],
  32228. 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 ]",
  32229. referencedClasses: [],
  32230. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  32231. }),
  32232. $globals.AmdPackageHandler);
  32233. $core.addMethod(
  32234. $core.method({
  32235. selector: "exporterClass",
  32236. protocol: "accessing",
  32237. fn: function (){
  32238. var self=this,$self=this;
  32239. return $globals.AmdExporter;
  32240. },
  32241. args: [],
  32242. source: "exporterClass\x0a\x09^ AmdExporter",
  32243. referencedClasses: ["AmdExporter"],
  32244. messageSends: []
  32245. }),
  32246. $globals.AmdPackageHandler);
  32247. $core.addMethod(
  32248. $core.method({
  32249. selector: "load:",
  32250. protocol: "loading",
  32251. fn: function (aPackage){
  32252. var self=this,$self=this;
  32253. return $core.withContext(function($ctx1) {
  32254. var $1,$3,$2,$receiver;
  32255. $1=$recv($globals.Smalltalk)._amdRequire();
  32256. if(($receiver = $1) == null || $receiver.a$nil){
  32257. $self._error_("AMD loader not present");
  32258. } else {
  32259. var require;
  32260. require=$receiver;
  32261. $3=$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32262. $ctx1.sendIdx[","]=1;
  32263. $2=$recv($globals.Array)._with_($3);
  32264. $recv(require)._value_($2);
  32265. }
  32266. return self;
  32267. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32268. },
  32269. args: ["aPackage"],
  32270. source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array with: (self namespaceFor: aPackage), '/', aPackage name ) ]",
  32271. referencedClasses: ["Smalltalk", "Array"],
  32272. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  32273. }),
  32274. $globals.AmdPackageHandler);
  32275. $core.addMethod(
  32276. $core.method({
  32277. selector: "namespaceFor:",
  32278. protocol: "committing",
  32279. fn: function (aPackage){
  32280. var self=this,$self=this;
  32281. return $core.withContext(function($ctx1) {
  32282. return $recv($recv(aPackage)._transport())._namespace();
  32283. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32284. },
  32285. args: ["aPackage"],
  32286. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  32287. referencedClasses: [],
  32288. messageSends: ["namespace", "transport"]
  32289. }),
  32290. $globals.AmdPackageHandler);
  32291. $core.addMethod(
  32292. $core.method({
  32293. selector: "toUrl:",
  32294. protocol: "private",
  32295. fn: function (aString){
  32296. var self=this,$self=this;
  32297. return $core.withContext(function($ctx1) {
  32298. var $1,$receiver;
  32299. $1=$recv($globals.Smalltalk)._amdRequire();
  32300. if(($receiver = $1) == null || $receiver.a$nil){
  32301. return $self._error_("AMD loader not present");
  32302. } else {
  32303. var require;
  32304. require=$receiver;
  32305. return $recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  32306. }
  32307. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  32308. },
  32309. args: ["aString"],
  32310. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
  32311. referencedClasses: ["Smalltalk"],
  32312. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  32313. }),
  32314. $globals.AmdPackageHandler);
  32315. $core.addMethod(
  32316. $core.method({
  32317. selector: "defaultNamespace",
  32318. protocol: "commit paths",
  32319. fn: function (){
  32320. var self=this,$self=this;
  32321. return $core.withContext(function($ctx1) {
  32322. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32323. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.a$cls)});
  32324. },
  32325. args: [],
  32326. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32327. referencedClasses: ["Smalltalk"],
  32328. messageSends: ["defaultAmdNamespace"]
  32329. }),
  32330. $globals.AmdPackageHandler.a$cls);
  32331. $core.addMethod(
  32332. $core.method({
  32333. selector: "defaultNamespace:",
  32334. protocol: "commit paths",
  32335. fn: function (aString){
  32336. var self=this,$self=this;
  32337. return $core.withContext(function($ctx1) {
  32338. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  32339. return self;
  32340. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.a$cls)});
  32341. },
  32342. args: ["aString"],
  32343. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  32344. referencedClasses: ["Smalltalk"],
  32345. messageSends: ["defaultAmdNamespace:"]
  32346. }),
  32347. $globals.AmdPackageHandler.a$cls);
  32348. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  32349. $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.";
  32350. $core.addMethod(
  32351. $core.method({
  32352. selector: "asJavaScriptObject",
  32353. protocol: "converting",
  32354. fn: function (){
  32355. var self=this,$self=this;
  32356. return $core.withContext(function($ctx1) {
  32357. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  32358. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.PackageTransport)});
  32359. },
  32360. args: [],
  32361. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  32362. referencedClasses: [],
  32363. messageSends: ["type"]
  32364. }),
  32365. $globals.PackageTransport);
  32366. $core.addMethod(
  32367. $core.method({
  32368. selector: "commit",
  32369. protocol: "committing",
  32370. fn: function (){
  32371. var self=this,$self=this;
  32372. return $core.withContext(function($ctx1) {
  32373. $recv($self._commitHandler())._commit_($self._package());
  32374. return self;
  32375. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  32376. },
  32377. args: [],
  32378. source: "commit\x0a\x09self commitHandler commit: self package",
  32379. referencedClasses: [],
  32380. messageSends: ["commit:", "commitHandler", "package"]
  32381. }),
  32382. $globals.PackageTransport);
  32383. $core.addMethod(
  32384. $core.method({
  32385. selector: "commitHandler",
  32386. protocol: "factory",
  32387. fn: function (){
  32388. var self=this,$self=this;
  32389. return $core.withContext(function($ctx1) {
  32390. return $recv($self._commitHandlerClass())._new();
  32391. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  32392. },
  32393. args: [],
  32394. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  32395. referencedClasses: [],
  32396. messageSends: ["new", "commitHandlerClass"]
  32397. }),
  32398. $globals.PackageTransport);
  32399. $core.addMethod(
  32400. $core.method({
  32401. selector: "commitHandlerClass",
  32402. protocol: "accessing",
  32403. fn: function (){
  32404. var self=this,$self=this;
  32405. return $core.withContext(function($ctx1) {
  32406. $self._subclassResponsibility();
  32407. return self;
  32408. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  32409. },
  32410. args: [],
  32411. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  32412. referencedClasses: [],
  32413. messageSends: ["subclassResponsibility"]
  32414. }),
  32415. $globals.PackageTransport);
  32416. $core.addMethod(
  32417. $core.method({
  32418. selector: "commitOnSuccess:onError:",
  32419. protocol: "committing",
  32420. fn: function (aBlock,anotherBlock){
  32421. var self=this,$self=this;
  32422. return $core.withContext(function($ctx1) {
  32423. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  32424. return self;
  32425. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  32426. },
  32427. args: ["aBlock", "anotherBlock"],
  32428. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  32429. referencedClasses: [],
  32430. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  32431. }),
  32432. $globals.PackageTransport);
  32433. $core.addMethod(
  32434. $core.method({
  32435. selector: "definition",
  32436. protocol: "accessing",
  32437. fn: function (){
  32438. var self=this,$self=this;
  32439. return "";
  32440. },
  32441. args: [],
  32442. source: "definition\x0a\x09^ ''",
  32443. referencedClasses: [],
  32444. messageSends: []
  32445. }),
  32446. $globals.PackageTransport);
  32447. $core.addMethod(
  32448. $core.method({
  32449. selector: "load",
  32450. protocol: "loading",
  32451. fn: function (){
  32452. var self=this,$self=this;
  32453. return $core.withContext(function($ctx1) {
  32454. $recv($self._commitHandler())._load_($self._package());
  32455. return self;
  32456. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  32457. },
  32458. args: [],
  32459. source: "load\x0a\x09self commitHandler load: self package",
  32460. referencedClasses: [],
  32461. messageSends: ["load:", "commitHandler", "package"]
  32462. }),
  32463. $globals.PackageTransport);
  32464. $core.addMethod(
  32465. $core.method({
  32466. selector: "package",
  32467. protocol: "accessing",
  32468. fn: function (){
  32469. var self=this,$self=this;
  32470. return $self["@package"];
  32471. },
  32472. args: [],
  32473. source: "package\x0a\x09^ package",
  32474. referencedClasses: [],
  32475. messageSends: []
  32476. }),
  32477. $globals.PackageTransport);
  32478. $core.addMethod(
  32479. $core.method({
  32480. selector: "package:",
  32481. protocol: "accessing",
  32482. fn: function (aPackage){
  32483. var self=this,$self=this;
  32484. $self["@package"]=aPackage;
  32485. return self;
  32486. },
  32487. args: ["aPackage"],
  32488. source: "package: aPackage\x0a\x09package := aPackage",
  32489. referencedClasses: [],
  32490. messageSends: []
  32491. }),
  32492. $globals.PackageTransport);
  32493. $core.addMethod(
  32494. $core.method({
  32495. selector: "setupFromJson:",
  32496. protocol: "initialization",
  32497. fn: function (anObject){
  32498. var self=this,$self=this;
  32499. return self;
  32500. },
  32501. args: ["anObject"],
  32502. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  32503. referencedClasses: [],
  32504. messageSends: []
  32505. }),
  32506. $globals.PackageTransport);
  32507. $core.addMethod(
  32508. $core.method({
  32509. selector: "type",
  32510. protocol: "accessing",
  32511. fn: function (){
  32512. var self=this,$self=this;
  32513. return $core.withContext(function($ctx1) {
  32514. return $recv($self._class())._type();
  32515. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  32516. },
  32517. args: [],
  32518. source: "type\x0a\x09^ self class type",
  32519. referencedClasses: [],
  32520. messageSends: ["type", "class"]
  32521. }),
  32522. $globals.PackageTransport);
  32523. $globals.PackageTransport.a$cls.iVarNames = ["registry"];
  32524. $core.addMethod(
  32525. $core.method({
  32526. selector: "classRegisteredFor:",
  32527. protocol: "accessing",
  32528. fn: function (aString){
  32529. var self=this,$self=this;
  32530. return $core.withContext(function($ctx1) {
  32531. return $recv($self["@registry"])._at_(aString);
  32532. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.a$cls)});
  32533. },
  32534. args: ["aString"],
  32535. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  32536. referencedClasses: [],
  32537. messageSends: ["at:"]
  32538. }),
  32539. $globals.PackageTransport.a$cls);
  32540. $core.addMethod(
  32541. $core.method({
  32542. selector: "defaultType",
  32543. protocol: "accessing",
  32544. fn: function (){
  32545. var self=this,$self=this;
  32546. return $core.withContext(function($ctx1) {
  32547. return $recv($globals.AmdPackageTransport)._type();
  32548. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.a$cls)});
  32549. },
  32550. args: [],
  32551. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  32552. referencedClasses: ["AmdPackageTransport"],
  32553. messageSends: ["type"]
  32554. }),
  32555. $globals.PackageTransport.a$cls);
  32556. $core.addMethod(
  32557. $core.method({
  32558. selector: "for:",
  32559. protocol: "instance creation",
  32560. fn: function (aString){
  32561. var self=this,$self=this;
  32562. return $core.withContext(function($ctx1) {
  32563. return $recv($self._classRegisteredFor_(aString))._new();
  32564. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.a$cls)});
  32565. },
  32566. args: ["aString"],
  32567. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  32568. referencedClasses: [],
  32569. messageSends: ["new", "classRegisteredFor:"]
  32570. }),
  32571. $globals.PackageTransport.a$cls);
  32572. $core.addMethod(
  32573. $core.method({
  32574. selector: "fromJson:",
  32575. protocol: "instance creation",
  32576. fn: function (anObject){
  32577. var self=this,$self=this;
  32578. return $core.withContext(function($ctx1) {
  32579. var $1,$2,$receiver;
  32580. if(($receiver = anObject) == null || $receiver.a$nil){
  32581. $1=$self._for_($self._defaultType());
  32582. $ctx1.sendIdx["for:"]=1;
  32583. return $1;
  32584. } else {
  32585. anObject;
  32586. }
  32587. $2=$self._for_($recv(anObject)._type());
  32588. $recv($2)._setupFromJson_(anObject);
  32589. return $recv($2)._yourself();
  32590. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.a$cls)});
  32591. },
  32592. args: ["anObject"],
  32593. 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",
  32594. referencedClasses: [],
  32595. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  32596. }),
  32597. $globals.PackageTransport.a$cls);
  32598. $core.addMethod(
  32599. $core.method({
  32600. selector: "initialize",
  32601. protocol: "initialization",
  32602. fn: function (){
  32603. var self=this,$self=this;
  32604. return $core.withContext(function($ctx1) {
  32605. var $1;
  32606. (
  32607. $ctx1.supercall = true,
  32608. ($globals.PackageTransport.a$cls.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  32609. $ctx1.supercall = false;
  32610. $1=$self.__eq_eq($globals.PackageTransport);
  32611. if($core.assert($1)){
  32612. $self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  32613. $self["@registry"];
  32614. } else {
  32615. $self._register();
  32616. }
  32617. return self;
  32618. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.a$cls)});
  32619. },
  32620. args: [],
  32621. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  32622. referencedClasses: ["PackageTransport"],
  32623. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  32624. }),
  32625. $globals.PackageTransport.a$cls);
  32626. $core.addMethod(
  32627. $core.method({
  32628. selector: "register",
  32629. protocol: "registration",
  32630. fn: function (){
  32631. var self=this,$self=this;
  32632. return $core.withContext(function($ctx1) {
  32633. $recv($globals.PackageTransport)._register_(self);
  32634. return self;
  32635. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.a$cls)});
  32636. },
  32637. args: [],
  32638. source: "register\x0a\x09PackageTransport register: self",
  32639. referencedClasses: ["PackageTransport"],
  32640. messageSends: ["register:"]
  32641. }),
  32642. $globals.PackageTransport.a$cls);
  32643. $core.addMethod(
  32644. $core.method({
  32645. selector: "register:",
  32646. protocol: "registration",
  32647. fn: function (aClass){
  32648. var self=this,$self=this;
  32649. return $core.withContext(function($ctx1) {
  32650. var $1,$receiver;
  32651. $1=$recv(aClass)._type();
  32652. $ctx1.sendIdx["type"]=1;
  32653. if(($receiver = $1) == null || $receiver.a$nil){
  32654. $1;
  32655. } else {
  32656. $recv($self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  32657. }
  32658. return self;
  32659. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.a$cls)});
  32660. },
  32661. args: ["aClass"],
  32662. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  32663. referencedClasses: [],
  32664. messageSends: ["ifNotNil:", "type", "at:put:"]
  32665. }),
  32666. $globals.PackageTransport.a$cls);
  32667. $core.addMethod(
  32668. $core.method({
  32669. selector: "type",
  32670. protocol: "accessing",
  32671. fn: function (){
  32672. var self=this,$self=this;
  32673. return nil;
  32674. },
  32675. args: [],
  32676. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  32677. referencedClasses: [],
  32678. messageSends: []
  32679. }),
  32680. $globals.PackageTransport.a$cls);
  32681. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  32682. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  32683. $core.addMethod(
  32684. $core.method({
  32685. selector: "asJavaScriptObject",
  32686. protocol: "converting",
  32687. fn: function (){
  32688. var self=this,$self=this;
  32689. return $core.withContext(function($ctx1) {
  32690. var $1;
  32691. $1=(
  32692. $ctx1.supercall = true,
  32693. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($self, []));
  32694. $ctx1.supercall = false;
  32695. $recv($1)._at_put_("amdNamespace",$self._namespace());
  32696. return $recv($1)._yourself();
  32697. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.AmdPackageTransport)});
  32698. },
  32699. args: [],
  32700. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  32701. referencedClasses: [],
  32702. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  32703. }),
  32704. $globals.AmdPackageTransport);
  32705. $core.addMethod(
  32706. $core.method({
  32707. selector: "commitHandlerClass",
  32708. protocol: "accessing",
  32709. fn: function (){
  32710. var self=this,$self=this;
  32711. return $globals.AmdPackageHandler;
  32712. },
  32713. args: [],
  32714. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  32715. referencedClasses: ["AmdPackageHandler"],
  32716. messageSends: []
  32717. }),
  32718. $globals.AmdPackageTransport);
  32719. $core.addMethod(
  32720. $core.method({
  32721. selector: "defaultNamespace",
  32722. protocol: "defaults",
  32723. fn: function (){
  32724. var self=this,$self=this;
  32725. return $core.withContext(function($ctx1) {
  32726. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32727. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  32728. },
  32729. args: [],
  32730. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32731. referencedClasses: ["Smalltalk"],
  32732. messageSends: ["defaultAmdNamespace"]
  32733. }),
  32734. $globals.AmdPackageTransport);
  32735. $core.addMethod(
  32736. $core.method({
  32737. selector: "definition",
  32738. protocol: "accessing",
  32739. fn: function (){
  32740. var self=this,$self=this;
  32741. return $core.withContext(function($ctx1) {
  32742. return $recv($globals.String)._streamContents_((function(stream){
  32743. return $core.withContext(function($ctx2) {
  32744. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  32745. return $recv(stream)._print_($self._namespace());
  32746. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  32747. }));
  32748. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  32749. },
  32750. args: [],
  32751. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  32752. referencedClasses: ["String"],
  32753. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  32754. }),
  32755. $globals.AmdPackageTransport);
  32756. $core.addMethod(
  32757. $core.method({
  32758. selector: "namespace",
  32759. protocol: "accessing",
  32760. fn: function (){
  32761. var self=this,$self=this;
  32762. return $core.withContext(function($ctx1) {
  32763. var $1,$receiver;
  32764. $1=$self["@namespace"];
  32765. if(($receiver = $1) == null || $receiver.a$nil){
  32766. return $self._defaultNamespace();
  32767. } else {
  32768. return $1;
  32769. }
  32770. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  32771. },
  32772. args: [],
  32773. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  32774. referencedClasses: [],
  32775. messageSends: ["ifNil:", "defaultNamespace"]
  32776. }),
  32777. $globals.AmdPackageTransport);
  32778. $core.addMethod(
  32779. $core.method({
  32780. selector: "namespace:",
  32781. protocol: "accessing",
  32782. fn: function (aString){
  32783. var self=this,$self=this;
  32784. $self["@namespace"]=aString;
  32785. return self;
  32786. },
  32787. args: ["aString"],
  32788. source: "namespace: aString\x0a\x09namespace := aString",
  32789. referencedClasses: [],
  32790. messageSends: []
  32791. }),
  32792. $globals.AmdPackageTransport);
  32793. $core.addMethod(
  32794. $core.method({
  32795. selector: "printOn:",
  32796. protocol: "printing",
  32797. fn: function (aStream){
  32798. var self=this,$self=this;
  32799. return $core.withContext(function($ctx1) {
  32800. (
  32801. $ctx1.supercall = true,
  32802. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  32803. $ctx1.supercall = false;
  32804. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  32805. $ctx1.sendIdx["nextPutAll:"]=1;
  32806. $recv(aStream)._nextPutAll_($self._namespace());
  32807. $ctx1.sendIdx["nextPutAll:"]=2;
  32808. $recv(aStream)._nextPutAll_(")");
  32809. return self;
  32810. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  32811. },
  32812. args: ["aStream"],
  32813. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  32814. referencedClasses: [],
  32815. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  32816. }),
  32817. $globals.AmdPackageTransport);
  32818. $core.addMethod(
  32819. $core.method({
  32820. selector: "setPath:",
  32821. protocol: "actions",
  32822. fn: function (aString){
  32823. var self=this,$self=this;
  32824. return $core.withContext(function($ctx1) {
  32825. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespace(),aString])]));
  32826. return self;
  32827. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  32828. },
  32829. args: ["aString"],
  32830. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09(require basicAt: 'config') value: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  32831. referencedClasses: [],
  32832. messageSends: ["value:", "basicAt:", "namespace"]
  32833. }),
  32834. $globals.AmdPackageTransport);
  32835. $core.addMethod(
  32836. $core.method({
  32837. selector: "setupFromJson:",
  32838. protocol: "initialization",
  32839. fn: function (anObject){
  32840. var self=this,$self=this;
  32841. return $core.withContext(function($ctx1) {
  32842. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  32843. return self;
  32844. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  32845. },
  32846. args: ["anObject"],
  32847. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  32848. referencedClasses: [],
  32849. messageSends: ["namespace:", "at:"]
  32850. }),
  32851. $globals.AmdPackageTransport);
  32852. $core.addMethod(
  32853. $core.method({
  32854. selector: "namespace:",
  32855. protocol: "instance creation",
  32856. fn: function (aString){
  32857. var self=this,$self=this;
  32858. return $core.withContext(function($ctx1) {
  32859. var $1;
  32860. $1=$self._new();
  32861. $recv($1)._namespace_(aString);
  32862. return $recv($1)._yourself();
  32863. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.a$cls)});
  32864. },
  32865. args: ["aString"],
  32866. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  32867. referencedClasses: [],
  32868. messageSends: ["namespace:", "new", "yourself"]
  32869. }),
  32870. $globals.AmdPackageTransport.a$cls);
  32871. $core.addMethod(
  32872. $core.method({
  32873. selector: "type",
  32874. protocol: "accessing",
  32875. fn: function (){
  32876. var self=this,$self=this;
  32877. return "amd";
  32878. },
  32879. args: [],
  32880. source: "type\x0a\x09^ 'amd'",
  32881. referencedClasses: [],
  32882. messageSends: []
  32883. }),
  32884. $globals.AmdPackageTransport.a$cls);
  32885. $core.addMethod(
  32886. $core.method({
  32887. selector: "exportBehaviorDefinitionTo:using:",
  32888. protocol: "*Platform-ImportExport",
  32889. fn: function (aStream,anExporter){
  32890. var self=this,$self=this;
  32891. return $core.withContext(function($ctx1) {
  32892. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  32893. return self;
  32894. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Class)});
  32895. },
  32896. args: ["aStream", "anExporter"],
  32897. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  32898. referencedClasses: [],
  32899. messageSends: ["exportDefinitionOf:on:"]
  32900. }),
  32901. $globals.Class);
  32902. $core.addMethod(
  32903. $core.method({
  32904. selector: "exportBehaviorDefinitionTo:using:",
  32905. protocol: "*Platform-ImportExport",
  32906. fn: function (aStream,anExporter){
  32907. var self=this,$self=this;
  32908. return $core.withContext(function($ctx1) {
  32909. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  32910. return self;
  32911. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Metaclass)});
  32912. },
  32913. args: ["aStream", "anExporter"],
  32914. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  32915. referencedClasses: [],
  32916. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  32917. }),
  32918. $globals.Metaclass);
  32919. $core.addMethod(
  32920. $core.method({
  32921. selector: "commit",
  32922. protocol: "*Platform-ImportExport",
  32923. fn: function (){
  32924. var self=this,$self=this;
  32925. return $core.withContext(function($ctx1) {
  32926. return $recv($self._transport())._commit();
  32927. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  32928. },
  32929. args: [],
  32930. source: "commit\x0a\x09^ self transport commit",
  32931. referencedClasses: [],
  32932. messageSends: ["commit", "transport"]
  32933. }),
  32934. $globals.Package);
  32935. $core.addMethod(
  32936. $core.method({
  32937. selector: "load",
  32938. protocol: "*Platform-ImportExport",
  32939. fn: function (){
  32940. var self=this,$self=this;
  32941. return $core.withContext(function($ctx1) {
  32942. return $recv($self._transport())._load();
  32943. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  32944. },
  32945. args: [],
  32946. source: "load\x0a\x09^ self transport load",
  32947. referencedClasses: [],
  32948. messageSends: ["load", "transport"]
  32949. }),
  32950. $globals.Package);
  32951. $core.addMethod(
  32952. $core.method({
  32953. selector: "loadFromNamespace:",
  32954. protocol: "*Platform-ImportExport",
  32955. fn: function (aString){
  32956. var self=this,$self=this;
  32957. return $core.withContext(function($ctx1) {
  32958. var $1;
  32959. $1=$self._transport();
  32960. $recv($1)._namespace_(aString);
  32961. return $recv($1)._load();
  32962. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  32963. },
  32964. args: ["aString"],
  32965. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  32966. referencedClasses: [],
  32967. messageSends: ["namespace:", "transport", "load"]
  32968. }),
  32969. $globals.Package);
  32970. $core.addMethod(
  32971. $core.method({
  32972. selector: "load:",
  32973. protocol: "*Platform-ImportExport",
  32974. fn: function (aPackageName){
  32975. var self=this,$self=this;
  32976. return $core.withContext(function($ctx1) {
  32977. $recv($self._named_(aPackageName))._load();
  32978. return self;
  32979. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  32980. },
  32981. args: ["aPackageName"],
  32982. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  32983. referencedClasses: [],
  32984. messageSends: ["load", "named:"]
  32985. }),
  32986. $globals.Package.a$cls);
  32987. $core.addMethod(
  32988. $core.method({
  32989. selector: "load:fromNamespace:",
  32990. protocol: "*Platform-ImportExport",
  32991. fn: function (aPackageName,aString){
  32992. var self=this,$self=this;
  32993. return $core.withContext(function($ctx1) {
  32994. $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  32995. return self;
  32996. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.a$cls)});
  32997. },
  32998. args: ["aPackageName", "aString"],
  32999. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  33000. referencedClasses: [],
  33001. messageSends: ["loadFromNamespace:", "named:"]
  33002. }),
  33003. $globals.Package.a$cls);
  33004. $core.addMethod(
  33005. $core.method({
  33006. selector: "methodsFor:",
  33007. protocol: "*Platform-ImportExport",
  33008. fn: function (aString){
  33009. var self=this,$self=this;
  33010. return $core.withContext(function($ctx1) {
  33011. var $1;
  33012. $1=$recv($globals.ClassProtocolReader)._new();
  33013. $recv($1)._class_category_(self,aString);
  33014. return $recv($1)._yourself();
  33015. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.TBehaviorProvider)});
  33016. },
  33017. args: ["aString"],
  33018. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  33019. referencedClasses: ["ClassProtocolReader"],
  33020. messageSends: ["class:category:", "new", "yourself"]
  33021. }),
  33022. $globals.TBehaviorProvider);
  33023. $core.addMethod(
  33024. $core.method({
  33025. selector: "methodsFor:stamp:",
  33026. protocol: "*Platform-ImportExport",
  33027. fn: function (aString,aStamp){
  33028. var self=this,$self=this;
  33029. return $core.withContext(function($ctx1) {
  33030. return $self._methodsFor_(aString);
  33031. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.TBehaviorProvider)});
  33032. },
  33033. args: ["aString", "aStamp"],
  33034. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  33035. referencedClasses: [],
  33036. messageSends: ["methodsFor:"]
  33037. }),
  33038. $globals.TBehaviorProvider);
  33039. $core.addMethod(
  33040. $core.method({
  33041. selector: "commentStamp",
  33042. protocol: "*Platform-ImportExport",
  33043. fn: function (){
  33044. var self=this,$self=this;
  33045. return $core.withContext(function($ctx1) {
  33046. var $1;
  33047. $1=$recv($globals.ClassCommentReader)._new();
  33048. $recv($1)._class_(self);
  33049. return $recv($1)._yourself();
  33050. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.TMasterBehavior)});
  33051. },
  33052. args: [],
  33053. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  33054. referencedClasses: ["ClassCommentReader"],
  33055. messageSends: ["class:", "new", "yourself"]
  33056. }),
  33057. $globals.TMasterBehavior);
  33058. $core.addMethod(
  33059. $core.method({
  33060. selector: "commentStamp:prior:",
  33061. protocol: "*Platform-ImportExport",
  33062. fn: function (aStamp,prior){
  33063. var self=this,$self=this;
  33064. return $core.withContext(function($ctx1) {
  33065. return $self._commentStamp();
  33066. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.TMasterBehavior)});
  33067. },
  33068. args: ["aStamp", "prior"],
  33069. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  33070. referencedClasses: [],
  33071. messageSends: ["commentStamp"]
  33072. }),
  33073. $globals.TMasterBehavior);
  33074. $core.addMethod(
  33075. $core.method({
  33076. selector: "exportBehaviorDefinitionTo:using:",
  33077. protocol: "*Platform-ImportExport",
  33078. fn: function (aStream,anExporter){
  33079. var self=this,$self=this;
  33080. return $core.withContext(function($ctx1) {
  33081. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  33082. return self;
  33083. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Trait)});
  33084. },
  33085. args: ["aStream", "anExporter"],
  33086. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  33087. referencedClasses: [],
  33088. messageSends: ["exportTraitDefinitionOf:on:"]
  33089. }),
  33090. $globals.Trait);
  33091. });
  33092. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  33093. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  33094. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  33095. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33096. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  33097. $core.addPackage("Compiler-Core");
  33098. $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  33099. $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33100. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  33101. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  33102. $core.addMethod(
  33103. $core.method({
  33104. selector: "compileNode:",
  33105. protocol: "compiling",
  33106. fn: function (aNode){
  33107. var self=this,$self=this;
  33108. return $core.withContext(function($ctx1) {
  33109. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  33110. return $core.withContext(function($ctx2) {
  33111. return $recv(transformer)._value_(input);
  33112. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  33113. }));
  33114. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  33115. },
  33116. args: ["aNode"],
  33117. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  33118. referencedClasses: [],
  33119. messageSends: ["inject:into:", "transformers", "value:"]
  33120. }),
  33121. $globals.AbstractCodeGenerator);
  33122. $core.addMethod(
  33123. $core.method({
  33124. selector: "currentClass",
  33125. protocol: "accessing",
  33126. fn: function (){
  33127. var self=this,$self=this;
  33128. return $self["@currentClass"];
  33129. },
  33130. args: [],
  33131. source: "currentClass\x0a\x09^ currentClass",
  33132. referencedClasses: [],
  33133. messageSends: []
  33134. }),
  33135. $globals.AbstractCodeGenerator);
  33136. $core.addMethod(
  33137. $core.method({
  33138. selector: "currentClass:",
  33139. protocol: "accessing",
  33140. fn: function (aClass){
  33141. var self=this,$self=this;
  33142. $self["@currentClass"]=aClass;
  33143. return self;
  33144. },
  33145. args: ["aClass"],
  33146. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  33147. referencedClasses: [],
  33148. messageSends: []
  33149. }),
  33150. $globals.AbstractCodeGenerator);
  33151. $core.addMethod(
  33152. $core.method({
  33153. selector: "currentPackage",
  33154. protocol: "accessing",
  33155. fn: function (){
  33156. var self=this,$self=this;
  33157. return $self["@currentPackage"];
  33158. },
  33159. args: [],
  33160. source: "currentPackage\x0a\x09^ currentPackage",
  33161. referencedClasses: [],
  33162. messageSends: []
  33163. }),
  33164. $globals.AbstractCodeGenerator);
  33165. $core.addMethod(
  33166. $core.method({
  33167. selector: "currentPackage:",
  33168. protocol: "accessing",
  33169. fn: function (anObject){
  33170. var self=this,$self=this;
  33171. $self["@currentPackage"]=anObject;
  33172. return self;
  33173. },
  33174. args: ["anObject"],
  33175. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  33176. referencedClasses: [],
  33177. messageSends: []
  33178. }),
  33179. $globals.AbstractCodeGenerator);
  33180. $core.addMethod(
  33181. $core.method({
  33182. selector: "pseudoVariables",
  33183. protocol: "accessing",
  33184. fn: function (){
  33185. var self=this,$self=this;
  33186. return $core.withContext(function($ctx1) {
  33187. return $recv($globals.Smalltalk)._pseudoVariableNames();
  33188. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  33189. },
  33190. args: [],
  33191. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  33192. referencedClasses: ["Smalltalk"],
  33193. messageSends: ["pseudoVariableNames"]
  33194. }),
  33195. $globals.AbstractCodeGenerator);
  33196. $core.addMethod(
  33197. $core.method({
  33198. selector: "source",
  33199. protocol: "accessing",
  33200. fn: function (){
  33201. var self=this,$self=this;
  33202. return $core.withContext(function($ctx1) {
  33203. var $1,$receiver;
  33204. $1=$self["@source"];
  33205. if(($receiver = $1) == null || $receiver.a$nil){
  33206. return "";
  33207. } else {
  33208. return $1;
  33209. }
  33210. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  33211. },
  33212. args: [],
  33213. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33214. referencedClasses: [],
  33215. messageSends: ["ifNil:"]
  33216. }),
  33217. $globals.AbstractCodeGenerator);
  33218. $core.addMethod(
  33219. $core.method({
  33220. selector: "source:",
  33221. protocol: "accessing",
  33222. fn: function (aString){
  33223. var self=this,$self=this;
  33224. $self["@source"]=aString;
  33225. return self;
  33226. },
  33227. args: ["aString"],
  33228. source: "source: aString\x0a\x09source := aString",
  33229. referencedClasses: [],
  33230. messageSends: []
  33231. }),
  33232. $globals.AbstractCodeGenerator);
  33233. $core.addMethod(
  33234. $core.method({
  33235. selector: "transformers",
  33236. protocol: "compiling",
  33237. fn: function (){
  33238. var self=this,$self=this;
  33239. var dict;
  33240. return $core.withContext(function($ctx1) {
  33241. dict=$self._transformersDictionary();
  33242. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  33243. return $core.withContext(function($ctx2) {
  33244. return $recv(dict)._at_(each);
  33245. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33246. }));
  33247. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  33248. },
  33249. args: [],
  33250. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  33251. referencedClasses: [],
  33252. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  33253. }),
  33254. $globals.AbstractCodeGenerator);
  33255. $core.addMethod(
  33256. $core.method({
  33257. selector: "transformersDictionary",
  33258. protocol: "compiling",
  33259. fn: function (){
  33260. var self=this,$self=this;
  33261. return $core.withContext(function($ctx1) {
  33262. $self._subclassResponsibility();
  33263. return self;
  33264. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  33265. },
  33266. args: [],
  33267. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  33268. referencedClasses: [],
  33269. messageSends: ["subclassResponsibility"]
  33270. }),
  33271. $globals.AbstractCodeGenerator);
  33272. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  33273. $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.";
  33274. $core.addMethod(
  33275. $core.method({
  33276. selector: "irTranslator",
  33277. protocol: "compiling",
  33278. fn: function (){
  33279. var self=this,$self=this;
  33280. return $core.withContext(function($ctx1) {
  33281. var $1;
  33282. $1=$recv($self._irTranslatorClass())._new();
  33283. $recv($1)._currentClass_($self._currentClass());
  33284. return $recv($1)._yourself();
  33285. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  33286. },
  33287. args: [],
  33288. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  33289. referencedClasses: [],
  33290. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  33291. }),
  33292. $globals.CodeGenerator);
  33293. $core.addMethod(
  33294. $core.method({
  33295. selector: "irTranslatorClass",
  33296. protocol: "compiling",
  33297. fn: function (){
  33298. var self=this,$self=this;
  33299. return $globals.IRJSTranslator;
  33300. },
  33301. args: [],
  33302. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  33303. referencedClasses: ["IRJSTranslator"],
  33304. messageSends: []
  33305. }),
  33306. $globals.CodeGenerator);
  33307. $core.addMethod(
  33308. $core.method({
  33309. selector: "semanticAnalyzer",
  33310. protocol: "compiling",
  33311. fn: function (){
  33312. var self=this,$self=this;
  33313. return $core.withContext(function($ctx1) {
  33314. var $1;
  33315. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  33316. $recv($1)._thePackage_($self._currentPackage());
  33317. return $recv($1)._yourself();
  33318. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  33319. },
  33320. args: [],
  33321. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  33322. referencedClasses: ["SemanticAnalyzer"],
  33323. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  33324. }),
  33325. $globals.CodeGenerator);
  33326. $core.addMethod(
  33327. $core.method({
  33328. selector: "transformersDictionary",
  33329. protocol: "compiling",
  33330. fn: function (){
  33331. var self=this,$self=this;
  33332. return $core.withContext(function($ctx1) {
  33333. var $1,$2,$receiver;
  33334. $1=$self["@transformersDictionary"];
  33335. if(($receiver = $1) == null || $receiver.a$nil){
  33336. $2=$recv($globals.Dictionary)._new();
  33337. $recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer());
  33338. $ctx1.sendIdx["at:put:"]=1;
  33339. $recv($2)._at_put_("5000-astToIr",$self._translator());
  33340. $ctx1.sendIdx["at:put:"]=2;
  33341. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  33342. $self["@transformersDictionary"]=$recv($2)._yourself();
  33343. return $self["@transformersDictionary"];
  33344. } else {
  33345. return $1;
  33346. }
  33347. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  33348. },
  33349. args: [],
  33350. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary new\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  33351. referencedClasses: ["Dictionary"],
  33352. messageSends: ["ifNil:", "at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  33353. }),
  33354. $globals.CodeGenerator);
  33355. $core.addMethod(
  33356. $core.method({
  33357. selector: "translator",
  33358. protocol: "compiling",
  33359. fn: function (){
  33360. var self=this,$self=this;
  33361. return $core.withContext(function($ctx1) {
  33362. var $1;
  33363. $1=$recv($globals.IRASTTranslator)._new();
  33364. $recv($1)._source_($self._source());
  33365. $recv($1)._theClass_($self._currentClass());
  33366. return $recv($1)._yourself();
  33367. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  33368. },
  33369. args: [],
  33370. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  33371. referencedClasses: ["IRASTTranslator"],
  33372. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  33373. }),
  33374. $globals.CodeGenerator);
  33375. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "codeGeneratorClass"], "Compiler-Core");
  33376. $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`";
  33377. $core.addMethod(
  33378. $core.method({
  33379. selector: "codeGeneratorClass",
  33380. protocol: "accessing",
  33381. fn: function (){
  33382. var self=this,$self=this;
  33383. return $core.withContext(function($ctx1) {
  33384. var $1,$receiver;
  33385. $1=$self["@codeGeneratorClass"];
  33386. if(($receiver = $1) == null || $receiver.a$nil){
  33387. return $globals.InliningCodeGenerator;
  33388. } else {
  33389. return $1;
  33390. }
  33391. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  33392. },
  33393. args: [],
  33394. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  33395. referencedClasses: ["InliningCodeGenerator"],
  33396. messageSends: ["ifNil:"]
  33397. }),
  33398. $globals.Compiler);
  33399. $core.addMethod(
  33400. $core.method({
  33401. selector: "codeGeneratorClass:",
  33402. protocol: "accessing",
  33403. fn: function (aClass){
  33404. var self=this,$self=this;
  33405. $self["@codeGeneratorClass"]=aClass;
  33406. return self;
  33407. },
  33408. args: ["aClass"],
  33409. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  33410. referencedClasses: [],
  33411. messageSends: []
  33412. }),
  33413. $globals.Compiler);
  33414. $core.addMethod(
  33415. $core.method({
  33416. selector: "compile:forClass:protocol:",
  33417. protocol: "compiling",
  33418. fn: function (aString,aClass,anotherString){
  33419. var self=this,$self=this;
  33420. return $core.withContext(function($ctx1) {
  33421. $self._source_(aString);
  33422. return $self._compileNode_forClass_package_($self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  33423. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  33424. },
  33425. args: ["aString", "aClass", "anotherString"],
  33426. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09compileNode: (self parse: aString)\x0a\x09\x09forClass: aClass\x0a\x09\x09package: (aClass packageOfProtocol: anotherString)",
  33427. referencedClasses: [],
  33428. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  33429. }),
  33430. $globals.Compiler);
  33431. $core.addMethod(
  33432. $core.method({
  33433. selector: "compileExpression:on:",
  33434. protocol: "compiling",
  33435. fn: function (aString,anObject){
  33436. var self=this,$self=this;
  33437. return $core.withContext(function($ctx1) {
  33438. var $1;
  33439. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  33440. $ctx1.sendIdx[","]=1;
  33441. return $self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  33442. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  33443. },
  33444. args: ["aString", "anObject"],
  33445. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  33446. referencedClasses: [],
  33447. messageSends: ["compile:forClass:protocol:", ",", "class"]
  33448. }),
  33449. $globals.Compiler);
  33450. $core.addMethod(
  33451. $core.method({
  33452. selector: "compileNode:",
  33453. protocol: "compiling",
  33454. fn: function (aNode){
  33455. var self=this,$self=this;
  33456. var generator,result;
  33457. return $core.withContext(function($ctx1) {
  33458. var $1;
  33459. generator=$recv($self._codeGeneratorClass())._new();
  33460. $1=generator;
  33461. $recv($1)._source_($self._source());
  33462. $recv($1)._currentClass_($self._currentClass());
  33463. $recv($1)._currentPackage_($self._currentPackage());
  33464. result=$recv(generator)._compileNode_(aNode);
  33465. return result;
  33466. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  33467. },
  33468. args: ["aNode"],
  33469. source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09currentPackage: self currentPackage.\x0a\x09result := generator compileNode: aNode.\x0a\x09^ result",
  33470. referencedClasses: [],
  33471. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:"]
  33472. }),
  33473. $globals.Compiler);
  33474. $core.addMethod(
  33475. $core.method({
  33476. selector: "compileNode:forClass:package:",
  33477. protocol: "compiling",
  33478. fn: function (aNode,aClass,aPackage){
  33479. var self=this,$self=this;
  33480. return $core.withContext(function($ctx1) {
  33481. $self._currentClass_(aClass);
  33482. $self._currentPackage_(aPackage);
  33483. return $self._compileNode_(aNode);
  33484. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  33485. },
  33486. args: ["aNode", "aClass", "aPackage"],
  33487. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  33488. referencedClasses: [],
  33489. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  33490. }),
  33491. $globals.Compiler);
  33492. $core.addMethod(
  33493. $core.method({
  33494. selector: "currentClass",
  33495. protocol: "accessing",
  33496. fn: function (){
  33497. var self=this,$self=this;
  33498. return $self["@currentClass"];
  33499. },
  33500. args: [],
  33501. source: "currentClass\x0a\x09^ currentClass",
  33502. referencedClasses: [],
  33503. messageSends: []
  33504. }),
  33505. $globals.Compiler);
  33506. $core.addMethod(
  33507. $core.method({
  33508. selector: "currentClass:",
  33509. protocol: "accessing",
  33510. fn: function (aClass){
  33511. var self=this,$self=this;
  33512. $self["@currentClass"]=aClass;
  33513. return self;
  33514. },
  33515. args: ["aClass"],
  33516. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  33517. referencedClasses: [],
  33518. messageSends: []
  33519. }),
  33520. $globals.Compiler);
  33521. $core.addMethod(
  33522. $core.method({
  33523. selector: "currentPackage",
  33524. protocol: "accessing",
  33525. fn: function (){
  33526. var self=this,$self=this;
  33527. return $self["@currentPackage"];
  33528. },
  33529. args: [],
  33530. source: "currentPackage\x0a\x09^ currentPackage",
  33531. referencedClasses: [],
  33532. messageSends: []
  33533. }),
  33534. $globals.Compiler);
  33535. $core.addMethod(
  33536. $core.method({
  33537. selector: "currentPackage:",
  33538. protocol: "accessing",
  33539. fn: function (anObject){
  33540. var self=this,$self=this;
  33541. $self["@currentPackage"]=anObject;
  33542. return self;
  33543. },
  33544. args: ["anObject"],
  33545. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  33546. referencedClasses: [],
  33547. messageSends: []
  33548. }),
  33549. $globals.Compiler);
  33550. $core.addMethod(
  33551. $core.method({
  33552. selector: "eval:",
  33553. protocol: "compiling",
  33554. fn: function (aString){
  33555. var self=this,$self=this;
  33556. return $core.withContext(function($ctx1) {
  33557. return eval(aString);
  33558. return self;
  33559. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  33560. },
  33561. args: ["aString"],
  33562. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  33563. referencedClasses: [],
  33564. messageSends: []
  33565. }),
  33566. $globals.Compiler);
  33567. $core.addMethod(
  33568. $core.method({
  33569. selector: "eval:forPackage:",
  33570. protocol: "compiling",
  33571. fn: function (aString,aPackage){
  33572. var self=this,$self=this;
  33573. return $core.withContext(function($ctx1) {
  33574. var $receiver;
  33575. if(($receiver = aPackage) == null || $receiver.a$nil){
  33576. return $self._eval_(aString);
  33577. $ctx1.sendIdx["eval:"]=1;
  33578. } else {
  33579. return $recv(aPackage)._eval_(aString);
  33580. }
  33581. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  33582. },
  33583. args: ["aString", "aPackage"],
  33584. source: "eval: aString forPackage: aPackage\x0a\x09^ aPackage\x0a\x09\x09ifNil: [ self eval: aString ]\x0a\x09\x09ifNotNil: [ aPackage eval: aString ]",
  33585. referencedClasses: [],
  33586. messageSends: ["ifNil:ifNotNil:", "eval:"]
  33587. }),
  33588. $globals.Compiler);
  33589. $core.addMethod(
  33590. $core.method({
  33591. selector: "evaluateExpression:",
  33592. protocol: "compiling",
  33593. fn: function (aString){
  33594. var self=this,$self=this;
  33595. return $core.withContext(function($ctx1) {
  33596. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  33597. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  33598. },
  33599. args: ["aString"],
  33600. 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",
  33601. referencedClasses: ["DoIt"],
  33602. messageSends: ["evaluateExpression:on:", "new"]
  33603. }),
  33604. $globals.Compiler);
  33605. $core.addMethod(
  33606. $core.method({
  33607. selector: "evaluateExpression:on:",
  33608. protocol: "compiling",
  33609. fn: function (aString,anObject){
  33610. var self=this,$self=this;
  33611. var result,method;
  33612. return $core.withContext(function($ctx1) {
  33613. var $1;
  33614. method=$self._eval_($self._compileExpression_on_(aString,anObject));
  33615. $recv(method)._protocol_("**xxxDoIt");
  33616. $1=$recv(anObject)._class();
  33617. $ctx1.sendIdx["class"]=1;
  33618. $recv($1)._addCompiledMethod_(method);
  33619. result=$recv(anObject)._xxxDoIt();
  33620. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  33621. return result;
  33622. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  33623. },
  33624. args: ["aString", "anObject"],
  33625. 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",
  33626. referencedClasses: [],
  33627. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  33628. }),
  33629. $globals.Compiler);
  33630. $core.addMethod(
  33631. $core.method({
  33632. selector: "install:forClass:protocol:",
  33633. protocol: "compiling",
  33634. fn: function (aString,aBehavior,anotherString){
  33635. var self=this,$self=this;
  33636. var compiledMethod;
  33637. return $core.withContext(function($ctx1) {
  33638. compiledMethod=$self._eval_forPackage_($self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  33639. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  33640. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  33641. },
  33642. args: ["aString", "aBehavior", "anotherString"],
  33643. 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",
  33644. referencedClasses: ["ClassBuilder"],
  33645. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  33646. }),
  33647. $globals.Compiler);
  33648. $core.addMethod(
  33649. $core.method({
  33650. selector: "parse:",
  33651. protocol: "compiling",
  33652. fn: function (aString){
  33653. var self=this,$self=this;
  33654. return $core.withContext(function($ctx1) {
  33655. return $recv($globals.Smalltalk)._parse_(aString);
  33656. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  33657. },
  33658. args: ["aString"],
  33659. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  33660. referencedClasses: ["Smalltalk"],
  33661. messageSends: ["parse:"]
  33662. }),
  33663. $globals.Compiler);
  33664. $core.addMethod(
  33665. $core.method({
  33666. selector: "parseExpression:",
  33667. protocol: "compiling",
  33668. fn: function (aString){
  33669. var self=this,$self=this;
  33670. return $core.withContext(function($ctx1) {
  33671. var $1;
  33672. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  33673. $ctx1.sendIdx[","]=1;
  33674. return $self._parse_($1);
  33675. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  33676. },
  33677. args: ["aString"],
  33678. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  33679. referencedClasses: [],
  33680. messageSends: ["parse:", ","]
  33681. }),
  33682. $globals.Compiler);
  33683. $core.addMethod(
  33684. $core.method({
  33685. selector: "recompile:",
  33686. protocol: "compiling",
  33687. fn: function (aClass){
  33688. var self=this,$self=this;
  33689. return $core.withContext(function($ctx1) {
  33690. var $1,$2,$3,$receiver;
  33691. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  33692. return $core.withContext(function($ctx2) {
  33693. $1=$recv($recv(each)._methodClass()).__eq(aClass);
  33694. $ctx2.sendIdx["="]=1;
  33695. if($core.assert($1)){
  33696. return $self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  33697. }
  33698. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33699. }),"Recompiling ".__comma($recv(aClass)._name()));
  33700. $2=$recv(aClass)._theMetaClass();
  33701. if(($receiver = $2) == null || $receiver.a$nil){
  33702. $2;
  33703. } else {
  33704. var meta;
  33705. meta=$receiver;
  33706. $3=$recv(meta).__eq(aClass);
  33707. if(!$core.assert($3)){
  33708. $self._recompile_(meta);
  33709. }
  33710. }
  33711. return self;
  33712. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  33713. },
  33714. args: ["aClass"],
  33715. 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 ] ]",
  33716. referencedClasses: [],
  33717. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
  33718. }),
  33719. $globals.Compiler);
  33720. $core.addMethod(
  33721. $core.method({
  33722. selector: "recompileAll",
  33723. protocol: "compiling",
  33724. fn: function (){
  33725. var self=this,$self=this;
  33726. return $core.withContext(function($ctx1) {
  33727. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  33728. return $core.withContext(function($ctx2) {
  33729. return $self._recompile_(each);
  33730. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33731. }),"Compiling all classes...");
  33732. return self;
  33733. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  33734. },
  33735. args: [],
  33736. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  33737. referencedClasses: ["Smalltalk"],
  33738. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  33739. }),
  33740. $globals.Compiler);
  33741. $core.addMethod(
  33742. $core.method({
  33743. selector: "source",
  33744. protocol: "accessing",
  33745. fn: function (){
  33746. var self=this,$self=this;
  33747. return $core.withContext(function($ctx1) {
  33748. var $1,$receiver;
  33749. $1=$self["@source"];
  33750. if(($receiver = $1) == null || $receiver.a$nil){
  33751. return "";
  33752. } else {
  33753. return $1;
  33754. }
  33755. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  33756. },
  33757. args: [],
  33758. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33759. referencedClasses: [],
  33760. messageSends: ["ifNil:"]
  33761. }),
  33762. $globals.Compiler);
  33763. $core.addMethod(
  33764. $core.method({
  33765. selector: "source:",
  33766. protocol: "accessing",
  33767. fn: function (aString){
  33768. var self=this,$self=this;
  33769. $self["@source"]=aString;
  33770. return self;
  33771. },
  33772. args: ["aString"],
  33773. source: "source: aString\x0a\x09source := aString",
  33774. referencedClasses: [],
  33775. messageSends: []
  33776. }),
  33777. $globals.Compiler);
  33778. $core.addMethod(
  33779. $core.method({
  33780. selector: "eval:",
  33781. protocol: "evaluating",
  33782. fn: function (aString){
  33783. var self=this,$self=this;
  33784. return $core.withContext(function($ctx1) {
  33785. return $recv($self._new())._eval_(aString);
  33786. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler.a$cls)});
  33787. },
  33788. args: ["aString"],
  33789. source: "eval: aString\x0a\x09^ self new eval: aString",
  33790. referencedClasses: [],
  33791. messageSends: ["eval:", "new"]
  33792. }),
  33793. $globals.Compiler.a$cls);
  33794. $core.addMethod(
  33795. $core.method({
  33796. selector: "recompile:",
  33797. protocol: "compiling",
  33798. fn: function (aClass){
  33799. var self=this,$self=this;
  33800. return $core.withContext(function($ctx1) {
  33801. $recv($self._new())._recompile_(aClass);
  33802. return self;
  33803. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.a$cls)});
  33804. },
  33805. args: ["aClass"],
  33806. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  33807. referencedClasses: [],
  33808. messageSends: ["recompile:", "new"]
  33809. }),
  33810. $globals.Compiler.a$cls);
  33811. $core.addMethod(
  33812. $core.method({
  33813. selector: "recompileAll",
  33814. protocol: "compiling",
  33815. fn: function (){
  33816. var self=this,$self=this;
  33817. return $core.withContext(function($ctx1) {
  33818. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  33819. return $core.withContext(function($ctx2) {
  33820. return $self._recompile_(each);
  33821. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33822. }));
  33823. return self;
  33824. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.a$cls)});
  33825. },
  33826. args: [],
  33827. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  33828. referencedClasses: ["Smalltalk"],
  33829. messageSends: ["do:", "classes", "recompile:"]
  33830. }),
  33831. $globals.Compiler.a$cls);
  33832. $core.addClass("CompilerError", $globals.Error, [], "Compiler-Core");
  33833. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  33834. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  33835. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  33836. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  33837. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  33838. $core.addMethod(
  33839. $core.method({
  33840. selector: "evaluate:context:",
  33841. protocol: "evaluating",
  33842. fn: function (aString,aContext){
  33843. var self=this,$self=this;
  33844. var compiler,ast;
  33845. return $core.withContext(function($ctx1) {
  33846. var $1;
  33847. var $early={};
  33848. try {
  33849. compiler=$recv($globals.Compiler)._new();
  33850. $recv((function(){
  33851. return $core.withContext(function($ctx2) {
  33852. ast=$recv(compiler)._parseExpression_(aString);
  33853. return ast;
  33854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33855. }))._on_do_($globals.Error,(function(ex){
  33856. return $core.withContext(function($ctx2) {
  33857. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  33858. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  33859. }));
  33860. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  33861. $recv($1)._context_(aContext);
  33862. $recv($1)._visit_(ast);
  33863. return $recv(aContext)._evaluateNode_(ast);
  33864. }
  33865. catch(e) {if(e===$early)return e[0]; throw e}
  33866. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  33867. },
  33868. args: ["aString", "aContext"],
  33869. 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",
  33870. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  33871. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  33872. }),
  33873. $globals.Evaluator);
  33874. $core.addMethod(
  33875. $core.method({
  33876. selector: "evaluate:for:",
  33877. protocol: "evaluating",
  33878. fn: function (aString,anObject){
  33879. var self=this,$self=this;
  33880. return $core.withContext(function($ctx1) {
  33881. return $recv(anObject)._evaluate_on_(aString,self);
  33882. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  33883. },
  33884. args: ["aString", "anObject"],
  33885. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  33886. referencedClasses: [],
  33887. messageSends: ["evaluate:on:"]
  33888. }),
  33889. $globals.Evaluator);
  33890. $core.addMethod(
  33891. $core.method({
  33892. selector: "evaluate:receiver:",
  33893. protocol: "evaluating",
  33894. fn: function (aString,anObject){
  33895. var self=this,$self=this;
  33896. var compiler;
  33897. return $core.withContext(function($ctx1) {
  33898. var $early={};
  33899. try {
  33900. compiler=$recv($globals.Compiler)._new();
  33901. $recv((function(){
  33902. return $core.withContext(function($ctx2) {
  33903. return $recv(compiler)._parseExpression_(aString);
  33904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33905. }))._on_do_($globals.Error,(function(ex){
  33906. return $core.withContext(function($ctx2) {
  33907. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  33908. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  33909. }));
  33910. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  33911. }
  33912. catch(e) {if(e===$early)return e[0]; throw e}
  33913. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  33914. },
  33915. args: ["aString", "anObject"],
  33916. 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",
  33917. referencedClasses: ["Compiler", "Error", "Terminal"],
  33918. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  33919. }),
  33920. $globals.Evaluator);
  33921. $core.addMethod(
  33922. $core.method({
  33923. selector: "evaluate:for:",
  33924. protocol: "instance creation",
  33925. fn: function (aString,anObject){
  33926. var self=this,$self=this;
  33927. return $core.withContext(function($ctx1) {
  33928. return $recv($self._new())._evaluate_for_(aString,anObject);
  33929. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.a$cls)});
  33930. },
  33931. args: ["aString", "anObject"],
  33932. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  33933. referencedClasses: [],
  33934. messageSends: ["evaluate:for:", "new"]
  33935. }),
  33936. $globals.Evaluator.a$cls);
  33937. $core.addMethod(
  33938. $core.method({
  33939. selector: "asVariableName",
  33940. protocol: "*Compiler-Core",
  33941. fn: function (){
  33942. var self=this,$self=this;
  33943. return $core.withContext(function($ctx1) {
  33944. var $1;
  33945. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  33946. if($core.assert($1)){
  33947. return $self.__comma("_");
  33948. } else {
  33949. return self;
  33950. }
  33951. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  33952. },
  33953. args: [],
  33954. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  33955. referencedClasses: ["Smalltalk"],
  33956. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  33957. }),
  33958. $globals.String);
  33959. });
  33960. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Methods"], function($boot){"use strict";
  33961. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  33962. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  33963. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33964. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  33965. $core.addPackage("Compiler-AST");
  33966. $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  33967. $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33968. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  33969. $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.";
  33970. $core.addMethod(
  33971. $core.method({
  33972. selector: "inPosition:",
  33973. protocol: "testing",
  33974. fn: function (aPoint){
  33975. var self=this,$self=this;
  33976. return $core.withContext(function($ctx1) {
  33977. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  33978. return $core.withContext(function($ctx2) {
  33979. return $recv($self._positionEnd()).__gt_eq(aPoint);
  33980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33981. }));
  33982. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  33983. },
  33984. args: ["aPoint"],
  33985. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  33986. referencedClasses: [],
  33987. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  33988. }),
  33989. $globals.ASTNode);
  33990. $core.addMethod(
  33991. $core.method({
  33992. selector: "isAssignmentNode",
  33993. protocol: "testing",
  33994. fn: function (){
  33995. var self=this,$self=this;
  33996. return false;
  33997. },
  33998. args: [],
  33999. source: "isAssignmentNode\x0a\x09^ false",
  34000. referencedClasses: [],
  34001. messageSends: []
  34002. }),
  34003. $globals.ASTNode);
  34004. $core.addMethod(
  34005. $core.method({
  34006. selector: "isBlockNode",
  34007. protocol: "testing",
  34008. fn: function (){
  34009. var self=this,$self=this;
  34010. return false;
  34011. },
  34012. args: [],
  34013. source: "isBlockNode\x0a\x09^ false",
  34014. referencedClasses: [],
  34015. messageSends: []
  34016. }),
  34017. $globals.ASTNode);
  34018. $core.addMethod(
  34019. $core.method({
  34020. selector: "isBlockSequenceNode",
  34021. protocol: "testing",
  34022. fn: function (){
  34023. var self=this,$self=this;
  34024. return false;
  34025. },
  34026. args: [],
  34027. source: "isBlockSequenceNode\x0a\x09^ false",
  34028. referencedClasses: [],
  34029. messageSends: []
  34030. }),
  34031. $globals.ASTNode);
  34032. $core.addMethod(
  34033. $core.method({
  34034. selector: "isCascadeNode",
  34035. protocol: "testing",
  34036. fn: function (){
  34037. var self=this,$self=this;
  34038. return false;
  34039. },
  34040. args: [],
  34041. source: "isCascadeNode\x0a\x09^ false",
  34042. referencedClasses: [],
  34043. messageSends: []
  34044. }),
  34045. $globals.ASTNode);
  34046. $core.addMethod(
  34047. $core.method({
  34048. selector: "isImmutable",
  34049. protocol: "testing",
  34050. fn: function (){
  34051. var self=this,$self=this;
  34052. return false;
  34053. },
  34054. args: [],
  34055. source: "isImmutable\x0a\x09^ false",
  34056. referencedClasses: [],
  34057. messageSends: []
  34058. }),
  34059. $globals.ASTNode);
  34060. $core.addMethod(
  34061. $core.method({
  34062. selector: "isJSStatementNode",
  34063. protocol: "testing",
  34064. fn: function (){
  34065. var self=this,$self=this;
  34066. return false;
  34067. },
  34068. args: [],
  34069. source: "isJSStatementNode\x0a\x09^ false",
  34070. referencedClasses: [],
  34071. messageSends: []
  34072. }),
  34073. $globals.ASTNode);
  34074. $core.addMethod(
  34075. $core.method({
  34076. selector: "isNavigationNode",
  34077. protocol: "testing",
  34078. fn: function (){
  34079. var self=this,$self=this;
  34080. return false;
  34081. },
  34082. args: [],
  34083. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  34084. referencedClasses: [],
  34085. messageSends: []
  34086. }),
  34087. $globals.ASTNode);
  34088. $core.addMethod(
  34089. $core.method({
  34090. selector: "isReturnNode",
  34091. protocol: "testing",
  34092. fn: function (){
  34093. var self=this,$self=this;
  34094. return false;
  34095. },
  34096. args: [],
  34097. source: "isReturnNode\x0a\x09^ false",
  34098. referencedClasses: [],
  34099. messageSends: []
  34100. }),
  34101. $globals.ASTNode);
  34102. $core.addMethod(
  34103. $core.method({
  34104. selector: "isSendNode",
  34105. protocol: "testing",
  34106. fn: function (){
  34107. var self=this,$self=this;
  34108. return false;
  34109. },
  34110. args: [],
  34111. source: "isSendNode\x0a\x09^ false",
  34112. referencedClasses: [],
  34113. messageSends: []
  34114. }),
  34115. $globals.ASTNode);
  34116. $core.addMethod(
  34117. $core.method({
  34118. selector: "isSequenceNode",
  34119. protocol: "testing",
  34120. fn: function (){
  34121. var self=this,$self=this;
  34122. return false;
  34123. },
  34124. args: [],
  34125. source: "isSequenceNode\x0a\x09^ false",
  34126. referencedClasses: [],
  34127. messageSends: []
  34128. }),
  34129. $globals.ASTNode);
  34130. $core.addMethod(
  34131. $core.method({
  34132. selector: "isSuperKeyword",
  34133. protocol: "testing",
  34134. fn: function (){
  34135. var self=this,$self=this;
  34136. return false;
  34137. },
  34138. args: [],
  34139. source: "isSuperKeyword\x0a\x09^ false",
  34140. referencedClasses: [],
  34141. messageSends: []
  34142. }),
  34143. $globals.ASTNode);
  34144. $core.addMethod(
  34145. $core.method({
  34146. selector: "isValueNode",
  34147. protocol: "testing",
  34148. fn: function (){
  34149. var self=this,$self=this;
  34150. return false;
  34151. },
  34152. args: [],
  34153. source: "isValueNode\x0a\x09^ false",
  34154. referencedClasses: [],
  34155. messageSends: []
  34156. }),
  34157. $globals.ASTNode);
  34158. $core.addMethod(
  34159. $core.method({
  34160. selector: "isVariableNode",
  34161. protocol: "testing",
  34162. fn: function (){
  34163. var self=this,$self=this;
  34164. return false;
  34165. },
  34166. args: [],
  34167. source: "isVariableNode\x0a\x09^ false",
  34168. referencedClasses: [],
  34169. messageSends: []
  34170. }),
  34171. $globals.ASTNode);
  34172. $core.addMethod(
  34173. $core.method({
  34174. selector: "location:",
  34175. protocol: "accessing",
  34176. fn: function (aLocation){
  34177. var self=this,$self=this;
  34178. return $core.withContext(function($ctx1) {
  34179. var $3,$2,$1;
  34180. $3=$recv(aLocation)._start();
  34181. $ctx1.sendIdx["start"]=1;
  34182. $2=$recv($3)._line();
  34183. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  34184. $self._position_($1);
  34185. return self;
  34186. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  34187. },
  34188. args: ["aLocation"],
  34189. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  34190. referencedClasses: [],
  34191. messageSends: ["position:", "@", "line", "start", "column"]
  34192. }),
  34193. $globals.ASTNode);
  34194. $core.addMethod(
  34195. $core.method({
  34196. selector: "method",
  34197. protocol: "accessing",
  34198. fn: function (){
  34199. var self=this,$self=this;
  34200. return $core.withContext(function($ctx1) {
  34201. var $1,$receiver;
  34202. $1=$self._parent();
  34203. if(($receiver = $1) == null || $receiver.a$nil){
  34204. return $1;
  34205. } else {
  34206. var node;
  34207. node=$receiver;
  34208. return $recv(node)._method();
  34209. }
  34210. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  34211. },
  34212. args: [],
  34213. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  34214. referencedClasses: [],
  34215. messageSends: ["ifNotNil:", "parent", "method"]
  34216. }),
  34217. $globals.ASTNode);
  34218. $core.addMethod(
  34219. $core.method({
  34220. selector: "navigationNodeAt:ifAbsent:",
  34221. protocol: "accessing",
  34222. fn: function (aPoint,aBlock){
  34223. var self=this,$self=this;
  34224. var children;
  34225. return $core.withContext(function($ctx1) {
  34226. var $2,$1;
  34227. var $early={};
  34228. try {
  34229. children=$recv($self._allDagChildren())._select_((function(each){
  34230. return $core.withContext(function($ctx2) {
  34231. return $recv($recv(each)._isNavigationNode())._and_((function(){
  34232. return $core.withContext(function($ctx3) {
  34233. return $recv(each)._inPosition_(aPoint);
  34234. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  34235. }));
  34236. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34237. }));
  34238. $recv(children)._ifEmpty_((function(){
  34239. return $core.withContext(function($ctx2) {
  34240. throw $early=[$recv(aBlock)._value()];
  34241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  34242. }));
  34243. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  34244. return $core.withContext(function($ctx2) {
  34245. $2=$recv(a)._positionStart();
  34246. $ctx2.sendIdx["positionStart"]=1;
  34247. $1=$recv($2)._dist_(aPoint);
  34248. $ctx2.sendIdx["dist:"]=1;
  34249. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  34250. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  34251. })))._first();
  34252. }
  34253. catch(e) {if(e===$early)return e[0]; throw e}
  34254. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  34255. },
  34256. args: ["aPoint", "aBlock"],
  34257. 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",
  34258. referencedClasses: [],
  34259. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  34260. }),
  34261. $globals.ASTNode);
  34262. $core.addMethod(
  34263. $core.method({
  34264. selector: "parent",
  34265. protocol: "accessing",
  34266. fn: function (){
  34267. var self=this,$self=this;
  34268. return $self["@parent"];
  34269. },
  34270. args: [],
  34271. source: "parent\x0a\x09^ parent",
  34272. referencedClasses: [],
  34273. messageSends: []
  34274. }),
  34275. $globals.ASTNode);
  34276. $core.addMethod(
  34277. $core.method({
  34278. selector: "parent:",
  34279. protocol: "accessing",
  34280. fn: function (aNode){
  34281. var self=this,$self=this;
  34282. $self["@parent"]=aNode;
  34283. return self;
  34284. },
  34285. args: ["aNode"],
  34286. source: "parent: aNode\x0a\x09parent := aNode",
  34287. referencedClasses: [],
  34288. messageSends: []
  34289. }),
  34290. $globals.ASTNode);
  34291. $core.addMethod(
  34292. $core.method({
  34293. selector: "position",
  34294. protocol: "accessing",
  34295. fn: function (){
  34296. var self=this,$self=this;
  34297. return $core.withContext(function($ctx1) {
  34298. var $1,$2,$receiver;
  34299. $1=$self["@position"];
  34300. if(($receiver = $1) == null || $receiver.a$nil){
  34301. $2=$self._parent();
  34302. if(($receiver = $2) == null || $receiver.a$nil){
  34303. return $2;
  34304. } else {
  34305. var node;
  34306. node=$receiver;
  34307. return $recv(node)._position();
  34308. }
  34309. } else {
  34310. return $1;
  34311. }
  34312. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  34313. },
  34314. args: [],
  34315. 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 ] ]",
  34316. referencedClasses: [],
  34317. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  34318. }),
  34319. $globals.ASTNode);
  34320. $core.addMethod(
  34321. $core.method({
  34322. selector: "position:",
  34323. protocol: "accessing",
  34324. fn: function (aPosition){
  34325. var self=this,$self=this;
  34326. $self["@position"]=aPosition;
  34327. return self;
  34328. },
  34329. args: ["aPosition"],
  34330. source: "position: aPosition\x0a\x09position := aPosition",
  34331. referencedClasses: [],
  34332. messageSends: []
  34333. }),
  34334. $globals.ASTNode);
  34335. $core.addMethod(
  34336. $core.method({
  34337. selector: "positionEnd",
  34338. protocol: "accessing",
  34339. fn: function (){
  34340. var self=this,$self=this;
  34341. return $core.withContext(function($ctx1) {
  34342. var $1,$6,$5,$4,$3,$2;
  34343. $1=$self._positionStart();
  34344. $6=$self._source();
  34345. $ctx1.sendIdx["source"]=1;
  34346. $5=$recv($6)._lines();
  34347. $ctx1.sendIdx["lines"]=1;
  34348. $4=$recv($5)._size();
  34349. $ctx1.sendIdx["size"]=1;
  34350. $3=$recv($4).__minus((1));
  34351. $ctx1.sendIdx["-"]=1;
  34352. $2=$recv($3).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1)));
  34353. return $recv($1).__plus($2);
  34354. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  34355. },
  34356. args: [],
  34357. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  34358. referencedClasses: [],
  34359. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  34360. }),
  34361. $globals.ASTNode);
  34362. $core.addMethod(
  34363. $core.method({
  34364. selector: "positionStart",
  34365. protocol: "accessing",
  34366. fn: function (){
  34367. var self=this,$self=this;
  34368. return $core.withContext(function($ctx1) {
  34369. return $self._position();
  34370. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  34371. },
  34372. args: [],
  34373. source: "positionStart\x0a\x09^ self position",
  34374. referencedClasses: [],
  34375. messageSends: ["position"]
  34376. }),
  34377. $globals.ASTNode);
  34378. $core.addMethod(
  34379. $core.method({
  34380. selector: "requiresSmalltalkContext",
  34381. protocol: "testing",
  34382. fn: function (){
  34383. var self=this,$self=this;
  34384. return $core.withContext(function($ctx1) {
  34385. return $recv($recv($self._dagChildren())._detect_ifNone_((function(each){
  34386. return $core.withContext(function($ctx2) {
  34387. return $recv(each)._requiresSmalltalkContext();
  34388. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34389. }),(function(){
  34390. return nil;
  34391. })))._notNil();
  34392. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  34393. },
  34394. args: [],
  34395. 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",
  34396. referencedClasses: [],
  34397. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  34398. }),
  34399. $globals.ASTNode);
  34400. $core.addMethod(
  34401. $core.method({
  34402. selector: "shouldBeAliased",
  34403. protocol: "accessing",
  34404. fn: function (){
  34405. var self=this,$self=this;
  34406. return $core.withContext(function($ctx1) {
  34407. var $1,$receiver;
  34408. $1=$self["@shouldBeAliased"];
  34409. if(($receiver = $1) == null || $receiver.a$nil){
  34410. return false;
  34411. } else {
  34412. return $1;
  34413. }
  34414. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  34415. },
  34416. args: [],
  34417. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  34418. referencedClasses: [],
  34419. messageSends: ["ifNil:"]
  34420. }),
  34421. $globals.ASTNode);
  34422. $core.addMethod(
  34423. $core.method({
  34424. selector: "shouldBeAliased:",
  34425. protocol: "accessing",
  34426. fn: function (aBoolean){
  34427. var self=this,$self=this;
  34428. $self["@shouldBeAliased"]=aBoolean;
  34429. return self;
  34430. },
  34431. args: ["aBoolean"],
  34432. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  34433. referencedClasses: [],
  34434. messageSends: []
  34435. }),
  34436. $globals.ASTNode);
  34437. $core.addMethod(
  34438. $core.method({
  34439. selector: "size",
  34440. protocol: "accessing",
  34441. fn: function (){
  34442. var self=this,$self=this;
  34443. return $core.withContext(function($ctx1) {
  34444. return $recv($self._source())._size();
  34445. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  34446. },
  34447. args: [],
  34448. source: "size\x0a\x09^ self source size",
  34449. referencedClasses: [],
  34450. messageSends: ["size", "source"]
  34451. }),
  34452. $globals.ASTNode);
  34453. $core.addMethod(
  34454. $core.method({
  34455. selector: "source",
  34456. protocol: "accessing",
  34457. fn: function (){
  34458. var self=this,$self=this;
  34459. return $core.withContext(function($ctx1) {
  34460. var $1,$receiver;
  34461. $1=$self["@source"];
  34462. if(($receiver = $1) == null || $receiver.a$nil){
  34463. return "";
  34464. } else {
  34465. return $1;
  34466. }
  34467. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  34468. },
  34469. args: [],
  34470. source: "source\x0a\x09^ source ifNil: [ '' ]",
  34471. referencedClasses: [],
  34472. messageSends: ["ifNil:"]
  34473. }),
  34474. $globals.ASTNode);
  34475. $core.addMethod(
  34476. $core.method({
  34477. selector: "source:",
  34478. protocol: "accessing",
  34479. fn: function (aString){
  34480. var self=this,$self=this;
  34481. $self["@source"]=aString;
  34482. return self;
  34483. },
  34484. args: ["aString"],
  34485. source: "source: aString\x0a\x09source := aString",
  34486. referencedClasses: [],
  34487. messageSends: []
  34488. }),
  34489. $globals.ASTNode);
  34490. $core.addMethod(
  34491. $core.method({
  34492. selector: "withTail:",
  34493. protocol: "building",
  34494. fn: function (aCollection){
  34495. var self=this,$self=this;
  34496. return $core.withContext(function($ctx1) {
  34497. var $1;
  34498. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  34499. return $core.withContext(function($ctx2) {
  34500. $1=$recv($globals.SendNode)._new();
  34501. $recv($1)._position_($recv(send)._position());
  34502. $recv($1)._source_($recv(send)._source());
  34503. $recv($1)._receiver_(receiver);
  34504. $recv($1)._selector_($recv(send)._selector());
  34505. $recv($1)._arguments_($recv(send)._arguments());
  34506. return $recv($1)._yourself();
  34507. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  34508. }));
  34509. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  34510. },
  34511. args: ["aCollection"],
  34512. 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 ]",
  34513. referencedClasses: ["SendNode"],
  34514. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  34515. }),
  34516. $globals.ASTNode);
  34517. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  34518. $globals.AssignmentNode.comment="I represent an assignment node.";
  34519. $core.addMethod(
  34520. $core.method({
  34521. selector: "acceptDagVisitor:",
  34522. protocol: "visiting",
  34523. fn: function (aVisitor){
  34524. var self=this,$self=this;
  34525. return $core.withContext(function($ctx1) {
  34526. return $recv(aVisitor)._visitAssignmentNode_(self);
  34527. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  34528. },
  34529. args: ["aVisitor"],
  34530. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  34531. referencedClasses: [],
  34532. messageSends: ["visitAssignmentNode:"]
  34533. }),
  34534. $globals.AssignmentNode);
  34535. $core.addMethod(
  34536. $core.method({
  34537. selector: "dagChildren",
  34538. protocol: "accessing",
  34539. fn: function (){
  34540. var self=this,$self=this;
  34541. return $core.withContext(function($ctx1) {
  34542. return $recv($globals.Array)._with_with_($self._left(),$self._right());
  34543. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  34544. },
  34545. args: [],
  34546. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  34547. referencedClasses: ["Array"],
  34548. messageSends: ["with:with:", "left", "right"]
  34549. }),
  34550. $globals.AssignmentNode);
  34551. $core.addMethod(
  34552. $core.method({
  34553. selector: "isAssignmentNode",
  34554. protocol: "testing",
  34555. fn: function (){
  34556. var self=this,$self=this;
  34557. return true;
  34558. },
  34559. args: [],
  34560. source: "isAssignmentNode\x0a\x09^ true",
  34561. referencedClasses: [],
  34562. messageSends: []
  34563. }),
  34564. $globals.AssignmentNode);
  34565. $core.addMethod(
  34566. $core.method({
  34567. selector: "left",
  34568. protocol: "accessing",
  34569. fn: function (){
  34570. var self=this,$self=this;
  34571. return $self["@left"];
  34572. },
  34573. args: [],
  34574. source: "left\x0a\x09^ left",
  34575. referencedClasses: [],
  34576. messageSends: []
  34577. }),
  34578. $globals.AssignmentNode);
  34579. $core.addMethod(
  34580. $core.method({
  34581. selector: "left:",
  34582. protocol: "accessing",
  34583. fn: function (aNode){
  34584. var self=this,$self=this;
  34585. $self["@left"]=aNode;
  34586. return self;
  34587. },
  34588. args: ["aNode"],
  34589. source: "left: aNode\x0a\x09left := aNode",
  34590. referencedClasses: [],
  34591. messageSends: []
  34592. }),
  34593. $globals.AssignmentNode);
  34594. $core.addMethod(
  34595. $core.method({
  34596. selector: "right",
  34597. protocol: "accessing",
  34598. fn: function (){
  34599. var self=this,$self=this;
  34600. return $self["@right"];
  34601. },
  34602. args: [],
  34603. source: "right\x0a\x09^ right",
  34604. referencedClasses: [],
  34605. messageSends: []
  34606. }),
  34607. $globals.AssignmentNode);
  34608. $core.addMethod(
  34609. $core.method({
  34610. selector: "right:",
  34611. protocol: "accessing",
  34612. fn: function (aNode){
  34613. var self=this,$self=this;
  34614. $self["@right"]=aNode;
  34615. return self;
  34616. },
  34617. args: ["aNode"],
  34618. source: "right: aNode\x0a\x09right := aNode",
  34619. referencedClasses: [],
  34620. messageSends: []
  34621. }),
  34622. $globals.AssignmentNode);
  34623. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  34624. $globals.BlockNode.comment="I represent an block closure node.";
  34625. $core.addMethod(
  34626. $core.method({
  34627. selector: "acceptDagVisitor:",
  34628. protocol: "visiting",
  34629. fn: function (aVisitor){
  34630. var self=this,$self=this;
  34631. return $core.withContext(function($ctx1) {
  34632. return $recv(aVisitor)._visitBlockNode_(self);
  34633. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  34634. },
  34635. args: ["aVisitor"],
  34636. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  34637. referencedClasses: [],
  34638. messageSends: ["visitBlockNode:"]
  34639. }),
  34640. $globals.BlockNode);
  34641. $core.addMethod(
  34642. $core.method({
  34643. selector: "isBlockNode",
  34644. protocol: "testing",
  34645. fn: function (){
  34646. var self=this,$self=this;
  34647. return true;
  34648. },
  34649. args: [],
  34650. source: "isBlockNode\x0a\x09^ true",
  34651. referencedClasses: [],
  34652. messageSends: []
  34653. }),
  34654. $globals.BlockNode);
  34655. $core.addMethod(
  34656. $core.method({
  34657. selector: "parameters",
  34658. protocol: "accessing",
  34659. fn: function (){
  34660. var self=this,$self=this;
  34661. return $core.withContext(function($ctx1) {
  34662. var $1,$receiver;
  34663. $1=$self["@parameters"];
  34664. if(($receiver = $1) == null || $receiver.a$nil){
  34665. $self["@parameters"]=$recv($globals.Array)._new();
  34666. return $self["@parameters"];
  34667. } else {
  34668. return $1;
  34669. }
  34670. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  34671. },
  34672. args: [],
  34673. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  34674. referencedClasses: ["Array"],
  34675. messageSends: ["ifNil:", "new"]
  34676. }),
  34677. $globals.BlockNode);
  34678. $core.addMethod(
  34679. $core.method({
  34680. selector: "parameters:",
  34681. protocol: "accessing",
  34682. fn: function (aCollection){
  34683. var self=this,$self=this;
  34684. $self["@parameters"]=aCollection;
  34685. return self;
  34686. },
  34687. args: ["aCollection"],
  34688. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  34689. referencedClasses: [],
  34690. messageSends: []
  34691. }),
  34692. $globals.BlockNode);
  34693. $core.addMethod(
  34694. $core.method({
  34695. selector: "scope",
  34696. protocol: "accessing",
  34697. fn: function (){
  34698. var self=this,$self=this;
  34699. return $self["@scope"];
  34700. },
  34701. args: [],
  34702. source: "scope\x0a\x09^ scope",
  34703. referencedClasses: [],
  34704. messageSends: []
  34705. }),
  34706. $globals.BlockNode);
  34707. $core.addMethod(
  34708. $core.method({
  34709. selector: "scope:",
  34710. protocol: "accessing",
  34711. fn: function (aLexicalScope){
  34712. var self=this,$self=this;
  34713. $self["@scope"]=aLexicalScope;
  34714. return self;
  34715. },
  34716. args: ["aLexicalScope"],
  34717. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34718. referencedClasses: [],
  34719. messageSends: []
  34720. }),
  34721. $globals.BlockNode);
  34722. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  34723. $globals.CascadeNode.comment="I represent an cascade node.";
  34724. $core.addMethod(
  34725. $core.method({
  34726. selector: "acceptDagVisitor:",
  34727. protocol: "visiting",
  34728. fn: function (aVisitor){
  34729. var self=this,$self=this;
  34730. return $core.withContext(function($ctx1) {
  34731. return $recv(aVisitor)._visitCascadeNode_(self);
  34732. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  34733. },
  34734. args: ["aVisitor"],
  34735. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  34736. referencedClasses: [],
  34737. messageSends: ["visitCascadeNode:"]
  34738. }),
  34739. $globals.CascadeNode);
  34740. $core.addMethod(
  34741. $core.method({
  34742. selector: "isCascadeNode",
  34743. protocol: "testing",
  34744. fn: function (){
  34745. var self=this,$self=this;
  34746. return true;
  34747. },
  34748. args: [],
  34749. source: "isCascadeNode\x0a\x09^ true",
  34750. referencedClasses: [],
  34751. messageSends: []
  34752. }),
  34753. $globals.CascadeNode);
  34754. $core.addMethod(
  34755. $core.method({
  34756. selector: "receiver",
  34757. protocol: "accessing",
  34758. fn: function (){
  34759. var self=this,$self=this;
  34760. return $self["@receiver"];
  34761. },
  34762. args: [],
  34763. source: "receiver\x0a\x09^ receiver",
  34764. referencedClasses: [],
  34765. messageSends: []
  34766. }),
  34767. $globals.CascadeNode);
  34768. $core.addMethod(
  34769. $core.method({
  34770. selector: "receiver:",
  34771. protocol: "accessing",
  34772. fn: function (aNode){
  34773. var self=this,$self=this;
  34774. $self["@receiver"]=aNode;
  34775. return self;
  34776. },
  34777. args: ["aNode"],
  34778. source: "receiver: aNode\x0a\x09receiver := aNode",
  34779. referencedClasses: [],
  34780. messageSends: []
  34781. }),
  34782. $globals.CascadeNode);
  34783. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  34784. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  34785. $core.addMethod(
  34786. $core.method({
  34787. selector: "acceptDagVisitor:",
  34788. protocol: "visiting",
  34789. fn: function (aVisitor){
  34790. var self=this,$self=this;
  34791. return $core.withContext(function($ctx1) {
  34792. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  34793. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  34794. },
  34795. args: ["aVisitor"],
  34796. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  34797. referencedClasses: [],
  34798. messageSends: ["visitDynamicArrayNode:"]
  34799. }),
  34800. $globals.DynamicArrayNode);
  34801. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  34802. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  34803. $core.addMethod(
  34804. $core.method({
  34805. selector: "acceptDagVisitor:",
  34806. protocol: "visiting",
  34807. fn: function (aVisitor){
  34808. var self=this,$self=this;
  34809. return $core.withContext(function($ctx1) {
  34810. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  34811. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  34812. },
  34813. args: ["aVisitor"],
  34814. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  34815. referencedClasses: [],
  34816. messageSends: ["visitDynamicDictionaryNode:"]
  34817. }),
  34818. $globals.DynamicDictionaryNode);
  34819. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  34820. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  34821. $core.addMethod(
  34822. $core.method({
  34823. selector: "acceptDagVisitor:",
  34824. protocol: "visiting",
  34825. fn: function (aVisitor){
  34826. var self=this,$self=this;
  34827. return $core.withContext(function($ctx1) {
  34828. return $recv(aVisitor)._visitJSStatementNode_(self);
  34829. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  34830. },
  34831. args: ["aVisitor"],
  34832. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  34833. referencedClasses: [],
  34834. messageSends: ["visitJSStatementNode:"]
  34835. }),
  34836. $globals.JSStatementNode);
  34837. $core.addMethod(
  34838. $core.method({
  34839. selector: "isJSStatementNode",
  34840. protocol: "testing",
  34841. fn: function (){
  34842. var self=this,$self=this;
  34843. return true;
  34844. },
  34845. args: [],
  34846. source: "isJSStatementNode\x0a\x09^ true",
  34847. referencedClasses: [],
  34848. messageSends: []
  34849. }),
  34850. $globals.JSStatementNode);
  34851. $core.addMethod(
  34852. $core.method({
  34853. selector: "requiresSmalltalkContext",
  34854. protocol: "testing",
  34855. fn: function (){
  34856. var self=this,$self=this;
  34857. return true;
  34858. },
  34859. args: [],
  34860. source: "requiresSmalltalkContext\x0a\x09^ true",
  34861. referencedClasses: [],
  34862. messageSends: []
  34863. }),
  34864. $globals.JSStatementNode);
  34865. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  34866. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  34867. $core.addMethod(
  34868. $core.method({
  34869. selector: "acceptDagVisitor:",
  34870. protocol: "visiting",
  34871. fn: function (aVisitor){
  34872. var self=this,$self=this;
  34873. return $core.withContext(function($ctx1) {
  34874. return $recv(aVisitor)._visitMethodNode_(self);
  34875. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  34876. },
  34877. args: ["aVisitor"],
  34878. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  34879. referencedClasses: [],
  34880. messageSends: ["visitMethodNode:"]
  34881. }),
  34882. $globals.MethodNode);
  34883. $core.addMethod(
  34884. $core.method({
  34885. selector: "arguments",
  34886. protocol: "accessing",
  34887. fn: function (){
  34888. var self=this,$self=this;
  34889. return $core.withContext(function($ctx1) {
  34890. var $1,$receiver;
  34891. $1=$self["@arguments"];
  34892. if(($receiver = $1) == null || $receiver.a$nil){
  34893. return [];
  34894. } else {
  34895. return $1;
  34896. }
  34897. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  34898. },
  34899. args: [],
  34900. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  34901. referencedClasses: [],
  34902. messageSends: ["ifNil:"]
  34903. }),
  34904. $globals.MethodNode);
  34905. $core.addMethod(
  34906. $core.method({
  34907. selector: "arguments:",
  34908. protocol: "accessing",
  34909. fn: function (aCollection){
  34910. var self=this,$self=this;
  34911. $self["@arguments"]=aCollection;
  34912. return self;
  34913. },
  34914. args: ["aCollection"],
  34915. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34916. referencedClasses: [],
  34917. messageSends: []
  34918. }),
  34919. $globals.MethodNode);
  34920. $core.addMethod(
  34921. $core.method({
  34922. selector: "classReferences",
  34923. protocol: "accessing",
  34924. fn: function (){
  34925. var self=this,$self=this;
  34926. return $self["@classReferences"];
  34927. },
  34928. args: [],
  34929. source: "classReferences\x0a\x09^ classReferences",
  34930. referencedClasses: [],
  34931. messageSends: []
  34932. }),
  34933. $globals.MethodNode);
  34934. $core.addMethod(
  34935. $core.method({
  34936. selector: "classReferences:",
  34937. protocol: "accessing",
  34938. fn: function (aCollection){
  34939. var self=this,$self=this;
  34940. $self["@classReferences"]=aCollection;
  34941. return self;
  34942. },
  34943. args: ["aCollection"],
  34944. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  34945. referencedClasses: [],
  34946. messageSends: []
  34947. }),
  34948. $globals.MethodNode);
  34949. $core.addMethod(
  34950. $core.method({
  34951. selector: "messageSends",
  34952. protocol: "accessing",
  34953. fn: function (){
  34954. var self=this,$self=this;
  34955. return $core.withContext(function($ctx1) {
  34956. return $recv($self._sendIndexes())._keys();
  34957. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  34958. },
  34959. args: [],
  34960. source: "messageSends\x0a\x09^ self sendIndexes keys",
  34961. referencedClasses: [],
  34962. messageSends: ["keys", "sendIndexes"]
  34963. }),
  34964. $globals.MethodNode);
  34965. $core.addMethod(
  34966. $core.method({
  34967. selector: "method",
  34968. protocol: "accessing",
  34969. fn: function (){
  34970. var self=this,$self=this;
  34971. return self;
  34972. },
  34973. args: [],
  34974. source: "method\x0a\x09^ self",
  34975. referencedClasses: [],
  34976. messageSends: []
  34977. }),
  34978. $globals.MethodNode);
  34979. $core.addMethod(
  34980. $core.method({
  34981. selector: "scope",
  34982. protocol: "accessing",
  34983. fn: function (){
  34984. var self=this,$self=this;
  34985. return $self["@scope"];
  34986. },
  34987. args: [],
  34988. source: "scope\x0a\x09^ scope",
  34989. referencedClasses: [],
  34990. messageSends: []
  34991. }),
  34992. $globals.MethodNode);
  34993. $core.addMethod(
  34994. $core.method({
  34995. selector: "scope:",
  34996. protocol: "accessing",
  34997. fn: function (aMethodScope){
  34998. var self=this,$self=this;
  34999. $self["@scope"]=aMethodScope;
  35000. return self;
  35001. },
  35002. args: ["aMethodScope"],
  35003. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  35004. referencedClasses: [],
  35005. messageSends: []
  35006. }),
  35007. $globals.MethodNode);
  35008. $core.addMethod(
  35009. $core.method({
  35010. selector: "selector",
  35011. protocol: "accessing",
  35012. fn: function (){
  35013. var self=this,$self=this;
  35014. return $self["@selector"];
  35015. },
  35016. args: [],
  35017. source: "selector\x0a\x09^ selector",
  35018. referencedClasses: [],
  35019. messageSends: []
  35020. }),
  35021. $globals.MethodNode);
  35022. $core.addMethod(
  35023. $core.method({
  35024. selector: "selector:",
  35025. protocol: "accessing",
  35026. fn: function (aString){
  35027. var self=this,$self=this;
  35028. $self["@selector"]=aString;
  35029. return self;
  35030. },
  35031. args: ["aString"],
  35032. source: "selector: aString\x0a\x09selector := aString",
  35033. referencedClasses: [],
  35034. messageSends: []
  35035. }),
  35036. $globals.MethodNode);
  35037. $core.addMethod(
  35038. $core.method({
  35039. selector: "sendIndexes",
  35040. protocol: "accessing",
  35041. fn: function (){
  35042. var self=this,$self=this;
  35043. return $self["@sendIndexes"];
  35044. },
  35045. args: [],
  35046. source: "sendIndexes\x0a\x09^ sendIndexes",
  35047. referencedClasses: [],
  35048. messageSends: []
  35049. }),
  35050. $globals.MethodNode);
  35051. $core.addMethod(
  35052. $core.method({
  35053. selector: "sendIndexes:",
  35054. protocol: "accessing",
  35055. fn: function (aDictionary){
  35056. var self=this,$self=this;
  35057. $self["@sendIndexes"]=aDictionary;
  35058. return self;
  35059. },
  35060. args: ["aDictionary"],
  35061. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  35062. referencedClasses: [],
  35063. messageSends: []
  35064. }),
  35065. $globals.MethodNode);
  35066. $core.addMethod(
  35067. $core.method({
  35068. selector: "sequenceNode",
  35069. protocol: "accessing",
  35070. fn: function (){
  35071. var self=this,$self=this;
  35072. return $core.withContext(function($ctx1) {
  35073. var $1;
  35074. var $early={};
  35075. try {
  35076. $recv($self._dagChildren())._do_((function(each){
  35077. return $core.withContext(function($ctx2) {
  35078. $1=$recv(each)._isSequenceNode();
  35079. if($core.assert($1)){
  35080. throw $early=[each];
  35081. }
  35082. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35083. }));
  35084. return nil;
  35085. }
  35086. catch(e) {if(e===$early)return e[0]; throw e}
  35087. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  35088. },
  35089. args: [],
  35090. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  35091. referencedClasses: [],
  35092. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  35093. }),
  35094. $globals.MethodNode);
  35095. $core.addMethod(
  35096. $core.method({
  35097. selector: "source",
  35098. protocol: "accessing",
  35099. fn: function (){
  35100. var self=this,$self=this;
  35101. return $self["@source"];
  35102. },
  35103. args: [],
  35104. source: "source\x0a\x09^ source",
  35105. referencedClasses: [],
  35106. messageSends: []
  35107. }),
  35108. $globals.MethodNode);
  35109. $core.addMethod(
  35110. $core.method({
  35111. selector: "source:",
  35112. protocol: "accessing",
  35113. fn: function (aString){
  35114. var self=this,$self=this;
  35115. $self["@source"]=aString;
  35116. return self;
  35117. },
  35118. args: ["aString"],
  35119. source: "source: aString\x0a\x09source := aString",
  35120. referencedClasses: [],
  35121. messageSends: []
  35122. }),
  35123. $globals.MethodNode);
  35124. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  35125. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  35126. $core.addMethod(
  35127. $core.method({
  35128. selector: "acceptDagVisitor:",
  35129. protocol: "visiting",
  35130. fn: function (aVisitor){
  35131. var self=this,$self=this;
  35132. return $core.withContext(function($ctx1) {
  35133. return $recv(aVisitor)._visitReturnNode_(self);
  35134. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  35135. },
  35136. args: ["aVisitor"],
  35137. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  35138. referencedClasses: [],
  35139. messageSends: ["visitReturnNode:"]
  35140. }),
  35141. $globals.ReturnNode);
  35142. $core.addMethod(
  35143. $core.method({
  35144. selector: "isReturnNode",
  35145. protocol: "testing",
  35146. fn: function (){
  35147. var self=this,$self=this;
  35148. return true;
  35149. },
  35150. args: [],
  35151. source: "isReturnNode\x0a\x09^ true",
  35152. referencedClasses: [],
  35153. messageSends: []
  35154. }),
  35155. $globals.ReturnNode);
  35156. $core.addMethod(
  35157. $core.method({
  35158. selector: "nonLocalReturn",
  35159. protocol: "testing",
  35160. fn: function (){
  35161. var self=this,$self=this;
  35162. return $core.withContext(function($ctx1) {
  35163. return $recv($recv($self._scope())._isMethodScope())._not();
  35164. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  35165. },
  35166. args: [],
  35167. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  35168. referencedClasses: [],
  35169. messageSends: ["not", "isMethodScope", "scope"]
  35170. }),
  35171. $globals.ReturnNode);
  35172. $core.addMethod(
  35173. $core.method({
  35174. selector: "scope",
  35175. protocol: "accessing",
  35176. fn: function (){
  35177. var self=this,$self=this;
  35178. return $self["@scope"];
  35179. },
  35180. args: [],
  35181. source: "scope\x0a\x09^ scope",
  35182. referencedClasses: [],
  35183. messageSends: []
  35184. }),
  35185. $globals.ReturnNode);
  35186. $core.addMethod(
  35187. $core.method({
  35188. selector: "scope:",
  35189. protocol: "accessing",
  35190. fn: function (aLexicalScope){
  35191. var self=this,$self=this;
  35192. $self["@scope"]=aLexicalScope;
  35193. return self;
  35194. },
  35195. args: ["aLexicalScope"],
  35196. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  35197. referencedClasses: [],
  35198. messageSends: []
  35199. }),
  35200. $globals.ReturnNode);
  35201. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  35202. $globals.SendNode.comment="I represent an message send node.";
  35203. $core.addMethod(
  35204. $core.method({
  35205. selector: "acceptDagVisitor:",
  35206. protocol: "visiting",
  35207. fn: function (aVisitor){
  35208. var self=this,$self=this;
  35209. return $core.withContext(function($ctx1) {
  35210. return $recv(aVisitor)._visitSendNode_(self);
  35211. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  35212. },
  35213. args: ["aVisitor"],
  35214. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  35215. referencedClasses: [],
  35216. messageSends: ["visitSendNode:"]
  35217. }),
  35218. $globals.SendNode);
  35219. $core.addMethod(
  35220. $core.method({
  35221. selector: "arguments",
  35222. protocol: "accessing",
  35223. fn: function (){
  35224. var self=this,$self=this;
  35225. return $core.withContext(function($ctx1) {
  35226. var $1,$receiver;
  35227. $1=$self["@arguments"];
  35228. if(($receiver = $1) == null || $receiver.a$nil){
  35229. $self["@arguments"]=[];
  35230. return $self["@arguments"];
  35231. } else {
  35232. return $1;
  35233. }
  35234. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  35235. },
  35236. args: [],
  35237. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  35238. referencedClasses: [],
  35239. messageSends: ["ifNil:"]
  35240. }),
  35241. $globals.SendNode);
  35242. $core.addMethod(
  35243. $core.method({
  35244. selector: "arguments:",
  35245. protocol: "accessing",
  35246. fn: function (aCollection){
  35247. var self=this,$self=this;
  35248. $self["@arguments"]=aCollection;
  35249. return self;
  35250. },
  35251. args: ["aCollection"],
  35252. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  35253. referencedClasses: [],
  35254. messageSends: []
  35255. }),
  35256. $globals.SendNode);
  35257. $core.addMethod(
  35258. $core.method({
  35259. selector: "dagChildren",
  35260. protocol: "accessing",
  35261. fn: function (){
  35262. var self=this,$self=this;
  35263. return $core.withContext(function($ctx1) {
  35264. var $1,$2,$3,$receiver;
  35265. $1=$self._receiver();
  35266. $ctx1.sendIdx["receiver"]=1;
  35267. if(($receiver = $1) == null || $receiver.a$nil){
  35268. $2=$self._arguments();
  35269. $ctx1.sendIdx["arguments"]=1;
  35270. return $recv($2)._copy();
  35271. } else {
  35272. $1;
  35273. }
  35274. $3=$recv($globals.Array)._with_($self._receiver());
  35275. $recv($3)._addAll_($self._arguments());
  35276. return $recv($3)._yourself();
  35277. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  35278. },
  35279. args: [],
  35280. 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",
  35281. referencedClasses: ["Array"],
  35282. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  35283. }),
  35284. $globals.SendNode);
  35285. $core.addMethod(
  35286. $core.method({
  35287. selector: "index",
  35288. protocol: "accessing",
  35289. fn: function (){
  35290. var self=this,$self=this;
  35291. return $self["@index"];
  35292. },
  35293. args: [],
  35294. source: "index\x0a\x09^ index",
  35295. referencedClasses: [],
  35296. messageSends: []
  35297. }),
  35298. $globals.SendNode);
  35299. $core.addMethod(
  35300. $core.method({
  35301. selector: "index:",
  35302. protocol: "accessing",
  35303. fn: function (anInteger){
  35304. var self=this,$self=this;
  35305. $self["@index"]=anInteger;
  35306. return self;
  35307. },
  35308. args: ["anInteger"],
  35309. source: "index: anInteger\x0a\x09index := anInteger",
  35310. referencedClasses: [],
  35311. messageSends: []
  35312. }),
  35313. $globals.SendNode);
  35314. $core.addMethod(
  35315. $core.method({
  35316. selector: "isNavigationNode",
  35317. protocol: "testing",
  35318. fn: function (){
  35319. var self=this,$self=this;
  35320. return true;
  35321. },
  35322. args: [],
  35323. source: "isNavigationNode\x0a\x09^ true",
  35324. referencedClasses: [],
  35325. messageSends: []
  35326. }),
  35327. $globals.SendNode);
  35328. $core.addMethod(
  35329. $core.method({
  35330. selector: "isSendNode",
  35331. protocol: "testing",
  35332. fn: function (){
  35333. var self=this,$self=this;
  35334. return true;
  35335. },
  35336. args: [],
  35337. source: "isSendNode\x0a\x09^ true",
  35338. referencedClasses: [],
  35339. messageSends: []
  35340. }),
  35341. $globals.SendNode);
  35342. $core.addMethod(
  35343. $core.method({
  35344. selector: "navigationLink",
  35345. protocol: "accessing",
  35346. fn: function (){
  35347. var self=this,$self=this;
  35348. return $core.withContext(function($ctx1) {
  35349. return $self._selector();
  35350. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  35351. },
  35352. args: [],
  35353. source: "navigationLink\x0a\x09^ self selector",
  35354. referencedClasses: [],
  35355. messageSends: ["selector"]
  35356. }),
  35357. $globals.SendNode);
  35358. $core.addMethod(
  35359. $core.method({
  35360. selector: "receiver",
  35361. protocol: "accessing",
  35362. fn: function (){
  35363. var self=this,$self=this;
  35364. return $self["@receiver"];
  35365. },
  35366. args: [],
  35367. source: "receiver\x0a\x09^ receiver",
  35368. referencedClasses: [],
  35369. messageSends: []
  35370. }),
  35371. $globals.SendNode);
  35372. $core.addMethod(
  35373. $core.method({
  35374. selector: "receiver:",
  35375. protocol: "accessing",
  35376. fn: function (aNode){
  35377. var self=this,$self=this;
  35378. $self["@receiver"]=aNode;
  35379. return self;
  35380. },
  35381. args: ["aNode"],
  35382. source: "receiver: aNode\x0a\x09receiver := aNode",
  35383. referencedClasses: [],
  35384. messageSends: []
  35385. }),
  35386. $globals.SendNode);
  35387. $core.addMethod(
  35388. $core.method({
  35389. selector: "requiresSmalltalkContext",
  35390. protocol: "testing",
  35391. fn: function (){
  35392. var self=this,$self=this;
  35393. return true;
  35394. },
  35395. args: [],
  35396. source: "requiresSmalltalkContext\x0a\x09^ true",
  35397. referencedClasses: [],
  35398. messageSends: []
  35399. }),
  35400. $globals.SendNode);
  35401. $core.addMethod(
  35402. $core.method({
  35403. selector: "selector",
  35404. protocol: "accessing",
  35405. fn: function (){
  35406. var self=this,$self=this;
  35407. return $self["@selector"];
  35408. },
  35409. args: [],
  35410. source: "selector\x0a\x09^ selector",
  35411. referencedClasses: [],
  35412. messageSends: []
  35413. }),
  35414. $globals.SendNode);
  35415. $core.addMethod(
  35416. $core.method({
  35417. selector: "selector:",
  35418. protocol: "accessing",
  35419. fn: function (aString){
  35420. var self=this,$self=this;
  35421. $self["@selector"]=aString;
  35422. return self;
  35423. },
  35424. args: ["aString"],
  35425. source: "selector: aString\x0a\x09selector := aString",
  35426. referencedClasses: [],
  35427. messageSends: []
  35428. }),
  35429. $globals.SendNode);
  35430. $core.addMethod(
  35431. $core.method({
  35432. selector: "shouldBeInlined",
  35433. protocol: "accessing",
  35434. fn: function (){
  35435. var self=this,$self=this;
  35436. return $core.withContext(function($ctx1) {
  35437. var $1,$receiver;
  35438. $1=$self["@shouldBeInlined"];
  35439. if(($receiver = $1) == null || $receiver.a$nil){
  35440. return false;
  35441. } else {
  35442. return $1;
  35443. }
  35444. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  35445. },
  35446. args: [],
  35447. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  35448. referencedClasses: [],
  35449. messageSends: ["ifNil:"]
  35450. }),
  35451. $globals.SendNode);
  35452. $core.addMethod(
  35453. $core.method({
  35454. selector: "shouldBeInlined:",
  35455. protocol: "accessing",
  35456. fn: function (aBoolean){
  35457. var self=this,$self=this;
  35458. $self["@shouldBeInlined"]=aBoolean;
  35459. return self;
  35460. },
  35461. args: ["aBoolean"],
  35462. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  35463. referencedClasses: [],
  35464. messageSends: []
  35465. }),
  35466. $globals.SendNode);
  35467. $core.addMethod(
  35468. $core.method({
  35469. selector: "superSend",
  35470. protocol: "accessing",
  35471. fn: function (){
  35472. var self=this,$self=this;
  35473. return $core.withContext(function($ctx1) {
  35474. var $2,$1;
  35475. $2=$self._receiver();
  35476. $ctx1.sendIdx["receiver"]=1;
  35477. $1=$recv($2)._notNil();
  35478. return $recv($1)._and_((function(){
  35479. return $core.withContext(function($ctx2) {
  35480. return $recv($self._receiver())._isSuperKeyword();
  35481. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35482. }));
  35483. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  35484. },
  35485. args: [],
  35486. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  35487. referencedClasses: [],
  35488. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  35489. }),
  35490. $globals.SendNode);
  35491. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "scope"], "Compiler-AST");
  35492. $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).";
  35493. $core.addMethod(
  35494. $core.method({
  35495. selector: "acceptDagVisitor:",
  35496. protocol: "visiting",
  35497. fn: function (aVisitor){
  35498. var self=this,$self=this;
  35499. return $core.withContext(function($ctx1) {
  35500. return $recv(aVisitor)._visitSequenceNode_(self);
  35501. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  35502. },
  35503. args: ["aVisitor"],
  35504. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  35505. referencedClasses: [],
  35506. messageSends: ["visitSequenceNode:"]
  35507. }),
  35508. $globals.SequenceNode);
  35509. $core.addMethod(
  35510. $core.method({
  35511. selector: "asBlockSequenceNode",
  35512. protocol: "building",
  35513. fn: function (){
  35514. var self=this,$self=this;
  35515. return $core.withContext(function($ctx1) {
  35516. var $1;
  35517. $1=$recv($globals.BlockSequenceNode)._new();
  35518. $recv($1)._position_($self._position());
  35519. $recv($1)._source_($self._source());
  35520. $recv($1)._dagChildren_($self._dagChildren());
  35521. $recv($1)._temps_($self._temps());
  35522. return $recv($1)._yourself();
  35523. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  35524. },
  35525. args: [],
  35526. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09dagChildren: self dagChildren;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  35527. referencedClasses: ["BlockSequenceNode"],
  35528. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "yourself"]
  35529. }),
  35530. $globals.SequenceNode);
  35531. $core.addMethod(
  35532. $core.method({
  35533. selector: "isSequenceNode",
  35534. protocol: "testing",
  35535. fn: function (){
  35536. var self=this,$self=this;
  35537. return true;
  35538. },
  35539. args: [],
  35540. source: "isSequenceNode\x0a\x09^ true",
  35541. referencedClasses: [],
  35542. messageSends: []
  35543. }),
  35544. $globals.SequenceNode);
  35545. $core.addMethod(
  35546. $core.method({
  35547. selector: "scope",
  35548. protocol: "accessing",
  35549. fn: function (){
  35550. var self=this,$self=this;
  35551. return $self["@scope"];
  35552. },
  35553. args: [],
  35554. source: "scope\x0a\x09^ scope",
  35555. referencedClasses: [],
  35556. messageSends: []
  35557. }),
  35558. $globals.SequenceNode);
  35559. $core.addMethod(
  35560. $core.method({
  35561. selector: "scope:",
  35562. protocol: "accessing",
  35563. fn: function (aLexicalScope){
  35564. var self=this,$self=this;
  35565. $self["@scope"]=aLexicalScope;
  35566. return self;
  35567. },
  35568. args: ["aLexicalScope"],
  35569. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  35570. referencedClasses: [],
  35571. messageSends: []
  35572. }),
  35573. $globals.SequenceNode);
  35574. $core.addMethod(
  35575. $core.method({
  35576. selector: "temps",
  35577. protocol: "accessing",
  35578. fn: function (){
  35579. var self=this,$self=this;
  35580. return $core.withContext(function($ctx1) {
  35581. var $1,$receiver;
  35582. $1=$self["@temps"];
  35583. if(($receiver = $1) == null || $receiver.a$nil){
  35584. return [];
  35585. } else {
  35586. return $1;
  35587. }
  35588. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  35589. },
  35590. args: [],
  35591. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  35592. referencedClasses: [],
  35593. messageSends: ["ifNil:"]
  35594. }),
  35595. $globals.SequenceNode);
  35596. $core.addMethod(
  35597. $core.method({
  35598. selector: "temps:",
  35599. protocol: "accessing",
  35600. fn: function (aCollection){
  35601. var self=this,$self=this;
  35602. $self["@temps"]=aCollection;
  35603. return self;
  35604. },
  35605. args: ["aCollection"],
  35606. source: "temps: aCollection\x0a\x09temps := aCollection",
  35607. referencedClasses: [],
  35608. messageSends: []
  35609. }),
  35610. $globals.SequenceNode);
  35611. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  35612. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  35613. $core.addMethod(
  35614. $core.method({
  35615. selector: "acceptDagVisitor:",
  35616. protocol: "visiting",
  35617. fn: function (aVisitor){
  35618. var self=this,$self=this;
  35619. return $core.withContext(function($ctx1) {
  35620. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  35621. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  35622. },
  35623. args: ["aVisitor"],
  35624. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  35625. referencedClasses: [],
  35626. messageSends: ["visitBlockSequenceNode:"]
  35627. }),
  35628. $globals.BlockSequenceNode);
  35629. $core.addMethod(
  35630. $core.method({
  35631. selector: "isBlockSequenceNode",
  35632. protocol: "testing",
  35633. fn: function (){
  35634. var self=this,$self=this;
  35635. return true;
  35636. },
  35637. args: [],
  35638. source: "isBlockSequenceNode\x0a\x09^ true",
  35639. referencedClasses: [],
  35640. messageSends: []
  35641. }),
  35642. $globals.BlockSequenceNode);
  35643. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  35644. $globals.ValueNode.comment="I represent a value node.";
  35645. $core.addMethod(
  35646. $core.method({
  35647. selector: "acceptDagVisitor:",
  35648. protocol: "visiting",
  35649. fn: function (aVisitor){
  35650. var self=this,$self=this;
  35651. return $core.withContext(function($ctx1) {
  35652. return $recv(aVisitor)._visitValueNode_(self);
  35653. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  35654. },
  35655. args: ["aVisitor"],
  35656. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  35657. referencedClasses: [],
  35658. messageSends: ["visitValueNode:"]
  35659. }),
  35660. $globals.ValueNode);
  35661. $core.addMethod(
  35662. $core.method({
  35663. selector: "isImmutable",
  35664. protocol: "testing",
  35665. fn: function (){
  35666. var self=this,$self=this;
  35667. return $core.withContext(function($ctx1) {
  35668. return $recv($self._value())._isImmutable();
  35669. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  35670. },
  35671. args: [],
  35672. source: "isImmutable\x0a\x09^ self value isImmutable",
  35673. referencedClasses: [],
  35674. messageSends: ["isImmutable", "value"]
  35675. }),
  35676. $globals.ValueNode);
  35677. $core.addMethod(
  35678. $core.method({
  35679. selector: "isValueNode",
  35680. protocol: "testing",
  35681. fn: function (){
  35682. var self=this,$self=this;
  35683. return true;
  35684. },
  35685. args: [],
  35686. source: "isValueNode\x0a\x09^ true",
  35687. referencedClasses: [],
  35688. messageSends: []
  35689. }),
  35690. $globals.ValueNode);
  35691. $core.addMethod(
  35692. $core.method({
  35693. selector: "value",
  35694. protocol: "accessing",
  35695. fn: function (){
  35696. var self=this,$self=this;
  35697. return $self["@value"];
  35698. },
  35699. args: [],
  35700. source: "value\x0a\x09^ value",
  35701. referencedClasses: [],
  35702. messageSends: []
  35703. }),
  35704. $globals.ValueNode);
  35705. $core.addMethod(
  35706. $core.method({
  35707. selector: "value:",
  35708. protocol: "accessing",
  35709. fn: function (anObject){
  35710. var self=this,$self=this;
  35711. $self["@value"]=anObject;
  35712. return self;
  35713. },
  35714. args: ["anObject"],
  35715. source: "value: anObject\x0a\x09value := anObject",
  35716. referencedClasses: [],
  35717. messageSends: []
  35718. }),
  35719. $globals.ValueNode);
  35720. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  35721. $globals.VariableNode.comment="I represent an variable node.";
  35722. $core.addMethod(
  35723. $core.method({
  35724. selector: "acceptDagVisitor:",
  35725. protocol: "visiting",
  35726. fn: function (aVisitor){
  35727. var self=this,$self=this;
  35728. return $core.withContext(function($ctx1) {
  35729. return $recv(aVisitor)._visitVariableNode_(self);
  35730. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  35731. },
  35732. args: ["aVisitor"],
  35733. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  35734. referencedClasses: [],
  35735. messageSends: ["visitVariableNode:"]
  35736. }),
  35737. $globals.VariableNode);
  35738. $core.addMethod(
  35739. $core.method({
  35740. selector: "alias",
  35741. protocol: "accessing",
  35742. fn: function (){
  35743. var self=this,$self=this;
  35744. return $core.withContext(function($ctx1) {
  35745. return $recv($self._binding())._alias();
  35746. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  35747. },
  35748. args: [],
  35749. source: "alias\x0a\x09^ self binding alias",
  35750. referencedClasses: [],
  35751. messageSends: ["alias", "binding"]
  35752. }),
  35753. $globals.VariableNode);
  35754. $core.addMethod(
  35755. $core.method({
  35756. selector: "assigned",
  35757. protocol: "accessing",
  35758. fn: function (){
  35759. var self=this,$self=this;
  35760. return $core.withContext(function($ctx1) {
  35761. var $1,$receiver;
  35762. $1=$self["@assigned"];
  35763. if(($receiver = $1) == null || $receiver.a$nil){
  35764. return false;
  35765. } else {
  35766. return $1;
  35767. }
  35768. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  35769. },
  35770. args: [],
  35771. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  35772. referencedClasses: [],
  35773. messageSends: ["ifNil:"]
  35774. }),
  35775. $globals.VariableNode);
  35776. $core.addMethod(
  35777. $core.method({
  35778. selector: "assigned:",
  35779. protocol: "accessing",
  35780. fn: function (aBoolean){
  35781. var self=this,$self=this;
  35782. $self["@assigned"]=aBoolean;
  35783. return self;
  35784. },
  35785. args: ["aBoolean"],
  35786. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  35787. referencedClasses: [],
  35788. messageSends: []
  35789. }),
  35790. $globals.VariableNode);
  35791. $core.addMethod(
  35792. $core.method({
  35793. selector: "beAssigned",
  35794. protocol: "accessing",
  35795. fn: function (){
  35796. var self=this,$self=this;
  35797. return $core.withContext(function($ctx1) {
  35798. $recv($self._binding())._validateAssignment();
  35799. $self["@assigned"]=true;
  35800. return self;
  35801. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  35802. },
  35803. args: [],
  35804. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  35805. referencedClasses: [],
  35806. messageSends: ["validateAssignment", "binding"]
  35807. }),
  35808. $globals.VariableNode);
  35809. $core.addMethod(
  35810. $core.method({
  35811. selector: "binding",
  35812. protocol: "accessing",
  35813. fn: function (){
  35814. var self=this,$self=this;
  35815. return $self["@binding"];
  35816. },
  35817. args: [],
  35818. source: "binding\x0a\x09^ binding",
  35819. referencedClasses: [],
  35820. messageSends: []
  35821. }),
  35822. $globals.VariableNode);
  35823. $core.addMethod(
  35824. $core.method({
  35825. selector: "binding:",
  35826. protocol: "accessing",
  35827. fn: function (aScopeVar){
  35828. var self=this,$self=this;
  35829. $self["@binding"]=aScopeVar;
  35830. return self;
  35831. },
  35832. args: ["aScopeVar"],
  35833. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  35834. referencedClasses: [],
  35835. messageSends: []
  35836. }),
  35837. $globals.VariableNode);
  35838. $core.addMethod(
  35839. $core.method({
  35840. selector: "isArgument",
  35841. protocol: "testing",
  35842. fn: function (){
  35843. var self=this,$self=this;
  35844. return $core.withContext(function($ctx1) {
  35845. return $recv($self._binding())._isArgVar();
  35846. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  35847. },
  35848. args: [],
  35849. source: "isArgument\x0a\x09^ self binding isArgVar",
  35850. referencedClasses: [],
  35851. messageSends: ["isArgVar", "binding"]
  35852. }),
  35853. $globals.VariableNode);
  35854. $core.addMethod(
  35855. $core.method({
  35856. selector: "isImmutable",
  35857. protocol: "testing",
  35858. fn: function (){
  35859. var self=this,$self=this;
  35860. return $core.withContext(function($ctx1) {
  35861. return $recv($self._binding())._isImmutable();
  35862. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  35863. },
  35864. args: [],
  35865. source: "isImmutable\x0a\x09^ self binding isImmutable",
  35866. referencedClasses: [],
  35867. messageSends: ["isImmutable", "binding"]
  35868. }),
  35869. $globals.VariableNode);
  35870. $core.addMethod(
  35871. $core.method({
  35872. selector: "isNavigationNode",
  35873. protocol: "testing",
  35874. fn: function (){
  35875. var self=this,$self=this;
  35876. return true;
  35877. },
  35878. args: [],
  35879. source: "isNavigationNode\x0a\x09^ true",
  35880. referencedClasses: [],
  35881. messageSends: []
  35882. }),
  35883. $globals.VariableNode);
  35884. $core.addMethod(
  35885. $core.method({
  35886. selector: "isSuperKeyword",
  35887. protocol: "testing",
  35888. fn: function (){
  35889. var self=this,$self=this;
  35890. return $core.withContext(function($ctx1) {
  35891. return $recv($self._value()).__eq("super");
  35892. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  35893. },
  35894. args: [],
  35895. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  35896. referencedClasses: [],
  35897. messageSends: ["=", "value"]
  35898. }),
  35899. $globals.VariableNode);
  35900. $core.addMethod(
  35901. $core.method({
  35902. selector: "isVariableNode",
  35903. protocol: "testing",
  35904. fn: function (){
  35905. var self=this,$self=this;
  35906. return true;
  35907. },
  35908. args: [],
  35909. source: "isVariableNode\x0a\x09^ true",
  35910. referencedClasses: [],
  35911. messageSends: []
  35912. }),
  35913. $globals.VariableNode);
  35914. $core.addMethod(
  35915. $core.method({
  35916. selector: "navigationLink",
  35917. protocol: "accessing",
  35918. fn: function (){
  35919. var self=this,$self=this;
  35920. return $core.withContext(function($ctx1) {
  35921. return $self._value();
  35922. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  35923. },
  35924. args: [],
  35925. source: "navigationLink\x0a\x09^ self value",
  35926. referencedClasses: [],
  35927. messageSends: ["value"]
  35928. }),
  35929. $globals.VariableNode);
  35930. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  35931. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  35932. $core.addMethod(
  35933. $core.method({
  35934. selector: "visit:",
  35935. protocol: "visiting",
  35936. fn: function (aNode){
  35937. var self=this,$self=this;
  35938. return $core.withContext(function($ctx1) {
  35939. var $1;
  35940. $recv($self._path())._ifNotEmpty_((function(p){
  35941. return $core.withContext(function($ctx2) {
  35942. return $recv(aNode)._parent_($recv(p)._last());
  35943. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  35944. }));
  35945. $1=(
  35946. $ctx1.supercall = true,
  35947. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  35948. $ctx1.supercall = false;
  35949. return $1;
  35950. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  35951. },
  35952. args: ["aNode"],
  35953. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  35954. referencedClasses: [],
  35955. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  35956. }),
  35957. $globals.ParentFakingPathDagVisitor);
  35958. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  35959. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  35960. $core.addMethod(
  35961. $core.method({
  35962. selector: "visitAssignmentNode:",
  35963. protocol: "visiting",
  35964. fn: function (aNode){
  35965. var self=this,$self=this;
  35966. return $core.withContext(function($ctx1) {
  35967. return $self._visitDagNode_(aNode);
  35968. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  35969. },
  35970. args: ["aNode"],
  35971. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35972. referencedClasses: [],
  35973. messageSends: ["visitDagNode:"]
  35974. }),
  35975. $globals.NodeVisitor);
  35976. $core.addMethod(
  35977. $core.method({
  35978. selector: "visitBlockNode:",
  35979. protocol: "visiting",
  35980. fn: function (aNode){
  35981. var self=this,$self=this;
  35982. return $core.withContext(function($ctx1) {
  35983. return $self._visitDagNode_(aNode);
  35984. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  35985. },
  35986. args: ["aNode"],
  35987. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35988. referencedClasses: [],
  35989. messageSends: ["visitDagNode:"]
  35990. }),
  35991. $globals.NodeVisitor);
  35992. $core.addMethod(
  35993. $core.method({
  35994. selector: "visitBlockSequenceNode:",
  35995. protocol: "visiting",
  35996. fn: function (aNode){
  35997. var self=this,$self=this;
  35998. return $core.withContext(function($ctx1) {
  35999. return $self._visitSequenceNode_(aNode);
  36000. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  36001. },
  36002. args: ["aNode"],
  36003. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  36004. referencedClasses: [],
  36005. messageSends: ["visitSequenceNode:"]
  36006. }),
  36007. $globals.NodeVisitor);
  36008. $core.addMethod(
  36009. $core.method({
  36010. selector: "visitCascadeNode:",
  36011. protocol: "visiting",
  36012. fn: function (aNode){
  36013. var self=this,$self=this;
  36014. return $core.withContext(function($ctx1) {
  36015. return $self._visitDagNode_(aNode);
  36016. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  36017. },
  36018. args: ["aNode"],
  36019. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36020. referencedClasses: [],
  36021. messageSends: ["visitDagNode:"]
  36022. }),
  36023. $globals.NodeVisitor);
  36024. $core.addMethod(
  36025. $core.method({
  36026. selector: "visitDagNode:",
  36027. protocol: "visiting",
  36028. fn: function (aNode){
  36029. var self=this,$self=this;
  36030. return $core.withContext(function($ctx1) {
  36031. return $self._visitDagNodeVariantSimple_(aNode);
  36032. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  36033. },
  36034. args: ["aNode"],
  36035. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  36036. referencedClasses: [],
  36037. messageSends: ["visitDagNodeVariantSimple:"]
  36038. }),
  36039. $globals.NodeVisitor);
  36040. $core.addMethod(
  36041. $core.method({
  36042. selector: "visitDynamicArrayNode:",
  36043. protocol: "visiting",
  36044. fn: function (aNode){
  36045. var self=this,$self=this;
  36046. return $core.withContext(function($ctx1) {
  36047. return $self._visitDagNode_(aNode);
  36048. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  36049. },
  36050. args: ["aNode"],
  36051. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36052. referencedClasses: [],
  36053. messageSends: ["visitDagNode:"]
  36054. }),
  36055. $globals.NodeVisitor);
  36056. $core.addMethod(
  36057. $core.method({
  36058. selector: "visitDynamicDictionaryNode:",
  36059. protocol: "visiting",
  36060. fn: function (aNode){
  36061. var self=this,$self=this;
  36062. return $core.withContext(function($ctx1) {
  36063. return $self._visitDagNode_(aNode);
  36064. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  36065. },
  36066. args: ["aNode"],
  36067. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36068. referencedClasses: [],
  36069. messageSends: ["visitDagNode:"]
  36070. }),
  36071. $globals.NodeVisitor);
  36072. $core.addMethod(
  36073. $core.method({
  36074. selector: "visitJSStatementNode:",
  36075. protocol: "visiting",
  36076. fn: function (aNode){
  36077. var self=this,$self=this;
  36078. return $core.withContext(function($ctx1) {
  36079. return $self._visitDagNode_(aNode);
  36080. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  36081. },
  36082. args: ["aNode"],
  36083. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36084. referencedClasses: [],
  36085. messageSends: ["visitDagNode:"]
  36086. }),
  36087. $globals.NodeVisitor);
  36088. $core.addMethod(
  36089. $core.method({
  36090. selector: "visitMethodNode:",
  36091. protocol: "visiting",
  36092. fn: function (aNode){
  36093. var self=this,$self=this;
  36094. return $core.withContext(function($ctx1) {
  36095. return $self._visitDagNode_(aNode);
  36096. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  36097. },
  36098. args: ["aNode"],
  36099. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36100. referencedClasses: [],
  36101. messageSends: ["visitDagNode:"]
  36102. }),
  36103. $globals.NodeVisitor);
  36104. $core.addMethod(
  36105. $core.method({
  36106. selector: "visitReturnNode:",
  36107. protocol: "visiting",
  36108. fn: function (aNode){
  36109. var self=this,$self=this;
  36110. return $core.withContext(function($ctx1) {
  36111. return $self._visitDagNode_(aNode);
  36112. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  36113. },
  36114. args: ["aNode"],
  36115. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36116. referencedClasses: [],
  36117. messageSends: ["visitDagNode:"]
  36118. }),
  36119. $globals.NodeVisitor);
  36120. $core.addMethod(
  36121. $core.method({
  36122. selector: "visitSendNode:",
  36123. protocol: "visiting",
  36124. fn: function (aNode){
  36125. var self=this,$self=this;
  36126. return $core.withContext(function($ctx1) {
  36127. return $self._visitDagNode_(aNode);
  36128. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  36129. },
  36130. args: ["aNode"],
  36131. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36132. referencedClasses: [],
  36133. messageSends: ["visitDagNode:"]
  36134. }),
  36135. $globals.NodeVisitor);
  36136. $core.addMethod(
  36137. $core.method({
  36138. selector: "visitSequenceNode:",
  36139. protocol: "visiting",
  36140. fn: function (aNode){
  36141. var self=this,$self=this;
  36142. return $core.withContext(function($ctx1) {
  36143. return $self._visitDagNode_(aNode);
  36144. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  36145. },
  36146. args: ["aNode"],
  36147. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36148. referencedClasses: [],
  36149. messageSends: ["visitDagNode:"]
  36150. }),
  36151. $globals.NodeVisitor);
  36152. $core.addMethod(
  36153. $core.method({
  36154. selector: "visitValueNode:",
  36155. protocol: "visiting",
  36156. fn: function (aNode){
  36157. var self=this,$self=this;
  36158. return $core.withContext(function($ctx1) {
  36159. return $self._visitDagNode_(aNode);
  36160. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  36161. },
  36162. args: ["aNode"],
  36163. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36164. referencedClasses: [],
  36165. messageSends: ["visitDagNode:"]
  36166. }),
  36167. $globals.NodeVisitor);
  36168. $core.addMethod(
  36169. $core.method({
  36170. selector: "visitVariableNode:",
  36171. protocol: "visiting",
  36172. fn: function (aNode){
  36173. var self=this,$self=this;
  36174. return $core.withContext(function($ctx1) {
  36175. return $self._visitDagNode_(aNode);
  36176. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  36177. },
  36178. args: ["aNode"],
  36179. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36180. referencedClasses: [],
  36181. messageSends: ["visitDagNode:"]
  36182. }),
  36183. $globals.NodeVisitor);
  36184. $core.addMethod(
  36185. $core.method({
  36186. selector: "ast",
  36187. protocol: "*Compiler-AST",
  36188. fn: function (){
  36189. var self=this,$self=this;
  36190. return $core.withContext(function($ctx1) {
  36191. var $1;
  36192. $1=$self._source();
  36193. $ctx1.sendIdx["source"]=1;
  36194. $recv($1)._ifEmpty_((function(){
  36195. return $core.withContext(function($ctx2) {
  36196. return $self._error_("Method source is empty");
  36197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36198. }));
  36199. return $recv($globals.Smalltalk)._parse_($self._source());
  36200. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  36201. },
  36202. args: [],
  36203. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  36204. referencedClasses: ["Smalltalk"],
  36205. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  36206. }),
  36207. $globals.CompiledMethod);
  36208. });
  36209. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  36210. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  36211. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  36212. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  36213. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  36214. $core.addPackage("Compiler-Semantic");
  36215. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  36216. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  36217. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  36218. $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.";
  36219. $core.addMethod(
  36220. $core.method({
  36221. selector: "addArg:",
  36222. protocol: "adding",
  36223. fn: function (aString){
  36224. var self=this,$self=this;
  36225. return $core.withContext(function($ctx1) {
  36226. var $1;
  36227. $1=$self._args();
  36228. $ctx1.sendIdx["args"]=1;
  36229. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  36230. $recv($recv($self._args())._at_(aString))._scope_(self);
  36231. return self;
  36232. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  36233. },
  36234. args: ["aString"],
  36235. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  36236. referencedClasses: ["ArgVar"],
  36237. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  36238. }),
  36239. $globals.LexicalScope);
  36240. $core.addMethod(
  36241. $core.method({
  36242. selector: "addTemp:",
  36243. protocol: "adding",
  36244. fn: function (aString){
  36245. var self=this,$self=this;
  36246. return $core.withContext(function($ctx1) {
  36247. var $1;
  36248. $1=$self._temps();
  36249. $ctx1.sendIdx["temps"]=1;
  36250. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  36251. $recv($recv($self._temps())._at_(aString))._scope_(self);
  36252. return self;
  36253. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  36254. },
  36255. args: ["aString"],
  36256. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  36257. referencedClasses: ["TempVar"],
  36258. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  36259. }),
  36260. $globals.LexicalScope);
  36261. $core.addMethod(
  36262. $core.method({
  36263. selector: "alias",
  36264. protocol: "accessing",
  36265. fn: function (){
  36266. var self=this,$self=this;
  36267. return $core.withContext(function($ctx1) {
  36268. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  36269. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  36270. },
  36271. args: [],
  36272. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  36273. referencedClasses: [],
  36274. messageSends: [",", "asString", "scopeLevel"]
  36275. }),
  36276. $globals.LexicalScope);
  36277. $core.addMethod(
  36278. $core.method({
  36279. selector: "allVariableNames",
  36280. protocol: "accessing",
  36281. fn: function (){
  36282. var self=this,$self=this;
  36283. return $core.withContext(function($ctx1) {
  36284. var $1;
  36285. $1=$recv($self._args())._keys();
  36286. $ctx1.sendIdx["keys"]=1;
  36287. return $recv($1).__comma($recv($self._temps())._keys());
  36288. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  36289. },
  36290. args: [],
  36291. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  36292. referencedClasses: [],
  36293. messageSends: [",", "keys", "args", "temps"]
  36294. }),
  36295. $globals.LexicalScope);
  36296. $core.addMethod(
  36297. $core.method({
  36298. selector: "args",
  36299. protocol: "accessing",
  36300. fn: function (){
  36301. var self=this,$self=this;
  36302. return $core.withContext(function($ctx1) {
  36303. var $1,$receiver;
  36304. $1=$self["@args"];
  36305. if(($receiver = $1) == null || $receiver.a$nil){
  36306. $self["@args"]=$recv($globals.Dictionary)._new();
  36307. return $self["@args"];
  36308. } else {
  36309. return $1;
  36310. }
  36311. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  36312. },
  36313. args: [],
  36314. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  36315. referencedClasses: ["Dictionary"],
  36316. messageSends: ["ifNil:", "new"]
  36317. }),
  36318. $globals.LexicalScope);
  36319. $core.addMethod(
  36320. $core.method({
  36321. selector: "bindingFor:",
  36322. protocol: "accessing",
  36323. fn: function (aStringOrNode){
  36324. var self=this,$self=this;
  36325. return $core.withContext(function($ctx1) {
  36326. var $2,$3,$4,$5,$1;
  36327. $2=$self._pseudoVars();
  36328. $3=$recv(aStringOrNode)._value();
  36329. $ctx1.sendIdx["value"]=1;
  36330. $1=$recv($2)._at_ifAbsent_($3,(function(){
  36331. return $core.withContext(function($ctx2) {
  36332. $4=$self._args();
  36333. $5=$recv(aStringOrNode)._value();
  36334. $ctx2.sendIdx["value"]=2;
  36335. return $recv($4)._at_ifAbsent_($5,(function(){
  36336. return $core.withContext(function($ctx3) {
  36337. return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  36338. return nil;
  36339. }));
  36340. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36341. }));
  36342. $ctx2.sendIdx["at:ifAbsent:"]=2;
  36343. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36344. }));
  36345. $ctx1.sendIdx["at:ifAbsent:"]=1;
  36346. return $1;
  36347. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  36348. },
  36349. args: ["aStringOrNode"],
  36350. 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 ]]]",
  36351. referencedClasses: [],
  36352. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  36353. }),
  36354. $globals.LexicalScope);
  36355. $core.addMethod(
  36356. $core.method({
  36357. selector: "blockIndex",
  36358. protocol: "accessing",
  36359. fn: function (){
  36360. var self=this,$self=this;
  36361. return $core.withContext(function($ctx1) {
  36362. var $1,$receiver;
  36363. $1=$self["@blockIndex"];
  36364. if(($receiver = $1) == null || $receiver.a$nil){
  36365. return (0);
  36366. } else {
  36367. return $1;
  36368. }
  36369. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  36370. },
  36371. args: [],
  36372. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  36373. referencedClasses: [],
  36374. messageSends: ["ifNil:"]
  36375. }),
  36376. $globals.LexicalScope);
  36377. $core.addMethod(
  36378. $core.method({
  36379. selector: "blockIndex:",
  36380. protocol: "accessing",
  36381. fn: function (anInteger){
  36382. var self=this,$self=this;
  36383. $self["@blockIndex"]=anInteger;
  36384. return self;
  36385. },
  36386. args: ["anInteger"],
  36387. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  36388. referencedClasses: [],
  36389. messageSends: []
  36390. }),
  36391. $globals.LexicalScope);
  36392. $core.addMethod(
  36393. $core.method({
  36394. selector: "canInlineNonLocalReturns",
  36395. protocol: "testing",
  36396. fn: function (){
  36397. var self=this,$self=this;
  36398. return $core.withContext(function($ctx1) {
  36399. return $recv($self._isInlined())._and_((function(){
  36400. return $core.withContext(function($ctx2) {
  36401. return $recv($self._outerScope())._canInlineNonLocalReturns();
  36402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36403. }));
  36404. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  36405. },
  36406. args: [],
  36407. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  36408. referencedClasses: [],
  36409. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  36410. }),
  36411. $globals.LexicalScope);
  36412. $core.addMethod(
  36413. $core.method({
  36414. selector: "instruction",
  36415. protocol: "accessing",
  36416. fn: function (){
  36417. var self=this,$self=this;
  36418. return $self["@instruction"];
  36419. },
  36420. args: [],
  36421. source: "instruction\x0a\x09^ instruction",
  36422. referencedClasses: [],
  36423. messageSends: []
  36424. }),
  36425. $globals.LexicalScope);
  36426. $core.addMethod(
  36427. $core.method({
  36428. selector: "instruction:",
  36429. protocol: "accessing",
  36430. fn: function (anIRInstruction){
  36431. var self=this,$self=this;
  36432. $self["@instruction"]=anIRInstruction;
  36433. return self;
  36434. },
  36435. args: ["anIRInstruction"],
  36436. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  36437. referencedClasses: [],
  36438. messageSends: []
  36439. }),
  36440. $globals.LexicalScope);
  36441. $core.addMethod(
  36442. $core.method({
  36443. selector: "isBlockScope",
  36444. protocol: "testing",
  36445. fn: function (){
  36446. var self=this,$self=this;
  36447. return $core.withContext(function($ctx1) {
  36448. return $recv($self._isMethodScope())._not();
  36449. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  36450. },
  36451. args: [],
  36452. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  36453. referencedClasses: [],
  36454. messageSends: ["not", "isMethodScope"]
  36455. }),
  36456. $globals.LexicalScope);
  36457. $core.addMethod(
  36458. $core.method({
  36459. selector: "isInlined",
  36460. protocol: "testing",
  36461. fn: function (){
  36462. var self=this,$self=this;
  36463. return $core.withContext(function($ctx1) {
  36464. var $2,$1;
  36465. $2=$self._instruction();
  36466. $ctx1.sendIdx["instruction"]=1;
  36467. $1=$recv($2)._notNil();
  36468. return $recv($1)._and_((function(){
  36469. return $core.withContext(function($ctx2) {
  36470. return $recv($self._instruction())._isInlined();
  36471. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36472. }));
  36473. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  36474. },
  36475. args: [],
  36476. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  36477. referencedClasses: [],
  36478. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  36479. }),
  36480. $globals.LexicalScope);
  36481. $core.addMethod(
  36482. $core.method({
  36483. selector: "isMethodScope",
  36484. protocol: "testing",
  36485. fn: function (){
  36486. var self=this,$self=this;
  36487. return false;
  36488. },
  36489. args: [],
  36490. source: "isMethodScope\x0a\x09^ false",
  36491. referencedClasses: [],
  36492. messageSends: []
  36493. }),
  36494. $globals.LexicalScope);
  36495. $core.addMethod(
  36496. $core.method({
  36497. selector: "lookupVariable:",
  36498. protocol: "accessing",
  36499. fn: function (aNode){
  36500. var self=this,$self=this;
  36501. var lookup;
  36502. return $core.withContext(function($ctx1) {
  36503. var $1,$2,$receiver;
  36504. lookup=$self._bindingFor_(aNode);
  36505. $1=lookup;
  36506. if(($receiver = $1) == null || $receiver.a$nil){
  36507. $2=$self._outerScope();
  36508. $ctx1.sendIdx["outerScope"]=1;
  36509. if(($receiver = $2) == null || $receiver.a$nil){
  36510. lookup=$2;
  36511. } else {
  36512. lookup=$recv($self._outerScope())._lookupVariable_(aNode);
  36513. }
  36514. lookup;
  36515. } else {
  36516. $1;
  36517. }
  36518. return lookup;
  36519. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  36520. },
  36521. args: ["aNode"],
  36522. 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",
  36523. referencedClasses: [],
  36524. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  36525. }),
  36526. $globals.LexicalScope);
  36527. $core.addMethod(
  36528. $core.method({
  36529. selector: "methodScope",
  36530. protocol: "accessing",
  36531. fn: function (){
  36532. var self=this,$self=this;
  36533. return $core.withContext(function($ctx1) {
  36534. var $1,$receiver;
  36535. $1=$self._outerScope();
  36536. $ctx1.sendIdx["outerScope"]=1;
  36537. if(($receiver = $1) == null || $receiver.a$nil){
  36538. return $1;
  36539. } else {
  36540. return $recv($self._outerScope())._methodScope();
  36541. }
  36542. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  36543. },
  36544. args: [],
  36545. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  36546. referencedClasses: [],
  36547. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  36548. }),
  36549. $globals.LexicalScope);
  36550. $core.addMethod(
  36551. $core.method({
  36552. selector: "node",
  36553. protocol: "accessing",
  36554. fn: function (){
  36555. var self=this,$self=this;
  36556. return $self["@node"];
  36557. },
  36558. args: [],
  36559. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  36560. referencedClasses: [],
  36561. messageSends: []
  36562. }),
  36563. $globals.LexicalScope);
  36564. $core.addMethod(
  36565. $core.method({
  36566. selector: "node:",
  36567. protocol: "accessing",
  36568. fn: function (aNode){
  36569. var self=this,$self=this;
  36570. $self["@node"]=aNode;
  36571. return self;
  36572. },
  36573. args: ["aNode"],
  36574. source: "node: aNode\x0a\x09node := aNode",
  36575. referencedClasses: [],
  36576. messageSends: []
  36577. }),
  36578. $globals.LexicalScope);
  36579. $core.addMethod(
  36580. $core.method({
  36581. selector: "outerScope",
  36582. protocol: "accessing",
  36583. fn: function (){
  36584. var self=this,$self=this;
  36585. return $self["@outerScope"];
  36586. },
  36587. args: [],
  36588. source: "outerScope\x0a\x09^ outerScope",
  36589. referencedClasses: [],
  36590. messageSends: []
  36591. }),
  36592. $globals.LexicalScope);
  36593. $core.addMethod(
  36594. $core.method({
  36595. selector: "outerScope:",
  36596. protocol: "accessing",
  36597. fn: function (aLexicalScope){
  36598. var self=this,$self=this;
  36599. $self["@outerScope"]=aLexicalScope;
  36600. return self;
  36601. },
  36602. args: ["aLexicalScope"],
  36603. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  36604. referencedClasses: [],
  36605. messageSends: []
  36606. }),
  36607. $globals.LexicalScope);
  36608. $core.addMethod(
  36609. $core.method({
  36610. selector: "pseudoVars",
  36611. protocol: "accessing",
  36612. fn: function (){
  36613. var self=this,$self=this;
  36614. return $core.withContext(function($ctx1) {
  36615. return $recv($self._methodScope())._pseudoVars();
  36616. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  36617. },
  36618. args: [],
  36619. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  36620. referencedClasses: [],
  36621. messageSends: ["pseudoVars", "methodScope"]
  36622. }),
  36623. $globals.LexicalScope);
  36624. $core.addMethod(
  36625. $core.method({
  36626. selector: "scopeLevel",
  36627. protocol: "accessing",
  36628. fn: function (){
  36629. var self=this,$self=this;
  36630. return $core.withContext(function($ctx1) {
  36631. var $1,$2,$4,$3,$receiver;
  36632. $1=$self._outerScope();
  36633. $ctx1.sendIdx["outerScope"]=1;
  36634. if(($receiver = $1) == null || $receiver.a$nil){
  36635. return (1);
  36636. } else {
  36637. $1;
  36638. }
  36639. $2=$self._isInlined();
  36640. if($core.assert($2)){
  36641. $4=$self._outerScope();
  36642. $ctx1.sendIdx["outerScope"]=2;
  36643. $3=$recv($4)._scopeLevel();
  36644. $ctx1.sendIdx["scopeLevel"]=1;
  36645. return $3;
  36646. }
  36647. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  36648. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  36649. },
  36650. args: [],
  36651. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  36652. referencedClasses: [],
  36653. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  36654. }),
  36655. $globals.LexicalScope);
  36656. $core.addMethod(
  36657. $core.method({
  36658. selector: "temps",
  36659. protocol: "accessing",
  36660. fn: function (){
  36661. var self=this,$self=this;
  36662. return $core.withContext(function($ctx1) {
  36663. var $1,$receiver;
  36664. $1=$self["@temps"];
  36665. if(($receiver = $1) == null || $receiver.a$nil){
  36666. $self["@temps"]=$recv($globals.Dictionary)._new();
  36667. return $self["@temps"];
  36668. } else {
  36669. return $1;
  36670. }
  36671. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  36672. },
  36673. args: [],
  36674. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  36675. referencedClasses: ["Dictionary"],
  36676. messageSends: ["ifNil:", "new"]
  36677. }),
  36678. $globals.LexicalScope);
  36679. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  36680. $globals.MethodLexicalScope.comment="I represent a method scope.";
  36681. $core.addMethod(
  36682. $core.method({
  36683. selector: "addIVar:",
  36684. protocol: "adding",
  36685. fn: function (aString){
  36686. var self=this,$self=this;
  36687. return $core.withContext(function($ctx1) {
  36688. var $1;
  36689. $1=$self._iVars();
  36690. $ctx1.sendIdx["iVars"]=1;
  36691. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  36692. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  36693. return self;
  36694. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  36695. },
  36696. args: ["aString"],
  36697. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  36698. referencedClasses: ["InstanceVar"],
  36699. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  36700. }),
  36701. $globals.MethodLexicalScope);
  36702. $core.addMethod(
  36703. $core.method({
  36704. selector: "addNonLocalReturn:",
  36705. protocol: "adding",
  36706. fn: function (aScope){
  36707. var self=this,$self=this;
  36708. return $core.withContext(function($ctx1) {
  36709. $recv($self._nonLocalReturns())._add_(aScope);
  36710. return self;
  36711. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  36712. },
  36713. args: ["aScope"],
  36714. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  36715. referencedClasses: [],
  36716. messageSends: ["add:", "nonLocalReturns"]
  36717. }),
  36718. $globals.MethodLexicalScope);
  36719. $core.addMethod(
  36720. $core.method({
  36721. selector: "allVariableNames",
  36722. protocol: "accessing",
  36723. fn: function (){
  36724. var self=this,$self=this;
  36725. return $core.withContext(function($ctx1) {
  36726. var $1;
  36727. $1=(
  36728. $ctx1.supercall = true,
  36729. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, []));
  36730. $ctx1.supercall = false;
  36731. return $recv($1).__comma($recv($self._iVars())._keys());
  36732. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  36733. },
  36734. args: [],
  36735. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  36736. referencedClasses: [],
  36737. messageSends: [",", "allVariableNames", "keys", "iVars"]
  36738. }),
  36739. $globals.MethodLexicalScope);
  36740. $core.addMethod(
  36741. $core.method({
  36742. selector: "bindingFor:",
  36743. protocol: "accessing",
  36744. fn: function (aNode){
  36745. var self=this,$self=this;
  36746. return $core.withContext(function($ctx1) {
  36747. var $1,$receiver;
  36748. $1=(
  36749. $ctx1.supercall = true,
  36750. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode]));
  36751. $ctx1.supercall = false;
  36752. if(($receiver = $1) == null || $receiver.a$nil){
  36753. return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  36754. return nil;
  36755. }));
  36756. } else {
  36757. return $1;
  36758. }
  36759. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  36760. },
  36761. args: ["aNode"],
  36762. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  36763. referencedClasses: [],
  36764. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  36765. }),
  36766. $globals.MethodLexicalScope);
  36767. $core.addMethod(
  36768. $core.method({
  36769. selector: "canInlineNonLocalReturns",
  36770. protocol: "testing",
  36771. fn: function (){
  36772. var self=this,$self=this;
  36773. return true;
  36774. },
  36775. args: [],
  36776. source: "canInlineNonLocalReturns\x0a\x09^ true",
  36777. referencedClasses: [],
  36778. messageSends: []
  36779. }),
  36780. $globals.MethodLexicalScope);
  36781. $core.addMethod(
  36782. $core.method({
  36783. selector: "hasLocalReturn",
  36784. protocol: "testing",
  36785. fn: function (){
  36786. var self=this,$self=this;
  36787. return $core.withContext(function($ctx1) {
  36788. return $self._localReturn();
  36789. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  36790. },
  36791. args: [],
  36792. source: "hasLocalReturn\x0a\x09^ self localReturn",
  36793. referencedClasses: [],
  36794. messageSends: ["localReturn"]
  36795. }),
  36796. $globals.MethodLexicalScope);
  36797. $core.addMethod(
  36798. $core.method({
  36799. selector: "hasNonLocalReturn",
  36800. protocol: "testing",
  36801. fn: function (){
  36802. var self=this,$self=this;
  36803. return $core.withContext(function($ctx1) {
  36804. return $recv($self._nonLocalReturns())._notEmpty();
  36805. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  36806. },
  36807. args: [],
  36808. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  36809. referencedClasses: [],
  36810. messageSends: ["notEmpty", "nonLocalReturns"]
  36811. }),
  36812. $globals.MethodLexicalScope);
  36813. $core.addMethod(
  36814. $core.method({
  36815. selector: "iVars",
  36816. protocol: "accessing",
  36817. fn: function (){
  36818. var self=this,$self=this;
  36819. return $core.withContext(function($ctx1) {
  36820. var $1,$receiver;
  36821. $1=$self["@iVars"];
  36822. if(($receiver = $1) == null || $receiver.a$nil){
  36823. $self["@iVars"]=$recv($globals.Dictionary)._new();
  36824. return $self["@iVars"];
  36825. } else {
  36826. return $1;
  36827. }
  36828. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  36829. },
  36830. args: [],
  36831. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  36832. referencedClasses: ["Dictionary"],
  36833. messageSends: ["ifNil:", "new"]
  36834. }),
  36835. $globals.MethodLexicalScope);
  36836. $core.addMethod(
  36837. $core.method({
  36838. selector: "isMethodScope",
  36839. protocol: "testing",
  36840. fn: function (){
  36841. var self=this,$self=this;
  36842. return true;
  36843. },
  36844. args: [],
  36845. source: "isMethodScope\x0a\x09^ true",
  36846. referencedClasses: [],
  36847. messageSends: []
  36848. }),
  36849. $globals.MethodLexicalScope);
  36850. $core.addMethod(
  36851. $core.method({
  36852. selector: "localReturn",
  36853. protocol: "accessing",
  36854. fn: function (){
  36855. var self=this,$self=this;
  36856. return $core.withContext(function($ctx1) {
  36857. var $1,$receiver;
  36858. $1=$self["@localReturn"];
  36859. if(($receiver = $1) == null || $receiver.a$nil){
  36860. return false;
  36861. } else {
  36862. return $1;
  36863. }
  36864. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  36865. },
  36866. args: [],
  36867. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  36868. referencedClasses: [],
  36869. messageSends: ["ifNil:"]
  36870. }),
  36871. $globals.MethodLexicalScope);
  36872. $core.addMethod(
  36873. $core.method({
  36874. selector: "localReturn:",
  36875. protocol: "accessing",
  36876. fn: function (aBoolean){
  36877. var self=this,$self=this;
  36878. $self["@localReturn"]=aBoolean;
  36879. return self;
  36880. },
  36881. args: ["aBoolean"],
  36882. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  36883. referencedClasses: [],
  36884. messageSends: []
  36885. }),
  36886. $globals.MethodLexicalScope);
  36887. $core.addMethod(
  36888. $core.method({
  36889. selector: "methodScope",
  36890. protocol: "accessing",
  36891. fn: function (){
  36892. var self=this,$self=this;
  36893. return self;
  36894. },
  36895. args: [],
  36896. source: "methodScope\x0a\x09^ self",
  36897. referencedClasses: [],
  36898. messageSends: []
  36899. }),
  36900. $globals.MethodLexicalScope);
  36901. $core.addMethod(
  36902. $core.method({
  36903. selector: "nonLocalReturns",
  36904. protocol: "accessing",
  36905. fn: function (){
  36906. var self=this,$self=this;
  36907. return $core.withContext(function($ctx1) {
  36908. var $1,$receiver;
  36909. $1=$self["@nonLocalReturns"];
  36910. if(($receiver = $1) == null || $receiver.a$nil){
  36911. $self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  36912. return $self["@nonLocalReturns"];
  36913. } else {
  36914. return $1;
  36915. }
  36916. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  36917. },
  36918. args: [],
  36919. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  36920. referencedClasses: ["OrderedCollection"],
  36921. messageSends: ["ifNil:", "new"]
  36922. }),
  36923. $globals.MethodLexicalScope);
  36924. $core.addMethod(
  36925. $core.method({
  36926. selector: "pseudoVars",
  36927. protocol: "accessing",
  36928. fn: function (){
  36929. var self=this,$self=this;
  36930. return $core.withContext(function($ctx1) {
  36931. var $1,$2,$4,$3,$receiver;
  36932. $1=$self["@pseudoVars"];
  36933. if(($receiver = $1) == null || $receiver.a$nil){
  36934. $self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  36935. $self["@pseudoVars"];
  36936. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  36937. return $core.withContext(function($ctx2) {
  36938. $2=$self["@pseudoVars"];
  36939. $4=$recv($globals.PseudoVar)._on_(each);
  36940. $recv($4)._scope_($self._methodScope());
  36941. $3=$recv($4)._yourself();
  36942. return $recv($2)._at_put_(each,$3);
  36943. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36944. }));
  36945. } else {
  36946. $1;
  36947. }
  36948. return $self["@pseudoVars"];
  36949. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  36950. },
  36951. args: [],
  36952. 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",
  36953. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  36954. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  36955. }),
  36956. $globals.MethodLexicalScope);
  36957. $core.addMethod(
  36958. $core.method({
  36959. selector: "removeNonLocalReturn:",
  36960. protocol: "adding",
  36961. fn: function (aScope){
  36962. var self=this,$self=this;
  36963. return $core.withContext(function($ctx1) {
  36964. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  36965. }));
  36966. return self;
  36967. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  36968. },
  36969. args: ["aScope"],
  36970. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  36971. referencedClasses: [],
  36972. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  36973. }),
  36974. $globals.MethodLexicalScope);
  36975. $core.addMethod(
  36976. $core.method({
  36977. selector: "unknownVariables",
  36978. protocol: "accessing",
  36979. fn: function (){
  36980. var self=this,$self=this;
  36981. return $core.withContext(function($ctx1) {
  36982. var $1,$receiver;
  36983. $1=$self["@unknownVariables"];
  36984. if(($receiver = $1) == null || $receiver.a$nil){
  36985. $self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  36986. return $self["@unknownVariables"];
  36987. } else {
  36988. return $1;
  36989. }
  36990. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  36991. },
  36992. args: [],
  36993. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  36994. referencedClasses: ["OrderedCollection"],
  36995. messageSends: ["ifNil:", "new"]
  36996. }),
  36997. $globals.MethodLexicalScope);
  36998. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  36999. $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.";
  37000. $core.addMethod(
  37001. $core.method({
  37002. selector: "alias",
  37003. protocol: "accessing",
  37004. fn: function (){
  37005. var self=this,$self=this;
  37006. return $core.withContext(function($ctx1) {
  37007. return $recv($self._name())._asVariableName();
  37008. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  37009. },
  37010. args: [],
  37011. source: "alias\x0a\x09^ self name asVariableName",
  37012. referencedClasses: [],
  37013. messageSends: ["asVariableName", "name"]
  37014. }),
  37015. $globals.ScopeVar);
  37016. $core.addMethod(
  37017. $core.method({
  37018. selector: "isArgVar",
  37019. protocol: "testing",
  37020. fn: function (){
  37021. var self=this,$self=this;
  37022. return false;
  37023. },
  37024. args: [],
  37025. source: "isArgVar\x0a\x09^ false",
  37026. referencedClasses: [],
  37027. messageSends: []
  37028. }),
  37029. $globals.ScopeVar);
  37030. $core.addMethod(
  37031. $core.method({
  37032. selector: "isClassRefVar",
  37033. protocol: "testing",
  37034. fn: function (){
  37035. var self=this,$self=this;
  37036. return false;
  37037. },
  37038. args: [],
  37039. source: "isClassRefVar\x0a\x09^ false",
  37040. referencedClasses: [],
  37041. messageSends: []
  37042. }),
  37043. $globals.ScopeVar);
  37044. $core.addMethod(
  37045. $core.method({
  37046. selector: "isImmutable",
  37047. protocol: "testing",
  37048. fn: function (){
  37049. var self=this,$self=this;
  37050. return false;
  37051. },
  37052. args: [],
  37053. source: "isImmutable\x0a\x09^ false",
  37054. referencedClasses: [],
  37055. messageSends: []
  37056. }),
  37057. $globals.ScopeVar);
  37058. $core.addMethod(
  37059. $core.method({
  37060. selector: "isInstanceVar",
  37061. protocol: "testing",
  37062. fn: function (){
  37063. var self=this,$self=this;
  37064. return false;
  37065. },
  37066. args: [],
  37067. source: "isInstanceVar\x0a\x09^ false",
  37068. referencedClasses: [],
  37069. messageSends: []
  37070. }),
  37071. $globals.ScopeVar);
  37072. $core.addMethod(
  37073. $core.method({
  37074. selector: "isPseudoVar",
  37075. protocol: "testing",
  37076. fn: function (){
  37077. var self=this,$self=this;
  37078. return false;
  37079. },
  37080. args: [],
  37081. source: "isPseudoVar\x0a\x09^ false",
  37082. referencedClasses: [],
  37083. messageSends: []
  37084. }),
  37085. $globals.ScopeVar);
  37086. $core.addMethod(
  37087. $core.method({
  37088. selector: "isSelf",
  37089. protocol: "testing",
  37090. fn: function (){
  37091. var self=this,$self=this;
  37092. return false;
  37093. },
  37094. args: [],
  37095. source: "isSelf\x0a\x09^ false",
  37096. referencedClasses: [],
  37097. messageSends: []
  37098. }),
  37099. $globals.ScopeVar);
  37100. $core.addMethod(
  37101. $core.method({
  37102. selector: "isSuper",
  37103. protocol: "testing",
  37104. fn: function (){
  37105. var self=this,$self=this;
  37106. return false;
  37107. },
  37108. args: [],
  37109. source: "isSuper\x0a\x09^ false",
  37110. referencedClasses: [],
  37111. messageSends: []
  37112. }),
  37113. $globals.ScopeVar);
  37114. $core.addMethod(
  37115. $core.method({
  37116. selector: "isTempVar",
  37117. protocol: "testing",
  37118. fn: function (){
  37119. var self=this,$self=this;
  37120. return false;
  37121. },
  37122. args: [],
  37123. source: "isTempVar\x0a\x09^ false",
  37124. referencedClasses: [],
  37125. messageSends: []
  37126. }),
  37127. $globals.ScopeVar);
  37128. $core.addMethod(
  37129. $core.method({
  37130. selector: "isUnknownVar",
  37131. protocol: "testing",
  37132. fn: function (){
  37133. var self=this,$self=this;
  37134. return false;
  37135. },
  37136. args: [],
  37137. source: "isUnknownVar\x0a\x09^ false",
  37138. referencedClasses: [],
  37139. messageSends: []
  37140. }),
  37141. $globals.ScopeVar);
  37142. $core.addMethod(
  37143. $core.method({
  37144. selector: "name",
  37145. protocol: "accessing",
  37146. fn: function (){
  37147. var self=this,$self=this;
  37148. return $self["@name"];
  37149. },
  37150. args: [],
  37151. source: "name\x0a\x09^ name",
  37152. referencedClasses: [],
  37153. messageSends: []
  37154. }),
  37155. $globals.ScopeVar);
  37156. $core.addMethod(
  37157. $core.method({
  37158. selector: "name:",
  37159. protocol: "accessing",
  37160. fn: function (aString){
  37161. var self=this,$self=this;
  37162. $self["@name"]=aString;
  37163. return self;
  37164. },
  37165. args: ["aString"],
  37166. source: "name: aString\x0a\x09name := aString",
  37167. referencedClasses: [],
  37168. messageSends: []
  37169. }),
  37170. $globals.ScopeVar);
  37171. $core.addMethod(
  37172. $core.method({
  37173. selector: "scope",
  37174. protocol: "accessing",
  37175. fn: function (){
  37176. var self=this,$self=this;
  37177. return $self["@scope"];
  37178. },
  37179. args: [],
  37180. source: "scope\x0a\x09^ scope",
  37181. referencedClasses: [],
  37182. messageSends: []
  37183. }),
  37184. $globals.ScopeVar);
  37185. $core.addMethod(
  37186. $core.method({
  37187. selector: "scope:",
  37188. protocol: "accessing",
  37189. fn: function (aScope){
  37190. var self=this,$self=this;
  37191. $self["@scope"]=aScope;
  37192. return self;
  37193. },
  37194. args: ["aScope"],
  37195. source: "scope: aScope\x0a\x09scope := aScope",
  37196. referencedClasses: [],
  37197. messageSends: []
  37198. }),
  37199. $globals.ScopeVar);
  37200. $core.addMethod(
  37201. $core.method({
  37202. selector: "validateAssignment",
  37203. protocol: "testing",
  37204. fn: function (){
  37205. var self=this,$self=this;
  37206. return $core.withContext(function($ctx1) {
  37207. var $1,$2;
  37208. $1=$recv($self._isArgVar())._or_((function(){
  37209. return $core.withContext(function($ctx2) {
  37210. return $self._isPseudoVar();
  37211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37212. }));
  37213. if($core.assert($1)){
  37214. $2=$recv($globals.InvalidAssignmentError)._new();
  37215. $recv($2)._variableName_($self._name());
  37216. $recv($2)._signal();
  37217. }
  37218. return self;
  37219. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  37220. },
  37221. args: [],
  37222. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  37223. referencedClasses: ["InvalidAssignmentError"],
  37224. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  37225. }),
  37226. $globals.ScopeVar);
  37227. $core.addMethod(
  37228. $core.method({
  37229. selector: "on:",
  37230. protocol: "instance creation",
  37231. fn: function (aString){
  37232. var self=this,$self=this;
  37233. return $core.withContext(function($ctx1) {
  37234. var $1;
  37235. $1=$self._new();
  37236. $recv($1)._name_(aString);
  37237. return $recv($1)._yourself();
  37238. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.a$cls)});
  37239. },
  37240. args: ["aString"],
  37241. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  37242. referencedClasses: [],
  37243. messageSends: ["name:", "new", "yourself"]
  37244. }),
  37245. $globals.ScopeVar.a$cls);
  37246. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  37247. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  37248. $core.addMethod(
  37249. $core.method({
  37250. selector: "isImmutable",
  37251. protocol: "testing",
  37252. fn: function (){
  37253. var self=this,$self=this;
  37254. return true;
  37255. },
  37256. args: [],
  37257. source: "isImmutable\x0a\x09^ true",
  37258. referencedClasses: [],
  37259. messageSends: []
  37260. }),
  37261. $globals.AliasVar);
  37262. $core.addMethod(
  37263. $core.method({
  37264. selector: "node",
  37265. protocol: "accessing",
  37266. fn: function (){
  37267. var self=this,$self=this;
  37268. return $self["@node"];
  37269. },
  37270. args: [],
  37271. source: "node\x0a\x09^ node",
  37272. referencedClasses: [],
  37273. messageSends: []
  37274. }),
  37275. $globals.AliasVar);
  37276. $core.addMethod(
  37277. $core.method({
  37278. selector: "node:",
  37279. protocol: "accessing",
  37280. fn: function (aNode){
  37281. var self=this,$self=this;
  37282. $self["@node"]=aNode;
  37283. return self;
  37284. },
  37285. args: ["aNode"],
  37286. source: "node: aNode\x0a\x09node := aNode",
  37287. referencedClasses: [],
  37288. messageSends: []
  37289. }),
  37290. $globals.AliasVar);
  37291. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37292. $globals.ArgVar.comment="I am an argument of a method or block.";
  37293. $core.addMethod(
  37294. $core.method({
  37295. selector: "isArgVar",
  37296. protocol: "testing",
  37297. fn: function (){
  37298. var self=this,$self=this;
  37299. return true;
  37300. },
  37301. args: [],
  37302. source: "isArgVar\x0a\x09^ true",
  37303. referencedClasses: [],
  37304. messageSends: []
  37305. }),
  37306. $globals.ArgVar);
  37307. $core.addMethod(
  37308. $core.method({
  37309. selector: "isImmutable",
  37310. protocol: "testing",
  37311. fn: function (){
  37312. var self=this,$self=this;
  37313. return true;
  37314. },
  37315. args: [],
  37316. source: "isImmutable\x0a\x09^ true",
  37317. referencedClasses: [],
  37318. messageSends: []
  37319. }),
  37320. $globals.ArgVar);
  37321. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37322. $globals.ClassRefVar.comment="I am an class reference variable";
  37323. $core.addMethod(
  37324. $core.method({
  37325. selector: "alias",
  37326. protocol: "accessing",
  37327. fn: function (){
  37328. var self=this,$self=this;
  37329. return $core.withContext(function($ctx1) {
  37330. return "$globals.".__comma($self._name());
  37331. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  37332. },
  37333. args: [],
  37334. 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",
  37335. referencedClasses: [],
  37336. messageSends: [",", "name"]
  37337. }),
  37338. $globals.ClassRefVar);
  37339. $core.addMethod(
  37340. $core.method({
  37341. selector: "isClassRefVar",
  37342. protocol: "testing",
  37343. fn: function (){
  37344. var self=this,$self=this;
  37345. return true;
  37346. },
  37347. args: [],
  37348. source: "isClassRefVar\x0a\x09^ true",
  37349. referencedClasses: [],
  37350. messageSends: []
  37351. }),
  37352. $globals.ClassRefVar);
  37353. $core.addMethod(
  37354. $core.method({
  37355. selector: "isImmutable",
  37356. protocol: "testing",
  37357. fn: function (){
  37358. var self=this,$self=this;
  37359. return true;
  37360. },
  37361. args: [],
  37362. source: "isImmutable\x0a\x09^ true",
  37363. referencedClasses: [],
  37364. messageSends: []
  37365. }),
  37366. $globals.ClassRefVar);
  37367. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37368. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  37369. $core.addMethod(
  37370. $core.method({
  37371. selector: "alias",
  37372. protocol: "testing",
  37373. fn: function (){
  37374. var self=this,$self=this;
  37375. return $core.withContext(function($ctx1) {
  37376. var $1;
  37377. $1=$recv("$self[\x22@".__comma($self._name())).__comma("\x22]");
  37378. $ctx1.sendIdx[","]=1;
  37379. return $1;
  37380. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  37381. },
  37382. args: [],
  37383. source: "alias\x0a\x09^ '$self[\x22@', self name, '\x22]'",
  37384. referencedClasses: [],
  37385. messageSends: [",", "name"]
  37386. }),
  37387. $globals.InstanceVar);
  37388. $core.addMethod(
  37389. $core.method({
  37390. selector: "isInstanceVar",
  37391. protocol: "testing",
  37392. fn: function (){
  37393. var self=this,$self=this;
  37394. return true;
  37395. },
  37396. args: [],
  37397. source: "isInstanceVar\x0a\x09^ true",
  37398. referencedClasses: [],
  37399. messageSends: []
  37400. }),
  37401. $globals.InstanceVar);
  37402. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37403. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  37404. $core.addMethod(
  37405. $core.method({
  37406. selector: "alias",
  37407. protocol: "accessing",
  37408. fn: function (){
  37409. var self=this,$self=this;
  37410. return $core.withContext(function($ctx1) {
  37411. return $self._name();
  37412. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  37413. },
  37414. args: [],
  37415. source: "alias\x0a\x09^ self name",
  37416. referencedClasses: [],
  37417. messageSends: ["name"]
  37418. }),
  37419. $globals.PseudoVar);
  37420. $core.addMethod(
  37421. $core.method({
  37422. selector: "isImmutable",
  37423. protocol: "testing",
  37424. fn: function (){
  37425. var self=this,$self=this;
  37426. return true;
  37427. },
  37428. args: [],
  37429. source: "isImmutable\x0a\x09^ true",
  37430. referencedClasses: [],
  37431. messageSends: []
  37432. }),
  37433. $globals.PseudoVar);
  37434. $core.addMethod(
  37435. $core.method({
  37436. selector: "isPseudoVar",
  37437. protocol: "testing",
  37438. fn: function (){
  37439. var self=this,$self=this;
  37440. return true;
  37441. },
  37442. args: [],
  37443. source: "isPseudoVar\x0a\x09^ true",
  37444. referencedClasses: [],
  37445. messageSends: []
  37446. }),
  37447. $globals.PseudoVar);
  37448. $core.addMethod(
  37449. $core.method({
  37450. selector: "isSelf",
  37451. protocol: "testing",
  37452. fn: function (){
  37453. var self=this,$self=this;
  37454. return $core.withContext(function($ctx1) {
  37455. return $recv($self["@name"]).__eq("self");
  37456. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.PseudoVar)});
  37457. },
  37458. args: [],
  37459. source: "isSelf\x0a\x09^ name = 'self'",
  37460. referencedClasses: [],
  37461. messageSends: ["="]
  37462. }),
  37463. $globals.PseudoVar);
  37464. $core.addMethod(
  37465. $core.method({
  37466. selector: "isSuper",
  37467. protocol: "testing",
  37468. fn: function (){
  37469. var self=this,$self=this;
  37470. return $core.withContext(function($ctx1) {
  37471. return $recv($self["@name"]).__eq("super");
  37472. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.PseudoVar)});
  37473. },
  37474. args: [],
  37475. source: "isSuper\x0a\x09^ name = 'super'",
  37476. referencedClasses: [],
  37477. messageSends: ["="]
  37478. }),
  37479. $globals.PseudoVar);
  37480. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37481. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  37482. $core.addMethod(
  37483. $core.method({
  37484. selector: "isTempVar",
  37485. protocol: "testing",
  37486. fn: function (){
  37487. var self=this,$self=this;
  37488. return true;
  37489. },
  37490. args: [],
  37491. source: "isTempVar\x0a\x09^ true",
  37492. referencedClasses: [],
  37493. messageSends: []
  37494. }),
  37495. $globals.TempVar);
  37496. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37497. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  37498. $core.addMethod(
  37499. $core.method({
  37500. selector: "isUnknownVar",
  37501. protocol: "testing",
  37502. fn: function (){
  37503. var self=this,$self=this;
  37504. return true;
  37505. },
  37506. args: [],
  37507. source: "isUnknownVar\x0a\x09^ true",
  37508. referencedClasses: [],
  37509. messageSends: []
  37510. }),
  37511. $globals.UnknownVar);
  37512. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  37513. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  37514. $core.addMethod(
  37515. $core.method({
  37516. selector: "classReferences",
  37517. protocol: "accessing",
  37518. fn: function (){
  37519. var self=this,$self=this;
  37520. return $core.withContext(function($ctx1) {
  37521. var $1,$receiver;
  37522. $1=$self["@classReferences"];
  37523. if(($receiver = $1) == null || $receiver.a$nil){
  37524. $self["@classReferences"]=$recv($globals.Set)._new();
  37525. return $self["@classReferences"];
  37526. } else {
  37527. return $1;
  37528. }
  37529. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  37530. },
  37531. args: [],
  37532. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  37533. referencedClasses: ["Set"],
  37534. messageSends: ["ifNil:", "new"]
  37535. }),
  37536. $globals.SemanticAnalyzer);
  37537. $core.addMethod(
  37538. $core.method({
  37539. selector: "errorShadowingVariable:",
  37540. protocol: "error handling",
  37541. fn: function (aString){
  37542. var self=this,$self=this;
  37543. return $core.withContext(function($ctx1) {
  37544. var $1;
  37545. $1=$recv($globals.ShadowingVariableError)._new();
  37546. $recv($1)._variableName_(aString);
  37547. $recv($1)._signal();
  37548. return self;
  37549. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  37550. },
  37551. args: ["aString"],
  37552. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  37553. referencedClasses: ["ShadowingVariableError"],
  37554. messageSends: ["variableName:", "new", "signal"]
  37555. }),
  37556. $globals.SemanticAnalyzer);
  37557. $core.addMethod(
  37558. $core.method({
  37559. selector: "errorUnknownVariable:",
  37560. protocol: "error handling",
  37561. fn: function (aNode){
  37562. var self=this,$self=this;
  37563. var identifier;
  37564. return $core.withContext(function($ctx1) {
  37565. var $1,$2,$3;
  37566. identifier=$recv(aNode)._value();
  37567. $ctx1.sendIdx["value"]=1;
  37568. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  37569. return $core.withContext(function($ctx2) {
  37570. return $self._isVariableUndefined_inPackage_(identifier,$self._thePackage());
  37571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37572. }));
  37573. if($core.assert($1)){
  37574. $2=$recv($globals.UnknownVariableError)._new();
  37575. $3=$recv(aNode)._value();
  37576. $ctx1.sendIdx["value"]=2;
  37577. $recv($2)._variableName_($3);
  37578. $recv($2)._signal();
  37579. } else {
  37580. $recv($recv($recv($self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  37581. }
  37582. return self;
  37583. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  37584. },
  37585. args: ["aNode"],
  37586. 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 ]",
  37587. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  37588. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  37589. }),
  37590. $globals.SemanticAnalyzer);
  37591. $core.addMethod(
  37592. $core.method({
  37593. selector: "isVariableUndefined:inPackage:",
  37594. protocol: "testing",
  37595. fn: function (aString,aPackage){
  37596. var self=this,$self=this;
  37597. return $core.withContext(function($ctx1) {
  37598. var $1,$2,$receiver;
  37599. if(($receiver = aPackage) == null || $receiver.a$nil){
  37600. aPackage;
  37601. } else {
  37602. var packageKnownVars;
  37603. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  37604. packageKnownVars;
  37605. $1=$recv(packageKnownVars)._includes_(aString);
  37606. if($core.assert($1)){
  37607. return false;
  37608. }
  37609. }
  37610. $2=$recv("typeof ".__comma(aString)).__comma(" === \x22undefined\x22");
  37611. $ctx1.sendIdx[","]=1;
  37612. return $recv($globals.Compiler)._eval_($2);
  37613. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  37614. },
  37615. args: ["aString", "aPackage"],
  37616. 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'",
  37617. referencedClasses: ["Compiler"],
  37618. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", ","]
  37619. }),
  37620. $globals.SemanticAnalyzer);
  37621. $core.addMethod(
  37622. $core.method({
  37623. selector: "messageSends",
  37624. protocol: "accessing",
  37625. fn: function (){
  37626. var self=this,$self=this;
  37627. return $core.withContext(function($ctx1) {
  37628. var $1,$receiver;
  37629. $1=$self["@messageSends"];
  37630. if(($receiver = $1) == null || $receiver.a$nil){
  37631. $self["@messageSends"]=$recv($globals.Dictionary)._new();
  37632. return $self["@messageSends"];
  37633. } else {
  37634. return $1;
  37635. }
  37636. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  37637. },
  37638. args: [],
  37639. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  37640. referencedClasses: ["Dictionary"],
  37641. messageSends: ["ifNil:", "new"]
  37642. }),
  37643. $globals.SemanticAnalyzer);
  37644. $core.addMethod(
  37645. $core.method({
  37646. selector: "newBlockScope",
  37647. protocol: "factory",
  37648. fn: function (){
  37649. var self=this,$self=this;
  37650. return $core.withContext(function($ctx1) {
  37651. return $self._newScopeOfClass_($globals.LexicalScope);
  37652. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  37653. },
  37654. args: [],
  37655. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  37656. referencedClasses: ["LexicalScope"],
  37657. messageSends: ["newScopeOfClass:"]
  37658. }),
  37659. $globals.SemanticAnalyzer);
  37660. $core.addMethod(
  37661. $core.method({
  37662. selector: "newMethodScope",
  37663. protocol: "factory",
  37664. fn: function (){
  37665. var self=this,$self=this;
  37666. return $core.withContext(function($ctx1) {
  37667. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  37668. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  37669. },
  37670. args: [],
  37671. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  37672. referencedClasses: ["MethodLexicalScope"],
  37673. messageSends: ["newScopeOfClass:"]
  37674. }),
  37675. $globals.SemanticAnalyzer);
  37676. $core.addMethod(
  37677. $core.method({
  37678. selector: "newScopeOfClass:",
  37679. protocol: "factory",
  37680. fn: function (aLexicalScopeClass){
  37681. var self=this,$self=this;
  37682. return $core.withContext(function($ctx1) {
  37683. var $1;
  37684. $1=$recv(aLexicalScopeClass)._new();
  37685. $recv($1)._outerScope_($self["@currentScope"]);
  37686. return $recv($1)._yourself();
  37687. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  37688. },
  37689. args: ["aLexicalScopeClass"],
  37690. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  37691. referencedClasses: [],
  37692. messageSends: ["outerScope:", "new", "yourself"]
  37693. }),
  37694. $globals.SemanticAnalyzer);
  37695. $core.addMethod(
  37696. $core.method({
  37697. selector: "nextBlockIndex",
  37698. protocol: "private",
  37699. fn: function (){
  37700. var self=this,$self=this;
  37701. return $core.withContext(function($ctx1) {
  37702. var $1,$receiver;
  37703. $1=$self["@blockIndex"];
  37704. if(($receiver = $1) == null || $receiver.a$nil){
  37705. $self["@blockIndex"]=(0);
  37706. $self["@blockIndex"];
  37707. } else {
  37708. $1;
  37709. }
  37710. $self["@blockIndex"]=$recv($self["@blockIndex"]).__plus((1));
  37711. return $self["@blockIndex"];
  37712. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  37713. },
  37714. args: [],
  37715. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  37716. referencedClasses: [],
  37717. messageSends: ["ifNil:", "+"]
  37718. }),
  37719. $globals.SemanticAnalyzer);
  37720. $core.addMethod(
  37721. $core.method({
  37722. selector: "popScope",
  37723. protocol: "scope",
  37724. fn: function (){
  37725. var self=this,$self=this;
  37726. return $core.withContext(function($ctx1) {
  37727. var $1,$receiver;
  37728. $1=$self["@currentScope"];
  37729. if(($receiver = $1) == null || $receiver.a$nil){
  37730. $1;
  37731. } else {
  37732. $self["@currentScope"]=$recv($self["@currentScope"])._outerScope();
  37733. $self["@currentScope"];
  37734. }
  37735. return self;
  37736. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  37737. },
  37738. args: [],
  37739. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  37740. referencedClasses: [],
  37741. messageSends: ["ifNotNil:", "outerScope"]
  37742. }),
  37743. $globals.SemanticAnalyzer);
  37744. $core.addMethod(
  37745. $core.method({
  37746. selector: "pushScope:",
  37747. protocol: "scope",
  37748. fn: function (aScope){
  37749. var self=this,$self=this;
  37750. return $core.withContext(function($ctx1) {
  37751. $recv(aScope)._outerScope_($self["@currentScope"]);
  37752. $self["@currentScope"]=aScope;
  37753. return self;
  37754. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  37755. },
  37756. args: ["aScope"],
  37757. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  37758. referencedClasses: [],
  37759. messageSends: ["outerScope:"]
  37760. }),
  37761. $globals.SemanticAnalyzer);
  37762. $core.addMethod(
  37763. $core.method({
  37764. selector: "theClass",
  37765. protocol: "accessing",
  37766. fn: function (){
  37767. var self=this,$self=this;
  37768. return $self["@theClass"];
  37769. },
  37770. args: [],
  37771. source: "theClass\x0a\x09^ theClass",
  37772. referencedClasses: [],
  37773. messageSends: []
  37774. }),
  37775. $globals.SemanticAnalyzer);
  37776. $core.addMethod(
  37777. $core.method({
  37778. selector: "theClass:",
  37779. protocol: "accessing",
  37780. fn: function (aClass){
  37781. var self=this,$self=this;
  37782. $self["@theClass"]=aClass;
  37783. return self;
  37784. },
  37785. args: ["aClass"],
  37786. source: "theClass: aClass\x0a\x09theClass := aClass",
  37787. referencedClasses: [],
  37788. messageSends: []
  37789. }),
  37790. $globals.SemanticAnalyzer);
  37791. $core.addMethod(
  37792. $core.method({
  37793. selector: "thePackage",
  37794. protocol: "accessing",
  37795. fn: function (){
  37796. var self=this,$self=this;
  37797. return $self["@thePackage"];
  37798. },
  37799. args: [],
  37800. source: "thePackage\x0a\x09^ thePackage",
  37801. referencedClasses: [],
  37802. messageSends: []
  37803. }),
  37804. $globals.SemanticAnalyzer);
  37805. $core.addMethod(
  37806. $core.method({
  37807. selector: "thePackage:",
  37808. protocol: "accessing",
  37809. fn: function (aPackage){
  37810. var self=this,$self=this;
  37811. $self["@thePackage"]=aPackage;
  37812. return self;
  37813. },
  37814. args: ["aPackage"],
  37815. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  37816. referencedClasses: [],
  37817. messageSends: []
  37818. }),
  37819. $globals.SemanticAnalyzer);
  37820. $core.addMethod(
  37821. $core.method({
  37822. selector: "validateVariableScope:",
  37823. protocol: "scope",
  37824. fn: function (aString){
  37825. var self=this,$self=this;
  37826. return $core.withContext(function($ctx1) {
  37827. var $1,$receiver;
  37828. $1=$recv($self["@currentScope"])._lookupVariable_(aString);
  37829. if(($receiver = $1) == null || $receiver.a$nil){
  37830. $1;
  37831. } else {
  37832. $self._errorShadowingVariable_(aString);
  37833. }
  37834. return self;
  37835. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  37836. },
  37837. args: ["aString"],
  37838. 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 ]",
  37839. referencedClasses: [],
  37840. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  37841. }),
  37842. $globals.SemanticAnalyzer);
  37843. $core.addMethod(
  37844. $core.method({
  37845. selector: "visitAssignmentNode:",
  37846. protocol: "visiting",
  37847. fn: function (aNode){
  37848. var self=this,$self=this;
  37849. return $core.withContext(function($ctx1) {
  37850. (
  37851. $ctx1.supercall = true,
  37852. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($self, [aNode]));
  37853. $ctx1.supercall = false;
  37854. $recv($recv(aNode)._left())._beAssigned();
  37855. return self;
  37856. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  37857. },
  37858. args: ["aNode"],
  37859. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  37860. referencedClasses: [],
  37861. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  37862. }),
  37863. $globals.SemanticAnalyzer);
  37864. $core.addMethod(
  37865. $core.method({
  37866. selector: "visitBlockNode:",
  37867. protocol: "visiting",
  37868. fn: function (aNode){
  37869. var self=this,$self=this;
  37870. return $core.withContext(function($ctx1) {
  37871. $self._pushScope_($self._newBlockScope());
  37872. $recv(aNode)._scope_($self["@currentScope"]);
  37873. $recv($self["@currentScope"])._node_(aNode);
  37874. $recv($self["@currentScope"])._blockIndex_($self._nextBlockIndex());
  37875. $recv($recv(aNode)._parameters())._do_((function(each){
  37876. return $core.withContext(function($ctx2) {
  37877. $self._validateVariableScope_(each);
  37878. return $recv($self["@currentScope"])._addArg_(each);
  37879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37880. }));
  37881. (
  37882. $ctx1.supercall = true,
  37883. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($self, [aNode]));
  37884. $ctx1.supercall = false;
  37885. $self._popScope();
  37886. return self;
  37887. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  37888. },
  37889. args: ["aNode"],
  37890. 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",
  37891. referencedClasses: [],
  37892. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  37893. }),
  37894. $globals.SemanticAnalyzer);
  37895. $core.addMethod(
  37896. $core.method({
  37897. selector: "visitCascadeNode:",
  37898. protocol: "visiting",
  37899. fn: function (aNode){
  37900. var self=this,$self=this;
  37901. return $core.withContext(function($ctx1) {
  37902. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  37903. (
  37904. $ctx1.supercall = true,
  37905. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($self, [aNode]));
  37906. $ctx1.supercall = false;
  37907. return self;
  37908. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  37909. },
  37910. args: ["aNode"],
  37911. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  37912. referencedClasses: [],
  37913. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  37914. }),
  37915. $globals.SemanticAnalyzer);
  37916. $core.addMethod(
  37917. $core.method({
  37918. selector: "visitMethodNode:",
  37919. protocol: "visiting",
  37920. fn: function (aNode){
  37921. var self=this,$self=this;
  37922. return $core.withContext(function($ctx1) {
  37923. $self._pushScope_($self._newMethodScope());
  37924. $recv(aNode)._scope_($self["@currentScope"]);
  37925. $recv($self["@currentScope"])._node_(aNode);
  37926. $recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  37927. return $core.withContext(function($ctx2) {
  37928. return $recv($self["@currentScope"])._addIVar_(each);
  37929. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37930. }));
  37931. $ctx1.sendIdx["do:"]=1;
  37932. $recv($recv(aNode)._arguments())._do_((function(each){
  37933. return $core.withContext(function($ctx2) {
  37934. $self._validateVariableScope_(each);
  37935. return $recv($self["@currentScope"])._addArg_(each);
  37936. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37937. }));
  37938. (
  37939. $ctx1.supercall = true,
  37940. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  37941. $ctx1.supercall = false;
  37942. $recv(aNode)._classReferences_($self._classReferences());
  37943. $recv(aNode)._sendIndexes_($self._messageSends());
  37944. $self._popScope();
  37945. return aNode;
  37946. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  37947. },
  37948. args: ["aNode"],
  37949. 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",
  37950. referencedClasses: [],
  37951. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  37952. }),
  37953. $globals.SemanticAnalyzer);
  37954. $core.addMethod(
  37955. $core.method({
  37956. selector: "visitReturnNode:",
  37957. protocol: "visiting",
  37958. fn: function (aNode){
  37959. var self=this,$self=this;
  37960. return $core.withContext(function($ctx1) {
  37961. var $1;
  37962. $recv(aNode)._scope_($self["@currentScope"]);
  37963. $1=$recv($self["@currentScope"])._isMethodScope();
  37964. if($core.assert($1)){
  37965. $recv($self["@currentScope"])._localReturn_(true);
  37966. } else {
  37967. $recv($recv($self["@currentScope"])._methodScope())._addNonLocalReturn_($self["@currentScope"]);
  37968. }
  37969. (
  37970. $ctx1.supercall = true,
  37971. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($self, [aNode]));
  37972. $ctx1.supercall = false;
  37973. return self;
  37974. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  37975. },
  37976. args: ["aNode"],
  37977. 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",
  37978. referencedClasses: [],
  37979. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  37980. }),
  37981. $globals.SemanticAnalyzer);
  37982. $core.addMethod(
  37983. $core.method({
  37984. selector: "visitSendNode:",
  37985. protocol: "visiting",
  37986. fn: function (aNode){
  37987. var self=this,$self=this;
  37988. var sends;
  37989. return $core.withContext(function($ctx1) {
  37990. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  37991. return $core.withContext(function($ctx2) {
  37992. return $recv($globals.OrderedCollection)._new();
  37993. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37994. }));
  37995. $recv(sends)._add_(aNode);
  37996. $recv(aNode)._index_($recv(sends)._size());
  37997. (
  37998. $ctx1.supercall = true,
  37999. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  38000. $ctx1.supercall = false;
  38001. return self;
  38002. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  38003. },
  38004. args: ["aNode"],
  38005. 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",
  38006. referencedClasses: ["OrderedCollection"],
  38007. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  38008. }),
  38009. $globals.SemanticAnalyzer);
  38010. $core.addMethod(
  38011. $core.method({
  38012. selector: "visitSequenceNode:",
  38013. protocol: "visiting",
  38014. fn: function (aNode){
  38015. var self=this,$self=this;
  38016. return $core.withContext(function($ctx1) {
  38017. $recv($recv(aNode)._temps())._do_((function(each){
  38018. return $core.withContext(function($ctx2) {
  38019. $self._validateVariableScope_(each);
  38020. return $recv($self["@currentScope"])._addTemp_(each);
  38021. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38022. }));
  38023. (
  38024. $ctx1.supercall = true,
  38025. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  38026. $ctx1.supercall = false;
  38027. return self;
  38028. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38029. },
  38030. args: ["aNode"],
  38031. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  38032. referencedClasses: [],
  38033. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  38034. }),
  38035. $globals.SemanticAnalyzer);
  38036. $core.addMethod(
  38037. $core.method({
  38038. selector: "visitVariableNode:",
  38039. protocol: "visiting",
  38040. fn: function (aNode){
  38041. var self=this,$self=this;
  38042. var binding;
  38043. return $core.withContext(function($ctx1) {
  38044. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  38045. binding=$recv($self["@currentScope"])._lookupVariable_(aNode);
  38046. $1=binding;
  38047. if(($receiver = $1) == null || $receiver.a$nil){
  38048. $3=$recv(aNode)._value();
  38049. $ctx1.sendIdx["value"]=1;
  38050. $2=$recv($3)._isCapitalized();
  38051. if($core.assert($2)){
  38052. $4=$recv($globals.ClassRefVar)._new();
  38053. $ctx1.sendIdx["new"]=1;
  38054. $5=$recv(aNode)._value();
  38055. $ctx1.sendIdx["value"]=2;
  38056. $recv($4)._name_($5);
  38057. $ctx1.sendIdx["name:"]=1;
  38058. $6=$recv($4)._yourself();
  38059. $ctx1.sendIdx["yourself"]=1;
  38060. binding=$6;
  38061. binding;
  38062. $7=$self._classReferences();
  38063. $8=$recv(aNode)._value();
  38064. $ctx1.sendIdx["value"]=3;
  38065. $recv($7)._add_($8);
  38066. } else {
  38067. $self._errorUnknownVariable_(aNode);
  38068. $9=$recv($globals.UnknownVar)._new();
  38069. $recv($9)._name_($recv(aNode)._value());
  38070. binding=$recv($9)._yourself();
  38071. binding;
  38072. }
  38073. } else {
  38074. $1;
  38075. }
  38076. $recv(aNode)._binding_(binding);
  38077. return self;
  38078. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  38079. },
  38080. args: ["aNode"],
  38081. 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.",
  38082. referencedClasses: ["ClassRefVar", "UnknownVar"],
  38083. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  38084. }),
  38085. $globals.SemanticAnalyzer);
  38086. $core.addMethod(
  38087. $core.method({
  38088. selector: "on:",
  38089. protocol: "instance creation",
  38090. fn: function (aClass){
  38091. var self=this,$self=this;
  38092. return $core.withContext(function($ctx1) {
  38093. var $1;
  38094. $1=$self._new();
  38095. $recv($1)._theClass_(aClass);
  38096. return $recv($1)._yourself();
  38097. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.a$cls)});
  38098. },
  38099. args: ["aClass"],
  38100. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  38101. referencedClasses: [],
  38102. messageSends: ["theClass:", "new", "yourself"]
  38103. }),
  38104. $globals.SemanticAnalyzer.a$cls);
  38105. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  38106. $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";
  38107. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38108. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  38109. $core.addMethod(
  38110. $core.method({
  38111. selector: "messageText",
  38112. protocol: "accessing",
  38113. fn: function (){
  38114. var self=this,$self=this;
  38115. return $core.withContext(function($ctx1) {
  38116. return " Invalid assignment to variable: ".__comma($self._variableName());
  38117. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  38118. },
  38119. args: [],
  38120. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  38121. referencedClasses: [],
  38122. messageSends: [",", "variableName"]
  38123. }),
  38124. $globals.InvalidAssignmentError);
  38125. $core.addMethod(
  38126. $core.method({
  38127. selector: "variableName",
  38128. protocol: "accessing",
  38129. fn: function (){
  38130. var self=this,$self=this;
  38131. return $self["@variableName"];
  38132. },
  38133. args: [],
  38134. source: "variableName\x0a\x09^ variableName",
  38135. referencedClasses: [],
  38136. messageSends: []
  38137. }),
  38138. $globals.InvalidAssignmentError);
  38139. $core.addMethod(
  38140. $core.method({
  38141. selector: "variableName:",
  38142. protocol: "accessing",
  38143. fn: function (aString){
  38144. var self=this,$self=this;
  38145. $self["@variableName"]=aString;
  38146. return self;
  38147. },
  38148. args: ["aString"],
  38149. source: "variableName: aString\x0a\x09variableName := aString",
  38150. referencedClasses: [],
  38151. messageSends: []
  38152. }),
  38153. $globals.InvalidAssignmentError);
  38154. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38155. $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.";
  38156. $core.addMethod(
  38157. $core.method({
  38158. selector: "messageText",
  38159. protocol: "accessing",
  38160. fn: function (){
  38161. var self=this,$self=this;
  38162. return $core.withContext(function($ctx1) {
  38163. var $1;
  38164. $1=$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined");
  38165. $ctx1.sendIdx[","]=1;
  38166. return $1;
  38167. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  38168. },
  38169. args: [],
  38170. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  38171. referencedClasses: [],
  38172. messageSends: [",", "variableName"]
  38173. }),
  38174. $globals.ShadowingVariableError);
  38175. $core.addMethod(
  38176. $core.method({
  38177. selector: "variableName",
  38178. protocol: "accessing",
  38179. fn: function (){
  38180. var self=this,$self=this;
  38181. return $self["@variableName"];
  38182. },
  38183. args: [],
  38184. source: "variableName\x0a\x09^ variableName",
  38185. referencedClasses: [],
  38186. messageSends: []
  38187. }),
  38188. $globals.ShadowingVariableError);
  38189. $core.addMethod(
  38190. $core.method({
  38191. selector: "variableName:",
  38192. protocol: "accessing",
  38193. fn: function (aString){
  38194. var self=this,$self=this;
  38195. $self["@variableName"]=aString;
  38196. return self;
  38197. },
  38198. args: ["aString"],
  38199. source: "variableName: aString\x0a\x09variableName := aString",
  38200. referencedClasses: [],
  38201. messageSends: []
  38202. }),
  38203. $globals.ShadowingVariableError);
  38204. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38205. $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.";
  38206. $core.addMethod(
  38207. $core.method({
  38208. selector: "messageText",
  38209. protocol: "accessing",
  38210. fn: function (){
  38211. var self=this,$self=this;
  38212. return $core.withContext(function($ctx1) {
  38213. var $1;
  38214. $1=$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined");
  38215. $ctx1.sendIdx[","]=1;
  38216. return $1;
  38217. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  38218. },
  38219. args: [],
  38220. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  38221. referencedClasses: [],
  38222. messageSends: [",", "variableName"]
  38223. }),
  38224. $globals.UnknownVariableError);
  38225. $core.addMethod(
  38226. $core.method({
  38227. selector: "variableName",
  38228. protocol: "accessing",
  38229. fn: function (){
  38230. var self=this,$self=this;
  38231. return $self["@variableName"];
  38232. },
  38233. args: [],
  38234. source: "variableName\x0a\x09^ variableName",
  38235. referencedClasses: [],
  38236. messageSends: []
  38237. }),
  38238. $globals.UnknownVariableError);
  38239. $core.addMethod(
  38240. $core.method({
  38241. selector: "variableName:",
  38242. protocol: "accessing",
  38243. fn: function (aString){
  38244. var self=this,$self=this;
  38245. $self["@variableName"]=aString;
  38246. return self;
  38247. },
  38248. args: ["aString"],
  38249. source: "variableName: aString\x0a\x09variableName := aString",
  38250. referencedClasses: [],
  38251. messageSends: []
  38252. }),
  38253. $globals.UnknownVariableError);
  38254. });
  38255. 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";
  38256. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  38257. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  38258. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  38259. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  38260. $core.addPackage("Compiler-IR");
  38261. $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  38262. $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  38263. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  38264. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  38265. $core.addMethod(
  38266. $core.method({
  38267. selector: "alias:",
  38268. protocol: "visiting",
  38269. fn: function (aNode){
  38270. var self=this,$self=this;
  38271. var variable;
  38272. return $core.withContext(function($ctx1) {
  38273. var $1,$2,$3,$5,$4,$6,$7,$9,$8;
  38274. $1=$recv(aNode)._isImmutable();
  38275. if($core.assert($1)){
  38276. $2=$self._visit_(aNode);
  38277. $ctx1.sendIdx["visit:"]=1;
  38278. return $2;
  38279. }
  38280. $3=$recv($globals.IRVariable)._new();
  38281. $ctx1.sendIdx["new"]=1;
  38282. $5=$recv($globals.AliasVar)._new();
  38283. $ctx1.sendIdx["new"]=2;
  38284. $4=$recv($5)._name_("$".__comma($self._nextAlias()));
  38285. $recv($3)._variable_($4);
  38286. $6=$recv($3)._yourself();
  38287. $ctx1.sendIdx["yourself"]=1;
  38288. variable=$6;
  38289. $7=$self._sequence();
  38290. $9=$recv($globals.IRAssignment)._new();
  38291. $recv($9)._add_(variable);
  38292. $ctx1.sendIdx["add:"]=2;
  38293. $recv($9)._add_($self._visit_(aNode));
  38294. $ctx1.sendIdx["add:"]=3;
  38295. $8=$recv($9)._yourself();
  38296. $recv($7)._add_($8);
  38297. $ctx1.sendIdx["add:"]=1;
  38298. $recv($recv($self._method())._internalVariables())._add_(variable);
  38299. return variable;
  38300. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  38301. },
  38302. args: ["aNode"],
  38303. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  38304. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  38305. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  38306. }),
  38307. $globals.IRASTTranslator);
  38308. $core.addMethod(
  38309. $core.method({
  38310. selector: "aliasTemporally:",
  38311. protocol: "visiting",
  38312. fn: function (aCollection){
  38313. var self=this,$self=this;
  38314. var threshold,result;
  38315. return $core.withContext(function($ctx1) {
  38316. var $1,$2,$4,$3;
  38317. threshold=(0);
  38318. $recv(aCollection)._withIndexDo_((function(each,i){
  38319. return $core.withContext(function($ctx2) {
  38320. $1=$recv(each)._subtreeNeedsAliasing();
  38321. if($core.assert($1)){
  38322. threshold=i;
  38323. return threshold;
  38324. }
  38325. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  38326. }));
  38327. $ctx1.sendIdx["withIndexDo:"]=1;
  38328. result=$recv($globals.OrderedCollection)._new();
  38329. $recv(aCollection)._withIndexDo_((function(each,i){
  38330. return $core.withContext(function($ctx2) {
  38331. $2=result;
  38332. $4=$recv(i).__lt_eq(threshold);
  38333. if($core.assert($4)){
  38334. $3=$self._alias_(each);
  38335. } else {
  38336. $3=$self._visit_(each);
  38337. }
  38338. return $recv($2)._add_($3);
  38339. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  38340. }));
  38341. return result;
  38342. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  38343. },
  38344. args: ["aCollection"],
  38345. 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",
  38346. referencedClasses: ["OrderedCollection"],
  38347. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  38348. }),
  38349. $globals.IRASTTranslator);
  38350. $core.addMethod(
  38351. $core.method({
  38352. selector: "method",
  38353. protocol: "accessing",
  38354. fn: function (){
  38355. var self=this,$self=this;
  38356. return $self["@method"];
  38357. },
  38358. args: [],
  38359. source: "method\x0a\x09^ method",
  38360. referencedClasses: [],
  38361. messageSends: []
  38362. }),
  38363. $globals.IRASTTranslator);
  38364. $core.addMethod(
  38365. $core.method({
  38366. selector: "method:",
  38367. protocol: "accessing",
  38368. fn: function (anIRMethod){
  38369. var self=this,$self=this;
  38370. $self["@method"]=anIRMethod;
  38371. return self;
  38372. },
  38373. args: ["anIRMethod"],
  38374. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  38375. referencedClasses: [],
  38376. messageSends: []
  38377. }),
  38378. $globals.IRASTTranslator);
  38379. $core.addMethod(
  38380. $core.method({
  38381. selector: "nextAlias",
  38382. protocol: "accessing",
  38383. fn: function (){
  38384. var self=this,$self=this;
  38385. return $core.withContext(function($ctx1) {
  38386. var $1,$receiver;
  38387. $1=$self["@nextAlias"];
  38388. if(($receiver = $1) == null || $receiver.a$nil){
  38389. $self["@nextAlias"]=(0);
  38390. $self["@nextAlias"];
  38391. } else {
  38392. $1;
  38393. }
  38394. $self["@nextAlias"]=$recv($self["@nextAlias"]).__plus((1));
  38395. return $recv($self["@nextAlias"])._asString();
  38396. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  38397. },
  38398. args: [],
  38399. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  38400. referencedClasses: [],
  38401. messageSends: ["ifNil:", "+", "asString"]
  38402. }),
  38403. $globals.IRASTTranslator);
  38404. $core.addMethod(
  38405. $core.method({
  38406. selector: "sequence",
  38407. protocol: "accessing",
  38408. fn: function (){
  38409. var self=this,$self=this;
  38410. return $self["@sequence"];
  38411. },
  38412. args: [],
  38413. source: "sequence\x0a\x09^ sequence",
  38414. referencedClasses: [],
  38415. messageSends: []
  38416. }),
  38417. $globals.IRASTTranslator);
  38418. $core.addMethod(
  38419. $core.method({
  38420. selector: "sequence:",
  38421. protocol: "accessing",
  38422. fn: function (anIRSequence){
  38423. var self=this,$self=this;
  38424. $self["@sequence"]=anIRSequence;
  38425. return self;
  38426. },
  38427. args: ["anIRSequence"],
  38428. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  38429. referencedClasses: [],
  38430. messageSends: []
  38431. }),
  38432. $globals.IRASTTranslator);
  38433. $core.addMethod(
  38434. $core.method({
  38435. selector: "source",
  38436. protocol: "accessing",
  38437. fn: function (){
  38438. var self=this,$self=this;
  38439. return $self["@source"];
  38440. },
  38441. args: [],
  38442. source: "source\x0a\x09^ source",
  38443. referencedClasses: [],
  38444. messageSends: []
  38445. }),
  38446. $globals.IRASTTranslator);
  38447. $core.addMethod(
  38448. $core.method({
  38449. selector: "source:",
  38450. protocol: "accessing",
  38451. fn: function (aString){
  38452. var self=this,$self=this;
  38453. $self["@source"]=aString;
  38454. return self;
  38455. },
  38456. args: ["aString"],
  38457. source: "source: aString\x0a\x09source := aString",
  38458. referencedClasses: [],
  38459. messageSends: []
  38460. }),
  38461. $globals.IRASTTranslator);
  38462. $core.addMethod(
  38463. $core.method({
  38464. selector: "theClass",
  38465. protocol: "accessing",
  38466. fn: function (){
  38467. var self=this,$self=this;
  38468. return $self["@theClass"];
  38469. },
  38470. args: [],
  38471. source: "theClass\x0a\x09^ theClass",
  38472. referencedClasses: [],
  38473. messageSends: []
  38474. }),
  38475. $globals.IRASTTranslator);
  38476. $core.addMethod(
  38477. $core.method({
  38478. selector: "theClass:",
  38479. protocol: "accessing",
  38480. fn: function (aClass){
  38481. var self=this,$self=this;
  38482. $self["@theClass"]=aClass;
  38483. return self;
  38484. },
  38485. args: ["aClass"],
  38486. source: "theClass: aClass\x0a\x09theClass := aClass",
  38487. referencedClasses: [],
  38488. messageSends: []
  38489. }),
  38490. $globals.IRASTTranslator);
  38491. $core.addMethod(
  38492. $core.method({
  38493. selector: "visitAssignmentNode:",
  38494. protocol: "visiting",
  38495. fn: function (aNode){
  38496. var self=this,$self=this;
  38497. var left,right,assignment;
  38498. return $core.withContext(function($ctx1) {
  38499. var $1,$3,$2;
  38500. right=$self._visit_($recv(aNode)._right());
  38501. $ctx1.sendIdx["visit:"]=1;
  38502. left=$self._visit_($recv(aNode)._left());
  38503. $1=$self._sequence();
  38504. $3=$recv($globals.IRAssignment)._new();
  38505. $recv($3)._add_(left);
  38506. $ctx1.sendIdx["add:"]=2;
  38507. $recv($3)._add_(right);
  38508. $2=$recv($3)._yourself();
  38509. $recv($1)._add_($2);
  38510. $ctx1.sendIdx["add:"]=1;
  38511. return left;
  38512. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  38513. },
  38514. args: ["aNode"],
  38515. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  38516. referencedClasses: ["IRAssignment"],
  38517. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  38518. }),
  38519. $globals.IRASTTranslator);
  38520. $core.addMethod(
  38521. $core.method({
  38522. selector: "visitBlockNode:",
  38523. protocol: "visiting",
  38524. fn: function (aNode){
  38525. var self=this,$self=this;
  38526. var closure;
  38527. return $core.withContext(function($ctx1) {
  38528. var $1,$2,$3,$5,$4,$6,$8,$7;
  38529. $1=$recv($globals.IRClosure)._new();
  38530. $ctx1.sendIdx["new"]=1;
  38531. $recv($1)._arguments_($recv(aNode)._parameters());
  38532. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  38533. $2=$recv(aNode)._scope();
  38534. $ctx1.sendIdx["scope"]=1;
  38535. $recv($1)._scope_($2);
  38536. $ctx1.sendIdx["scope:"]=1;
  38537. $3=$recv($1)._yourself();
  38538. $ctx1.sendIdx["yourself"]=1;
  38539. closure=$3;
  38540. $5=$recv(aNode)._scope();
  38541. $ctx1.sendIdx["scope"]=2;
  38542. $4=$recv($5)._temps();
  38543. $recv($4)._do_((function(each){
  38544. return $core.withContext(function($ctx2) {
  38545. $6=closure;
  38546. $8=$recv($globals.IRTempDeclaration)._new();
  38547. $recv($8)._name_($recv(each)._name());
  38548. $recv($8)._scope_($recv(aNode)._scope());
  38549. $7=$recv($8)._yourself();
  38550. return $recv($6)._add_($7);
  38551. $ctx2.sendIdx["add:"]=1;
  38552. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38553. }));
  38554. $ctx1.sendIdx["do:"]=1;
  38555. $recv($recv(aNode)._dagChildren())._do_((function(each){
  38556. return $core.withContext(function($ctx2) {
  38557. return $recv(closure)._add_($self._visit_(each));
  38558. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38559. }));
  38560. return closure;
  38561. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  38562. },
  38563. args: ["aNode"],
  38564. 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",
  38565. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  38566. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  38567. }),
  38568. $globals.IRASTTranslator);
  38569. $core.addMethod(
  38570. $core.method({
  38571. selector: "visitBlockSequenceNode:",
  38572. protocol: "visiting",
  38573. fn: function (aNode){
  38574. var self=this,$self=this;
  38575. return $core.withContext(function($ctx1) {
  38576. var $1,$2,$4,$3,$5,$6,$9,$8,$7,$10,$12,$15,$14,$13,$11;
  38577. $1=$recv($globals.IRBlockSequence)._new();
  38578. $ctx1.sendIdx["new"]=1;
  38579. return $self._withSequence_do_($1,(function(){
  38580. return $core.withContext(function($ctx2) {
  38581. $2=$recv(aNode)._dagChildren();
  38582. $ctx2.sendIdx["dagChildren"]=1;
  38583. return $recv($2)._ifNotEmpty_((function(){
  38584. return $core.withContext(function($ctx3) {
  38585. $4=$recv(aNode)._dagChildren();
  38586. $ctx3.sendIdx["dagChildren"]=2;
  38587. $3=$recv($4)._allButLast();
  38588. $recv($3)._do_((function(each){
  38589. return $core.withContext(function($ctx4) {
  38590. $5=$self._sequence();
  38591. $ctx4.sendIdx["sequence"]=1;
  38592. $6=$self._visitOrAlias_(each);
  38593. $ctx4.sendIdx["visitOrAlias:"]=1;
  38594. return $recv($5)._add_($6);
  38595. $ctx4.sendIdx["add:"]=1;
  38596. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  38597. }));
  38598. $9=$recv(aNode)._dagChildren();
  38599. $ctx3.sendIdx["dagChildren"]=3;
  38600. $8=$recv($9)._last();
  38601. $ctx3.sendIdx["last"]=1;
  38602. $7=$recv($8)._isReturnNode();
  38603. if($core.assert($7)){
  38604. return $recv($self._sequence())._add_($self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  38605. } else {
  38606. $10=$self._sequence();
  38607. $ctx3.sendIdx["sequence"]=2;
  38608. $12=$recv($globals.IRBlockReturn)._new();
  38609. $15=$recv(aNode)._dagChildren();
  38610. $ctx3.sendIdx["dagChildren"]=4;
  38611. $14=$recv($15)._last();
  38612. $ctx3.sendIdx["last"]=2;
  38613. $13=$self._visitOrAlias_($14);
  38614. $ctx3.sendIdx["visitOrAlias:"]=2;
  38615. $recv($12)._add_($13);
  38616. $ctx3.sendIdx["add:"]=3;
  38617. $11=$recv($12)._yourself();
  38618. return $recv($10)._add_($11);
  38619. $ctx3.sendIdx["add:"]=2;
  38620. }
  38621. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  38622. }));
  38623. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38624. }));
  38625. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38626. },
  38627. args: ["aNode"],
  38628. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren ifNotEmpty: [\x0a\x09\x09\x09\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode dagChildren last) ] ]]",
  38629. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  38630. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  38631. }),
  38632. $globals.IRASTTranslator);
  38633. $core.addMethod(
  38634. $core.method({
  38635. selector: "visitCascadeNode:",
  38636. protocol: "visiting",
  38637. fn: function (aNode){
  38638. var self=this,$self=this;
  38639. var receiver;
  38640. return $core.withContext(function($ctx1) {
  38641. var $1,$2,$4,$3;
  38642. receiver=$recv(aNode)._receiver();
  38643. $1=$recv(receiver)._isImmutable();
  38644. if(!$core.assert($1)){
  38645. var alias;
  38646. alias=$self._alias_(receiver);
  38647. alias;
  38648. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  38649. receiver;
  38650. }
  38651. $2=$recv(aNode)._dagChildren();
  38652. $ctx1.sendIdx["dagChildren"]=1;
  38653. $recv($2)._do_((function(each){
  38654. return $core.withContext(function($ctx2) {
  38655. return $recv(each)._receiver_(receiver);
  38656. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38657. }));
  38658. $ctx1.sendIdx["do:"]=1;
  38659. $4=$recv(aNode)._dagChildren();
  38660. $ctx1.sendIdx["dagChildren"]=2;
  38661. $3=$recv($4)._allButLast();
  38662. $recv($3)._do_((function(each){
  38663. return $core.withContext(function($ctx2) {
  38664. return $recv($self._sequence())._add_($self._visit_(each));
  38665. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  38666. }));
  38667. return $self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  38668. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  38669. },
  38670. args: ["aNode"],
  38671. source: "visitCascadeNode: aNode\x0a\x09| receiver |\x0a\x09receiver := aNode receiver.\x0a\x09receiver isImmutable ifFalse: [\x0a\x09\x09| alias |\x0a\x09\x09alias := self alias: receiver.\x0a\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09aNode dagChildren do: [ :each | each receiver: receiver ].\x0a\x0a\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode dagChildren last",
  38672. referencedClasses: ["VariableNode"],
  38673. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "add:", "sequence", "visit:", "visitOrAlias:", "last"]
  38674. }),
  38675. $globals.IRASTTranslator);
  38676. $core.addMethod(
  38677. $core.method({
  38678. selector: "visitDynamicArrayNode:",
  38679. protocol: "visiting",
  38680. fn: function (aNode){
  38681. var self=this,$self=this;
  38682. var array;
  38683. return $core.withContext(function($ctx1) {
  38684. array=$recv($globals.IRDynamicArray)._new();
  38685. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  38686. return $core.withContext(function($ctx2) {
  38687. return $recv(array)._add_(each);
  38688. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38689. }));
  38690. return array;
  38691. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  38692. },
  38693. args: ["aNode"],
  38694. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  38695. referencedClasses: ["IRDynamicArray"],
  38696. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  38697. }),
  38698. $globals.IRASTTranslator);
  38699. $core.addMethod(
  38700. $core.method({
  38701. selector: "visitDynamicDictionaryNode:",
  38702. protocol: "visiting",
  38703. fn: function (aNode){
  38704. var self=this,$self=this;
  38705. var dictionary;
  38706. return $core.withContext(function($ctx1) {
  38707. dictionary=$recv($globals.IRDynamicDictionary)._new();
  38708. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  38709. return $core.withContext(function($ctx2) {
  38710. return $recv(dictionary)._add_(each);
  38711. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38712. }));
  38713. return dictionary;
  38714. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  38715. },
  38716. args: ["aNode"],
  38717. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  38718. referencedClasses: ["IRDynamicDictionary"],
  38719. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  38720. }),
  38721. $globals.IRASTTranslator);
  38722. $core.addMethod(
  38723. $core.method({
  38724. selector: "visitJSStatementNode:",
  38725. protocol: "visiting",
  38726. fn: function (aNode){
  38727. var self=this,$self=this;
  38728. return $core.withContext(function($ctx1) {
  38729. var $1;
  38730. $1=$recv($globals.IRVerbatim)._new();
  38731. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  38732. return $recv($1)._yourself();
  38733. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38734. },
  38735. args: ["aNode"],
  38736. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  38737. referencedClasses: ["IRVerbatim"],
  38738. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  38739. }),
  38740. $globals.IRASTTranslator);
  38741. $core.addMethod(
  38742. $core.method({
  38743. selector: "visitMethodNode:",
  38744. protocol: "visiting",
  38745. fn: function (aNode){
  38746. var self=this,$self=this;
  38747. return $core.withContext(function($ctx1) {
  38748. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  38749. $2=$recv($globals.IRMethod)._new();
  38750. $ctx1.sendIdx["new"]=1;
  38751. $recv($2)._source_($recv($self._source())._crlfSanitized());
  38752. $ctx1.sendIdx["source:"]=1;
  38753. $recv($2)._theClass_($self._theClass());
  38754. $recv($2)._arguments_($recv(aNode)._arguments());
  38755. $recv($2)._selector_($recv(aNode)._selector());
  38756. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  38757. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  38758. $recv($2)._classReferences_($recv(aNode)._classReferences());
  38759. $3=$recv(aNode)._scope();
  38760. $ctx1.sendIdx["scope"]=1;
  38761. $recv($2)._scope_($3);
  38762. $ctx1.sendIdx["scope:"]=1;
  38763. $4=$recv($2)._yourself();
  38764. $ctx1.sendIdx["yourself"]=1;
  38765. $1=$4;
  38766. $self._method_($1);
  38767. $6=$recv(aNode)._scope();
  38768. $ctx1.sendIdx["scope"]=2;
  38769. $5=$recv($6)._temps();
  38770. $recv($5)._do_((function(each){
  38771. return $core.withContext(function($ctx2) {
  38772. $7=$self._method();
  38773. $ctx2.sendIdx["method"]=1;
  38774. $9=$recv($globals.IRTempDeclaration)._new();
  38775. $ctx2.sendIdx["new"]=2;
  38776. $recv($9)._name_($recv(each)._name());
  38777. $10=$recv(aNode)._scope();
  38778. $ctx2.sendIdx["scope"]=3;
  38779. $recv($9)._scope_($10);
  38780. $11=$recv($9)._yourself();
  38781. $ctx2.sendIdx["yourself"]=2;
  38782. $8=$11;
  38783. return $recv($7)._add_($8);
  38784. $ctx2.sendIdx["add:"]=1;
  38785. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38786. }));
  38787. $ctx1.sendIdx["do:"]=1;
  38788. $recv($recv(aNode)._dagChildren())._do_((function(each){
  38789. return $core.withContext(function($ctx2) {
  38790. $12=$self._method();
  38791. $ctx2.sendIdx["method"]=2;
  38792. return $recv($12)._add_($self._visit_(each));
  38793. $ctx2.sendIdx["add:"]=2;
  38794. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38795. }));
  38796. $14=$recv(aNode)._scope();
  38797. $ctx1.sendIdx["scope"]=4;
  38798. $13=$recv($14)._hasLocalReturn();
  38799. if(!$core.assert($13)){
  38800. $15=$self._method();
  38801. $ctx1.sendIdx["method"]=3;
  38802. $17=$recv($globals.IRReturn)._new();
  38803. $ctx1.sendIdx["new"]=3;
  38804. $19=$recv($globals.IRVariable)._new();
  38805. $ctx1.sendIdx["new"]=4;
  38806. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  38807. $20=$recv($19)._yourself();
  38808. $ctx1.sendIdx["yourself"]=3;
  38809. $18=$20;
  38810. $recv($17)._add_($18);
  38811. $ctx1.sendIdx["add:"]=4;
  38812. $21=$recv($17)._yourself();
  38813. $ctx1.sendIdx["yourself"]=4;
  38814. $16=$21;
  38815. $recv($15)._add_($16);
  38816. $ctx1.sendIdx["add:"]=3;
  38817. $23=$recv($globals.IRVerbatim)._new();
  38818. $recv($23)._source_("");
  38819. $22=$recv($23)._yourself();
  38820. $recv($15)._add_($22);
  38821. }
  38822. return $self._method();
  38823. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38824. },
  38825. args: ["aNode"],
  38826. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ''; yourself) ].\x0a\x0a\x09^ self method",
  38827. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  38828. 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"]
  38829. }),
  38830. $globals.IRASTTranslator);
  38831. $core.addMethod(
  38832. $core.method({
  38833. selector: "visitOrAlias:",
  38834. protocol: "visiting",
  38835. fn: function (aNode){
  38836. var self=this,$self=this;
  38837. return $core.withContext(function($ctx1) {
  38838. var $1;
  38839. $1=$recv(aNode)._shouldBeAliased();
  38840. if($core.assert($1)){
  38841. return $self._alias_(aNode);
  38842. } else {
  38843. return $self._visit_(aNode);
  38844. }
  38845. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  38846. },
  38847. args: ["aNode"],
  38848. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  38849. referencedClasses: [],
  38850. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  38851. }),
  38852. $globals.IRASTTranslator);
  38853. $core.addMethod(
  38854. $core.method({
  38855. selector: "visitReturnNode:",
  38856. protocol: "visiting",
  38857. fn: function (aNode){
  38858. var self=this,$self=this;
  38859. var return_;
  38860. return $core.withContext(function($ctx1) {
  38861. var $1;
  38862. $1=$recv(aNode)._nonLocalReturn();
  38863. if($core.assert($1)){
  38864. return_=$recv($globals.IRNonLocalReturn)._new();
  38865. $ctx1.sendIdx["new"]=1;
  38866. } else {
  38867. return_=$recv($globals.IRReturn)._new();
  38868. }
  38869. $recv(return_)._scope_($recv(aNode)._scope());
  38870. $recv($recv(aNode)._dagChildren())._do_((function(each){
  38871. return $core.withContext(function($ctx2) {
  38872. return $recv(return_)._add_($self._visitOrAlias_(each));
  38873. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  38874. }));
  38875. return return_;
  38876. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  38877. },
  38878. args: ["aNode"],
  38879. 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",
  38880. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  38881. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  38882. }),
  38883. $globals.IRASTTranslator);
  38884. $core.addMethod(
  38885. $core.method({
  38886. selector: "visitSendNode:",
  38887. protocol: "visiting",
  38888. fn: function (aNode){
  38889. var self=this,$self=this;
  38890. var send;
  38891. return $core.withContext(function($ctx1) {
  38892. var $1;
  38893. send=$recv($globals.IRSend)._new();
  38894. $1=send;
  38895. $recv($1)._selector_($recv(aNode)._selector());
  38896. $recv($1)._index_($recv(aNode)._index());
  38897. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  38898. return $core.withContext(function($ctx2) {
  38899. return $recv(send)._add_(each);
  38900. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38901. }));
  38902. return send;
  38903. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  38904. },
  38905. args: ["aNode"],
  38906. 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",
  38907. referencedClasses: ["IRSend"],
  38908. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  38909. }),
  38910. $globals.IRASTTranslator);
  38911. $core.addMethod(
  38912. $core.method({
  38913. selector: "visitSequenceNode:",
  38914. protocol: "visiting",
  38915. fn: function (aNode){
  38916. var self=this,$self=this;
  38917. return $core.withContext(function($ctx1) {
  38918. var $1;
  38919. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  38920. return $core.withContext(function($ctx2) {
  38921. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  38922. var instruction;
  38923. return $core.withContext(function($ctx3) {
  38924. instruction=$self._visitOrAlias_(each);
  38925. instruction;
  38926. $1=$recv(instruction)._isVariable();
  38927. if(!$core.assert($1)){
  38928. return $recv($self._sequence())._add_(instruction);
  38929. }
  38930. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  38931. }));
  38932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38933. }));
  38934. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38935. },
  38936. args: ["aNode"],
  38937. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]",
  38938. referencedClasses: ["IRSequence"],
  38939. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  38940. }),
  38941. $globals.IRASTTranslator);
  38942. $core.addMethod(
  38943. $core.method({
  38944. selector: "visitValueNode:",
  38945. protocol: "visiting",
  38946. fn: function (aNode){
  38947. var self=this,$self=this;
  38948. return $core.withContext(function($ctx1) {
  38949. var $1;
  38950. $1=$recv($globals.IRValue)._new();
  38951. $recv($1)._value_($recv(aNode)._value());
  38952. return $recv($1)._yourself();
  38953. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38954. },
  38955. args: ["aNode"],
  38956. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  38957. referencedClasses: ["IRValue"],
  38958. messageSends: ["value:", "new", "value", "yourself"]
  38959. }),
  38960. $globals.IRASTTranslator);
  38961. $core.addMethod(
  38962. $core.method({
  38963. selector: "visitVariableNode:",
  38964. protocol: "visiting",
  38965. fn: function (aNode){
  38966. var self=this,$self=this;
  38967. return $core.withContext(function($ctx1) {
  38968. var $1;
  38969. $1=$recv($globals.IRVariable)._new();
  38970. $recv($1)._variable_($recv(aNode)._binding());
  38971. return $recv($1)._yourself();
  38972. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38973. },
  38974. args: ["aNode"],
  38975. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  38976. referencedClasses: ["IRVariable"],
  38977. messageSends: ["variable:", "new", "binding", "yourself"]
  38978. }),
  38979. $globals.IRASTTranslator);
  38980. $core.addMethod(
  38981. $core.method({
  38982. selector: "withSequence:do:",
  38983. protocol: "accessing",
  38984. fn: function (aSequence,aBlock){
  38985. var self=this,$self=this;
  38986. var outerSequence;
  38987. return $core.withContext(function($ctx1) {
  38988. outerSequence=$self._sequence();
  38989. $self._sequence_(aSequence);
  38990. $ctx1.sendIdx["sequence:"]=1;
  38991. $recv(aBlock)._value();
  38992. $self._sequence_(outerSequence);
  38993. return aSequence;
  38994. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  38995. },
  38996. args: ["aSequence", "aBlock"],
  38997. 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",
  38998. referencedClasses: [],
  38999. messageSends: ["sequence", "sequence:", "value"]
  39000. }),
  39001. $globals.IRASTTranslator);
  39002. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  39003. $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.";
  39004. $core.addMethod(
  39005. $core.method({
  39006. selector: "add:",
  39007. protocol: "building",
  39008. fn: function (anObject){
  39009. var self=this,$self=this;
  39010. return $core.withContext(function($ctx1) {
  39011. $recv(anObject)._parent_(self);
  39012. return $recv($self._dagChildren())._add_(anObject);
  39013. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  39014. },
  39015. args: ["anObject"],
  39016. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  39017. referencedClasses: [],
  39018. messageSends: ["parent:", "add:", "dagChildren"]
  39019. }),
  39020. $globals.IRInstruction);
  39021. $core.addMethod(
  39022. $core.method({
  39023. selector: "isClosure",
  39024. protocol: "testing",
  39025. fn: function (){
  39026. var self=this,$self=this;
  39027. return false;
  39028. },
  39029. args: [],
  39030. source: "isClosure\x0a\x09^ false",
  39031. referencedClasses: [],
  39032. messageSends: []
  39033. }),
  39034. $globals.IRInstruction);
  39035. $core.addMethod(
  39036. $core.method({
  39037. selector: "isInlined",
  39038. protocol: "testing",
  39039. fn: function (){
  39040. var self=this,$self=this;
  39041. return false;
  39042. },
  39043. args: [],
  39044. source: "isInlined\x0a\x09^ false",
  39045. referencedClasses: [],
  39046. messageSends: []
  39047. }),
  39048. $globals.IRInstruction);
  39049. $core.addMethod(
  39050. $core.method({
  39051. selector: "isMethod",
  39052. protocol: "testing",
  39053. fn: function (){
  39054. var self=this,$self=this;
  39055. return false;
  39056. },
  39057. args: [],
  39058. source: "isMethod\x0a\x09^ false",
  39059. referencedClasses: [],
  39060. messageSends: []
  39061. }),
  39062. $globals.IRInstruction);
  39063. $core.addMethod(
  39064. $core.method({
  39065. selector: "isSelf",
  39066. protocol: "testing",
  39067. fn: function (){
  39068. var self=this,$self=this;
  39069. return false;
  39070. },
  39071. args: [],
  39072. source: "isSelf\x0a\x09^ false",
  39073. referencedClasses: [],
  39074. messageSends: []
  39075. }),
  39076. $globals.IRInstruction);
  39077. $core.addMethod(
  39078. $core.method({
  39079. selector: "isSend",
  39080. protocol: "testing",
  39081. fn: function (){
  39082. var self=this,$self=this;
  39083. return false;
  39084. },
  39085. args: [],
  39086. source: "isSend\x0a\x09^ false",
  39087. referencedClasses: [],
  39088. messageSends: []
  39089. }),
  39090. $globals.IRInstruction);
  39091. $core.addMethod(
  39092. $core.method({
  39093. selector: "isSequence",
  39094. protocol: "testing",
  39095. fn: function (){
  39096. var self=this,$self=this;
  39097. return false;
  39098. },
  39099. args: [],
  39100. source: "isSequence\x0a\x09^ false",
  39101. referencedClasses: [],
  39102. messageSends: []
  39103. }),
  39104. $globals.IRInstruction);
  39105. $core.addMethod(
  39106. $core.method({
  39107. selector: "isSuper",
  39108. protocol: "testing",
  39109. fn: function (){
  39110. var self=this,$self=this;
  39111. return false;
  39112. },
  39113. args: [],
  39114. source: "isSuper\x0a\x09^ false",
  39115. referencedClasses: [],
  39116. messageSends: []
  39117. }),
  39118. $globals.IRInstruction);
  39119. $core.addMethod(
  39120. $core.method({
  39121. selector: "isTempDeclaration",
  39122. protocol: "testing",
  39123. fn: function (){
  39124. var self=this,$self=this;
  39125. return false;
  39126. },
  39127. args: [],
  39128. source: "isTempDeclaration\x0a\x09^ false",
  39129. referencedClasses: [],
  39130. messageSends: []
  39131. }),
  39132. $globals.IRInstruction);
  39133. $core.addMethod(
  39134. $core.method({
  39135. selector: "isVariable",
  39136. protocol: "testing",
  39137. fn: function (){
  39138. var self=this,$self=this;
  39139. return false;
  39140. },
  39141. args: [],
  39142. source: "isVariable\x0a\x09^ false",
  39143. referencedClasses: [],
  39144. messageSends: []
  39145. }),
  39146. $globals.IRInstruction);
  39147. $core.addMethod(
  39148. $core.method({
  39149. selector: "method",
  39150. protocol: "accessing",
  39151. fn: function (){
  39152. var self=this,$self=this;
  39153. return $core.withContext(function($ctx1) {
  39154. return $recv($self._parent())._method();
  39155. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  39156. },
  39157. args: [],
  39158. source: "method\x0a\x09^ self parent method",
  39159. referencedClasses: [],
  39160. messageSends: ["method", "parent"]
  39161. }),
  39162. $globals.IRInstruction);
  39163. $core.addMethod(
  39164. $core.method({
  39165. selector: "needsBoxingAsReceiver",
  39166. protocol: "testing",
  39167. fn: function (){
  39168. var self=this,$self=this;
  39169. return true;
  39170. },
  39171. args: [],
  39172. source: "needsBoxingAsReceiver\x0a\x09^ true",
  39173. referencedClasses: [],
  39174. messageSends: []
  39175. }),
  39176. $globals.IRInstruction);
  39177. $core.addMethod(
  39178. $core.method({
  39179. selector: "parent",
  39180. protocol: "accessing",
  39181. fn: function (){
  39182. var self=this,$self=this;
  39183. return $self["@parent"];
  39184. },
  39185. args: [],
  39186. source: "parent\x0a\x09^ parent",
  39187. referencedClasses: [],
  39188. messageSends: []
  39189. }),
  39190. $globals.IRInstruction);
  39191. $core.addMethod(
  39192. $core.method({
  39193. selector: "parent:",
  39194. protocol: "accessing",
  39195. fn: function (anIRInstruction){
  39196. var self=this,$self=this;
  39197. $self["@parent"]=anIRInstruction;
  39198. return self;
  39199. },
  39200. args: ["anIRInstruction"],
  39201. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  39202. referencedClasses: [],
  39203. messageSends: []
  39204. }),
  39205. $globals.IRInstruction);
  39206. $core.addMethod(
  39207. $core.method({
  39208. selector: "remove:",
  39209. protocol: "building",
  39210. fn: function (anIRInstruction){
  39211. var self=this,$self=this;
  39212. return $core.withContext(function($ctx1) {
  39213. $recv($self._dagChildren())._remove_(anIRInstruction);
  39214. return self;
  39215. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39216. },
  39217. args: ["anIRInstruction"],
  39218. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  39219. referencedClasses: [],
  39220. messageSends: ["remove:", "dagChildren"]
  39221. }),
  39222. $globals.IRInstruction);
  39223. $core.addMethod(
  39224. $core.method({
  39225. selector: "replace:with:",
  39226. protocol: "building",
  39227. fn: function (anIRInstruction,anotherIRInstruction){
  39228. var self=this,$self=this;
  39229. return $core.withContext(function($ctx1) {
  39230. var $1;
  39231. $recv(anotherIRInstruction)._parent_(self);
  39232. $1=$self._dagChildren();
  39233. $ctx1.sendIdx["dagChildren"]=1;
  39234. $recv($1)._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  39235. return self;
  39236. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  39237. },
  39238. args: ["anIRInstruction", "anotherIRInstruction"],
  39239. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  39240. referencedClasses: [],
  39241. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  39242. }),
  39243. $globals.IRInstruction);
  39244. $core.addMethod(
  39245. $core.method({
  39246. selector: "replaceWith:",
  39247. protocol: "building",
  39248. fn: function (anIRInstruction){
  39249. var self=this,$self=this;
  39250. return $core.withContext(function($ctx1) {
  39251. $recv($self._parent())._replace_with_(self,anIRInstruction);
  39252. return self;
  39253. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39254. },
  39255. args: ["anIRInstruction"],
  39256. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  39257. referencedClasses: [],
  39258. messageSends: ["replace:with:", "parent"]
  39259. }),
  39260. $globals.IRInstruction);
  39261. $core.addMethod(
  39262. $core.method({
  39263. selector: "scope",
  39264. protocol: "accessing",
  39265. fn: function (){
  39266. var self=this,$self=this;
  39267. return $core.withContext(function($ctx1) {
  39268. var $1,$receiver;
  39269. $1=$self._parent();
  39270. if(($receiver = $1) == null || $receiver.a$nil){
  39271. return $1;
  39272. } else {
  39273. var node;
  39274. node=$receiver;
  39275. return $recv(node)._scope();
  39276. }
  39277. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  39278. },
  39279. args: [],
  39280. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  39281. referencedClasses: [],
  39282. messageSends: ["ifNotNil:", "parent", "scope"]
  39283. }),
  39284. $globals.IRInstruction);
  39285. $core.addMethod(
  39286. $core.method({
  39287. selector: "yieldsValue",
  39288. protocol: "testing",
  39289. fn: function (){
  39290. var self=this,$self=this;
  39291. return true;
  39292. },
  39293. args: [],
  39294. source: "yieldsValue\x0a\x09^ true",
  39295. referencedClasses: [],
  39296. messageSends: []
  39297. }),
  39298. $globals.IRInstruction);
  39299. $core.addMethod(
  39300. $core.method({
  39301. selector: "on:",
  39302. protocol: "instance creation",
  39303. fn: function (aBuilder){
  39304. var self=this,$self=this;
  39305. return $core.withContext(function($ctx1) {
  39306. var $1;
  39307. $1=$self._new();
  39308. $recv($1)._builder_(aBuilder);
  39309. return $recv($1)._yourself();
  39310. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.a$cls)});
  39311. },
  39312. args: ["aBuilder"],
  39313. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  39314. referencedClasses: [],
  39315. messageSends: ["builder:", "new", "yourself"]
  39316. }),
  39317. $globals.IRInstruction.a$cls);
  39318. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  39319. $core.addMethod(
  39320. $core.method({
  39321. selector: "acceptDagVisitor:",
  39322. protocol: "visiting",
  39323. fn: function (aVisitor){
  39324. var self=this,$self=this;
  39325. return $core.withContext(function($ctx1) {
  39326. return $recv(aVisitor)._visitIRAssignment_(self);
  39327. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  39328. },
  39329. args: ["aVisitor"],
  39330. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  39331. referencedClasses: [],
  39332. messageSends: ["visitIRAssignment:"]
  39333. }),
  39334. $globals.IRAssignment);
  39335. $core.addMethod(
  39336. $core.method({
  39337. selector: "left",
  39338. protocol: "accessing",
  39339. fn: function (){
  39340. var self=this,$self=this;
  39341. return $core.withContext(function($ctx1) {
  39342. return $recv($self._dagChildren())._first();
  39343. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  39344. },
  39345. args: [],
  39346. source: "left\x0a\x09^ self dagChildren first",
  39347. referencedClasses: [],
  39348. messageSends: ["first", "dagChildren"]
  39349. }),
  39350. $globals.IRAssignment);
  39351. $core.addMethod(
  39352. $core.method({
  39353. selector: "right",
  39354. protocol: "accessing",
  39355. fn: function (){
  39356. var self=this,$self=this;
  39357. return $core.withContext(function($ctx1) {
  39358. return $recv($self._dagChildren())._last();
  39359. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  39360. },
  39361. args: [],
  39362. source: "right\x0a\x09^ self dagChildren last",
  39363. referencedClasses: [],
  39364. messageSends: ["last", "dagChildren"]
  39365. }),
  39366. $globals.IRAssignment);
  39367. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  39368. $core.addMethod(
  39369. $core.method({
  39370. selector: "acceptDagVisitor:",
  39371. protocol: "visiting",
  39372. fn: function (aVisitor){
  39373. var self=this,$self=this;
  39374. return $core.withContext(function($ctx1) {
  39375. return $recv(aVisitor)._visitIRDynamicArray_(self);
  39376. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  39377. },
  39378. args: ["aVisitor"],
  39379. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  39380. referencedClasses: [],
  39381. messageSends: ["visitIRDynamicArray:"]
  39382. }),
  39383. $globals.IRDynamicArray);
  39384. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  39385. $core.addMethod(
  39386. $core.method({
  39387. selector: "acceptDagVisitor:",
  39388. protocol: "visiting",
  39389. fn: function (aVisitor){
  39390. var self=this,$self=this;
  39391. return $core.withContext(function($ctx1) {
  39392. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  39393. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  39394. },
  39395. args: ["aVisitor"],
  39396. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  39397. referencedClasses: [],
  39398. messageSends: ["visitIRDynamicDictionary:"]
  39399. }),
  39400. $globals.IRDynamicDictionary);
  39401. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  39402. $core.addMethod(
  39403. $core.method({
  39404. selector: "scope",
  39405. protocol: "accessing",
  39406. fn: function (){
  39407. var self=this,$self=this;
  39408. return $self["@scope"];
  39409. },
  39410. args: [],
  39411. source: "scope\x0a\x09^ scope",
  39412. referencedClasses: [],
  39413. messageSends: []
  39414. }),
  39415. $globals.IRScopedInstruction);
  39416. $core.addMethod(
  39417. $core.method({
  39418. selector: "scope:",
  39419. protocol: "accessing",
  39420. fn: function (aScope){
  39421. var self=this,$self=this;
  39422. $self["@scope"]=aScope;
  39423. return self;
  39424. },
  39425. args: ["aScope"],
  39426. source: "scope: aScope\x0a\x09scope := aScope",
  39427. referencedClasses: [],
  39428. messageSends: []
  39429. }),
  39430. $globals.IRScopedInstruction);
  39431. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  39432. $core.addMethod(
  39433. $core.method({
  39434. selector: "arguments",
  39435. protocol: "accessing",
  39436. fn: function (){
  39437. var self=this,$self=this;
  39438. return $core.withContext(function($ctx1) {
  39439. var $1,$receiver;
  39440. $1=$self["@arguments"];
  39441. if(($receiver = $1) == null || $receiver.a$nil){
  39442. return [];
  39443. } else {
  39444. return $1;
  39445. }
  39446. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  39447. },
  39448. args: [],
  39449. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  39450. referencedClasses: [],
  39451. messageSends: ["ifNil:"]
  39452. }),
  39453. $globals.IRClosureInstruction);
  39454. $core.addMethod(
  39455. $core.method({
  39456. selector: "arguments:",
  39457. protocol: "accessing",
  39458. fn: function (aCollection){
  39459. var self=this,$self=this;
  39460. $self["@arguments"]=aCollection;
  39461. return self;
  39462. },
  39463. args: ["aCollection"],
  39464. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  39465. referencedClasses: [],
  39466. messageSends: []
  39467. }),
  39468. $globals.IRClosureInstruction);
  39469. $core.addMethod(
  39470. $core.method({
  39471. selector: "locals",
  39472. protocol: "accessing",
  39473. fn: function (){
  39474. var self=this,$self=this;
  39475. return $core.withContext(function($ctx1) {
  39476. var $1;
  39477. $1=$recv($self._arguments())._copy();
  39478. $recv($1)._addAll_($recv($self._tempDeclarations())._collect_((function(each){
  39479. return $core.withContext(function($ctx2) {
  39480. return $recv(each)._name();
  39481. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39482. })));
  39483. return $recv($1)._yourself();
  39484. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  39485. },
  39486. args: [],
  39487. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  39488. referencedClasses: [],
  39489. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  39490. }),
  39491. $globals.IRClosureInstruction);
  39492. $core.addMethod(
  39493. $core.method({
  39494. selector: "requiresSmalltalkContext",
  39495. protocol: "accessing",
  39496. fn: function (){
  39497. var self=this,$self=this;
  39498. return $core.withContext(function($ctx1) {
  39499. var $1,$receiver;
  39500. $1=$self["@requiresSmalltalkContext"];
  39501. if(($receiver = $1) == null || $receiver.a$nil){
  39502. return false;
  39503. } else {
  39504. return $1;
  39505. }
  39506. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  39507. },
  39508. args: [],
  39509. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  39510. referencedClasses: [],
  39511. messageSends: ["ifNil:"]
  39512. }),
  39513. $globals.IRClosureInstruction);
  39514. $core.addMethod(
  39515. $core.method({
  39516. selector: "requiresSmalltalkContext:",
  39517. protocol: "accessing",
  39518. fn: function (anObject){
  39519. var self=this,$self=this;
  39520. $self["@requiresSmalltalkContext"]=anObject;
  39521. return self;
  39522. },
  39523. args: ["anObject"],
  39524. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  39525. referencedClasses: [],
  39526. messageSends: []
  39527. }),
  39528. $globals.IRClosureInstruction);
  39529. $core.addMethod(
  39530. $core.method({
  39531. selector: "scope:",
  39532. protocol: "accessing",
  39533. fn: function (aScope){
  39534. var self=this,$self=this;
  39535. return $core.withContext(function($ctx1) {
  39536. (
  39537. $ctx1.supercall = true,
  39538. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($self, [aScope]));
  39539. $ctx1.supercall = false;
  39540. $recv(aScope)._instruction_(self);
  39541. return self;
  39542. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  39543. },
  39544. args: ["aScope"],
  39545. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  39546. referencedClasses: [],
  39547. messageSends: ["scope:", "instruction:"]
  39548. }),
  39549. $globals.IRClosureInstruction);
  39550. $core.addMethod(
  39551. $core.method({
  39552. selector: "tempDeclarations",
  39553. protocol: "accessing",
  39554. fn: function (){
  39555. var self=this,$self=this;
  39556. return $core.withContext(function($ctx1) {
  39557. return $recv($self._dagChildren())._select_((function(each){
  39558. return $core.withContext(function($ctx2) {
  39559. return $recv(each)._isTempDeclaration();
  39560. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39561. }));
  39562. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  39563. },
  39564. args: [],
  39565. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  39566. referencedClasses: [],
  39567. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  39568. }),
  39569. $globals.IRClosureInstruction);
  39570. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  39571. $core.addMethod(
  39572. $core.method({
  39573. selector: "acceptDagVisitor:",
  39574. protocol: "visiting",
  39575. fn: function (aVisitor){
  39576. var self=this,$self=this;
  39577. return $core.withContext(function($ctx1) {
  39578. return $recv(aVisitor)._visitIRClosure_(self);
  39579. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  39580. },
  39581. args: ["aVisitor"],
  39582. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  39583. referencedClasses: [],
  39584. messageSends: ["visitIRClosure:"]
  39585. }),
  39586. $globals.IRClosure);
  39587. $core.addMethod(
  39588. $core.method({
  39589. selector: "isClosure",
  39590. protocol: "testing",
  39591. fn: function (){
  39592. var self=this,$self=this;
  39593. return true;
  39594. },
  39595. args: [],
  39596. source: "isClosure\x0a\x09^ true",
  39597. referencedClasses: [],
  39598. messageSends: []
  39599. }),
  39600. $globals.IRClosure);
  39601. $core.addMethod(
  39602. $core.method({
  39603. selector: "sequence",
  39604. protocol: "accessing",
  39605. fn: function (){
  39606. var self=this,$self=this;
  39607. return $core.withContext(function($ctx1) {
  39608. return $recv($self._dagChildren())._last();
  39609. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  39610. },
  39611. args: [],
  39612. source: "sequence\x0a\x09^ self dagChildren last",
  39613. referencedClasses: [],
  39614. messageSends: ["last", "dagChildren"]
  39615. }),
  39616. $globals.IRClosure);
  39617. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  39618. $globals.IRMethod.comment="I am a method instruction";
  39619. $core.addMethod(
  39620. $core.method({
  39621. selector: "acceptDagVisitor:",
  39622. protocol: "visiting",
  39623. fn: function (aVisitor){
  39624. var self=this,$self=this;
  39625. return $core.withContext(function($ctx1) {
  39626. return $recv(aVisitor)._visitIRMethod_(self);
  39627. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  39628. },
  39629. args: ["aVisitor"],
  39630. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  39631. referencedClasses: [],
  39632. messageSends: ["visitIRMethod:"]
  39633. }),
  39634. $globals.IRMethod);
  39635. $core.addMethod(
  39636. $core.method({
  39637. selector: "classReferences",
  39638. protocol: "accessing",
  39639. fn: function (){
  39640. var self=this,$self=this;
  39641. return $self["@classReferences"];
  39642. },
  39643. args: [],
  39644. source: "classReferences\x0a\x09^ classReferences",
  39645. referencedClasses: [],
  39646. messageSends: []
  39647. }),
  39648. $globals.IRMethod);
  39649. $core.addMethod(
  39650. $core.method({
  39651. selector: "classReferences:",
  39652. protocol: "accessing",
  39653. fn: function (aCollection){
  39654. var self=this,$self=this;
  39655. $self["@classReferences"]=aCollection;
  39656. return self;
  39657. },
  39658. args: ["aCollection"],
  39659. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  39660. referencedClasses: [],
  39661. messageSends: []
  39662. }),
  39663. $globals.IRMethod);
  39664. $core.addMethod(
  39665. $core.method({
  39666. selector: "internalVariables",
  39667. protocol: "accessing",
  39668. fn: function (){
  39669. var self=this,$self=this;
  39670. return $core.withContext(function($ctx1) {
  39671. var $1,$receiver;
  39672. $1=$self["@internalVariables"];
  39673. if(($receiver = $1) == null || $receiver.a$nil){
  39674. $self["@internalVariables"]=$recv($globals.Set)._new();
  39675. return $self["@internalVariables"];
  39676. } else {
  39677. return $1;
  39678. }
  39679. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  39680. },
  39681. args: [],
  39682. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  39683. referencedClasses: ["Set"],
  39684. messageSends: ["ifNil:", "new"]
  39685. }),
  39686. $globals.IRMethod);
  39687. $core.addMethod(
  39688. $core.method({
  39689. selector: "isMethod",
  39690. protocol: "testing",
  39691. fn: function (){
  39692. var self=this,$self=this;
  39693. return true;
  39694. },
  39695. args: [],
  39696. source: "isMethod\x0a\x09^ true",
  39697. referencedClasses: [],
  39698. messageSends: []
  39699. }),
  39700. $globals.IRMethod);
  39701. $core.addMethod(
  39702. $core.method({
  39703. selector: "messageSends",
  39704. protocol: "accessing",
  39705. fn: function (){
  39706. var self=this,$self=this;
  39707. return $core.withContext(function($ctx1) {
  39708. return $recv($self._sendIndexes())._keys();
  39709. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  39710. },
  39711. args: [],
  39712. source: "messageSends\x0a\x09^ self sendIndexes keys",
  39713. referencedClasses: [],
  39714. messageSends: ["keys", "sendIndexes"]
  39715. }),
  39716. $globals.IRMethod);
  39717. $core.addMethod(
  39718. $core.method({
  39719. selector: "method",
  39720. protocol: "accessing",
  39721. fn: function (){
  39722. var self=this,$self=this;
  39723. return self;
  39724. },
  39725. args: [],
  39726. source: "method\x0a\x09^ self",
  39727. referencedClasses: [],
  39728. messageSends: []
  39729. }),
  39730. $globals.IRMethod);
  39731. $core.addMethod(
  39732. $core.method({
  39733. selector: "selector",
  39734. protocol: "accessing",
  39735. fn: function (){
  39736. var self=this,$self=this;
  39737. return $self["@selector"];
  39738. },
  39739. args: [],
  39740. source: "selector\x0a\x09^ selector",
  39741. referencedClasses: [],
  39742. messageSends: []
  39743. }),
  39744. $globals.IRMethod);
  39745. $core.addMethod(
  39746. $core.method({
  39747. selector: "selector:",
  39748. protocol: "accessing",
  39749. fn: function (aString){
  39750. var self=this,$self=this;
  39751. $self["@selector"]=aString;
  39752. return self;
  39753. },
  39754. args: ["aString"],
  39755. source: "selector: aString\x0a\x09selector := aString",
  39756. referencedClasses: [],
  39757. messageSends: []
  39758. }),
  39759. $globals.IRMethod);
  39760. $core.addMethod(
  39761. $core.method({
  39762. selector: "sendIndexes",
  39763. protocol: "accessing",
  39764. fn: function (){
  39765. var self=this,$self=this;
  39766. return $self["@sendIndexes"];
  39767. },
  39768. args: [],
  39769. source: "sendIndexes\x0a\x09^ sendIndexes",
  39770. referencedClasses: [],
  39771. messageSends: []
  39772. }),
  39773. $globals.IRMethod);
  39774. $core.addMethod(
  39775. $core.method({
  39776. selector: "sendIndexes:",
  39777. protocol: "accessing",
  39778. fn: function (aDictionary){
  39779. var self=this,$self=this;
  39780. $self["@sendIndexes"]=aDictionary;
  39781. return self;
  39782. },
  39783. args: ["aDictionary"],
  39784. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  39785. referencedClasses: [],
  39786. messageSends: []
  39787. }),
  39788. $globals.IRMethod);
  39789. $core.addMethod(
  39790. $core.method({
  39791. selector: "source",
  39792. protocol: "accessing",
  39793. fn: function (){
  39794. var self=this,$self=this;
  39795. return $self["@source"];
  39796. },
  39797. args: [],
  39798. source: "source\x0a\x09^ source",
  39799. referencedClasses: [],
  39800. messageSends: []
  39801. }),
  39802. $globals.IRMethod);
  39803. $core.addMethod(
  39804. $core.method({
  39805. selector: "source:",
  39806. protocol: "accessing",
  39807. fn: function (aString){
  39808. var self=this,$self=this;
  39809. $self["@source"]=aString;
  39810. return self;
  39811. },
  39812. args: ["aString"],
  39813. source: "source: aString\x0a\x09source := aString",
  39814. referencedClasses: [],
  39815. messageSends: []
  39816. }),
  39817. $globals.IRMethod);
  39818. $core.addMethod(
  39819. $core.method({
  39820. selector: "theClass",
  39821. protocol: "accessing",
  39822. fn: function (){
  39823. var self=this,$self=this;
  39824. return $self["@theClass"];
  39825. },
  39826. args: [],
  39827. source: "theClass\x0a\x09^ theClass",
  39828. referencedClasses: [],
  39829. messageSends: []
  39830. }),
  39831. $globals.IRMethod);
  39832. $core.addMethod(
  39833. $core.method({
  39834. selector: "theClass:",
  39835. protocol: "accessing",
  39836. fn: function (aClass){
  39837. var self=this,$self=this;
  39838. $self["@theClass"]=aClass;
  39839. return self;
  39840. },
  39841. args: ["aClass"],
  39842. source: "theClass: aClass\x0a\x09theClass := aClass",
  39843. referencedClasses: [],
  39844. messageSends: []
  39845. }),
  39846. $globals.IRMethod);
  39847. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  39848. $globals.IRReturn.comment="I am a local return instruction.";
  39849. $core.addMethod(
  39850. $core.method({
  39851. selector: "acceptDagVisitor:",
  39852. protocol: "visiting",
  39853. fn: function (aVisitor){
  39854. var self=this,$self=this;
  39855. return $core.withContext(function($ctx1) {
  39856. return $recv(aVisitor)._visitIRReturn_(self);
  39857. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  39858. },
  39859. args: ["aVisitor"],
  39860. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  39861. referencedClasses: [],
  39862. messageSends: ["visitIRReturn:"]
  39863. }),
  39864. $globals.IRReturn);
  39865. $core.addMethod(
  39866. $core.method({
  39867. selector: "expression",
  39868. protocol: "accessing",
  39869. fn: function (){
  39870. var self=this,$self=this;
  39871. return $core.withContext(function($ctx1) {
  39872. return $recv($self._dagChildren())._single();
  39873. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  39874. },
  39875. args: [],
  39876. source: "expression\x0a\x09^ self dagChildren single",
  39877. referencedClasses: [],
  39878. messageSends: ["single", "dagChildren"]
  39879. }),
  39880. $globals.IRReturn);
  39881. $core.addMethod(
  39882. $core.method({
  39883. selector: "scope",
  39884. protocol: "accessing",
  39885. fn: function (){
  39886. var self=this,$self=this;
  39887. return $core.withContext(function($ctx1) {
  39888. var $1,$receiver;
  39889. $1=$self["@scope"];
  39890. if(($receiver = $1) == null || $receiver.a$nil){
  39891. return $recv($self._parent())._scope();
  39892. } else {
  39893. return $1;
  39894. }
  39895. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  39896. },
  39897. args: [],
  39898. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  39899. referencedClasses: [],
  39900. messageSends: ["ifNil:", "scope", "parent"]
  39901. }),
  39902. $globals.IRReturn);
  39903. $core.addMethod(
  39904. $core.method({
  39905. selector: "yieldsValue",
  39906. protocol: "testing",
  39907. fn: function (){
  39908. var self=this,$self=this;
  39909. return false;
  39910. },
  39911. args: [],
  39912. source: "yieldsValue\x0a\x09^ false",
  39913. referencedClasses: [],
  39914. messageSends: []
  39915. }),
  39916. $globals.IRReturn);
  39917. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  39918. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  39919. $core.addMethod(
  39920. $core.method({
  39921. selector: "acceptDagVisitor:",
  39922. protocol: "visiting",
  39923. fn: function (aVisitor){
  39924. var self=this,$self=this;
  39925. return $core.withContext(function($ctx1) {
  39926. return $recv(aVisitor)._visitIRBlockReturn_(self);
  39927. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  39928. },
  39929. args: ["aVisitor"],
  39930. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  39931. referencedClasses: [],
  39932. messageSends: ["visitIRBlockReturn:"]
  39933. }),
  39934. $globals.IRBlockReturn);
  39935. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  39936. $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.";
  39937. $core.addMethod(
  39938. $core.method({
  39939. selector: "acceptDagVisitor:",
  39940. protocol: "visiting",
  39941. fn: function (aVisitor){
  39942. var self=this,$self=this;
  39943. return $core.withContext(function($ctx1) {
  39944. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  39945. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  39946. },
  39947. args: ["aVisitor"],
  39948. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  39949. referencedClasses: [],
  39950. messageSends: ["visitIRNonLocalReturn:"]
  39951. }),
  39952. $globals.IRNonLocalReturn);
  39953. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  39954. $core.addMethod(
  39955. $core.method({
  39956. selector: "acceptDagVisitor:",
  39957. protocol: "visiting",
  39958. fn: function (aVisitor){
  39959. var self=this,$self=this;
  39960. return $core.withContext(function($ctx1) {
  39961. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  39962. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  39963. },
  39964. args: ["aVisitor"],
  39965. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  39966. referencedClasses: [],
  39967. messageSends: ["visitIRTempDeclaration:"]
  39968. }),
  39969. $globals.IRTempDeclaration);
  39970. $core.addMethod(
  39971. $core.method({
  39972. selector: "isTempDeclaration",
  39973. protocol: "testing",
  39974. fn: function (){
  39975. var self=this,$self=this;
  39976. return true;
  39977. },
  39978. args: [],
  39979. source: "isTempDeclaration\x0a\x09^ true",
  39980. referencedClasses: [],
  39981. messageSends: []
  39982. }),
  39983. $globals.IRTempDeclaration);
  39984. $core.addMethod(
  39985. $core.method({
  39986. selector: "name",
  39987. protocol: "accessing",
  39988. fn: function (){
  39989. var self=this,$self=this;
  39990. return $self["@name"];
  39991. },
  39992. args: [],
  39993. source: "name\x0a\x09^ name",
  39994. referencedClasses: [],
  39995. messageSends: []
  39996. }),
  39997. $globals.IRTempDeclaration);
  39998. $core.addMethod(
  39999. $core.method({
  40000. selector: "name:",
  40001. protocol: "accessing",
  40002. fn: function (aString){
  40003. var self=this,$self=this;
  40004. $self["@name"]=aString;
  40005. return self;
  40006. },
  40007. args: ["aString"],
  40008. source: "name: aString\x0a\x09name := aString",
  40009. referencedClasses: [],
  40010. messageSends: []
  40011. }),
  40012. $globals.IRTempDeclaration);
  40013. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "index"], "Compiler-IR");
  40014. $globals.IRSend.comment="I am a message send instruction.";
  40015. $core.addMethod(
  40016. $core.method({
  40017. selector: "acceptDagVisitor:",
  40018. protocol: "visiting",
  40019. fn: function (aVisitor){
  40020. var self=this,$self=this;
  40021. return $core.withContext(function($ctx1) {
  40022. return $recv(aVisitor)._visitIRSend_(self);
  40023. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  40024. },
  40025. args: ["aVisitor"],
  40026. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  40027. referencedClasses: [],
  40028. messageSends: ["visitIRSend:"]
  40029. }),
  40030. $globals.IRSend);
  40031. $core.addMethod(
  40032. $core.method({
  40033. selector: "arguments",
  40034. protocol: "accessing",
  40035. fn: function (){
  40036. var self=this,$self=this;
  40037. return $core.withContext(function($ctx1) {
  40038. return $recv($self._dagChildren())._allButFirst();
  40039. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  40040. },
  40041. args: [],
  40042. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  40043. referencedClasses: [],
  40044. messageSends: ["allButFirst", "dagChildren"]
  40045. }),
  40046. $globals.IRSend);
  40047. $core.addMethod(
  40048. $core.method({
  40049. selector: "index",
  40050. protocol: "accessing",
  40051. fn: function (){
  40052. var self=this,$self=this;
  40053. return $self["@index"];
  40054. },
  40055. args: [],
  40056. source: "index\x0a\x09^ index",
  40057. referencedClasses: [],
  40058. messageSends: []
  40059. }),
  40060. $globals.IRSend);
  40061. $core.addMethod(
  40062. $core.method({
  40063. selector: "index:",
  40064. protocol: "accessing",
  40065. fn: function (anInteger){
  40066. var self=this,$self=this;
  40067. $self["@index"]=anInteger;
  40068. return self;
  40069. },
  40070. args: ["anInteger"],
  40071. source: "index: anInteger\x0a\x09index := anInteger",
  40072. referencedClasses: [],
  40073. messageSends: []
  40074. }),
  40075. $globals.IRSend);
  40076. $core.addMethod(
  40077. $core.method({
  40078. selector: "isSend",
  40079. protocol: "testing",
  40080. fn: function (){
  40081. var self=this,$self=this;
  40082. return true;
  40083. },
  40084. args: [],
  40085. source: "isSend\x0a\x09^ true",
  40086. referencedClasses: [],
  40087. messageSends: []
  40088. }),
  40089. $globals.IRSend);
  40090. $core.addMethod(
  40091. $core.method({
  40092. selector: "receiver",
  40093. protocol: "accessing",
  40094. fn: function (){
  40095. var self=this,$self=this;
  40096. return $core.withContext(function($ctx1) {
  40097. return $recv($self._dagChildren())._first();
  40098. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  40099. },
  40100. args: [],
  40101. source: "receiver\x0a\x09^ self dagChildren first",
  40102. referencedClasses: [],
  40103. messageSends: ["first", "dagChildren"]
  40104. }),
  40105. $globals.IRSend);
  40106. $core.addMethod(
  40107. $core.method({
  40108. selector: "selector",
  40109. protocol: "accessing",
  40110. fn: function (){
  40111. var self=this,$self=this;
  40112. return $self["@selector"];
  40113. },
  40114. args: [],
  40115. source: "selector\x0a\x09^ selector",
  40116. referencedClasses: [],
  40117. messageSends: []
  40118. }),
  40119. $globals.IRSend);
  40120. $core.addMethod(
  40121. $core.method({
  40122. selector: "selector:",
  40123. protocol: "accessing",
  40124. fn: function (aString){
  40125. var self=this,$self=this;
  40126. $self["@selector"]=aString;
  40127. return self;
  40128. },
  40129. args: ["aString"],
  40130. source: "selector: aString\x0a\x09selector := aString",
  40131. referencedClasses: [],
  40132. messageSends: []
  40133. }),
  40134. $globals.IRSend);
  40135. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  40136. $core.addMethod(
  40137. $core.method({
  40138. selector: "acceptDagVisitor:",
  40139. protocol: "visiting",
  40140. fn: function (aVisitor){
  40141. var self=this,$self=this;
  40142. return $core.withContext(function($ctx1) {
  40143. return $recv(aVisitor)._visitIRSequence_(self);
  40144. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  40145. },
  40146. args: ["aVisitor"],
  40147. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  40148. referencedClasses: [],
  40149. messageSends: ["visitIRSequence:"]
  40150. }),
  40151. $globals.IRSequence);
  40152. $core.addMethod(
  40153. $core.method({
  40154. selector: "isSequence",
  40155. protocol: "testing",
  40156. fn: function (){
  40157. var self=this,$self=this;
  40158. return true;
  40159. },
  40160. args: [],
  40161. source: "isSequence\x0a\x09^ true",
  40162. referencedClasses: [],
  40163. messageSends: []
  40164. }),
  40165. $globals.IRSequence);
  40166. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  40167. $core.addMethod(
  40168. $core.method({
  40169. selector: "acceptDagVisitor:",
  40170. protocol: "visiting",
  40171. fn: function (aVisitor){
  40172. var self=this,$self=this;
  40173. return $core.withContext(function($ctx1) {
  40174. return $recv(aVisitor)._visitIRBlockSequence_(self);
  40175. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  40176. },
  40177. args: ["aVisitor"],
  40178. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  40179. referencedClasses: [],
  40180. messageSends: ["visitIRBlockSequence:"]
  40181. }),
  40182. $globals.IRBlockSequence);
  40183. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  40184. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  40185. $core.addMethod(
  40186. $core.method({
  40187. selector: "acceptDagVisitor:",
  40188. protocol: "visiting",
  40189. fn: function (aVisitor){
  40190. var self=this,$self=this;
  40191. return $core.withContext(function($ctx1) {
  40192. return $recv(aVisitor)._visitIRValue_(self);
  40193. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  40194. },
  40195. args: ["aVisitor"],
  40196. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  40197. referencedClasses: [],
  40198. messageSends: ["visitIRValue:"]
  40199. }),
  40200. $globals.IRValue);
  40201. $core.addMethod(
  40202. $core.method({
  40203. selector: "needsBoxingAsReceiver",
  40204. protocol: "testing",
  40205. fn: function (){
  40206. var self=this,$self=this;
  40207. return false;
  40208. },
  40209. args: [],
  40210. source: "needsBoxingAsReceiver\x0a\x09^ false",
  40211. referencedClasses: [],
  40212. messageSends: []
  40213. }),
  40214. $globals.IRValue);
  40215. $core.addMethod(
  40216. $core.method({
  40217. selector: "value",
  40218. protocol: "accessing",
  40219. fn: function (){
  40220. var self=this,$self=this;
  40221. return $self["@value"];
  40222. },
  40223. args: [],
  40224. source: "value\x0a\x09^ value",
  40225. referencedClasses: [],
  40226. messageSends: []
  40227. }),
  40228. $globals.IRValue);
  40229. $core.addMethod(
  40230. $core.method({
  40231. selector: "value:",
  40232. protocol: "accessing",
  40233. fn: function (aString){
  40234. var self=this,$self=this;
  40235. $self["@value"]=aString;
  40236. return self;
  40237. },
  40238. args: ["aString"],
  40239. source: "value: aString\x0a\x09value := aString",
  40240. referencedClasses: [],
  40241. messageSends: []
  40242. }),
  40243. $globals.IRValue);
  40244. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  40245. $globals.IRVariable.comment="I am a variable instruction.";
  40246. $core.addMethod(
  40247. $core.method({
  40248. selector: "acceptDagVisitor:",
  40249. protocol: "visiting",
  40250. fn: function (aVisitor){
  40251. var self=this,$self=this;
  40252. return $core.withContext(function($ctx1) {
  40253. return $recv(aVisitor)._visitIRVariable_(self);
  40254. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  40255. },
  40256. args: ["aVisitor"],
  40257. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  40258. referencedClasses: [],
  40259. messageSends: ["visitIRVariable:"]
  40260. }),
  40261. $globals.IRVariable);
  40262. $core.addMethod(
  40263. $core.method({
  40264. selector: "isSelf",
  40265. protocol: "testing",
  40266. fn: function (){
  40267. var self=this,$self=this;
  40268. return $core.withContext(function($ctx1) {
  40269. return $recv($self._variable())._isSelf();
  40270. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.IRVariable)});
  40271. },
  40272. args: [],
  40273. source: "isSelf\x0a\x09^ self variable isSelf",
  40274. referencedClasses: [],
  40275. messageSends: ["isSelf", "variable"]
  40276. }),
  40277. $globals.IRVariable);
  40278. $core.addMethod(
  40279. $core.method({
  40280. selector: "isSuper",
  40281. protocol: "testing",
  40282. fn: function (){
  40283. var self=this,$self=this;
  40284. return $core.withContext(function($ctx1) {
  40285. return $recv($self._variable())._isSuper();
  40286. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.IRVariable)});
  40287. },
  40288. args: [],
  40289. source: "isSuper\x0a\x09^ self variable isSuper",
  40290. referencedClasses: [],
  40291. messageSends: ["isSuper", "variable"]
  40292. }),
  40293. $globals.IRVariable);
  40294. $core.addMethod(
  40295. $core.method({
  40296. selector: "isVariable",
  40297. protocol: "testing",
  40298. fn: function (){
  40299. var self=this,$self=this;
  40300. return true;
  40301. },
  40302. args: [],
  40303. source: "isVariable\x0a\x09^ true",
  40304. referencedClasses: [],
  40305. messageSends: []
  40306. }),
  40307. $globals.IRVariable);
  40308. $core.addMethod(
  40309. $core.method({
  40310. selector: "needsBoxingAsReceiver",
  40311. protocol: "testing",
  40312. fn: function (){
  40313. var self=this,$self=this;
  40314. return $core.withContext(function($ctx1) {
  40315. return $recv($recv($self._variable())._isPseudoVar())._not();
  40316. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  40317. },
  40318. args: [],
  40319. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  40320. referencedClasses: [],
  40321. messageSends: ["not", "isPseudoVar", "variable"]
  40322. }),
  40323. $globals.IRVariable);
  40324. $core.addMethod(
  40325. $core.method({
  40326. selector: "variable",
  40327. protocol: "accessing",
  40328. fn: function (){
  40329. var self=this,$self=this;
  40330. return $self["@variable"];
  40331. },
  40332. args: [],
  40333. source: "variable\x0a\x09^ variable",
  40334. referencedClasses: [],
  40335. messageSends: []
  40336. }),
  40337. $globals.IRVariable);
  40338. $core.addMethod(
  40339. $core.method({
  40340. selector: "variable:",
  40341. protocol: "accessing",
  40342. fn: function (aScopeVariable){
  40343. var self=this,$self=this;
  40344. $self["@variable"]=aScopeVariable;
  40345. return self;
  40346. },
  40347. args: ["aScopeVariable"],
  40348. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  40349. referencedClasses: [],
  40350. messageSends: []
  40351. }),
  40352. $globals.IRVariable);
  40353. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  40354. $core.addMethod(
  40355. $core.method({
  40356. selector: "acceptDagVisitor:",
  40357. protocol: "visiting",
  40358. fn: function (aVisitor){
  40359. var self=this,$self=this;
  40360. return $core.withContext(function($ctx1) {
  40361. return $recv(aVisitor)._visitIRVerbatim_(self);
  40362. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  40363. },
  40364. args: ["aVisitor"],
  40365. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  40366. referencedClasses: [],
  40367. messageSends: ["visitIRVerbatim:"]
  40368. }),
  40369. $globals.IRVerbatim);
  40370. $core.addMethod(
  40371. $core.method({
  40372. selector: "source",
  40373. protocol: "accessing",
  40374. fn: function (){
  40375. var self=this,$self=this;
  40376. return $self["@source"];
  40377. },
  40378. args: [],
  40379. source: "source\x0a\x09^ source",
  40380. referencedClasses: [],
  40381. messageSends: []
  40382. }),
  40383. $globals.IRVerbatim);
  40384. $core.addMethod(
  40385. $core.method({
  40386. selector: "source:",
  40387. protocol: "accessing",
  40388. fn: function (aString){
  40389. var self=this,$self=this;
  40390. $self["@source"]=aString;
  40391. return self;
  40392. },
  40393. args: ["aString"],
  40394. source: "source: aString\x0a\x09source := aString",
  40395. referencedClasses: [],
  40396. messageSends: []
  40397. }),
  40398. $globals.IRVerbatim);
  40399. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  40400. $core.addMethod(
  40401. $core.method({
  40402. selector: "visitDagNode:",
  40403. protocol: "visiting",
  40404. fn: function (aNode){
  40405. var self=this,$self=this;
  40406. return $core.withContext(function($ctx1) {
  40407. return $self._visitDagNodeVariantSimple_(aNode);
  40408. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  40409. },
  40410. args: ["aNode"],
  40411. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  40412. referencedClasses: [],
  40413. messageSends: ["visitDagNodeVariantSimple:"]
  40414. }),
  40415. $globals.IRVisitor);
  40416. $core.addMethod(
  40417. $core.method({
  40418. selector: "visitIRAssignment:",
  40419. protocol: "visiting",
  40420. fn: function (anIRAssignment){
  40421. var self=this,$self=this;
  40422. return $core.withContext(function($ctx1) {
  40423. return $self._visitDagNode_(anIRAssignment);
  40424. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  40425. },
  40426. args: ["anIRAssignment"],
  40427. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  40428. referencedClasses: [],
  40429. messageSends: ["visitDagNode:"]
  40430. }),
  40431. $globals.IRVisitor);
  40432. $core.addMethod(
  40433. $core.method({
  40434. selector: "visitIRBlockReturn:",
  40435. protocol: "visiting",
  40436. fn: function (anIRBlockReturn){
  40437. var self=this,$self=this;
  40438. return $core.withContext(function($ctx1) {
  40439. return $self._visitIRReturn_(anIRBlockReturn);
  40440. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  40441. },
  40442. args: ["anIRBlockReturn"],
  40443. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  40444. referencedClasses: [],
  40445. messageSends: ["visitIRReturn:"]
  40446. }),
  40447. $globals.IRVisitor);
  40448. $core.addMethod(
  40449. $core.method({
  40450. selector: "visitIRBlockSequence:",
  40451. protocol: "visiting",
  40452. fn: function (anIRBlockSequence){
  40453. var self=this,$self=this;
  40454. return $core.withContext(function($ctx1) {
  40455. return $self._visitIRSequence_(anIRBlockSequence);
  40456. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  40457. },
  40458. args: ["anIRBlockSequence"],
  40459. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  40460. referencedClasses: [],
  40461. messageSends: ["visitIRSequence:"]
  40462. }),
  40463. $globals.IRVisitor);
  40464. $core.addMethod(
  40465. $core.method({
  40466. selector: "visitIRClosure:",
  40467. protocol: "visiting",
  40468. fn: function (anIRClosure){
  40469. var self=this,$self=this;
  40470. return $core.withContext(function($ctx1) {
  40471. return $self._visitDagNode_(anIRClosure);
  40472. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  40473. },
  40474. args: ["anIRClosure"],
  40475. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  40476. referencedClasses: [],
  40477. messageSends: ["visitDagNode:"]
  40478. }),
  40479. $globals.IRVisitor);
  40480. $core.addMethod(
  40481. $core.method({
  40482. selector: "visitIRDynamicArray:",
  40483. protocol: "visiting",
  40484. fn: function (anIRDynamicArray){
  40485. var self=this,$self=this;
  40486. return $core.withContext(function($ctx1) {
  40487. return $self._visitDagNode_(anIRDynamicArray);
  40488. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  40489. },
  40490. args: ["anIRDynamicArray"],
  40491. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  40492. referencedClasses: [],
  40493. messageSends: ["visitDagNode:"]
  40494. }),
  40495. $globals.IRVisitor);
  40496. $core.addMethod(
  40497. $core.method({
  40498. selector: "visitIRDynamicDictionary:",
  40499. protocol: "visiting",
  40500. fn: function (anIRDynamicDictionary){
  40501. var self=this,$self=this;
  40502. return $core.withContext(function($ctx1) {
  40503. return $self._visitDagNode_(anIRDynamicDictionary);
  40504. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  40505. },
  40506. args: ["anIRDynamicDictionary"],
  40507. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  40508. referencedClasses: [],
  40509. messageSends: ["visitDagNode:"]
  40510. }),
  40511. $globals.IRVisitor);
  40512. $core.addMethod(
  40513. $core.method({
  40514. selector: "visitIRInlinedClosure:",
  40515. protocol: "visiting",
  40516. fn: function (anIRInlinedClosure){
  40517. var self=this,$self=this;
  40518. return $core.withContext(function($ctx1) {
  40519. return $self._visitIRClosure_(anIRInlinedClosure);
  40520. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  40521. },
  40522. args: ["anIRInlinedClosure"],
  40523. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  40524. referencedClasses: [],
  40525. messageSends: ["visitIRClosure:"]
  40526. }),
  40527. $globals.IRVisitor);
  40528. $core.addMethod(
  40529. $core.method({
  40530. selector: "visitIRInlinedSequence:",
  40531. protocol: "visiting",
  40532. fn: function (anIRInlinedSequence){
  40533. var self=this,$self=this;
  40534. return $core.withContext(function($ctx1) {
  40535. return $self._visitIRSequence_(anIRInlinedSequence);
  40536. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  40537. },
  40538. args: ["anIRInlinedSequence"],
  40539. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  40540. referencedClasses: [],
  40541. messageSends: ["visitIRSequence:"]
  40542. }),
  40543. $globals.IRVisitor);
  40544. $core.addMethod(
  40545. $core.method({
  40546. selector: "visitIRMethod:",
  40547. protocol: "visiting",
  40548. fn: function (anIRMethod){
  40549. var self=this,$self=this;
  40550. return $core.withContext(function($ctx1) {
  40551. return $self._visitDagNode_(anIRMethod);
  40552. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  40553. },
  40554. args: ["anIRMethod"],
  40555. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  40556. referencedClasses: [],
  40557. messageSends: ["visitDagNode:"]
  40558. }),
  40559. $globals.IRVisitor);
  40560. $core.addMethod(
  40561. $core.method({
  40562. selector: "visitIRNonLocalReturn:",
  40563. protocol: "visiting",
  40564. fn: function (anIRNonLocalReturn){
  40565. var self=this,$self=this;
  40566. return $core.withContext(function($ctx1) {
  40567. return $self._visitDagNode_(anIRNonLocalReturn);
  40568. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  40569. },
  40570. args: ["anIRNonLocalReturn"],
  40571. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  40572. referencedClasses: [],
  40573. messageSends: ["visitDagNode:"]
  40574. }),
  40575. $globals.IRVisitor);
  40576. $core.addMethod(
  40577. $core.method({
  40578. selector: "visitIRNonLocalReturnHandling:",
  40579. protocol: "visiting",
  40580. fn: function (anIRNonLocalReturnHandling){
  40581. var self=this,$self=this;
  40582. return $core.withContext(function($ctx1) {
  40583. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  40584. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  40585. },
  40586. args: ["anIRNonLocalReturnHandling"],
  40587. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  40588. referencedClasses: [],
  40589. messageSends: ["visitDagNode:"]
  40590. }),
  40591. $globals.IRVisitor);
  40592. $core.addMethod(
  40593. $core.method({
  40594. selector: "visitIRReturn:",
  40595. protocol: "visiting",
  40596. fn: function (anIRReturn){
  40597. var self=this,$self=this;
  40598. return $core.withContext(function($ctx1) {
  40599. return $self._visitDagNode_(anIRReturn);
  40600. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  40601. },
  40602. args: ["anIRReturn"],
  40603. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  40604. referencedClasses: [],
  40605. messageSends: ["visitDagNode:"]
  40606. }),
  40607. $globals.IRVisitor);
  40608. $core.addMethod(
  40609. $core.method({
  40610. selector: "visitIRSend:",
  40611. protocol: "visiting",
  40612. fn: function (anIRSend){
  40613. var self=this,$self=this;
  40614. return $core.withContext(function($ctx1) {
  40615. return $self._visitDagNode_(anIRSend);
  40616. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  40617. },
  40618. args: ["anIRSend"],
  40619. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  40620. referencedClasses: [],
  40621. messageSends: ["visitDagNode:"]
  40622. }),
  40623. $globals.IRVisitor);
  40624. $core.addMethod(
  40625. $core.method({
  40626. selector: "visitIRSequence:",
  40627. protocol: "visiting",
  40628. fn: function (anIRSequence){
  40629. var self=this,$self=this;
  40630. return $core.withContext(function($ctx1) {
  40631. return $self._visitDagNode_(anIRSequence);
  40632. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  40633. },
  40634. args: ["anIRSequence"],
  40635. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  40636. referencedClasses: [],
  40637. messageSends: ["visitDagNode:"]
  40638. }),
  40639. $globals.IRVisitor);
  40640. $core.addMethod(
  40641. $core.method({
  40642. selector: "visitIRTempDeclaration:",
  40643. protocol: "visiting",
  40644. fn: function (anIRTempDeclaration){
  40645. var self=this,$self=this;
  40646. return $core.withContext(function($ctx1) {
  40647. return $self._visitDagNode_(anIRTempDeclaration);
  40648. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  40649. },
  40650. args: ["anIRTempDeclaration"],
  40651. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  40652. referencedClasses: [],
  40653. messageSends: ["visitDagNode:"]
  40654. }),
  40655. $globals.IRVisitor);
  40656. $core.addMethod(
  40657. $core.method({
  40658. selector: "visitIRValue:",
  40659. protocol: "visiting",
  40660. fn: function (anIRValue){
  40661. var self=this,$self=this;
  40662. return $core.withContext(function($ctx1) {
  40663. return $self._visitDagNode_(anIRValue);
  40664. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  40665. },
  40666. args: ["anIRValue"],
  40667. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  40668. referencedClasses: [],
  40669. messageSends: ["visitDagNode:"]
  40670. }),
  40671. $globals.IRVisitor);
  40672. $core.addMethod(
  40673. $core.method({
  40674. selector: "visitIRVariable:",
  40675. protocol: "visiting",
  40676. fn: function (anIRVariable){
  40677. var self=this,$self=this;
  40678. return $core.withContext(function($ctx1) {
  40679. return $self._visitDagNode_(anIRVariable);
  40680. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  40681. },
  40682. args: ["anIRVariable"],
  40683. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  40684. referencedClasses: [],
  40685. messageSends: ["visitDagNode:"]
  40686. }),
  40687. $globals.IRVisitor);
  40688. $core.addMethod(
  40689. $core.method({
  40690. selector: "visitIRVerbatim:",
  40691. protocol: "visiting",
  40692. fn: function (anIRVerbatim){
  40693. var self=this,$self=this;
  40694. return $core.withContext(function($ctx1) {
  40695. return $self._visitDagNode_(anIRVerbatim);
  40696. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  40697. },
  40698. args: ["anIRVerbatim"],
  40699. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  40700. referencedClasses: [],
  40701. messageSends: ["visitDagNode:"]
  40702. }),
  40703. $globals.IRVisitor);
  40704. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  40705. $core.addMethod(
  40706. $core.method({
  40707. selector: "contents",
  40708. protocol: "accessing",
  40709. fn: function (){
  40710. var self=this,$self=this;
  40711. return $core.withContext(function($ctx1) {
  40712. return $recv($self._stream())._contents();
  40713. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  40714. },
  40715. args: [],
  40716. source: "contents\x0a\x09^ self stream contents",
  40717. referencedClasses: [],
  40718. messageSends: ["contents", "stream"]
  40719. }),
  40720. $globals.IRJSTranslator);
  40721. $core.addMethod(
  40722. $core.method({
  40723. selector: "currentClass",
  40724. protocol: "accessing",
  40725. fn: function (){
  40726. var self=this,$self=this;
  40727. return $self["@currentClass"];
  40728. },
  40729. args: [],
  40730. source: "currentClass\x0a\x09^ currentClass",
  40731. referencedClasses: [],
  40732. messageSends: []
  40733. }),
  40734. $globals.IRJSTranslator);
  40735. $core.addMethod(
  40736. $core.method({
  40737. selector: "currentClass:",
  40738. protocol: "accessing",
  40739. fn: function (aClass){
  40740. var self=this,$self=this;
  40741. $self["@currentClass"]=aClass;
  40742. return self;
  40743. },
  40744. args: ["aClass"],
  40745. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  40746. referencedClasses: [],
  40747. messageSends: []
  40748. }),
  40749. $globals.IRJSTranslator);
  40750. $core.addMethod(
  40751. $core.method({
  40752. selector: "initialize",
  40753. protocol: "initialization",
  40754. fn: function (){
  40755. var self=this,$self=this;
  40756. return $core.withContext(function($ctx1) {
  40757. (
  40758. $ctx1.supercall = true,
  40759. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  40760. $ctx1.supercall = false;
  40761. $self["@stream"]=$recv($globals.JSStream)._new();
  40762. return self;
  40763. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  40764. },
  40765. args: [],
  40766. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  40767. referencedClasses: ["JSStream"],
  40768. messageSends: ["initialize", "new"]
  40769. }),
  40770. $globals.IRJSTranslator);
  40771. $core.addMethod(
  40772. $core.method({
  40773. selector: "stream",
  40774. protocol: "accessing",
  40775. fn: function (){
  40776. var self=this,$self=this;
  40777. return $self["@stream"];
  40778. },
  40779. args: [],
  40780. source: "stream\x0a\x09^ stream",
  40781. referencedClasses: [],
  40782. messageSends: []
  40783. }),
  40784. $globals.IRJSTranslator);
  40785. $core.addMethod(
  40786. $core.method({
  40787. selector: "stream:",
  40788. protocol: "accessing",
  40789. fn: function (aStream){
  40790. var self=this,$self=this;
  40791. $self["@stream"]=aStream;
  40792. return self;
  40793. },
  40794. args: ["aStream"],
  40795. source: "stream: aStream\x0a\x09stream := aStream",
  40796. referencedClasses: [],
  40797. messageSends: []
  40798. }),
  40799. $globals.IRJSTranslator);
  40800. $core.addMethod(
  40801. $core.method({
  40802. selector: "visitIRAssignment:",
  40803. protocol: "visiting",
  40804. fn: function (anIRAssignment){
  40805. var self=this,$self=this;
  40806. return $core.withContext(function($ctx1) {
  40807. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  40808. return $core.withContext(function($ctx2) {
  40809. return $self._visit_($recv(anIRAssignment)._left());
  40810. $ctx2.sendIdx["visit:"]=1;
  40811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40812. }),(function(){
  40813. return $core.withContext(function($ctx2) {
  40814. return $self._visit_($recv(anIRAssignment)._right());
  40815. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40816. }));
  40817. return self;
  40818. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  40819. },
  40820. args: ["anIRAssignment"],
  40821. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  40822. referencedClasses: [],
  40823. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  40824. }),
  40825. $globals.IRJSTranslator);
  40826. $core.addMethod(
  40827. $core.method({
  40828. selector: "visitIRClosure:",
  40829. protocol: "visiting",
  40830. fn: function (anIRClosure){
  40831. var self=this,$self=this;
  40832. return $core.withContext(function($ctx1) {
  40833. var $1,$2;
  40834. $1=$self._stream();
  40835. $ctx1.sendIdx["stream"]=1;
  40836. $recv($1)._nextPutClosureWith_arguments_((function(){
  40837. return $core.withContext(function($ctx2) {
  40838. $2=$self._stream();
  40839. $ctx2.sendIdx["stream"]=2;
  40840. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  40841. return $core.withContext(function($ctx3) {
  40842. return $recv($recv(each)._name())._asVariableName();
  40843. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  40844. })));
  40845. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  40846. return $core.withContext(function($ctx3) {
  40847. return (
  40848. $ctx3.supercall = true,
  40849. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($self, [anIRClosure]));
  40850. $ctx3.supercall = false;
  40851. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  40852. }));
  40853. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40854. }),$recv(anIRClosure)._arguments());
  40855. return self;
  40856. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  40857. },
  40858. args: ["anIRClosure"],
  40859. 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",
  40860. referencedClasses: [],
  40861. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  40862. }),
  40863. $globals.IRJSTranslator);
  40864. $core.addMethod(
  40865. $core.method({
  40866. selector: "visitIRDynamicArray:",
  40867. protocol: "visiting",
  40868. fn: function (anIRDynamicArray){
  40869. var self=this,$self=this;
  40870. return $core.withContext(function($ctx1) {
  40871. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  40872. return self;
  40873. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  40874. },
  40875. args: ["anIRDynamicArray"],
  40876. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  40877. referencedClasses: [],
  40878. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  40879. }),
  40880. $globals.IRJSTranslator);
  40881. $core.addMethod(
  40882. $core.method({
  40883. selector: "visitIRDynamicDictionary:",
  40884. protocol: "visiting",
  40885. fn: function (anIRDynamicDictionary){
  40886. var self=this,$self=this;
  40887. return $core.withContext(function($ctx1) {
  40888. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  40889. return self;
  40890. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  40891. },
  40892. args: ["anIRDynamicDictionary"],
  40893. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  40894. referencedClasses: [],
  40895. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  40896. }),
  40897. $globals.IRJSTranslator);
  40898. $core.addMethod(
  40899. $core.method({
  40900. selector: "visitIRMethod:",
  40901. protocol: "visiting",
  40902. fn: function (anIRMethod){
  40903. var self=this,$self=this;
  40904. return $core.withContext(function($ctx1) {
  40905. var $1,$2,$3,$4,$5,$6,$7;
  40906. $1=$self._stream();
  40907. $ctx1.sendIdx["stream"]=1;
  40908. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  40909. return $core.withContext(function($ctx2) {
  40910. $2=$self._stream();
  40911. $ctx2.sendIdx["stream"]=2;
  40912. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  40913. return $core.withContext(function($ctx3) {
  40914. $3=$self._stream();
  40915. $ctx3.sendIdx["stream"]=3;
  40916. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  40917. return $core.withContext(function($ctx4) {
  40918. return $recv($recv(each)._name())._asVariableName();
  40919. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  40920. }));
  40921. $ctx3.sendIdx["collect:"]=1;
  40922. $recv($3)._nextPutVars_($4);
  40923. $ctx3.sendIdx["nextPutVars:"]=1;
  40924. $5=$self._stream();
  40925. $ctx3.sendIdx["stream"]=4;
  40926. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  40927. return $core.withContext(function($ctx4) {
  40928. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  40929. return $core.withContext(function($ctx5) {
  40930. $6=$self._stream();
  40931. $ctx5.sendIdx["stream"]=5;
  40932. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  40933. return $core.withContext(function($ctx6) {
  40934. return $recv($recv(each)._variable())._alias();
  40935. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  40936. })));
  40937. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  40938. }));
  40939. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  40940. if($core.assert($7)){
  40941. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  40942. return $core.withContext(function($ctx5) {
  40943. return (
  40944. $ctx5.supercall = true,
  40945. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  40946. $ctx5.supercall = false;
  40947. $ctx5.sendIdx["visitIRMethod:"]=1;
  40948. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  40949. }));
  40950. } else {
  40951. return (
  40952. $ctx4.supercall = true,
  40953. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  40954. $ctx4.supercall = false;
  40955. }
  40956. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  40957. }));
  40958. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40959. }),$recv(anIRMethod)._arguments());
  40960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40961. }));
  40962. return $self._contents();
  40963. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  40964. },
  40965. args: ["anIRMethod"],
  40966. 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",
  40967. referencedClasses: [],
  40968. 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"]
  40969. }),
  40970. $globals.IRJSTranslator);
  40971. $core.addMethod(
  40972. $core.method({
  40973. selector: "visitIRNonLocalReturn:",
  40974. protocol: "visiting",
  40975. fn: function (anIRNonLocalReturn){
  40976. var self=this,$self=this;
  40977. return $core.withContext(function($ctx1) {
  40978. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  40979. return $core.withContext(function($ctx2) {
  40980. return (
  40981. $ctx2.supercall = true,
  40982. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  40983. $ctx2.supercall = false;
  40984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40985. }));
  40986. return self;
  40987. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  40988. },
  40989. args: ["anIRNonLocalReturn"],
  40990. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  40991. referencedClasses: [],
  40992. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  40993. }),
  40994. $globals.IRJSTranslator);
  40995. $core.addMethod(
  40996. $core.method({
  40997. selector: "visitIRReturn:",
  40998. protocol: "visiting",
  40999. fn: function (anIRReturn){
  41000. var self=this,$self=this;
  41001. return $core.withContext(function($ctx1) {
  41002. $recv($self._stream())._nextPutReturnWith_((function(){
  41003. return $core.withContext(function($ctx2) {
  41004. return (
  41005. $ctx2.supercall = true,
  41006. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  41007. $ctx2.supercall = false;
  41008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41009. }));
  41010. return self;
  41011. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  41012. },
  41013. args: ["anIRReturn"],
  41014. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  41015. referencedClasses: [],
  41016. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  41017. }),
  41018. $globals.IRJSTranslator);
  41019. $core.addMethod(
  41020. $core.method({
  41021. selector: "visitIRSend:",
  41022. protocol: "visiting",
  41023. fn: function (anIRSend){
  41024. var self=this,$self=this;
  41025. var sends,superclass;
  41026. return $core.withContext(function($ctx1) {
  41027. var $1,$2;
  41028. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  41029. $1=$recv($recv(anIRSend)._receiver())._isSuper();
  41030. if($core.assert($1)){
  41031. $self._visitSuperSend_(anIRSend);
  41032. } else {
  41033. $self._visitSend_(anIRSend);
  41034. }
  41035. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  41036. if($core.assert($2)){
  41037. $recv($self._stream())._nextPutSendIndexFor_(anIRSend);
  41038. }
  41039. return self;
  41040. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  41041. },
  41042. args: ["anIRSend"],
  41043. 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 ]",
  41044. referencedClasses: [],
  41045. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuper", "receiver", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  41046. }),
  41047. $globals.IRJSTranslator);
  41048. $core.addMethod(
  41049. $core.method({
  41050. selector: "visitIRSequence:",
  41051. protocol: "visiting",
  41052. fn: function (anIRSequence){
  41053. var self=this,$self=this;
  41054. return $core.withContext(function($ctx1) {
  41055. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  41056. return $core.withContext(function($ctx2) {
  41057. return $recv($self._stream())._nextPutStatementWith_((function(){
  41058. return $core.withContext(function($ctx3) {
  41059. return $self._visit_(each);
  41060. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41061. }));
  41062. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41063. }));
  41064. return self;
  41065. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  41066. },
  41067. args: ["anIRSequence"],
  41068. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  41069. referencedClasses: [],
  41070. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  41071. }),
  41072. $globals.IRJSTranslator);
  41073. $core.addMethod(
  41074. $core.method({
  41075. selector: "visitIRTempDeclaration:",
  41076. protocol: "visiting",
  41077. fn: function (anIRTempDeclaration){
  41078. var self=this,$self=this;
  41079. return self;
  41080. },
  41081. args: ["anIRTempDeclaration"],
  41082. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  41083. referencedClasses: [],
  41084. messageSends: []
  41085. }),
  41086. $globals.IRJSTranslator);
  41087. $core.addMethod(
  41088. $core.method({
  41089. selector: "visitIRValue:",
  41090. protocol: "visiting",
  41091. fn: function (anIRValue){
  41092. var self=this,$self=this;
  41093. return $core.withContext(function($ctx1) {
  41094. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  41095. return self;
  41096. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  41097. },
  41098. args: ["anIRValue"],
  41099. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  41100. referencedClasses: [],
  41101. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  41102. }),
  41103. $globals.IRJSTranslator);
  41104. $core.addMethod(
  41105. $core.method({
  41106. selector: "visitIRVariable:",
  41107. protocol: "visiting",
  41108. fn: function (anIRVariable){
  41109. var self=this,$self=this;
  41110. return $core.withContext(function($ctx1) {
  41111. var $3,$2,$1,$4;
  41112. $3=$recv(anIRVariable)._variable();
  41113. $ctx1.sendIdx["variable"]=1;
  41114. $2=$recv($3)._name();
  41115. $1=$recv($2).__eq("thisContext");
  41116. if($core.assert($1)){
  41117. $4=$self._stream();
  41118. $ctx1.sendIdx["stream"]=1;
  41119. $recv($4)._nextPutAll_("$core.getThisContext()");
  41120. $ctx1.sendIdx["nextPutAll:"]=1;
  41121. } else {
  41122. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  41123. }
  41124. return self;
  41125. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  41126. },
  41127. args: ["anIRVariable"],
  41128. 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 ]",
  41129. referencedClasses: [],
  41130. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  41131. }),
  41132. $globals.IRJSTranslator);
  41133. $core.addMethod(
  41134. $core.method({
  41135. selector: "visitIRVerbatim:",
  41136. protocol: "visiting",
  41137. fn: function (anIRVerbatim){
  41138. var self=this,$self=this;
  41139. return $core.withContext(function($ctx1) {
  41140. var $1;
  41141. $1=$self._stream();
  41142. $ctx1.sendIdx["stream"]=1;
  41143. $recv($1)._nextPutStatementWith_((function(){
  41144. return $core.withContext(function($ctx2) {
  41145. return $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  41146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41147. }));
  41148. return self;
  41149. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  41150. },
  41151. args: ["anIRVerbatim"],
  41152. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  41153. referencedClasses: [],
  41154. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  41155. }),
  41156. $globals.IRJSTranslator);
  41157. $core.addMethod(
  41158. $core.method({
  41159. selector: "visitInstructionList:enclosedBetween:and:",
  41160. protocol: "visiting",
  41161. fn: function (anArray,aString,anotherString){
  41162. var self=this,$self=this;
  41163. return $core.withContext(function($ctx1) {
  41164. var $1;
  41165. $1=$self._stream();
  41166. $ctx1.sendIdx["stream"]=1;
  41167. $recv($1)._nextPutAll_(aString);
  41168. $ctx1.sendIdx["nextPutAll:"]=1;
  41169. $recv(anArray)._do_separatedBy_((function(each){
  41170. return $core.withContext(function($ctx2) {
  41171. return $self._visit_(each);
  41172. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41173. }),(function(){
  41174. return $core.withContext(function($ctx2) {
  41175. return $recv($self._stream())._nextPutAll_(",");
  41176. $ctx2.sendIdx["nextPutAll:"]=2;
  41177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41178. }));
  41179. $recv($self["@stream"])._nextPutAll_(anotherString);
  41180. return self;
  41181. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  41182. },
  41183. args: ["anArray", "aString", "anotherString"],
  41184. 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",
  41185. referencedClasses: [],
  41186. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  41187. }),
  41188. $globals.IRJSTranslator);
  41189. $core.addMethod(
  41190. $core.method({
  41191. selector: "visitReceiver:",
  41192. protocol: "visiting",
  41193. fn: function (anIRInstruction){
  41194. var self=this,$self=this;
  41195. var instr;
  41196. return $core.withContext(function($ctx1) {
  41197. var $1,$2,$4,$5,$3,$6,$7,$8;
  41198. $1=$recv(anIRInstruction)._isSelf();
  41199. if($core.assert($1)){
  41200. $2=$recv(anIRInstruction)._copy();
  41201. $ctx1.sendIdx["copy"]=1;
  41202. $4=$recv($recv(anIRInstruction)._variable())._copy();
  41203. $recv($4)._name_("$self");
  41204. $5=$recv($4)._yourself();
  41205. $ctx1.sendIdx["yourself"]=1;
  41206. $3=$5;
  41207. $recv($2)._variable_($3);
  41208. instr=$recv($2)._yourself();
  41209. instr;
  41210. } else {
  41211. instr=anIRInstruction;
  41212. instr;
  41213. }
  41214. $6=$recv(instr)._needsBoxingAsReceiver();
  41215. if(!$core.assert($6)){
  41216. $7=$self._visit_(instr);
  41217. $ctx1.sendIdx["visit:"]=1;
  41218. return $7;
  41219. }
  41220. $8=$self._stream();
  41221. $ctx1.sendIdx["stream"]=1;
  41222. $recv($8)._nextPutAll_("$recv(");
  41223. $ctx1.sendIdx["nextPutAll:"]=1;
  41224. $self._visit_(instr);
  41225. $recv($self._stream())._nextPutAll_(")");
  41226. return self;
  41227. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction,instr:instr},$globals.IRJSTranslator)});
  41228. },
  41229. args: ["anIRInstruction"],
  41230. 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: ')'",
  41231. referencedClasses: [],
  41232. messageSends: ["ifTrue:ifFalse:", "isSelf", "variable:", "copy", "name:", "variable", "yourself", "ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  41233. }),
  41234. $globals.IRJSTranslator);
  41235. $core.addMethod(
  41236. $core.method({
  41237. selector: "visitSend:",
  41238. protocol: "visiting",
  41239. fn: function (anIRSend){
  41240. var self=this,$self=this;
  41241. return $core.withContext(function($ctx1) {
  41242. $self._visitReceiver_($recv(anIRSend)._receiver());
  41243. $recv($self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  41244. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  41245. return self;
  41246. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41247. },
  41248. args: ["anIRSend"],
  41249. 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: ')'",
  41250. referencedClasses: [],
  41251. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41252. }),
  41253. $globals.IRJSTranslator);
  41254. $core.addMethod(
  41255. $core.method({
  41256. selector: "visitSuperSend:",
  41257. protocol: "visiting",
  41258. fn: function (anIRSend){
  41259. var self=this,$self=this;
  41260. return $core.withContext(function($ctx1) {
  41261. var $1,$4,$3,$2,$5,$6,$7,$8;
  41262. $1=$self._stream();
  41263. $ctx1.sendIdx["stream"]=1;
  41264. $recv($1)._nextPutAll_("(");
  41265. $ctx1.sendIdx["nextPutAll:"]=1;
  41266. $recv($1)._lf();
  41267. $ctx1.sendIdx["lf"]=1;
  41268. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41269. $ctx1.sendIdx["nextPutAll:"]=2;
  41270. $recv($1)._lf();
  41271. $ctx1.sendIdx["lf"]=2;
  41272. $4=$recv(anIRSend)._scope();
  41273. $ctx1.sendIdx["scope"]=1;
  41274. $3=$recv($4)._alias();
  41275. $ctx1.sendIdx["alias"]=1;
  41276. $2=$recv($3).__comma(".supercall = true,");
  41277. $ctx1.sendIdx[","]=1;
  41278. $recv($1)._nextPutAll_($2);
  41279. $ctx1.sendIdx["nextPutAll:"]=3;
  41280. $recv($1)._lf();
  41281. $ctx1.sendIdx["lf"]=3;
  41282. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41283. $ctx1.sendIdx["nextPutAll:"]=4;
  41284. $recv($1)._lf();
  41285. $ctx1.sendIdx["lf"]=4;
  41286. $5="(".__comma($recv($self._currentClass())._asJavaScriptSource());
  41287. $ctx1.sendIdx[","]=2;
  41288. $recv($1)._nextPutAll_($5);
  41289. $ctx1.sendIdx["nextPutAll:"]=5;
  41290. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  41291. $ctx1.sendIdx["nextPutAll:"]=6;
  41292. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  41293. $ctx1.sendIdx[","]=3;
  41294. $recv($1)._nextPutAll_($6);
  41295. $ctx1.sendIdx["nextPutAll:"]=7;
  41296. $7=$recv($1)._nextPutAll_("$self, ");
  41297. $ctx1.sendIdx["nextPutAll:"]=8;
  41298. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  41299. $8=$self._stream();
  41300. $recv($8)._nextPutAll_("));");
  41301. $ctx1.sendIdx["nextPutAll:"]=9;
  41302. $recv($8)._lf();
  41303. $ctx1.sendIdx["lf"]=5;
  41304. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41305. $ctx1.sendIdx["nextPutAll:"]=10;
  41306. $recv($8)._lf();
  41307. $ctx1.sendIdx["lf"]=6;
  41308. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  41309. $ctx1.sendIdx["nextPutAll:"]=11;
  41310. $recv($8)._lf();
  41311. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41312. return self;
  41313. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41314. },
  41315. args: ["anIRSend"],
  41316. 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);'",
  41317. referencedClasses: [],
  41318. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41319. }),
  41320. $globals.IRJSTranslator);
  41321. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  41322. $core.addMethod(
  41323. $core.method({
  41324. selector: "contents",
  41325. protocol: "accessing",
  41326. fn: function (){
  41327. var self=this,$self=this;
  41328. return $core.withContext(function($ctx1) {
  41329. return $recv($self["@stream"])._contents();
  41330. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  41331. },
  41332. args: [],
  41333. source: "contents\x0a\x09^ stream contents",
  41334. referencedClasses: [],
  41335. messageSends: ["contents"]
  41336. }),
  41337. $globals.JSStream);
  41338. $core.addMethod(
  41339. $core.method({
  41340. selector: "initialize",
  41341. protocol: "initialization",
  41342. fn: function (){
  41343. var self=this,$self=this;
  41344. return $core.withContext(function($ctx1) {
  41345. (
  41346. $ctx1.supercall = true,
  41347. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41348. $ctx1.supercall = false;
  41349. $self["@stream"]=""._writeStream();
  41350. return self;
  41351. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  41352. },
  41353. args: [],
  41354. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  41355. referencedClasses: [],
  41356. messageSends: ["initialize", "writeStream"]
  41357. }),
  41358. $globals.JSStream);
  41359. $core.addMethod(
  41360. $core.method({
  41361. selector: "lf",
  41362. protocol: "streaming",
  41363. fn: function (){
  41364. var self=this,$self=this;
  41365. return $core.withContext(function($ctx1) {
  41366. $recv($self["@stream"])._lf();
  41367. return self;
  41368. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  41369. },
  41370. args: [],
  41371. source: "lf\x0a\x09stream lf",
  41372. referencedClasses: [],
  41373. messageSends: ["lf"]
  41374. }),
  41375. $globals.JSStream);
  41376. $core.addMethod(
  41377. $core.method({
  41378. selector: "nextPut:",
  41379. protocol: "streaming",
  41380. fn: function (aString){
  41381. var self=this,$self=this;
  41382. return $core.withContext(function($ctx1) {
  41383. $recv($self["@stream"])._nextPut_(aString);
  41384. return self;
  41385. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  41386. },
  41387. args: ["aString"],
  41388. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  41389. referencedClasses: [],
  41390. messageSends: ["nextPut:"]
  41391. }),
  41392. $globals.JSStream);
  41393. $core.addMethod(
  41394. $core.method({
  41395. selector: "nextPutAll:",
  41396. protocol: "streaming",
  41397. fn: function (aString){
  41398. var self=this,$self=this;
  41399. return $core.withContext(function($ctx1) {
  41400. $recv($self["@stream"])._nextPutAll_(aString);
  41401. return self;
  41402. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  41403. },
  41404. args: ["aString"],
  41405. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  41406. referencedClasses: [],
  41407. messageSends: ["nextPutAll:"]
  41408. }),
  41409. $globals.JSStream);
  41410. $core.addMethod(
  41411. $core.method({
  41412. selector: "nextPutAssignLhs:rhs:",
  41413. protocol: "streaming",
  41414. fn: function (aBlock,anotherBlock){
  41415. var self=this,$self=this;
  41416. return $core.withContext(function($ctx1) {
  41417. $recv(aBlock)._value();
  41418. $ctx1.sendIdx["value"]=1;
  41419. $recv($self["@stream"])._nextPutAll_("=");
  41420. $recv(anotherBlock)._value();
  41421. return self;
  41422. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  41423. },
  41424. args: ["aBlock", "anotherBlock"],
  41425. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  41426. referencedClasses: [],
  41427. messageSends: ["value", "nextPutAll:"]
  41428. }),
  41429. $globals.JSStream);
  41430. $core.addMethod(
  41431. $core.method({
  41432. selector: "nextPutBlockContextFor:during:",
  41433. protocol: "streaming",
  41434. fn: function (anIRClosure,aBlock){
  41435. var self=this,$self=this;
  41436. return $core.withContext(function($ctx1) {
  41437. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  41438. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  41439. if(!$core.assert($1)){
  41440. $2=$recv(aBlock)._value();
  41441. $ctx1.sendIdx["value"]=1;
  41442. return $2;
  41443. }
  41444. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41445. $ctx1.sendIdx["nextPutAll:"]=1;
  41446. $self._lf();
  41447. $ctx1.sendIdx["lf"]=1;
  41448. $6=$recv(anIRClosure)._scope();
  41449. $ctx1.sendIdx["scope"]=1;
  41450. $5=$recv($6)._alias();
  41451. $ctx1.sendIdx["alias"]=1;
  41452. $4="return $core.withContext(function(".__comma($5);
  41453. $ctx1.sendIdx[","]=2;
  41454. $3=$recv($4).__comma(") {");
  41455. $ctx1.sendIdx[","]=1;
  41456. $self._nextPutAll_($3);
  41457. $ctx1.sendIdx["nextPutAll:"]=2;
  41458. $self._lf();
  41459. $ctx1.sendIdx["lf"]=2;
  41460. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41461. $ctx1.sendIdx["nextPutAll:"]=3;
  41462. $7=$self._lf();
  41463. $ctx1.sendIdx["lf"]=3;
  41464. $recv(aBlock)._value();
  41465. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41466. $ctx1.sendIdx["nextPutAll:"]=4;
  41467. $self._lf();
  41468. $ctx1.sendIdx["lf"]=4;
  41469. $11=$recv(anIRClosure)._scope();
  41470. $ctx1.sendIdx["scope"]=2;
  41471. $10=$recv($11)._alias();
  41472. $ctx1.sendIdx["alias"]=2;
  41473. $9="}, function(".__comma($10);
  41474. $ctx1.sendIdx[","]=4;
  41475. $8=$recv($9).__comma(") {");
  41476. $ctx1.sendIdx[","]=3;
  41477. $self._nextPutAll_($8);
  41478. $ctx1.sendIdx["nextPutAll:"]=5;
  41479. $15=$recv(anIRClosure)._scope();
  41480. $ctx1.sendIdx["scope"]=3;
  41481. $14=$recv($15)._alias();
  41482. $ctx1.sendIdx["alias"]=3;
  41483. $13=$recv($14).__comma(".fillBlock({");
  41484. $ctx1.sendIdx[","]=5;
  41485. $12=$self._nextPutAll_($13);
  41486. $ctx1.sendIdx["nextPutAll:"]=6;
  41487. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  41488. return $core.withContext(function($ctx2) {
  41489. $16=$recv(each)._asVariableName();
  41490. $ctx2.sendIdx["asVariableName"]=1;
  41491. $self._nextPutAll_($16);
  41492. $ctx2.sendIdx["nextPutAll:"]=7;
  41493. $self._nextPutAll_(":");
  41494. $ctx2.sendIdx["nextPutAll:"]=8;
  41495. $17=$self._nextPutAll_($recv(each)._asVariableName());
  41496. $ctx2.sendIdx["nextPutAll:"]=9;
  41497. return $17;
  41498. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41499. }),(function(){
  41500. return $core.withContext(function($ctx2) {
  41501. return $self._nextPutAll_(",");
  41502. $ctx2.sendIdx["nextPutAll:"]=10;
  41503. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41504. }));
  41505. $self._nextPutAll_("},");
  41506. $ctx1.sendIdx["nextPutAll:"]=11;
  41507. $23=$recv(anIRClosure)._scope();
  41508. $ctx1.sendIdx["scope"]=4;
  41509. $22=$recv($23)._outerScope();
  41510. $21=$recv($22)._alias();
  41511. $20=$recv($21).__comma(",");
  41512. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  41513. $ctx1.sendIdx[","]=7;
  41514. $18=$recv($19).__comma(")});");
  41515. $ctx1.sendIdx[","]=6;
  41516. $self._nextPutAll_($18);
  41517. $ctx1.sendIdx["nextPutAll:"]=12;
  41518. $self._lf();
  41519. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41520. return self;
  41521. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  41522. },
  41523. args: ["anIRClosure", "aBlock"],
  41524. 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);'",
  41525. referencedClasses: [],
  41526. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  41527. }),
  41528. $globals.JSStream);
  41529. $core.addMethod(
  41530. $core.method({
  41531. selector: "nextPutClosureWith:arguments:",
  41532. protocol: "streaming",
  41533. fn: function (aBlock,anArray){
  41534. var self=this,$self=this;
  41535. return $core.withContext(function($ctx1) {
  41536. var $1,$2,$3;
  41537. $recv($self["@stream"])._nextPutAll_("(function(");
  41538. $ctx1.sendIdx["nextPutAll:"]=1;
  41539. $recv(anArray)._do_separatedBy_((function(each){
  41540. return $core.withContext(function($ctx2) {
  41541. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  41542. $ctx2.sendIdx["nextPutAll:"]=2;
  41543. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41544. }),(function(){
  41545. return $core.withContext(function($ctx2) {
  41546. return $recv($self["@stream"])._nextPut_(",");
  41547. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41548. }));
  41549. $1=$self["@stream"];
  41550. $recv($1)._nextPutAll_("){");
  41551. $ctx1.sendIdx["nextPutAll:"]=3;
  41552. $2=$recv($1)._lf();
  41553. $ctx1.sendIdx["lf"]=1;
  41554. $recv(aBlock)._value();
  41555. $3=$self["@stream"];
  41556. $recv($3)._lf();
  41557. $recv($3)._nextPutAll_("})");
  41558. return self;
  41559. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  41560. },
  41561. args: ["aBlock", "anArray"],
  41562. 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: '})'",
  41563. referencedClasses: [],
  41564. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  41565. }),
  41566. $globals.JSStream);
  41567. $core.addMethod(
  41568. $core.method({
  41569. selector: "nextPutContextFor:during:",
  41570. protocol: "streaming",
  41571. fn: function (aMethod,aBlock){
  41572. var self=this,$self=this;
  41573. return $core.withContext(function($ctx1) {
  41574. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  41575. $1=$recv(aMethod)._requiresSmalltalkContext();
  41576. if(!$core.assert($1)){
  41577. $2=$recv(aBlock)._value();
  41578. $ctx1.sendIdx["value"]=1;
  41579. return $2;
  41580. }
  41581. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41582. $ctx1.sendIdx["nextPutAll:"]=1;
  41583. $self._lf();
  41584. $ctx1.sendIdx["lf"]=1;
  41585. $6=$recv(aMethod)._scope();
  41586. $ctx1.sendIdx["scope"]=1;
  41587. $5=$recv($6)._alias();
  41588. $ctx1.sendIdx["alias"]=1;
  41589. $4="return $core.withContext(function(".__comma($5);
  41590. $ctx1.sendIdx[","]=2;
  41591. $3=$recv($4).__comma(") {");
  41592. $ctx1.sendIdx[","]=1;
  41593. $self._nextPutAll_($3);
  41594. $ctx1.sendIdx["nextPutAll:"]=2;
  41595. $self._lf();
  41596. $ctx1.sendIdx["lf"]=2;
  41597. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41598. $ctx1.sendIdx["nextPutAll:"]=3;
  41599. $7=$self._lf();
  41600. $ctx1.sendIdx["lf"]=3;
  41601. $recv(aBlock)._value();
  41602. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41603. $ctx1.sendIdx["nextPutAll:"]=4;
  41604. $self._lf();
  41605. $ctx1.sendIdx["lf"]=4;
  41606. $12=$recv(aMethod)._scope();
  41607. $ctx1.sendIdx["scope"]=2;
  41608. $11=$recv($12)._alias();
  41609. $ctx1.sendIdx["alias"]=2;
  41610. $10="}, function(".__comma($11);
  41611. $ctx1.sendIdx[","]=5;
  41612. $9=$recv($10).__comma(") {");
  41613. $ctx1.sendIdx[","]=4;
  41614. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  41615. $ctx1.sendIdx[","]=3;
  41616. $self._nextPutAll_($8);
  41617. $ctx1.sendIdx["nextPutAll:"]=5;
  41618. $16=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  41619. $ctx1.sendIdx["asJavaScriptSource"]=1;
  41620. $15=".fill(self,".__comma($16);
  41621. $14=$recv($15).__comma(",{");
  41622. $ctx1.sendIdx[","]=6;
  41623. $13=$self._nextPutAll_($14);
  41624. $ctx1.sendIdx["nextPutAll:"]=6;
  41625. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  41626. return $core.withContext(function($ctx2) {
  41627. $17=$recv(each)._asVariableName();
  41628. $ctx2.sendIdx["asVariableName"]=1;
  41629. $self._nextPutAll_($17);
  41630. $ctx2.sendIdx["nextPutAll:"]=7;
  41631. $self._nextPutAll_(":");
  41632. $ctx2.sendIdx["nextPutAll:"]=8;
  41633. $18=$self._nextPutAll_($recv(each)._asVariableName());
  41634. $ctx2.sendIdx["nextPutAll:"]=9;
  41635. return $18;
  41636. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41637. }),(function(){
  41638. return $core.withContext(function($ctx2) {
  41639. return $self._nextPutAll_(",");
  41640. $ctx2.sendIdx["nextPutAll:"]=10;
  41641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41642. }));
  41643. $self._nextPutAll_("},");
  41644. $ctx1.sendIdx["nextPutAll:"]=11;
  41645. $self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavaScriptSource());
  41646. $ctx1.sendIdx["nextPutAll:"]=12;
  41647. $self._nextPutAll_(")});");
  41648. $ctx1.sendIdx["nextPutAll:"]=13;
  41649. $self._lf();
  41650. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41651. return self;
  41652. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  41653. },
  41654. args: ["aMethod", "aBlock"],
  41655. 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);'",
  41656. referencedClasses: [],
  41657. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  41658. }),
  41659. $globals.JSStream);
  41660. $core.addMethod(
  41661. $core.method({
  41662. selector: "nextPutFunctionWith:arguments:",
  41663. protocol: "streaming",
  41664. fn: function (aBlock,anArray){
  41665. var self=this,$self=this;
  41666. return $core.withContext(function($ctx1) {
  41667. var $1,$2,$3,$4,$5;
  41668. $recv($self["@stream"])._nextPutAll_("fn: function(");
  41669. $ctx1.sendIdx["nextPutAll:"]=1;
  41670. $recv(anArray)._do_separatedBy_((function(each){
  41671. return $core.withContext(function($ctx2) {
  41672. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  41673. $ctx2.sendIdx["nextPutAll:"]=2;
  41674. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41675. }),(function(){
  41676. return $core.withContext(function($ctx2) {
  41677. return $recv($self["@stream"])._nextPut_(",");
  41678. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41679. }));
  41680. $1=$self["@stream"];
  41681. $recv($1)._nextPutAll_("){");
  41682. $ctx1.sendIdx["nextPutAll:"]=3;
  41683. $2=$recv($1)._lf();
  41684. $ctx1.sendIdx["lf"]=1;
  41685. $3=$self["@stream"];
  41686. $recv($3)._nextPutAll_("var self=this,$self=this;");
  41687. $ctx1.sendIdx["nextPutAll:"]=4;
  41688. $4=$recv($3)._lf();
  41689. $ctx1.sendIdx["lf"]=2;
  41690. $recv(aBlock)._value();
  41691. $5=$self["@stream"];
  41692. $recv($5)._lf();
  41693. $recv($5)._nextPutAll_("}");
  41694. return self;
  41695. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  41696. },
  41697. args: ["aBlock", "anArray"],
  41698. 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: '}'",
  41699. referencedClasses: [],
  41700. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  41701. }),
  41702. $globals.JSStream);
  41703. $core.addMethod(
  41704. $core.method({
  41705. selector: "nextPutIf:then:",
  41706. protocol: "streaming",
  41707. fn: function (aBlock,anotherBlock){
  41708. var self=this,$self=this;
  41709. return $core.withContext(function($ctx1) {
  41710. var $1;
  41711. $recv($self["@stream"])._nextPutAll_("if(");
  41712. $ctx1.sendIdx["nextPutAll:"]=1;
  41713. $recv(aBlock)._value();
  41714. $ctx1.sendIdx["value"]=1;
  41715. $1=$self["@stream"];
  41716. $recv($1)._nextPutAll_("){");
  41717. $ctx1.sendIdx["nextPutAll:"]=2;
  41718. $recv($1)._lf();
  41719. $recv(anotherBlock)._value();
  41720. $recv($self["@stream"])._nextPutAll_("}");
  41721. $self._omitSemicolon_(true);
  41722. return self;
  41723. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  41724. },
  41725. args: ["aBlock", "anotherBlock"],
  41726. 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",
  41727. referencedClasses: [],
  41728. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  41729. }),
  41730. $globals.JSStream);
  41731. $core.addMethod(
  41732. $core.method({
  41733. selector: "nextPutIf:then:else:",
  41734. protocol: "streaming",
  41735. fn: function (aBlock,ifBlock,elseBlock){
  41736. var self=this,$self=this;
  41737. return $core.withContext(function($ctx1) {
  41738. var $1,$2,$3;
  41739. $recv($self["@stream"])._nextPutAll_("if(");
  41740. $ctx1.sendIdx["nextPutAll:"]=1;
  41741. $recv(aBlock)._value();
  41742. $ctx1.sendIdx["value"]=1;
  41743. $1=$self["@stream"];
  41744. $recv($1)._nextPutAll_("){");
  41745. $ctx1.sendIdx["nextPutAll:"]=2;
  41746. $2=$recv($1)._lf();
  41747. $ctx1.sendIdx["lf"]=1;
  41748. $recv(ifBlock)._value();
  41749. $ctx1.sendIdx["value"]=2;
  41750. $3=$self["@stream"];
  41751. $recv($3)._nextPutAll_("} else {");
  41752. $ctx1.sendIdx["nextPutAll:"]=3;
  41753. $recv($3)._lf();
  41754. $recv(elseBlock)._value();
  41755. $recv($self["@stream"])._nextPutAll_("}");
  41756. $self._omitSemicolon_(true);
  41757. return self;
  41758. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  41759. },
  41760. args: ["aBlock", "ifBlock", "elseBlock"],
  41761. 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",
  41762. referencedClasses: [],
  41763. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  41764. }),
  41765. $globals.JSStream);
  41766. $core.addMethod(
  41767. $core.method({
  41768. selector: "nextPutMethodDeclaration:with:",
  41769. protocol: "streaming",
  41770. fn: function (aMethod,aBlock){
  41771. var self=this,$self=this;
  41772. return $core.withContext(function($ctx1) {
  41773. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  41774. $1=$self["@stream"];
  41775. $recv($1)._nextPutAll_("$core.method({");
  41776. $ctx1.sendIdx["nextPutAll:"]=1;
  41777. $recv($1)._lf();
  41778. $ctx1.sendIdx["lf"]=1;
  41779. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  41780. $ctx1.sendIdx["asJavaScriptSource"]=1;
  41781. $3="selector: ".__comma($4);
  41782. $ctx1.sendIdx[","]=2;
  41783. $2=$recv($3).__comma(",");
  41784. $ctx1.sendIdx[","]=1;
  41785. $recv($1)._nextPutAll_($2);
  41786. $ctx1.sendIdx["nextPutAll:"]=2;
  41787. $recv($1)._lf();
  41788. $ctx1.sendIdx["lf"]=2;
  41789. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  41790. $ctx1.sendIdx["asJavaScriptSource"]=2;
  41791. $6="source: ".__comma($7);
  41792. $ctx1.sendIdx[","]=4;
  41793. $5=$recv($6).__comma(",");
  41794. $ctx1.sendIdx[","]=3;
  41795. $recv($1)._nextPutAll_($5);
  41796. $ctx1.sendIdx["nextPutAll:"]=3;
  41797. $8=$recv($1)._lf();
  41798. $ctx1.sendIdx["lf"]=3;
  41799. $recv(aBlock)._value();
  41800. $ctx1.sendIdx["value"]=1;
  41801. $9=$self["@stream"];
  41802. $12=$recv($globals.String)._lf();
  41803. $ctx1.sendIdx["lf"]=4;
  41804. $11=",".__comma($12);
  41805. $ctx1.sendIdx[","]=6;
  41806. $10=$recv($11).__comma("messageSends: ");
  41807. $ctx1.sendIdx[","]=5;
  41808. $recv($9)._nextPutAll_($10);
  41809. $ctx1.sendIdx["nextPutAll:"]=4;
  41810. $15=$recv($recv(aMethod)._messageSends())._asArray();
  41811. $ctx1.sendIdx["asArray"]=1;
  41812. $14=$recv($15)._asJavaScriptSource();
  41813. $ctx1.sendIdx["asJavaScriptSource"]=3;
  41814. $13=$recv($14).__comma(",");
  41815. $ctx1.sendIdx[","]=7;
  41816. $recv($9)._nextPutAll_($13);
  41817. $ctx1.sendIdx["nextPutAll:"]=5;
  41818. $recv($9)._lf();
  41819. $ctx1.sendIdx["lf"]=5;
  41820. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  41821. return $core.withContext(function($ctx2) {
  41822. return $recv(each)._value();
  41823. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41824. })))._asArray())._asJavaScriptSource();
  41825. $ctx1.sendIdx["asJavaScriptSource"]=4;
  41826. $17="args: ".__comma($18);
  41827. $16=$recv($17).__comma(",");
  41828. $ctx1.sendIdx[","]=8;
  41829. $recv($9)._nextPutAll_($16);
  41830. $ctx1.sendIdx["nextPutAll:"]=6;
  41831. $recv($9)._lf();
  41832. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  41833. $ctx1.sendIdx["nextPutAll:"]=7;
  41834. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  41835. return $core.withContext(function($ctx2) {
  41836. return $recv($self["@stream"])._nextPutAll_($recv(each)._asJavaScriptSource());
  41837. $ctx2.sendIdx["nextPutAll:"]=8;
  41838. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41839. }),(function(){
  41840. return $core.withContext(function($ctx2) {
  41841. return $recv($self["@stream"])._nextPutAll_(",");
  41842. $ctx2.sendIdx["nextPutAll:"]=9;
  41843. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41844. }));
  41845. $20=$self["@stream"];
  41846. $recv($20)._nextPutAll_("]");
  41847. $ctx1.sendIdx["nextPutAll:"]=10;
  41848. $recv($20)._nextPutAll_("})");
  41849. return self;
  41850. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  41851. },
  41852. args: ["aMethod", "aBlock"],
  41853. 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: '})'",
  41854. referencedClasses: ["String"],
  41855. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  41856. }),
  41857. $globals.JSStream);
  41858. $core.addMethod(
  41859. $core.method({
  41860. selector: "nextPutNonLocalReturnHandlingWith:",
  41861. protocol: "streaming",
  41862. fn: function (aBlock){
  41863. var self=this,$self=this;
  41864. return $core.withContext(function($ctx1) {
  41865. var $1,$2,$3;
  41866. $1=$self["@stream"];
  41867. $recv($1)._nextPutAll_("var $early={};");
  41868. $ctx1.sendIdx["nextPutAll:"]=1;
  41869. $recv($1)._lf();
  41870. $ctx1.sendIdx["lf"]=1;
  41871. $recv($1)._nextPutAll_("try {");
  41872. $ctx1.sendIdx["nextPutAll:"]=2;
  41873. $2=$recv($1)._lf();
  41874. $ctx1.sendIdx["lf"]=2;
  41875. $recv(aBlock)._value();
  41876. $3=$self["@stream"];
  41877. $recv($3)._nextPutAll_("}");
  41878. $ctx1.sendIdx["nextPutAll:"]=3;
  41879. $recv($3)._lf();
  41880. $ctx1.sendIdx["lf"]=3;
  41881. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  41882. $recv($3)._lf();
  41883. return self;
  41884. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  41885. },
  41886. args: ["aBlock"],
  41887. 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",
  41888. referencedClasses: [],
  41889. messageSends: ["nextPutAll:", "lf", "value"]
  41890. }),
  41891. $globals.JSStream);
  41892. $core.addMethod(
  41893. $core.method({
  41894. selector: "nextPutNonLocalReturnWith:",
  41895. protocol: "streaming",
  41896. fn: function (aBlock){
  41897. var self=this,$self=this;
  41898. return $core.withContext(function($ctx1) {
  41899. $recv($self["@stream"])._nextPutAll_("throw $early=[");
  41900. $ctx1.sendIdx["nextPutAll:"]=1;
  41901. $recv(aBlock)._value();
  41902. $recv($self["@stream"])._nextPutAll_("]");
  41903. return self;
  41904. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  41905. },
  41906. args: ["aBlock"],
  41907. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  41908. referencedClasses: [],
  41909. messageSends: ["nextPutAll:", "value"]
  41910. }),
  41911. $globals.JSStream);
  41912. $core.addMethod(
  41913. $core.method({
  41914. selector: "nextPutReturnWith:",
  41915. protocol: "streaming",
  41916. fn: function (aBlock){
  41917. var self=this,$self=this;
  41918. return $core.withContext(function($ctx1) {
  41919. $recv($self["@stream"])._nextPutAll_("return ");
  41920. $recv(aBlock)._value();
  41921. return self;
  41922. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  41923. },
  41924. args: ["aBlock"],
  41925. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  41926. referencedClasses: [],
  41927. messageSends: ["nextPutAll:", "value"]
  41928. }),
  41929. $globals.JSStream);
  41930. $core.addMethod(
  41931. $core.method({
  41932. selector: "nextPutSendIndexFor:",
  41933. protocol: "streaming",
  41934. fn: function (anIRSend){
  41935. var self=this,$self=this;
  41936. return $core.withContext(function($ctx1) {
  41937. $self._nextPutAll_(";");
  41938. $ctx1.sendIdx["nextPutAll:"]=1;
  41939. $self._lf();
  41940. $ctx1.sendIdx["lf"]=1;
  41941. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41942. $ctx1.sendIdx["nextPutAll:"]=2;
  41943. $self._lf();
  41944. $ctx1.sendIdx["lf"]=2;
  41945. $self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  41946. $ctx1.sendIdx["nextPutAll:"]=3;
  41947. $self._nextPutAll_(".sendIdx[");
  41948. $ctx1.sendIdx["nextPutAll:"]=4;
  41949. $self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  41950. $ctx1.sendIdx["nextPutAll:"]=5;
  41951. $self._nextPutAll_("]=");
  41952. $ctx1.sendIdx["nextPutAll:"]=6;
  41953. $self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  41954. $ctx1.sendIdx["nextPutAll:"]=7;
  41955. $self._nextPutAll_(";");
  41956. $ctx1.sendIdx["nextPutAll:"]=8;
  41957. $self._lf();
  41958. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  41959. return self;
  41960. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  41961. },
  41962. args: ["anIRSend"],
  41963. 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)'",
  41964. referencedClasses: [],
  41965. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  41966. }),
  41967. $globals.JSStream);
  41968. $core.addMethod(
  41969. $core.method({
  41970. selector: "nextPutStatementWith:",
  41971. protocol: "streaming",
  41972. fn: function (aBlock){
  41973. var self=this,$self=this;
  41974. return $core.withContext(function($ctx1) {
  41975. var $1;
  41976. $self._omitSemicolon_(false);
  41977. $ctx1.sendIdx["omitSemicolon:"]=1;
  41978. $recv(aBlock)._value();
  41979. $1=$self._omitSemicolon();
  41980. if(!$core.assert($1)){
  41981. $recv($self["@stream"])._nextPutAll_(";");
  41982. }
  41983. $self._omitSemicolon_(false);
  41984. $recv($self["@stream"])._lf();
  41985. return self;
  41986. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  41987. },
  41988. args: ["aBlock"],
  41989. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  41990. referencedClasses: [],
  41991. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  41992. }),
  41993. $globals.JSStream);
  41994. $core.addMethod(
  41995. $core.method({
  41996. selector: "nextPutVars:",
  41997. protocol: "streaming",
  41998. fn: function (aCollection){
  41999. var self=this,$self=this;
  42000. return $core.withContext(function($ctx1) {
  42001. var $1;
  42002. $recv(aCollection)._ifNotEmpty_((function(){
  42003. return $core.withContext(function($ctx2) {
  42004. $recv($self["@stream"])._nextPutAll_("var ");
  42005. $ctx2.sendIdx["nextPutAll:"]=1;
  42006. $recv(aCollection)._do_separatedBy_((function(each){
  42007. return $core.withContext(function($ctx3) {
  42008. return $recv($self["@stream"])._nextPutAll_(each);
  42009. $ctx3.sendIdx["nextPutAll:"]=2;
  42010. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42011. }),(function(){
  42012. return $core.withContext(function($ctx3) {
  42013. return $recv($self["@stream"])._nextPutAll_(",");
  42014. $ctx3.sendIdx["nextPutAll:"]=3;
  42015. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42016. }));
  42017. $1=$self["@stream"];
  42018. $recv($1)._nextPutAll_(";");
  42019. return $recv($1)._lf();
  42020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42021. }));
  42022. return self;
  42023. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  42024. },
  42025. args: ["aCollection"],
  42026. 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 ]",
  42027. referencedClasses: [],
  42028. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  42029. }),
  42030. $globals.JSStream);
  42031. $core.addMethod(
  42032. $core.method({
  42033. selector: "omitSemicolon",
  42034. protocol: "accessing",
  42035. fn: function (){
  42036. var self=this,$self=this;
  42037. return $self["@omitSemicolon"];
  42038. },
  42039. args: [],
  42040. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  42041. referencedClasses: [],
  42042. messageSends: []
  42043. }),
  42044. $globals.JSStream);
  42045. $core.addMethod(
  42046. $core.method({
  42047. selector: "omitSemicolon:",
  42048. protocol: "accessing",
  42049. fn: function (aBoolean){
  42050. var self=this,$self=this;
  42051. $self["@omitSemicolon"]=aBoolean;
  42052. return self;
  42053. },
  42054. args: ["aBoolean"],
  42055. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  42056. referencedClasses: [],
  42057. messageSends: []
  42058. }),
  42059. $globals.JSStream);
  42060. $core.addMethod(
  42061. $core.method({
  42062. selector: "isReferenced",
  42063. protocol: "*Compiler-IR",
  42064. fn: function (){
  42065. var self=this,$self=this;
  42066. return $core.withContext(function($ctx1) {
  42067. var $3,$2,$1;
  42068. $3=$self._parent();
  42069. $ctx1.sendIdx["parent"]=1;
  42070. $2=$recv($3)._isSequenceNode();
  42071. $1=$recv($2)._or_((function(){
  42072. return $core.withContext(function($ctx2) {
  42073. return $recv($self._parent())._isAssignmentNode();
  42074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42075. }));
  42076. return $recv($1)._not();
  42077. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  42078. },
  42079. args: [],
  42080. 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",
  42081. referencedClasses: [],
  42082. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  42083. }),
  42084. $globals.ASTNode);
  42085. $core.addMethod(
  42086. $core.method({
  42087. selector: "subtreeNeedsAliasing",
  42088. protocol: "*Compiler-IR",
  42089. fn: function (){
  42090. var self=this,$self=this;
  42091. return $core.withContext(function($ctx1) {
  42092. return $recv($self._shouldBeAliased())._or_((function(){
  42093. return $core.withContext(function($ctx2) {
  42094. return $recv($self._dagChildren())._anySatisfy_((function(each){
  42095. return $core.withContext(function($ctx3) {
  42096. return $recv(each)._subtreeNeedsAliasing();
  42097. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42098. }));
  42099. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42100. }));
  42101. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  42102. },
  42103. args: [],
  42104. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  42105. referencedClasses: [],
  42106. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  42107. }),
  42108. $globals.ASTNode);
  42109. $core.addMethod(
  42110. $core.method({
  42111. selector: "shouldBeAliased",
  42112. protocol: "*Compiler-IR",
  42113. fn: function (){
  42114. var self=this,$self=this;
  42115. return $core.withContext(function($ctx1) {
  42116. var $1;
  42117. $1=(
  42118. $ctx1.supercall = true,
  42119. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42120. $ctx1.supercall = false;
  42121. return $recv($1)._or_((function(){
  42122. return $core.withContext(function($ctx2) {
  42123. return $self._isReferenced();
  42124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42125. }));
  42126. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  42127. },
  42128. args: [],
  42129. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  42130. referencedClasses: [],
  42131. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  42132. }),
  42133. $globals.AssignmentNode);
  42134. $core.addMethod(
  42135. $core.method({
  42136. selector: "appendToInstruction:",
  42137. protocol: "*Compiler-IR",
  42138. fn: function (anIRInstruction){
  42139. var self=this,$self=this;
  42140. return $core.withContext(function($ctx1) {
  42141. $recv(anIRInstruction)._appendBlock_(self);
  42142. return self;
  42143. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  42144. },
  42145. args: ["anIRInstruction"],
  42146. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  42147. referencedClasses: [],
  42148. messageSends: ["appendBlock:"]
  42149. }),
  42150. $globals.BlockClosure);
  42151. $core.addMethod(
  42152. $core.method({
  42153. selector: "subtreeNeedsAliasing",
  42154. protocol: "*Compiler-IR",
  42155. fn: function (){
  42156. var self=this,$self=this;
  42157. return $core.withContext(function($ctx1) {
  42158. return $self._shouldBeAliased();
  42159. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  42160. },
  42161. args: [],
  42162. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  42163. referencedClasses: [],
  42164. messageSends: ["shouldBeAliased"]
  42165. }),
  42166. $globals.BlockNode);
  42167. $core.addMethod(
  42168. $core.method({
  42169. selector: "subtreeNeedsAliasing",
  42170. protocol: "*Compiler-IR",
  42171. fn: function (){
  42172. var self=this,$self=this;
  42173. return $core.withContext(function($ctx1) {
  42174. return $recv($recv($self._parent())._isSequenceNode())._not();
  42175. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  42176. },
  42177. args: [],
  42178. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  42179. referencedClasses: [],
  42180. messageSends: ["not", "isSequenceNode", "parent"]
  42181. }),
  42182. $globals.CascadeNode);
  42183. $core.addMethod(
  42184. $core.method({
  42185. selector: "shouldBeAliased",
  42186. protocol: "*Compiler-IR",
  42187. fn: function (){
  42188. var self=this,$self=this;
  42189. var sends;
  42190. return $core.withContext(function($ctx1) {
  42191. var $2,$1;
  42192. sends=$recv($recv($recv($self._method())._sendIndexes())._at_($self._selector()))._size();
  42193. $2=(
  42194. $ctx1.supercall = true,
  42195. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42196. $ctx1.supercall = false;
  42197. $1=$recv($2)._or_((function(){
  42198. return $core.withContext(function($ctx2) {
  42199. return $recv($self._isReferenced())._and_((function(){
  42200. return $core.withContext(function($ctx3) {
  42201. return $recv($recv($self._index()).__lt(sends))._or_((function(){
  42202. return $core.withContext(function($ctx4) {
  42203. return $self._superSend();
  42204. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  42205. }));
  42206. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42207. }));
  42208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42209. }));
  42210. $ctx1.sendIdx["or:"]=1;
  42211. return $1;
  42212. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  42213. },
  42214. args: [],
  42215. 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 ] ] ])",
  42216. referencedClasses: [],
  42217. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  42218. }),
  42219. $globals.SendNode);
  42220. $core.addMethod(
  42221. $core.method({
  42222. selector: "subtreeNeedsAliasing",
  42223. protocol: "*Compiler-IR",
  42224. fn: function (){
  42225. var self=this,$self=this;
  42226. return $core.withContext(function($ctx1) {
  42227. return $recv($self._shouldBeInlined())._or_((function(){
  42228. return $core.withContext(function($ctx2) {
  42229. return (
  42230. $ctx2.supercall = true,
  42231. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($self, []));
  42232. $ctx2.supercall = false;
  42233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42234. }));
  42235. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  42236. },
  42237. args: [],
  42238. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  42239. referencedClasses: [],
  42240. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  42241. }),
  42242. $globals.SendNode);
  42243. });
  42244. 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";
  42245. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  42246. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  42247. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  42248. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  42249. $core.addPackage("Compiler-Inlining");
  42250. $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  42251. $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  42252. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  42253. $core.addMethod(
  42254. $core.method({
  42255. selector: "visitSendNode:",
  42256. protocol: "visiting",
  42257. fn: function (aNode){
  42258. var self=this,$self=this;
  42259. return $core.withContext(function($ctx1) {
  42260. var $1,$2,$3,$4,$receiver;
  42261. $1=$recv(aNode)._superSend();
  42262. if(!$core.assert($1)){
  42263. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  42264. if($core.assert($2)){
  42265. $recv(aNode)._shouldBeInlined_(true);
  42266. $3=$recv(aNode)._receiver();
  42267. if(($receiver = $3) == null || $receiver.a$nil){
  42268. $3;
  42269. } else {
  42270. var receiver;
  42271. receiver=$receiver;
  42272. $recv(receiver)._shouldBeAliased_(true);
  42273. }
  42274. }
  42275. }
  42276. $4=(
  42277. $ctx1.supercall = true,
  42278. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  42279. $ctx1.supercall = false;
  42280. return $4;
  42281. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  42282. },
  42283. args: ["aNode"],
  42284. 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",
  42285. referencedClasses: ["IRSendInliner"],
  42286. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  42287. }),
  42288. $globals.ASTPreInliner);
  42289. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  42290. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  42291. $core.addMethod(
  42292. $core.method({
  42293. selector: "acceptDagVisitor:",
  42294. protocol: "visiting",
  42295. fn: function (aVisitor){
  42296. var self=this,$self=this;
  42297. return $core.withContext(function($ctx1) {
  42298. $recv(aVisitor)._visitIRInlinedClosure_(self);
  42299. return self;
  42300. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  42301. },
  42302. args: ["aVisitor"],
  42303. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  42304. referencedClasses: [],
  42305. messageSends: ["visitIRInlinedClosure:"]
  42306. }),
  42307. $globals.IRInlinedClosure);
  42308. $core.addMethod(
  42309. $core.method({
  42310. selector: "isInlined",
  42311. protocol: "testing",
  42312. fn: function (){
  42313. var self=this,$self=this;
  42314. return true;
  42315. },
  42316. args: [],
  42317. source: "isInlined\x0a\x09^ true",
  42318. referencedClasses: [],
  42319. messageSends: []
  42320. }),
  42321. $globals.IRInlinedClosure);
  42322. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  42323. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  42324. $core.addMethod(
  42325. $core.method({
  42326. selector: "acceptDagVisitor:",
  42327. protocol: "visiting",
  42328. fn: function (aVisitor){
  42329. var self=this,$self=this;
  42330. return $core.withContext(function($ctx1) {
  42331. $recv(aVisitor)._visitInlinedSend_(self);
  42332. return self;
  42333. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  42334. },
  42335. args: ["aVisitor"],
  42336. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  42337. referencedClasses: [],
  42338. messageSends: ["visitInlinedSend:"]
  42339. }),
  42340. $globals.IRInlinedSend);
  42341. $core.addMethod(
  42342. $core.method({
  42343. selector: "internalVariables",
  42344. protocol: "accessing",
  42345. fn: function (){
  42346. var self=this,$self=this;
  42347. return [];
  42348. },
  42349. args: [],
  42350. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  42351. referencedClasses: [],
  42352. messageSends: []
  42353. }),
  42354. $globals.IRInlinedSend);
  42355. $core.addMethod(
  42356. $core.method({
  42357. selector: "isInlined",
  42358. protocol: "testing",
  42359. fn: function (){
  42360. var self=this,$self=this;
  42361. return true;
  42362. },
  42363. args: [],
  42364. source: "isInlined\x0a\x09^ true",
  42365. referencedClasses: [],
  42366. messageSends: []
  42367. }),
  42368. $globals.IRInlinedSend);
  42369. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42370. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  42371. $core.addMethod(
  42372. $core.method({
  42373. selector: "acceptDagVisitor:",
  42374. protocol: "visiting",
  42375. fn: function (aVisitor){
  42376. var self=this,$self=this;
  42377. return $core.withContext(function($ctx1) {
  42378. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  42379. return self;
  42380. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  42381. },
  42382. args: ["aVisitor"],
  42383. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  42384. referencedClasses: [],
  42385. messageSends: ["visitIRInlinedIfFalse:"]
  42386. }),
  42387. $globals.IRInlinedIfFalse);
  42388. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42389. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  42390. $core.addMethod(
  42391. $core.method({
  42392. selector: "acceptDagVisitor:",
  42393. protocol: "visiting",
  42394. fn: function (aVisitor){
  42395. var self=this,$self=this;
  42396. return $core.withContext(function($ctx1) {
  42397. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  42398. return self;
  42399. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  42400. },
  42401. args: ["aVisitor"],
  42402. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  42403. referencedClasses: [],
  42404. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  42405. }),
  42406. $globals.IRInlinedIfNilIfNotNil);
  42407. $core.addMethod(
  42408. $core.method({
  42409. selector: "internalVariables",
  42410. protocol: "accessing",
  42411. fn: function (){
  42412. var self=this,$self=this;
  42413. return $core.withContext(function($ctx1) {
  42414. return $recv($globals.Array)._with_($self._receiverInternalVariable());
  42415. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  42416. },
  42417. args: [],
  42418. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  42419. referencedClasses: ["Array"],
  42420. messageSends: ["with:", "receiverInternalVariable"]
  42421. }),
  42422. $globals.IRInlinedIfNilIfNotNil);
  42423. $core.addMethod(
  42424. $core.method({
  42425. selector: "receiverInternalVariable",
  42426. protocol: "accessing",
  42427. fn: function (){
  42428. var self=this,$self=this;
  42429. return $core.withContext(function($ctx1) {
  42430. var $1;
  42431. $1=$recv($globals.IRVariable)._new();
  42432. $ctx1.sendIdx["new"]=1;
  42433. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_($self._receiverInternalVariableName()));
  42434. return $recv($1)._yourself();
  42435. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  42436. },
  42437. args: [],
  42438. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  42439. referencedClasses: ["IRVariable", "AliasVar"],
  42440. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  42441. }),
  42442. $globals.IRInlinedIfNilIfNotNil);
  42443. $core.addMethod(
  42444. $core.method({
  42445. selector: "receiverInternalVariableName",
  42446. protocol: "accessing",
  42447. fn: function (){
  42448. var self=this,$self=this;
  42449. return "$receiver";
  42450. },
  42451. args: [],
  42452. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  42453. referencedClasses: [],
  42454. messageSends: []
  42455. }),
  42456. $globals.IRInlinedIfNilIfNotNil);
  42457. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42458. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  42459. $core.addMethod(
  42460. $core.method({
  42461. selector: "acceptDagVisitor:",
  42462. protocol: "visiting",
  42463. fn: function (aVisitor){
  42464. var self=this,$self=this;
  42465. return $core.withContext(function($ctx1) {
  42466. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  42467. return self;
  42468. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  42469. },
  42470. args: ["aVisitor"],
  42471. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  42472. referencedClasses: [],
  42473. messageSends: ["visitIRInlinedIfTrue:"]
  42474. }),
  42475. $globals.IRInlinedIfTrue);
  42476. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42477. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  42478. $core.addMethod(
  42479. $core.method({
  42480. selector: "acceptDagVisitor:",
  42481. protocol: "visiting",
  42482. fn: function (aVisitor){
  42483. var self=this,$self=this;
  42484. return $core.withContext(function($ctx1) {
  42485. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  42486. return self;
  42487. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  42488. },
  42489. args: ["aVisitor"],
  42490. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  42491. referencedClasses: [],
  42492. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  42493. }),
  42494. $globals.IRInlinedIfTrueIfFalse);
  42495. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  42496. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  42497. $core.addMethod(
  42498. $core.method({
  42499. selector: "acceptDagVisitor:",
  42500. protocol: "visiting",
  42501. fn: function (aVisitor){
  42502. var self=this,$self=this;
  42503. return $core.withContext(function($ctx1) {
  42504. $recv(aVisitor)._visitIRInlinedSequence_(self);
  42505. return self;
  42506. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  42507. },
  42508. args: ["aVisitor"],
  42509. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  42510. referencedClasses: [],
  42511. messageSends: ["visitIRInlinedSequence:"]
  42512. }),
  42513. $globals.IRInlinedSequence);
  42514. $core.addMethod(
  42515. $core.method({
  42516. selector: "isInlined",
  42517. protocol: "testing",
  42518. fn: function (){
  42519. var self=this,$self=this;
  42520. return true;
  42521. },
  42522. args: [],
  42523. source: "isInlined\x0a\x09^ true",
  42524. referencedClasses: [],
  42525. messageSends: []
  42526. }),
  42527. $globals.IRInlinedSequence);
  42528. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  42529. $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`";
  42530. $core.addMethod(
  42531. $core.method({
  42532. selector: "assignmentInliner",
  42533. protocol: "factory",
  42534. fn: function (){
  42535. var self=this,$self=this;
  42536. return $core.withContext(function($ctx1) {
  42537. var $1;
  42538. $1=$recv($globals.IRAssignmentInliner)._new();
  42539. $recv($1)._translator_(self);
  42540. return $recv($1)._yourself();
  42541. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  42542. },
  42543. args: [],
  42544. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  42545. referencedClasses: ["IRAssignmentInliner"],
  42546. messageSends: ["translator:", "new", "yourself"]
  42547. }),
  42548. $globals.IRInliner);
  42549. $core.addMethod(
  42550. $core.method({
  42551. selector: "returnInliner",
  42552. protocol: "factory",
  42553. fn: function (){
  42554. var self=this,$self=this;
  42555. return $core.withContext(function($ctx1) {
  42556. var $1;
  42557. $1=$recv($globals.IRReturnInliner)._new();
  42558. $recv($1)._translator_(self);
  42559. return $recv($1)._yourself();
  42560. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  42561. },
  42562. args: [],
  42563. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  42564. referencedClasses: ["IRReturnInliner"],
  42565. messageSends: ["translator:", "new", "yourself"]
  42566. }),
  42567. $globals.IRInliner);
  42568. $core.addMethod(
  42569. $core.method({
  42570. selector: "sendInliner",
  42571. protocol: "factory",
  42572. fn: function (){
  42573. var self=this,$self=this;
  42574. return $core.withContext(function($ctx1) {
  42575. var $1;
  42576. $1=$recv($globals.IRSendInliner)._new();
  42577. $recv($1)._translator_(self);
  42578. return $recv($1)._yourself();
  42579. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  42580. },
  42581. args: [],
  42582. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  42583. referencedClasses: ["IRSendInliner"],
  42584. messageSends: ["translator:", "new", "yourself"]
  42585. }),
  42586. $globals.IRInliner);
  42587. $core.addMethod(
  42588. $core.method({
  42589. selector: "shouldInlineAssignment:",
  42590. protocol: "testing",
  42591. fn: function (anIRAssignment){
  42592. var self=this,$self=this;
  42593. return $core.withContext(function($ctx1) {
  42594. var $3,$2,$1;
  42595. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  42596. return $core.withContext(function($ctx2) {
  42597. $3=$recv(anIRAssignment)._right();
  42598. $ctx2.sendIdx["right"]=1;
  42599. $2=$recv($3)._isSend();
  42600. return $recv($2)._and_((function(){
  42601. return $core.withContext(function($ctx3) {
  42602. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  42603. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42604. }));
  42605. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42606. }));
  42607. $ctx1.sendIdx["and:"]=1;
  42608. return $1;
  42609. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  42610. },
  42611. args: ["anIRAssignment"],
  42612. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  42613. referencedClasses: [],
  42614. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  42615. }),
  42616. $globals.IRInliner);
  42617. $core.addMethod(
  42618. $core.method({
  42619. selector: "shouldInlineReturn:",
  42620. protocol: "testing",
  42621. fn: function (anIRReturn){
  42622. var self=this,$self=this;
  42623. return $core.withContext(function($ctx1) {
  42624. var $3,$2,$1;
  42625. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  42626. return $core.withContext(function($ctx2) {
  42627. $3=$recv(anIRReturn)._expression();
  42628. $ctx2.sendIdx["expression"]=1;
  42629. $2=$recv($3)._isSend();
  42630. return $recv($2)._and_((function(){
  42631. return $core.withContext(function($ctx3) {
  42632. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  42633. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42634. }));
  42635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42636. }));
  42637. $ctx1.sendIdx["and:"]=1;
  42638. return $1;
  42639. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  42640. },
  42641. args: ["anIRReturn"],
  42642. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  42643. referencedClasses: [],
  42644. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  42645. }),
  42646. $globals.IRInliner);
  42647. $core.addMethod(
  42648. $core.method({
  42649. selector: "shouldInlineSend:",
  42650. protocol: "testing",
  42651. fn: function (anIRSend){
  42652. var self=this,$self=this;
  42653. return $core.withContext(function($ctx1) {
  42654. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  42655. return $core.withContext(function($ctx2) {
  42656. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  42657. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42658. }));
  42659. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  42660. },
  42661. args: ["anIRSend"],
  42662. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  42663. referencedClasses: ["IRSendInliner"],
  42664. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  42665. }),
  42666. $globals.IRInliner);
  42667. $core.addMethod(
  42668. $core.method({
  42669. selector: "visitIRAssignment:",
  42670. protocol: "visiting",
  42671. fn: function (anIRAssignment){
  42672. var self=this,$self=this;
  42673. return $core.withContext(function($ctx1) {
  42674. var $1;
  42675. $1=$self._shouldInlineAssignment_(anIRAssignment);
  42676. if($core.assert($1)){
  42677. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  42678. } else {
  42679. return (
  42680. $ctx1.supercall = true,
  42681. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($self, [anIRAssignment]));
  42682. $ctx1.supercall = false;
  42683. }
  42684. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  42685. },
  42686. args: ["anIRAssignment"],
  42687. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  42688. referencedClasses: [],
  42689. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  42690. }),
  42691. $globals.IRInliner);
  42692. $core.addMethod(
  42693. $core.method({
  42694. selector: "visitIRNonLocalReturn:",
  42695. protocol: "visiting",
  42696. fn: function (anIRNonLocalReturn){
  42697. var self=this,$self=this;
  42698. var localReturn;
  42699. return $core.withContext(function($ctx1) {
  42700. var $2,$1,$4,$3,$5,$6,$7;
  42701. $2=$recv(anIRNonLocalReturn)._scope();
  42702. $ctx1.sendIdx["scope"]=1;
  42703. $1=$recv($2)._canInlineNonLocalReturns();
  42704. if($core.assert($1)){
  42705. $4=$recv(anIRNonLocalReturn)._scope();
  42706. $ctx1.sendIdx["scope"]=2;
  42707. $3=$recv($4)._methodScope();
  42708. $5=$recv(anIRNonLocalReturn)._scope();
  42709. $ctx1.sendIdx["scope"]=3;
  42710. $recv($3)._removeNonLocalReturn_($5);
  42711. $6=$recv($globals.IRReturn)._new();
  42712. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  42713. localReturn=$recv($6)._yourself();
  42714. localReturn;
  42715. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  42716. return $core.withContext(function($ctx2) {
  42717. return $recv(localReturn)._add_(each);
  42718. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42719. }));
  42720. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  42721. return $self._visitIRReturn_(localReturn);
  42722. }
  42723. $7=(
  42724. $ctx1.supercall = true,
  42725. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  42726. $ctx1.supercall = false;
  42727. return $7;
  42728. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  42729. },
  42730. args: ["anIRNonLocalReturn"],
  42731. 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",
  42732. referencedClasses: ["IRReturn"],
  42733. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  42734. }),
  42735. $globals.IRInliner);
  42736. $core.addMethod(
  42737. $core.method({
  42738. selector: "visitIRReturn:",
  42739. protocol: "visiting",
  42740. fn: function (anIRReturn){
  42741. var self=this,$self=this;
  42742. return $core.withContext(function($ctx1) {
  42743. var $1;
  42744. $1=$self._shouldInlineReturn_(anIRReturn);
  42745. if($core.assert($1)){
  42746. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  42747. } else {
  42748. return (
  42749. $ctx1.supercall = true,
  42750. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  42751. $ctx1.supercall = false;
  42752. }
  42753. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  42754. },
  42755. args: ["anIRReturn"],
  42756. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  42757. referencedClasses: [],
  42758. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  42759. }),
  42760. $globals.IRInliner);
  42761. $core.addMethod(
  42762. $core.method({
  42763. selector: "visitIRSend:",
  42764. protocol: "visiting",
  42765. fn: function (anIRSend){
  42766. var self=this,$self=this;
  42767. return $core.withContext(function($ctx1) {
  42768. var $1;
  42769. $1=$self._shouldInlineSend_(anIRSend);
  42770. if($core.assert($1)){
  42771. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  42772. } else {
  42773. return (
  42774. $ctx1.supercall = true,
  42775. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($self, [anIRSend]));
  42776. $ctx1.supercall = false;
  42777. }
  42778. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  42779. },
  42780. args: ["anIRSend"],
  42781. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  42782. referencedClasses: [],
  42783. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  42784. }),
  42785. $globals.IRInliner);
  42786. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  42787. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  42788. $core.addMethod(
  42789. $core.method({
  42790. selector: "visitIRInlinedClosure:",
  42791. protocol: "visiting",
  42792. fn: function (anIRInlinedClosure){
  42793. var self=this,$self=this;
  42794. return $core.withContext(function($ctx1) {
  42795. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  42796. return $core.withContext(function($ctx2) {
  42797. return $recv($recv(each)._name())._asVariableName();
  42798. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42799. })));
  42800. $self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  42801. return self;
  42802. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  42803. },
  42804. args: ["anIRInlinedClosure"],
  42805. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  42806. referencedClasses: [],
  42807. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  42808. }),
  42809. $globals.IRInliningJSTranslator);
  42810. $core.addMethod(
  42811. $core.method({
  42812. selector: "visitIRInlinedIfFalse:",
  42813. protocol: "visiting",
  42814. fn: function (anIRInlinedIfFalse){
  42815. var self=this,$self=this;
  42816. return $core.withContext(function($ctx1) {
  42817. var $1,$2,$4,$3;
  42818. $1=$self._stream();
  42819. $ctx1.sendIdx["stream"]=1;
  42820. $recv($1)._nextPutIf_then_((function(){
  42821. return $core.withContext(function($ctx2) {
  42822. $2=$self._stream();
  42823. $ctx2.sendIdx["stream"]=2;
  42824. $recv($2)._nextPutAll_("!$core.assert(");
  42825. $ctx2.sendIdx["nextPutAll:"]=1;
  42826. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  42827. $ctx2.sendIdx["dagChildren"]=1;
  42828. $3=$recv($4)._first();
  42829. $self._visit_($3);
  42830. $ctx2.sendIdx["visit:"]=1;
  42831. return $recv($self._stream())._nextPutAll_(")");
  42832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42833. }),(function(){
  42834. return $core.withContext(function($ctx2) {
  42835. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  42836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42837. }));
  42838. return self;
  42839. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  42840. },
  42841. args: ["anIRInlinedIfFalse"],
  42842. 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 ]",
  42843. referencedClasses: [],
  42844. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  42845. }),
  42846. $globals.IRInliningJSTranslator);
  42847. $core.addMethod(
  42848. $core.method({
  42849. selector: "visitIRInlinedIfNilIfNotNil:",
  42850. protocol: "visiting",
  42851. fn: function (anIRInlinedIfNilIfNotNil){
  42852. var self=this,$self=this;
  42853. return $core.withContext(function($ctx1) {
  42854. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  42855. $1=$self._stream();
  42856. $ctx1.sendIdx["stream"]=1;
  42857. $recv($1)._nextPutIf_then_else_((function(){
  42858. var recvVarName;
  42859. return $core.withContext(function($ctx2) {
  42860. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  42861. recvVarName;
  42862. $2=$self._stream();
  42863. $ctx2.sendIdx["stream"]=2;
  42864. $4="(".__comma(recvVarName);
  42865. $ctx2.sendIdx[","]=2;
  42866. $3=$recv($4).__comma(" = ");
  42867. $ctx2.sendIdx[","]=1;
  42868. $recv($2)._nextPutAll_($3);
  42869. $ctx2.sendIdx["nextPutAll:"]=1;
  42870. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  42871. $ctx2.sendIdx["dagChildren"]=1;
  42872. $5=$recv($6)._first();
  42873. $self._visit_($5);
  42874. $ctx2.sendIdx["visit:"]=1;
  42875. $7=$self._stream();
  42876. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".a$nil");
  42877. $ctx2.sendIdx[","]=3;
  42878. return $recv($7)._nextPutAll_($8);
  42879. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  42880. }),(function(){
  42881. return $core.withContext(function($ctx2) {
  42882. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  42883. $ctx2.sendIdx["dagChildren"]=2;
  42884. $9=$recv($10)._second();
  42885. return $self._visit_($9);
  42886. $ctx2.sendIdx["visit:"]=2;
  42887. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42888. }),(function(){
  42889. return $core.withContext(function($ctx2) {
  42890. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  42891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42892. }));
  42893. return self;
  42894. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  42895. },
  42896. args: ["anIRInlinedIfNilIfNotNil"],
  42897. 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 ]",
  42898. referencedClasses: [],
  42899. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  42900. }),
  42901. $globals.IRInliningJSTranslator);
  42902. $core.addMethod(
  42903. $core.method({
  42904. selector: "visitIRInlinedIfTrue:",
  42905. protocol: "visiting",
  42906. fn: function (anIRInlinedIfTrue){
  42907. var self=this,$self=this;
  42908. return $core.withContext(function($ctx1) {
  42909. var $1,$2,$4,$3;
  42910. $1=$self._stream();
  42911. $ctx1.sendIdx["stream"]=1;
  42912. $recv($1)._nextPutIf_then_((function(){
  42913. return $core.withContext(function($ctx2) {
  42914. $2=$self._stream();
  42915. $ctx2.sendIdx["stream"]=2;
  42916. $recv($2)._nextPutAll_("$core.assert(");
  42917. $ctx2.sendIdx["nextPutAll:"]=1;
  42918. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  42919. $ctx2.sendIdx["dagChildren"]=1;
  42920. $3=$recv($4)._first();
  42921. $self._visit_($3);
  42922. $ctx2.sendIdx["visit:"]=1;
  42923. return $recv($self._stream())._nextPutAll_(")");
  42924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42925. }),(function(){
  42926. return $core.withContext(function($ctx2) {
  42927. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  42928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42929. }));
  42930. return self;
  42931. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  42932. },
  42933. args: ["anIRInlinedIfTrue"],
  42934. 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 ]",
  42935. referencedClasses: [],
  42936. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  42937. }),
  42938. $globals.IRInliningJSTranslator);
  42939. $core.addMethod(
  42940. $core.method({
  42941. selector: "visitIRInlinedIfTrueIfFalse:",
  42942. protocol: "visiting",
  42943. fn: function (anIRInlinedIfTrueIfFalse){
  42944. var self=this,$self=this;
  42945. return $core.withContext(function($ctx1) {
  42946. var $1,$2,$4,$3,$6,$5;
  42947. $1=$self._stream();
  42948. $ctx1.sendIdx["stream"]=1;
  42949. $recv($1)._nextPutIf_then_else_((function(){
  42950. return $core.withContext(function($ctx2) {
  42951. $2=$self._stream();
  42952. $ctx2.sendIdx["stream"]=2;
  42953. $recv($2)._nextPutAll_("$core.assert(");
  42954. $ctx2.sendIdx["nextPutAll:"]=1;
  42955. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  42956. $ctx2.sendIdx["dagChildren"]=1;
  42957. $3=$recv($4)._first();
  42958. $self._visit_($3);
  42959. $ctx2.sendIdx["visit:"]=1;
  42960. return $recv($self._stream())._nextPutAll_(")");
  42961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42962. }),(function(){
  42963. return $core.withContext(function($ctx2) {
  42964. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  42965. $ctx2.sendIdx["dagChildren"]=2;
  42966. $5=$recv($6)._second();
  42967. return $self._visit_($5);
  42968. $ctx2.sendIdx["visit:"]=2;
  42969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42970. }),(function(){
  42971. return $core.withContext(function($ctx2) {
  42972. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  42973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42974. }));
  42975. return self;
  42976. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  42977. },
  42978. args: ["anIRInlinedIfTrueIfFalse"],
  42979. 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 ]",
  42980. referencedClasses: [],
  42981. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  42982. }),
  42983. $globals.IRInliningJSTranslator);
  42984. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  42985. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  42986. $core.addMethod(
  42987. $core.method({
  42988. selector: "ifFalse:",
  42989. protocol: "inlining",
  42990. fn: function (anIRInstruction){
  42991. var self=this,$self=this;
  42992. return $core.withContext(function($ctx1) {
  42993. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  42994. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  42995. },
  42996. args: ["anIRInstruction"],
  42997. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  42998. referencedClasses: ["IRInlinedIfFalse"],
  42999. messageSends: ["inlinedSend:withBlock:", "new"]
  43000. }),
  43001. $globals.IRSendInliner);
  43002. $core.addMethod(
  43003. $core.method({
  43004. selector: "ifFalse:ifTrue:",
  43005. protocol: "inlining",
  43006. fn: function (anIRInstruction,anotherIRInstruction){
  43007. var self=this,$self=this;
  43008. return $core.withContext(function($ctx1) {
  43009. return $self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  43010. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43011. },
  43012. args: ["anIRInstruction", "anotherIRInstruction"],
  43013. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  43014. referencedClasses: [],
  43015. messageSends: ["perform:withArguments:"]
  43016. }),
  43017. $globals.IRSendInliner);
  43018. $core.addMethod(
  43019. $core.method({
  43020. selector: "ifNil:",
  43021. protocol: "inlining",
  43022. fn: function (anIRInstruction){
  43023. var self=this,$self=this;
  43024. return $core.withContext(function($ctx1) {
  43025. var $1,$3,$5,$6,$4,$2;
  43026. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43027. $ctx1.sendIdx["new"]=1;
  43028. $3=$recv($globals.IRClosure)._new();
  43029. $ctx1.sendIdx["new"]=2;
  43030. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43031. $5=$recv($globals.IRBlockSequence)._new();
  43032. $recv($5)._add_($recv($self._send())._receiver());
  43033. $6=$recv($5)._yourself();
  43034. $ctx1.sendIdx["yourself"]=1;
  43035. $4=$6;
  43036. $recv($3)._add_($4);
  43037. $ctx1.sendIdx["add:"]=1;
  43038. $2=$recv($3)._yourself();
  43039. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  43040. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43041. },
  43042. args: ["anIRInstruction"],
  43043. 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)",
  43044. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43045. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43046. }),
  43047. $globals.IRSendInliner);
  43048. $core.addMethod(
  43049. $core.method({
  43050. selector: "ifNil:ifNotNil:",
  43051. protocol: "inlining",
  43052. fn: function (anIRInstruction,anotherIRInstruction){
  43053. var self=this,$self=this;
  43054. return $core.withContext(function($ctx1) {
  43055. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  43056. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43057. },
  43058. args: ["anIRInstruction", "anotherIRInstruction"],
  43059. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43060. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43061. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43062. }),
  43063. $globals.IRSendInliner);
  43064. $core.addMethod(
  43065. $core.method({
  43066. selector: "ifNotNil:",
  43067. protocol: "inlining",
  43068. fn: function (anIRInstruction){
  43069. var self=this,$self=this;
  43070. return $core.withContext(function($ctx1) {
  43071. var $1,$3,$5,$6,$4,$2;
  43072. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43073. $ctx1.sendIdx["new"]=1;
  43074. $3=$recv($globals.IRClosure)._new();
  43075. $ctx1.sendIdx["new"]=2;
  43076. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43077. $5=$recv($globals.IRBlockSequence)._new();
  43078. $recv($5)._add_($recv($self._send())._receiver());
  43079. $6=$recv($5)._yourself();
  43080. $ctx1.sendIdx["yourself"]=1;
  43081. $4=$6;
  43082. $recv($3)._add_($4);
  43083. $ctx1.sendIdx["add:"]=1;
  43084. $2=$recv($3)._yourself();
  43085. return $self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  43086. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43087. },
  43088. args: ["anIRInstruction"],
  43089. 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",
  43090. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43091. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43092. }),
  43093. $globals.IRSendInliner);
  43094. $core.addMethod(
  43095. $core.method({
  43096. selector: "ifNotNil:ifNil:",
  43097. protocol: "inlining",
  43098. fn: function (anIRInstruction,anotherIRInstruction){
  43099. var self=this,$self=this;
  43100. return $core.withContext(function($ctx1) {
  43101. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  43102. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43103. },
  43104. args: ["anIRInstruction", "anotherIRInstruction"],
  43105. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  43106. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43107. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43108. }),
  43109. $globals.IRSendInliner);
  43110. $core.addMethod(
  43111. $core.method({
  43112. selector: "ifTrue:",
  43113. protocol: "inlining",
  43114. fn: function (anIRInstruction){
  43115. var self=this,$self=this;
  43116. return $core.withContext(function($ctx1) {
  43117. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  43118. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43119. },
  43120. args: ["anIRInstruction"],
  43121. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  43122. referencedClasses: ["IRInlinedIfTrue"],
  43123. messageSends: ["inlinedSend:withBlock:", "new"]
  43124. }),
  43125. $globals.IRSendInliner);
  43126. $core.addMethod(
  43127. $core.method({
  43128. selector: "ifTrue:ifFalse:",
  43129. protocol: "inlining",
  43130. fn: function (anIRInstruction,anotherIRInstruction){
  43131. var self=this,$self=this;
  43132. return $core.withContext(function($ctx1) {
  43133. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  43134. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43135. },
  43136. args: ["anIRInstruction", "anotherIRInstruction"],
  43137. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43138. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  43139. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43140. }),
  43141. $globals.IRSendInliner);
  43142. $core.addMethod(
  43143. $core.method({
  43144. selector: "inlineClosure:",
  43145. protocol: "inlining",
  43146. fn: function (anIRClosure){
  43147. var self=this,$self=this;
  43148. var inlinedClosure,sequence,statements;
  43149. return $core.withContext(function($ctx1) {
  43150. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  43151. inlinedClosure=$self._inlinedClosure();
  43152. $1=inlinedClosure;
  43153. $2=$recv(anIRClosure)._scope();
  43154. $ctx1.sendIdx["scope"]=1;
  43155. $recv($1)._scope_($2);
  43156. $ctx1.sendIdx["scope:"]=1;
  43157. $recv($1)._parent_($recv(anIRClosure)._parent());
  43158. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  43159. return $core.withContext(function($ctx2) {
  43160. return $recv(inlinedClosure)._add_(each);
  43161. $ctx2.sendIdx["add:"]=1;
  43162. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43163. }));
  43164. $ctx1.sendIdx["do:"]=1;
  43165. sequence=$self._inlinedSequence();
  43166. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  43167. return $core.withContext(function($ctx2) {
  43168. $3=inlinedClosure;
  43169. $5=$recv($globals.IRTempDeclaration)._new();
  43170. $ctx2.sendIdx["new"]=1;
  43171. $recv($5)._name_(each);
  43172. $ctx2.sendIdx["name:"]=1;
  43173. $6=$recv($5)._yourself();
  43174. $ctx2.sendIdx["yourself"]=1;
  43175. $4=$6;
  43176. $recv($3)._add_($4);
  43177. $ctx2.sendIdx["add:"]=2;
  43178. $7=sequence;
  43179. $9=$recv($globals.IRAssignment)._new();
  43180. $ctx2.sendIdx["new"]=2;
  43181. $11=$recv($globals.IRVariable)._new();
  43182. $ctx2.sendIdx["new"]=3;
  43183. $13=$recv($globals.AliasVar)._new();
  43184. $ctx2.sendIdx["new"]=4;
  43185. $14=$recv(inlinedClosure)._scope();
  43186. $ctx2.sendIdx["scope"]=2;
  43187. $recv($13)._scope_($14);
  43188. $ctx2.sendIdx["scope:"]=2;
  43189. $recv($13)._name_(each);
  43190. $ctx2.sendIdx["name:"]=2;
  43191. $15=$recv($13)._yourself();
  43192. $ctx2.sendIdx["yourself"]=2;
  43193. $12=$15;
  43194. $10=$recv($11)._variable_($12);
  43195. $ctx2.sendIdx["variable:"]=1;
  43196. $recv($9)._add_($10);
  43197. $ctx2.sendIdx["add:"]=4;
  43198. $17=$recv($globals.IRVariable)._new();
  43199. $ctx2.sendIdx["new"]=5;
  43200. $19=$recv($globals.AliasVar)._new();
  43201. $recv($19)._scope_($recv(inlinedClosure)._scope());
  43202. $recv($19)._name_("$receiver");
  43203. $20=$recv($19)._yourself();
  43204. $ctx2.sendIdx["yourself"]=3;
  43205. $18=$20;
  43206. $16=$recv($17)._variable_($18);
  43207. $recv($9)._add_($16);
  43208. $ctx2.sendIdx["add:"]=5;
  43209. $8=$recv($9)._yourself();
  43210. return $recv($7)._add_($8);
  43211. $ctx2.sendIdx["add:"]=3;
  43212. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43213. }));
  43214. $ctx1.sendIdx["do:"]=2;
  43215. $recv(inlinedClosure)._add_(sequence);
  43216. $ctx1.sendIdx["add:"]=6;
  43217. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  43218. $recv(statements)._ifNotEmpty_((function(){
  43219. return $core.withContext(function($ctx2) {
  43220. $recv($recv(statements)._allButLast())._do_((function(each){
  43221. return $core.withContext(function($ctx3) {
  43222. return $recv(sequence)._add_(each);
  43223. $ctx3.sendIdx["add:"]=7;
  43224. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  43225. }));
  43226. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  43227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43228. }));
  43229. return inlinedClosure;
  43230. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  43231. },
  43232. args: ["anIRClosure"],
  43233. 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",
  43234. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  43235. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  43236. }),
  43237. $globals.IRSendInliner);
  43238. $core.addMethod(
  43239. $core.method({
  43240. selector: "inlineSend:",
  43241. protocol: "inlining",
  43242. fn: function (anIRSend){
  43243. var self=this,$self=this;
  43244. return $core.withContext(function($ctx1) {
  43245. var $2,$1;
  43246. $self._send_(anIRSend);
  43247. $2=$self._send();
  43248. $ctx1.sendIdx["send"]=1;
  43249. $1=$recv($2)._selector();
  43250. return $self._perform_withArguments_($1,$recv($self._send())._arguments());
  43251. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  43252. },
  43253. args: ["anIRSend"],
  43254. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  43255. referencedClasses: [],
  43256. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  43257. }),
  43258. $globals.IRSendInliner);
  43259. $core.addMethod(
  43260. $core.method({
  43261. selector: "inlineSend:andReplace:",
  43262. protocol: "private",
  43263. fn: function (anIRSend,anIRInstruction){
  43264. var self=this,$self=this;
  43265. return $core.withContext(function($ctx1) {
  43266. $recv(anIRInstruction)._replaceWith_(anIRSend);
  43267. return $self._inlineSend_(anIRSend);
  43268. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43269. },
  43270. args: ["anIRSend", "anIRInstruction"],
  43271. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  43272. referencedClasses: [],
  43273. messageSends: ["replaceWith:", "inlineSend:"]
  43274. }),
  43275. $globals.IRSendInliner);
  43276. $core.addMethod(
  43277. $core.method({
  43278. selector: "inlinedClosure",
  43279. protocol: "factory",
  43280. fn: function (){
  43281. var self=this,$self=this;
  43282. return $core.withContext(function($ctx1) {
  43283. return $recv($globals.IRInlinedClosure)._new();
  43284. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  43285. },
  43286. args: [],
  43287. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  43288. referencedClasses: ["IRInlinedClosure"],
  43289. messageSends: ["new"]
  43290. }),
  43291. $globals.IRSendInliner);
  43292. $core.addMethod(
  43293. $core.method({
  43294. selector: "inlinedSend:withBlock:",
  43295. protocol: "private",
  43296. fn: function (inlinedSend,anIRInstruction){
  43297. var self=this,$self=this;
  43298. var inlinedClosure;
  43299. return $core.withContext(function($ctx1) {
  43300. var $1,$2,$4,$3,$5;
  43301. $1=$recv(anIRInstruction)._isClosure();
  43302. if(!$core.assert($1)){
  43303. $self._inliningError_("Message argument should be a block");
  43304. $ctx1.sendIdx["inliningError:"]=1;
  43305. }
  43306. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  43307. if(!$core.assert($2)){
  43308. $self._inliningError_("Inlined block should have zero argument");
  43309. }
  43310. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  43311. $4=$self._send();
  43312. $ctx1.sendIdx["send"]=1;
  43313. $3=$recv($4)._receiver();
  43314. $recv(inlinedSend)._add_($3);
  43315. $ctx1.sendIdx["add:"]=1;
  43316. $recv(inlinedSend)._add_(inlinedClosure);
  43317. $recv($self._send())._replaceWith_(inlinedSend);
  43318. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  43319. $ctx1.sendIdx["internalVariables"]=1;
  43320. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  43321. return inlinedSend;
  43322. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  43323. },
  43324. args: ["inlinedSend", "anIRInstruction"],
  43325. 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",
  43326. referencedClasses: [],
  43327. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43328. }),
  43329. $globals.IRSendInliner);
  43330. $core.addMethod(
  43331. $core.method({
  43332. selector: "inlinedSend:withBlock:withBlock:",
  43333. protocol: "private",
  43334. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  43335. var self=this,$self=this;
  43336. var inlinedClosure1,inlinedClosure2;
  43337. return $core.withContext(function($ctx1) {
  43338. var $1,$2,$3,$4,$6,$5,$7;
  43339. $1=$recv(anIRInstruction)._isClosure();
  43340. $ctx1.sendIdx["isClosure"]=1;
  43341. if(!$core.assert($1)){
  43342. $self._inliningError_("Message argument should be a block");
  43343. $ctx1.sendIdx["inliningError:"]=1;
  43344. }
  43345. $2=$recv(anotherIRInstruction)._isClosure();
  43346. if(!$core.assert($2)){
  43347. $self._inliningError_("Message argument should be a block");
  43348. }
  43349. $3=$self._translator();
  43350. $ctx1.sendIdx["translator"]=1;
  43351. $4=$self._inlineClosure_(anIRInstruction);
  43352. $ctx1.sendIdx["inlineClosure:"]=1;
  43353. inlinedClosure1=$recv($3)._visit_($4);
  43354. $ctx1.sendIdx["visit:"]=1;
  43355. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  43356. $6=$self._send();
  43357. $ctx1.sendIdx["send"]=1;
  43358. $5=$recv($6)._receiver();
  43359. $recv(inlinedSend)._add_($5);
  43360. $ctx1.sendIdx["add:"]=1;
  43361. $recv(inlinedSend)._add_(inlinedClosure1);
  43362. $ctx1.sendIdx["add:"]=2;
  43363. $recv(inlinedSend)._add_(inlinedClosure2);
  43364. $recv($self._send())._replaceWith_(inlinedSend);
  43365. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  43366. $ctx1.sendIdx["internalVariables"]=1;
  43367. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  43368. return inlinedSend;
  43369. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  43370. },
  43371. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  43372. 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",
  43373. referencedClasses: [],
  43374. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43375. }),
  43376. $globals.IRSendInliner);
  43377. $core.addMethod(
  43378. $core.method({
  43379. selector: "inlinedSequence",
  43380. protocol: "factory",
  43381. fn: function (){
  43382. var self=this,$self=this;
  43383. return $core.withContext(function($ctx1) {
  43384. return $recv($globals.IRInlinedSequence)._new();
  43385. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  43386. },
  43387. args: [],
  43388. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  43389. referencedClasses: ["IRInlinedSequence"],
  43390. messageSends: ["new"]
  43391. }),
  43392. $globals.IRSendInliner);
  43393. $core.addMethod(
  43394. $core.method({
  43395. selector: "inliningError:",
  43396. protocol: "error handling",
  43397. fn: function (aString){
  43398. var self=this,$self=this;
  43399. return $core.withContext(function($ctx1) {
  43400. $recv($globals.InliningError)._signal_(aString);
  43401. return self;
  43402. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  43403. },
  43404. args: ["aString"],
  43405. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  43406. referencedClasses: ["InliningError"],
  43407. messageSends: ["signal:"]
  43408. }),
  43409. $globals.IRSendInliner);
  43410. $core.addMethod(
  43411. $core.method({
  43412. selector: "send",
  43413. protocol: "accessing",
  43414. fn: function (){
  43415. var self=this,$self=this;
  43416. return $self["@send"];
  43417. },
  43418. args: [],
  43419. source: "send\x0a\x09^ send",
  43420. referencedClasses: [],
  43421. messageSends: []
  43422. }),
  43423. $globals.IRSendInliner);
  43424. $core.addMethod(
  43425. $core.method({
  43426. selector: "send:",
  43427. protocol: "accessing",
  43428. fn: function (anIRSend){
  43429. var self=this,$self=this;
  43430. $self["@send"]=anIRSend;
  43431. return self;
  43432. },
  43433. args: ["anIRSend"],
  43434. source: "send: anIRSend\x0a\x09send := anIRSend",
  43435. referencedClasses: [],
  43436. messageSends: []
  43437. }),
  43438. $globals.IRSendInliner);
  43439. $core.addMethod(
  43440. $core.method({
  43441. selector: "translator",
  43442. protocol: "accessing",
  43443. fn: function (){
  43444. var self=this,$self=this;
  43445. return $self["@translator"];
  43446. },
  43447. args: [],
  43448. source: "translator\x0a\x09^ translator",
  43449. referencedClasses: [],
  43450. messageSends: []
  43451. }),
  43452. $globals.IRSendInliner);
  43453. $core.addMethod(
  43454. $core.method({
  43455. selector: "translator:",
  43456. protocol: "accessing",
  43457. fn: function (anASTTranslator){
  43458. var self=this,$self=this;
  43459. $self["@translator"]=anASTTranslator;
  43460. return self;
  43461. },
  43462. args: ["anASTTranslator"],
  43463. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  43464. referencedClasses: [],
  43465. messageSends: []
  43466. }),
  43467. $globals.IRSendInliner);
  43468. $core.addMethod(
  43469. $core.method({
  43470. selector: "inlinedSelectors",
  43471. protocol: "accessing",
  43472. fn: function (){
  43473. var self=this,$self=this;
  43474. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  43475. },
  43476. args: [],
  43477. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  43478. referencedClasses: [],
  43479. messageSends: []
  43480. }),
  43481. $globals.IRSendInliner.a$cls);
  43482. $core.addMethod(
  43483. $core.method({
  43484. selector: "shouldInline:",
  43485. protocol: "accessing",
  43486. fn: function (anIRSend){
  43487. var self=this,$self=this;
  43488. return $core.withContext(function($ctx1) {
  43489. var $1;
  43490. $1=$recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  43491. if(!$core.assert($1)){
  43492. return false;
  43493. }
  43494. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  43495. return $core.withContext(function($ctx2) {
  43496. return $recv(each)._isClosure();
  43497. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43498. }));
  43499. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.a$cls)});
  43500. },
  43501. args: ["anIRSend"],
  43502. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  43503. referencedClasses: [],
  43504. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  43505. }),
  43506. $globals.IRSendInliner.a$cls);
  43507. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  43508. $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};";
  43509. $core.addMethod(
  43510. $core.method({
  43511. selector: "inlineAssignment:",
  43512. protocol: "inlining",
  43513. fn: function (anIRAssignment){
  43514. var self=this,$self=this;
  43515. return $core.withContext(function($ctx1) {
  43516. $self._target_($recv(anIRAssignment)._left());
  43517. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  43518. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  43519. },
  43520. args: ["anIRAssignment"],
  43521. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  43522. referencedClasses: [],
  43523. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  43524. }),
  43525. $globals.IRAssignmentInliner);
  43526. $core.addMethod(
  43527. $core.method({
  43528. selector: "inlineClosure:",
  43529. protocol: "inlining",
  43530. fn: function (anIRClosure){
  43531. var self=this,$self=this;
  43532. var closure,sequence,statements;
  43533. return $core.withContext(function($ctx1) {
  43534. var $1,$2,$3,$5,$4;
  43535. closure=(
  43536. $ctx1.supercall = true,
  43537. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  43538. $ctx1.supercall = false;
  43539. sequence=$recv(closure)._sequence();
  43540. statements=$recv(sequence)._dagChildren();
  43541. $recv(statements)._ifNotEmpty_((function(){
  43542. var final;
  43543. return $core.withContext(function($ctx2) {
  43544. final=$recv(statements)._last();
  43545. final;
  43546. $1=$recv(final)._yieldsValue();
  43547. if($core.assert($1)){
  43548. $2=sequence;
  43549. $3=final;
  43550. $5=$recv($globals.IRAssignment)._new();
  43551. $recv($5)._add_($self._target());
  43552. $ctx2.sendIdx["add:"]=1;
  43553. $recv($5)._add_($recv(final)._copy());
  43554. $4=$recv($5)._yourself();
  43555. return $recv($2)._replace_with_($3,$4);
  43556. }
  43557. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  43558. }));
  43559. return closure;
  43560. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  43561. },
  43562. args: ["anIRClosure"],
  43563. 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",
  43564. referencedClasses: ["IRAssignment"],
  43565. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  43566. }),
  43567. $globals.IRAssignmentInliner);
  43568. $core.addMethod(
  43569. $core.method({
  43570. selector: "target",
  43571. protocol: "accessing",
  43572. fn: function (){
  43573. var self=this,$self=this;
  43574. return $self["@target"];
  43575. },
  43576. args: [],
  43577. source: "target\x0a\x09^ target",
  43578. referencedClasses: [],
  43579. messageSends: []
  43580. }),
  43581. $globals.IRAssignmentInliner);
  43582. $core.addMethod(
  43583. $core.method({
  43584. selector: "target:",
  43585. protocol: "accessing",
  43586. fn: function (anObject){
  43587. var self=this,$self=this;
  43588. $self["@target"]=anObject;
  43589. return self;
  43590. },
  43591. args: ["anObject"],
  43592. source: "target: anObject\x0a\x09target := anObject",
  43593. referencedClasses: [],
  43594. messageSends: []
  43595. }),
  43596. $globals.IRAssignmentInliner);
  43597. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  43598. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  43599. $core.addMethod(
  43600. $core.method({
  43601. selector: "inlineClosure:",
  43602. protocol: "inlining",
  43603. fn: function (anIRClosure){
  43604. var self=this,$self=this;
  43605. var closure,sequence,statements;
  43606. return $core.withContext(function($ctx1) {
  43607. var $1,$2,$3,$5,$4;
  43608. closure=(
  43609. $ctx1.supercall = true,
  43610. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  43611. $ctx1.supercall = false;
  43612. sequence=$recv(closure)._sequence();
  43613. statements=$recv(sequence)._dagChildren();
  43614. $recv(statements)._ifNotEmpty_((function(){
  43615. var final;
  43616. return $core.withContext(function($ctx2) {
  43617. final=$recv(statements)._last();
  43618. final;
  43619. $1=$recv(final)._yieldsValue();
  43620. if($core.assert($1)){
  43621. $2=sequence;
  43622. $3=final;
  43623. $5=$recv($globals.IRReturn)._new();
  43624. $recv($5)._add_($recv(final)._copy());
  43625. $4=$recv($5)._yourself();
  43626. return $recv($2)._replace_with_($3,$4);
  43627. }
  43628. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  43629. }));
  43630. return closure;
  43631. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  43632. },
  43633. args: ["anIRClosure"],
  43634. 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",
  43635. referencedClasses: ["IRReturn"],
  43636. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  43637. }),
  43638. $globals.IRReturnInliner);
  43639. $core.addMethod(
  43640. $core.method({
  43641. selector: "inlineReturn:",
  43642. protocol: "inlining",
  43643. fn: function (anIRReturn){
  43644. var self=this,$self=this;
  43645. return $core.withContext(function($ctx1) {
  43646. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  43647. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  43648. },
  43649. args: ["anIRReturn"],
  43650. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  43651. referencedClasses: [],
  43652. messageSends: ["inlineSend:andReplace:", "expression"]
  43653. }),
  43654. $globals.IRReturnInliner);
  43655. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  43656. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  43657. $core.addMethod(
  43658. $core.method({
  43659. selector: "inliner",
  43660. protocol: "compiling",
  43661. fn: function (){
  43662. var self=this,$self=this;
  43663. return $core.withContext(function($ctx1) {
  43664. return $recv($globals.IRInliner)._new();
  43665. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  43666. },
  43667. args: [],
  43668. source: "inliner\x0a\x09^ IRInliner new",
  43669. referencedClasses: ["IRInliner"],
  43670. messageSends: ["new"]
  43671. }),
  43672. $globals.InliningCodeGenerator);
  43673. $core.addMethod(
  43674. $core.method({
  43675. selector: "irTranslatorClass",
  43676. protocol: "compiling",
  43677. fn: function (){
  43678. var self=this,$self=this;
  43679. return $globals.IRInliningJSTranslator;
  43680. },
  43681. args: [],
  43682. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  43683. referencedClasses: ["IRInliningJSTranslator"],
  43684. messageSends: []
  43685. }),
  43686. $globals.InliningCodeGenerator);
  43687. $core.addMethod(
  43688. $core.method({
  43689. selector: "preInliner",
  43690. protocol: "compiling",
  43691. fn: function (){
  43692. var self=this,$self=this;
  43693. return $core.withContext(function($ctx1) {
  43694. return $recv($globals.ASTPreInliner)._new();
  43695. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  43696. },
  43697. args: [],
  43698. source: "preInliner\x0a\x09^ ASTPreInliner new",
  43699. referencedClasses: ["ASTPreInliner"],
  43700. messageSends: ["new"]
  43701. }),
  43702. $globals.InliningCodeGenerator);
  43703. $core.addMethod(
  43704. $core.method({
  43705. selector: "transformersDictionary",
  43706. protocol: "compiling",
  43707. fn: function (){
  43708. var self=this,$self=this;
  43709. return $core.withContext(function($ctx1) {
  43710. var $1,$2,$receiver;
  43711. $1=$self["@transformersDictionary"];
  43712. if(($receiver = $1) == null || $receiver.a$nil){
  43713. $2=(
  43714. $ctx1.supercall = true,
  43715. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($self, []));
  43716. $ctx1.supercall = false;
  43717. $recv($2)._at_put_("3000-inlinerTagging",$self._preInliner());
  43718. $ctx1.sendIdx["at:put:"]=1;
  43719. $recv($2)._at_put_("6000-inliner",$self._inliner());
  43720. $ctx1.sendIdx["at:put:"]=2;
  43721. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  43722. $self["@transformersDictionary"]=$recv($2)._yourself();
  43723. return $self["@transformersDictionary"];
  43724. } else {
  43725. return $1;
  43726. }
  43727. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  43728. },
  43729. args: [],
  43730. 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 ]",
  43731. referencedClasses: [],
  43732. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  43733. }),
  43734. $globals.InliningCodeGenerator);
  43735. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  43736. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  43737. $core.addClass("InliningSemanticAnalyzer", $globals.SemanticAnalyzer, [], "Compiler-Inlining");
  43738. $core.addMethod(
  43739. $core.method({
  43740. selector: "visitSendNode:",
  43741. protocol: "visiting",
  43742. fn: function (aNode){
  43743. var self=this,$self=this;
  43744. return $core.withContext(function($ctx1) {
  43745. var $1,$2,$3,$receiver;
  43746. $1=$recv(aNode)._superSend();
  43747. if(!$core.assert($1)){
  43748. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  43749. if($core.assert($2)){
  43750. $recv(aNode)._shouldBeInlined_(true);
  43751. $3=$recv(aNode)._receiver();
  43752. if(($receiver = $3) == null || $receiver.a$nil){
  43753. $3;
  43754. } else {
  43755. var receiver;
  43756. receiver=$receiver;
  43757. $recv(receiver)._shouldBeAliased_(true);
  43758. }
  43759. }
  43760. }
  43761. (
  43762. $ctx1.supercall = true,
  43763. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  43764. $ctx1.supercall = false;
  43765. return self;
  43766. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  43767. },
  43768. args: ["aNode"],
  43769. 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",
  43770. referencedClasses: ["IRSendInliner"],
  43771. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  43772. }),
  43773. $globals.InliningSemanticAnalyzer);
  43774. $core.addMethod(
  43775. $core.method({
  43776. selector: "asInlinedBlockResult",
  43777. protocol: "*Compiler-Inlining",
  43778. fn: function (){
  43779. var self=this,$self=this;
  43780. return $core.withContext(function($ctx1) {
  43781. return $self._expression();
  43782. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  43783. },
  43784. args: [],
  43785. source: "asInlinedBlockResult\x0a\x09^ self expression",
  43786. referencedClasses: [],
  43787. messageSends: ["expression"]
  43788. }),
  43789. $globals.IRBlockReturn);
  43790. $core.addMethod(
  43791. $core.method({
  43792. selector: "asInlinedBlockResult",
  43793. protocol: "*Compiler-Inlining",
  43794. fn: function (){
  43795. var self=this,$self=this;
  43796. return self;
  43797. },
  43798. args: [],
  43799. source: "asInlinedBlockResult\x0a\x09^ self",
  43800. referencedClasses: [],
  43801. messageSends: []
  43802. }),
  43803. $globals.IRInstruction);
  43804. });
  43805. 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";
  43806. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  43807. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  43808. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  43809. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  43810. $core.addPackage("Compiler-Interpreter");
  43811. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  43812. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  43813. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  43814. $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`).";
  43815. $core.addMethod(
  43816. $core.method({
  43817. selector: "applyTo:arguments:",
  43818. protocol: "evaluating",
  43819. fn: function (anObject,aCollection){
  43820. var self=this,$self=this;
  43821. return $core.withContext(function($ctx1) {
  43822. $self._interpreterError();
  43823. return self;
  43824. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  43825. },
  43826. args: ["anObject", "aCollection"],
  43827. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  43828. referencedClasses: [],
  43829. messageSends: ["interpreterError"]
  43830. }),
  43831. $globals.AIBlockClosure);
  43832. $core.addMethod(
  43833. $core.method({
  43834. selector: "compiledSource",
  43835. protocol: "accessing",
  43836. fn: function (){
  43837. var self=this,$self=this;
  43838. return "[ AST Block closure ]";
  43839. },
  43840. args: [],
  43841. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  43842. referencedClasses: [],
  43843. messageSends: []
  43844. }),
  43845. $globals.AIBlockClosure);
  43846. $core.addMethod(
  43847. $core.method({
  43848. selector: "currySelf",
  43849. protocol: "converting",
  43850. fn: function (){
  43851. var self=this,$self=this;
  43852. return $core.withContext(function($ctx1) {
  43853. $self._interpreterError();
  43854. return self;
  43855. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  43856. },
  43857. args: [],
  43858. source: "currySelf\x0a\x09self interpreterError",
  43859. referencedClasses: [],
  43860. messageSends: ["interpreterError"]
  43861. }),
  43862. $globals.AIBlockClosure);
  43863. $core.addMethod(
  43864. $core.method({
  43865. selector: "initializeWithContext:node:",
  43866. protocol: "initialization",
  43867. fn: function (aContext,aNode){
  43868. var self=this,$self=this;
  43869. $self["@node"]=aNode;
  43870. $self["@outerContext"]=aContext;
  43871. return self;
  43872. },
  43873. args: ["aContext", "aNode"],
  43874. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  43875. referencedClasses: [],
  43876. messageSends: []
  43877. }),
  43878. $globals.AIBlockClosure);
  43879. $core.addMethod(
  43880. $core.method({
  43881. selector: "interpreterError",
  43882. protocol: "error handling",
  43883. fn: function (){
  43884. var self=this,$self=this;
  43885. return $core.withContext(function($ctx1) {
  43886. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  43887. return self;
  43888. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  43889. },
  43890. args: [],
  43891. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  43892. referencedClasses: ["ASTInterpreterError"],
  43893. messageSends: ["signal:"]
  43894. }),
  43895. $globals.AIBlockClosure);
  43896. $core.addMethod(
  43897. $core.method({
  43898. selector: "numArgs",
  43899. protocol: "accessing",
  43900. fn: function (){
  43901. var self=this,$self=this;
  43902. return $core.withContext(function($ctx1) {
  43903. return $recv($recv($self["@node"])._temps())._size();
  43904. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  43905. },
  43906. args: [],
  43907. source: "numArgs\x0a\x09^ node temps size",
  43908. referencedClasses: [],
  43909. messageSends: ["size", "temps"]
  43910. }),
  43911. $globals.AIBlockClosure);
  43912. $core.addMethod(
  43913. $core.method({
  43914. selector: "value",
  43915. protocol: "evaluating",
  43916. fn: function (){
  43917. var self=this,$self=this;
  43918. return $core.withContext(function($ctx1) {
  43919. return $self._valueWithPossibleArguments_([]);
  43920. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  43921. },
  43922. args: [],
  43923. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  43924. referencedClasses: [],
  43925. messageSends: ["valueWithPossibleArguments:"]
  43926. }),
  43927. $globals.AIBlockClosure);
  43928. $core.addMethod(
  43929. $core.method({
  43930. selector: "value:",
  43931. protocol: "evaluating",
  43932. fn: function (anArgument){
  43933. var self=this,$self=this;
  43934. return $core.withContext(function($ctx1) {
  43935. return $self._valueWithPossibleArguments_([anArgument]);
  43936. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  43937. },
  43938. args: ["anArgument"],
  43939. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  43940. referencedClasses: [],
  43941. messageSends: ["valueWithPossibleArguments:"]
  43942. }),
  43943. $globals.AIBlockClosure);
  43944. $core.addMethod(
  43945. $core.method({
  43946. selector: "value:value:",
  43947. protocol: "evaluating",
  43948. fn: function (firstArgument,secondArgument){
  43949. var self=this,$self=this;
  43950. return $core.withContext(function($ctx1) {
  43951. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  43952. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  43953. },
  43954. args: ["firstArgument", "secondArgument"],
  43955. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  43956. referencedClasses: [],
  43957. messageSends: ["valueWithPossibleArguments:"]
  43958. }),
  43959. $globals.AIBlockClosure);
  43960. $core.addMethod(
  43961. $core.method({
  43962. selector: "value:value:value:",
  43963. protocol: "evaluating",
  43964. fn: function (firstArgument,secondArgument,thirdArgument){
  43965. var self=this,$self=this;
  43966. return $core.withContext(function($ctx1) {
  43967. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  43968. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  43969. },
  43970. args: ["firstArgument", "secondArgument", "thirdArgument"],
  43971. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  43972. referencedClasses: [],
  43973. messageSends: ["valueWithPossibleArguments:"]
  43974. }),
  43975. $globals.AIBlockClosure);
  43976. $core.addMethod(
  43977. $core.method({
  43978. selector: "valueWithPossibleArguments:",
  43979. protocol: "evaluating",
  43980. fn: function (aCollection){
  43981. var self=this,$self=this;
  43982. var context,sequenceNode;
  43983. return $core.withContext(function($ctx1) {
  43984. var $1,$2,$3;
  43985. context=$recv($self["@outerContext"])._newInnerContext();
  43986. $1=$recv($recv($recv($self["@node"])._dagChildren())._first())._copy();
  43987. $recv($1)._parent_(nil);
  43988. sequenceNode=$recv($1)._yourself();
  43989. $recv($recv(sequenceNode)._temps())._do_((function(each){
  43990. return $core.withContext(function($ctx2) {
  43991. return $recv(context)._defineLocal_(each);
  43992. $ctx2.sendIdx["defineLocal:"]=1;
  43993. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43994. }));
  43995. $recv($recv($self["@node"])._parameters())._withIndexDo_((function(each,index){
  43996. return $core.withContext(function($ctx2) {
  43997. $recv(context)._defineLocal_(each);
  43998. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  43999. return nil;
  44000. })));
  44001. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  44002. }));
  44003. $2=$recv(context)._interpreter();
  44004. $ctx1.sendIdx["interpreter"]=1;
  44005. $recv($2)._node_(sequenceNode);
  44006. $recv($2)._enterNode();
  44007. $recv($2)._proceed();
  44008. $3=$recv($self["@outerContext"])._interpreter();
  44009. $ctx1.sendIdx["interpreter"]=2;
  44010. $recv($3)._setNonLocalReturnFromContext_(context);
  44011. return $recv($recv(context)._interpreter())._pop();
  44012. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  44013. },
  44014. args: ["aCollection"],
  44015. 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",
  44016. referencedClasses: [],
  44017. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  44018. }),
  44019. $globals.AIBlockClosure);
  44020. $core.addMethod(
  44021. $core.method({
  44022. selector: "forContext:node:",
  44023. protocol: "instance creation",
  44024. fn: function (aContext,aNode){
  44025. var self=this,$self=this;
  44026. return $core.withContext(function($ctx1) {
  44027. var $1;
  44028. $1=$self._new();
  44029. $recv($1)._initializeWithContext_node_(aContext,aNode);
  44030. return $recv($1)._yourself();
  44031. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.a$cls)});
  44032. },
  44033. args: ["aContext", "aNode"],
  44034. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  44035. referencedClasses: [],
  44036. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  44037. }),
  44038. $globals.AIBlockClosure.a$cls);
  44039. $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  44040. $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)";
  44041. $core.addMethod(
  44042. $core.method({
  44043. selector: "arguments",
  44044. protocol: "interpreting",
  44045. fn: function (){
  44046. var self=this,$self=this;
  44047. return $core.withContext(function($ctx1) {
  44048. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  44049. return $core.withContext(function($ctx2) {
  44050. return $self._localAt_ifAbsent_(each,(function(){
  44051. return $core.withContext(function($ctx3) {
  44052. return $self._error_("Argument not in context");
  44053. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44054. }));
  44055. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44056. }));
  44057. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  44058. },
  44059. args: [],
  44060. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  44061. referencedClasses: [],
  44062. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  44063. }),
  44064. $globals.AIContext);
  44065. $core.addMethod(
  44066. $core.method({
  44067. selector: "ast",
  44068. protocol: "interpreting",
  44069. fn: function (){
  44070. var self=this,$self=this;
  44071. return $core.withContext(function($ctx1) {
  44072. var $1,$2,$3,$receiver;
  44073. $1=$self._isBlockContext();
  44074. if($core.assert($1)){
  44075. $2=$self._outerContext();
  44076. if(($receiver = $2) == null || $receiver.a$nil){
  44077. return $2;
  44078. } else {
  44079. var context;
  44080. context=$receiver;
  44081. return $recv(context)._ast();
  44082. }
  44083. }
  44084. $3=$self["@ast"];
  44085. if(($receiver = $3) == null || $receiver.a$nil){
  44086. $self._initializeAST();
  44087. } else {
  44088. $3;
  44089. }
  44090. return $self["@ast"];
  44091. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  44092. },
  44093. args: [],
  44094. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  44095. referencedClasses: [],
  44096. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  44097. }),
  44098. $globals.AIContext);
  44099. $core.addMethod(
  44100. $core.method({
  44101. selector: "basicLocalAt:",
  44102. protocol: "private",
  44103. fn: function (aString){
  44104. var self=this,$self=this;
  44105. return $core.withContext(function($ctx1) {
  44106. return $recv($self._locals())._at_(aString);
  44107. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  44108. },
  44109. args: ["aString"],
  44110. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  44111. referencedClasses: [],
  44112. messageSends: ["at:", "locals"]
  44113. }),
  44114. $globals.AIContext);
  44115. $core.addMethod(
  44116. $core.method({
  44117. selector: "basicLocalAt:put:",
  44118. protocol: "private",
  44119. fn: function (aString,anObject){
  44120. var self=this,$self=this;
  44121. return $core.withContext(function($ctx1) {
  44122. $recv($self._locals())._at_put_(aString,anObject);
  44123. return self;
  44124. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  44125. },
  44126. args: ["aString", "anObject"],
  44127. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  44128. referencedClasses: [],
  44129. messageSends: ["at:put:", "locals"]
  44130. }),
  44131. $globals.AIContext);
  44132. $core.addMethod(
  44133. $core.method({
  44134. selector: "basicReceiver",
  44135. protocol: "interpreting",
  44136. fn: function (){
  44137. var self=this,$self=this;
  44138. return $core.withContext(function($ctx1) {
  44139. return $self._localAt_("self");
  44140. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  44141. },
  44142. args: [],
  44143. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  44144. referencedClasses: [],
  44145. messageSends: ["localAt:"]
  44146. }),
  44147. $globals.AIContext);
  44148. $core.addMethod(
  44149. $core.method({
  44150. selector: "defineLocal:",
  44151. protocol: "accessing",
  44152. fn: function (aString){
  44153. var self=this,$self=this;
  44154. return $core.withContext(function($ctx1) {
  44155. $recv($self._locals())._at_put_(aString,nil);
  44156. return self;
  44157. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  44158. },
  44159. args: ["aString"],
  44160. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  44161. referencedClasses: [],
  44162. messageSends: ["at:put:", "locals"]
  44163. }),
  44164. $globals.AIContext);
  44165. $core.addMethod(
  44166. $core.method({
  44167. selector: "evaluate:on:",
  44168. protocol: "evaluating",
  44169. fn: function (aString,anEvaluator){
  44170. var self=this,$self=this;
  44171. return $core.withContext(function($ctx1) {
  44172. return $recv(anEvaluator)._evaluate_context_(aString,self);
  44173. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  44174. },
  44175. args: ["aString", "anEvaluator"],
  44176. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  44177. referencedClasses: [],
  44178. messageSends: ["evaluate:context:"]
  44179. }),
  44180. $globals.AIContext);
  44181. $core.addMethod(
  44182. $core.method({
  44183. selector: "evaluateNode:",
  44184. protocol: "evaluating",
  44185. fn: function (aNode){
  44186. var self=this,$self=this;
  44187. return $core.withContext(function($ctx1) {
  44188. var $1;
  44189. $1=$recv($globals.ASTInterpreter)._new();
  44190. $recv($1)._context_(self);
  44191. $recv($1)._node_(aNode);
  44192. $recv($1)._enterNode();
  44193. $recv($1)._proceed();
  44194. return $recv($1)._result();
  44195. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  44196. },
  44197. args: ["aNode"],
  44198. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  44199. referencedClasses: ["ASTInterpreter"],
  44200. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  44201. }),
  44202. $globals.AIContext);
  44203. $core.addMethod(
  44204. $core.method({
  44205. selector: "evaluatedSelector",
  44206. protocol: "accessing",
  44207. fn: function (){
  44208. var self=this,$self=this;
  44209. return $self["@evaluatedSelector"];
  44210. },
  44211. args: [],
  44212. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  44213. referencedClasses: [],
  44214. messageSends: []
  44215. }),
  44216. $globals.AIContext);
  44217. $core.addMethod(
  44218. $core.method({
  44219. selector: "evaluatedSelector:",
  44220. protocol: "accessing",
  44221. fn: function (aString){
  44222. var self=this,$self=this;
  44223. $self["@evaluatedSelector"]=aString;
  44224. return self;
  44225. },
  44226. args: ["aString"],
  44227. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  44228. referencedClasses: [],
  44229. messageSends: []
  44230. }),
  44231. $globals.AIContext);
  44232. $core.addMethod(
  44233. $core.method({
  44234. selector: "index",
  44235. protocol: "accessing",
  44236. fn: function (){
  44237. var self=this,$self=this;
  44238. return $core.withContext(function($ctx1) {
  44239. var $1,$receiver;
  44240. $1=$self["@index"];
  44241. if(($receiver = $1) == null || $receiver.a$nil){
  44242. return (0);
  44243. } else {
  44244. return $1;
  44245. }
  44246. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  44247. },
  44248. args: [],
  44249. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  44250. referencedClasses: [],
  44251. messageSends: ["ifNil:"]
  44252. }),
  44253. $globals.AIContext);
  44254. $core.addMethod(
  44255. $core.method({
  44256. selector: "index:",
  44257. protocol: "accessing",
  44258. fn: function (anInteger){
  44259. var self=this,$self=this;
  44260. $self["@index"]=anInteger;
  44261. return self;
  44262. },
  44263. args: ["anInteger"],
  44264. source: "index: anInteger\x0a\x09index := anInteger",
  44265. referencedClasses: [],
  44266. messageSends: []
  44267. }),
  44268. $globals.AIContext);
  44269. $core.addMethod(
  44270. $core.method({
  44271. selector: "initializeAST",
  44272. protocol: "initialization",
  44273. fn: function (){
  44274. var self=this,$self=this;
  44275. return $core.withContext(function($ctx1) {
  44276. var $1;
  44277. $1=$self._method();
  44278. $ctx1.sendIdx["method"]=1;
  44279. $self["@ast"]=$recv($1)._ast();
  44280. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._methodClass()))._visit_($self["@ast"]);
  44281. return self;
  44282. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  44283. },
  44284. args: [],
  44285. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  44286. referencedClasses: ["SemanticAnalyzer"],
  44287. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  44288. }),
  44289. $globals.AIContext);
  44290. $core.addMethod(
  44291. $core.method({
  44292. selector: "initializeFromMethodContext:",
  44293. protocol: "initialization",
  44294. fn: function (aMethodContext){
  44295. var self=this,$self=this;
  44296. return $core.withContext(function($ctx1) {
  44297. var $1,$2,$3,$receiver;
  44298. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  44299. $self._index_($recv(aMethodContext)._index());
  44300. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  44301. $self._receiver_($recv(aMethodContext)._receiver());
  44302. $self._supercall_($recv(aMethodContext)._supercall());
  44303. $self._selector_($recv(aMethodContext)._selector());
  44304. $1=$recv(aMethodContext)._outerContext();
  44305. $ctx1.sendIdx["outerContext"]=1;
  44306. if(($receiver = $1) == null || $receiver.a$nil){
  44307. $1;
  44308. } else {
  44309. var outer;
  44310. outer=$receiver;
  44311. $2=$recv(outer)._methodContext();
  44312. if(($receiver = $2) == null || $receiver.a$nil){
  44313. $2;
  44314. } else {
  44315. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  44316. }
  44317. $3=$recv(aMethodContext)._locals();
  44318. $ctx1.sendIdx["locals"]=1;
  44319. $recv($3)._keysAndValuesDo_((function(key,value){
  44320. return $core.withContext(function($ctx2) {
  44321. return $recv($self._locals())._at_put_(key,value);
  44322. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  44323. }));
  44324. }
  44325. return self;
  44326. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  44327. },
  44328. args: ["aMethodContext"],
  44329. 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 ] ]",
  44330. referencedClasses: [],
  44331. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  44332. }),
  44333. $globals.AIContext);
  44334. $core.addMethod(
  44335. $core.method({
  44336. selector: "initializeInterpreter",
  44337. protocol: "initialization",
  44338. fn: function (){
  44339. var self=this,$self=this;
  44340. return $core.withContext(function($ctx1) {
  44341. var $1,$2,$receiver;
  44342. $1=$recv($globals.ASTInterpreter)._new();
  44343. $recv($1)._context_(self);
  44344. $self["@interpreter"]=$recv($1)._yourself();
  44345. $2=$self._innerContext();
  44346. if(($receiver = $2) == null || $receiver.a$nil){
  44347. $2;
  44348. } else {
  44349. $self._setupInterpreter_($self["@interpreter"]);
  44350. }
  44351. return self;
  44352. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  44353. },
  44354. args: [],
  44355. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  44356. referencedClasses: ["ASTInterpreter"],
  44357. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  44358. }),
  44359. $globals.AIContext);
  44360. $core.addMethod(
  44361. $core.method({
  44362. selector: "initializeLocals",
  44363. protocol: "initialization",
  44364. fn: function (){
  44365. var self=this,$self=this;
  44366. return $core.withContext(function($ctx1) {
  44367. $self["@locals"]=$recv($globals.Dictionary)._new();
  44368. $recv($self["@locals"])._at_put_("thisContext",self);
  44369. return self;
  44370. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  44371. },
  44372. args: [],
  44373. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  44374. referencedClasses: ["Dictionary"],
  44375. messageSends: ["new", "at:put:"]
  44376. }),
  44377. $globals.AIContext);
  44378. $core.addMethod(
  44379. $core.method({
  44380. selector: "innerContext",
  44381. protocol: "accessing",
  44382. fn: function (){
  44383. var self=this,$self=this;
  44384. return $self["@innerContext"];
  44385. },
  44386. args: [],
  44387. source: "innerContext\x0a\x09^ innerContext",
  44388. referencedClasses: [],
  44389. messageSends: []
  44390. }),
  44391. $globals.AIContext);
  44392. $core.addMethod(
  44393. $core.method({
  44394. selector: "innerContext:",
  44395. protocol: "accessing",
  44396. fn: function (anAIContext){
  44397. var self=this,$self=this;
  44398. $self["@innerContext"]=anAIContext;
  44399. return self;
  44400. },
  44401. args: ["anAIContext"],
  44402. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  44403. referencedClasses: [],
  44404. messageSends: []
  44405. }),
  44406. $globals.AIContext);
  44407. $core.addMethod(
  44408. $core.method({
  44409. selector: "interpreter",
  44410. protocol: "interpreting",
  44411. fn: function (){
  44412. var self=this,$self=this;
  44413. return $core.withContext(function($ctx1) {
  44414. var $1,$receiver;
  44415. $1=$self["@interpreter"];
  44416. if(($receiver = $1) == null || $receiver.a$nil){
  44417. $self._initializeInterpreter();
  44418. } else {
  44419. $1;
  44420. }
  44421. return $self["@interpreter"];
  44422. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  44423. },
  44424. args: [],
  44425. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  44426. referencedClasses: [],
  44427. messageSends: ["ifNil:", "initializeInterpreter"]
  44428. }),
  44429. $globals.AIContext);
  44430. $core.addMethod(
  44431. $core.method({
  44432. selector: "interpreter:",
  44433. protocol: "interpreting",
  44434. fn: function (anInterpreter){
  44435. var self=this,$self=this;
  44436. $self["@interpreter"]=anInterpreter;
  44437. return self;
  44438. },
  44439. args: ["anInterpreter"],
  44440. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  44441. referencedClasses: [],
  44442. messageSends: []
  44443. }),
  44444. $globals.AIContext);
  44445. $core.addMethod(
  44446. $core.method({
  44447. selector: "isTopContext",
  44448. protocol: "testing",
  44449. fn: function (){
  44450. var self=this,$self=this;
  44451. return $core.withContext(function($ctx1) {
  44452. return $recv($self._innerContext())._isNil();
  44453. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  44454. },
  44455. args: [],
  44456. source: "isTopContext\x0a\x09^ self innerContext isNil",
  44457. referencedClasses: [],
  44458. messageSends: ["isNil", "innerContext"]
  44459. }),
  44460. $globals.AIContext);
  44461. $core.addMethod(
  44462. $core.method({
  44463. selector: "localAt:",
  44464. protocol: "accessing",
  44465. fn: function (aString){
  44466. var self=this,$self=this;
  44467. var context;
  44468. return $core.withContext(function($ctx1) {
  44469. context=$self._lookupContextForLocal_(aString);
  44470. return $recv(context)._basicLocalAt_(aString);
  44471. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  44472. },
  44473. args: ["aString"],
  44474. 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",
  44475. referencedClasses: [],
  44476. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  44477. }),
  44478. $globals.AIContext);
  44479. $core.addMethod(
  44480. $core.method({
  44481. selector: "localAt:ifAbsent:",
  44482. protocol: "accessing",
  44483. fn: function (aString,aBlock){
  44484. var self=this,$self=this;
  44485. var context;
  44486. return $core.withContext(function($ctx1) {
  44487. var $early={};
  44488. try {
  44489. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  44490. return $core.withContext(function($ctx2) {
  44491. throw $early=[$recv(aBlock)._value()];
  44492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44493. }));
  44494. return $recv(context)._basicLocalAt_(aString);
  44495. }
  44496. catch(e) {if(e===$early)return e[0]; throw e}
  44497. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  44498. },
  44499. args: ["aString", "aBlock"],
  44500. 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",
  44501. referencedClasses: [],
  44502. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  44503. }),
  44504. $globals.AIContext);
  44505. $core.addMethod(
  44506. $core.method({
  44507. selector: "localAt:put:",
  44508. protocol: "accessing",
  44509. fn: function (aString,anObject){
  44510. var self=this,$self=this;
  44511. var context;
  44512. return $core.withContext(function($ctx1) {
  44513. context=$self._lookupContextForLocal_(aString);
  44514. $recv(context)._basicLocalAt_put_(aString,anObject);
  44515. return self;
  44516. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  44517. },
  44518. args: ["aString", "anObject"],
  44519. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  44520. referencedClasses: [],
  44521. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  44522. }),
  44523. $globals.AIContext);
  44524. $core.addMethod(
  44525. $core.method({
  44526. selector: "locals",
  44527. protocol: "accessing",
  44528. fn: function (){
  44529. var self=this,$self=this;
  44530. return $core.withContext(function($ctx1) {
  44531. var $1,$receiver;
  44532. $1=$self["@locals"];
  44533. if(($receiver = $1) == null || $receiver.a$nil){
  44534. $self._initializeLocals();
  44535. } else {
  44536. $1;
  44537. }
  44538. return $self["@locals"];
  44539. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  44540. },
  44541. args: [],
  44542. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  44543. referencedClasses: [],
  44544. messageSends: ["ifNil:", "initializeLocals"]
  44545. }),
  44546. $globals.AIContext);
  44547. $core.addMethod(
  44548. $core.method({
  44549. selector: "lookupContextForLocal:",
  44550. protocol: "private",
  44551. fn: function (aString){
  44552. var self=this,$self=this;
  44553. return $core.withContext(function($ctx1) {
  44554. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  44555. return $core.withContext(function($ctx2) {
  44556. return $self._variableNotFound();
  44557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44558. }));
  44559. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  44560. },
  44561. args: ["aString"],
  44562. 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 ]",
  44563. referencedClasses: [],
  44564. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  44565. }),
  44566. $globals.AIContext);
  44567. $core.addMethod(
  44568. $core.method({
  44569. selector: "lookupContextForLocal:ifNone:",
  44570. protocol: "private",
  44571. fn: function (aString,aBlock){
  44572. var self=this,$self=this;
  44573. return $core.withContext(function($ctx1) {
  44574. var $1;
  44575. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  44576. return self;
  44577. }),(function(){
  44578. return $core.withContext(function($ctx2) {
  44579. $1=$self._outerContext();
  44580. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  44581. return $core.withContext(function($ctx3) {
  44582. return $recv(context)._lookupContextForLocal_(aString);
  44583. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  44584. }));
  44585. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44586. }));
  44587. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  44588. },
  44589. args: ["aString", "aBlock"],
  44590. 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 ] ]",
  44591. referencedClasses: [],
  44592. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  44593. }),
  44594. $globals.AIContext);
  44595. $core.addMethod(
  44596. $core.method({
  44597. selector: "newInnerContext",
  44598. protocol: "factory",
  44599. fn: function (){
  44600. var self=this,$self=this;
  44601. return $core.withContext(function($ctx1) {
  44602. var $1;
  44603. $1=$recv($self._class())._new();
  44604. $recv($1)._outerContext_(self);
  44605. return $recv($1)._yourself();
  44606. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  44607. },
  44608. args: [],
  44609. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  44610. referencedClasses: [],
  44611. messageSends: ["outerContext:", "new", "class", "yourself"]
  44612. }),
  44613. $globals.AIContext);
  44614. $core.addMethod(
  44615. $core.method({
  44616. selector: "outerContext",
  44617. protocol: "accessing",
  44618. fn: function (){
  44619. var self=this,$self=this;
  44620. return $self["@outerContext"];
  44621. },
  44622. args: [],
  44623. source: "outerContext\x0a\x09^ outerContext",
  44624. referencedClasses: [],
  44625. messageSends: []
  44626. }),
  44627. $globals.AIContext);
  44628. $core.addMethod(
  44629. $core.method({
  44630. selector: "outerContext:",
  44631. protocol: "accessing",
  44632. fn: function (anAIContext){
  44633. var self=this,$self=this;
  44634. return $core.withContext(function($ctx1) {
  44635. var $1,$receiver;
  44636. $self["@outerContext"]=anAIContext;
  44637. $1=$self["@outerContext"];
  44638. if(($receiver = $1) == null || $receiver.a$nil){
  44639. $1;
  44640. } else {
  44641. var context;
  44642. context=$receiver;
  44643. $recv(context)._innerContext_(self);
  44644. }
  44645. return self;
  44646. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  44647. },
  44648. args: ["anAIContext"],
  44649. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  44650. referencedClasses: [],
  44651. messageSends: ["ifNotNil:", "innerContext:"]
  44652. }),
  44653. $globals.AIContext);
  44654. $core.addMethod(
  44655. $core.method({
  44656. selector: "receiver:",
  44657. protocol: "interpreting",
  44658. fn: function (anObject){
  44659. var self=this,$self=this;
  44660. return $core.withContext(function($ctx1) {
  44661. $recv($self._locals())._at_put_("self",anObject);
  44662. return self;
  44663. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  44664. },
  44665. args: ["anObject"],
  44666. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  44667. referencedClasses: [],
  44668. messageSends: ["at:put:", "locals"]
  44669. }),
  44670. $globals.AIContext);
  44671. $core.addMethod(
  44672. $core.method({
  44673. selector: "selector",
  44674. protocol: "accessing",
  44675. fn: function (){
  44676. var self=this,$self=this;
  44677. return $self["@selector"];
  44678. },
  44679. args: [],
  44680. source: "selector\x0a\x09^ selector",
  44681. referencedClasses: [],
  44682. messageSends: []
  44683. }),
  44684. $globals.AIContext);
  44685. $core.addMethod(
  44686. $core.method({
  44687. selector: "selector:",
  44688. protocol: "accessing",
  44689. fn: function (aString){
  44690. var self=this,$self=this;
  44691. $self["@selector"]=aString;
  44692. return self;
  44693. },
  44694. args: ["aString"],
  44695. source: "selector: aString\x0a\x09selector := aString",
  44696. referencedClasses: [],
  44697. messageSends: []
  44698. }),
  44699. $globals.AIContext);
  44700. $core.addMethod(
  44701. $core.method({
  44702. selector: "sendIndexAt:",
  44703. protocol: "accessing",
  44704. fn: function (aString){
  44705. var self=this,$self=this;
  44706. return $core.withContext(function($ctx1) {
  44707. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  44708. return (0);
  44709. }));
  44710. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  44711. },
  44712. args: ["aString"],
  44713. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  44714. referencedClasses: [],
  44715. messageSends: ["at:ifAbsent:", "sendIndexes"]
  44716. }),
  44717. $globals.AIContext);
  44718. $core.addMethod(
  44719. $core.method({
  44720. selector: "sendIndexes",
  44721. protocol: "accessing",
  44722. fn: function (){
  44723. var self=this,$self=this;
  44724. return $core.withContext(function($ctx1) {
  44725. var $1,$receiver;
  44726. $1=$self["@sendIndexes"];
  44727. if(($receiver = $1) == null || $receiver.a$nil){
  44728. return $recv($globals.Dictionary)._new();
  44729. } else {
  44730. return $1;
  44731. }
  44732. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  44733. },
  44734. args: [],
  44735. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  44736. referencedClasses: ["Dictionary"],
  44737. messageSends: ["ifNil:", "new"]
  44738. }),
  44739. $globals.AIContext);
  44740. $core.addMethod(
  44741. $core.method({
  44742. selector: "sendIndexes:",
  44743. protocol: "accessing",
  44744. fn: function (aDictionary){
  44745. var self=this,$self=this;
  44746. $self["@sendIndexes"]=aDictionary;
  44747. return self;
  44748. },
  44749. args: ["aDictionary"],
  44750. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  44751. referencedClasses: [],
  44752. messageSends: []
  44753. }),
  44754. $globals.AIContext);
  44755. $core.addMethod(
  44756. $core.method({
  44757. selector: "setupInterpreter:",
  44758. protocol: "interpreting",
  44759. fn: function (anInterpreter){
  44760. var self=this,$self=this;
  44761. var currentNode;
  44762. return $core.withContext(function($ctx1) {
  44763. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  44764. $1=$recv($globals.ASTPCNodeVisitor)._new();
  44765. $2=$self._evaluatedSelector();
  44766. $ctx1.sendIdx["evaluatedSelector"]=1;
  44767. $recv($1)._selector_($2);
  44768. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  44769. $3=$self._ast();
  44770. $ctx1.sendIdx["ast"]=1;
  44771. $recv($1)._visit_($3);
  44772. currentNode=$recv($1)._currentNode();
  44773. $4=$recv($self._ast())._sequenceNode();
  44774. if(($receiver = $4) == null || $receiver.a$nil){
  44775. $4;
  44776. } else {
  44777. var sequence;
  44778. sequence=$receiver;
  44779. $recv($recv(sequence)._temps())._do_((function(each){
  44780. return $core.withContext(function($ctx2) {
  44781. return $self._defineLocal_(each);
  44782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44783. }));
  44784. $ctx1.sendIdx["do:"]=1;
  44785. }
  44786. $recv(anInterpreter)._node_(currentNode);
  44787. $7=$self._innerContext();
  44788. $ctx1.sendIdx["innerContext"]=1;
  44789. $6=$recv($7)._arguments();
  44790. $5=$recv($6)._reversed();
  44791. $recv($5)._do_((function(each){
  44792. return $core.withContext(function($ctx2) {
  44793. return $recv(anInterpreter)._push_(each);
  44794. $ctx2.sendIdx["push:"]=1;
  44795. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  44796. }));
  44797. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  44798. return self;
  44799. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  44800. },
  44801. args: ["anInterpreter"],
  44802. 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)",
  44803. referencedClasses: ["ASTPCNodeVisitor"],
  44804. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  44805. }),
  44806. $globals.AIContext);
  44807. $core.addMethod(
  44808. $core.method({
  44809. selector: "supercall",
  44810. protocol: "interpreting",
  44811. fn: function (){
  44812. var self=this,$self=this;
  44813. return $core.withContext(function($ctx1) {
  44814. var $1,$receiver;
  44815. $1=$self["@supercall"];
  44816. if(($receiver = $1) == null || $receiver.a$nil){
  44817. return false;
  44818. } else {
  44819. return $1;
  44820. }
  44821. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  44822. },
  44823. args: [],
  44824. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  44825. referencedClasses: [],
  44826. messageSends: ["ifNil:"]
  44827. }),
  44828. $globals.AIContext);
  44829. $core.addMethod(
  44830. $core.method({
  44831. selector: "supercall:",
  44832. protocol: "interpreting",
  44833. fn: function (aBoolean){
  44834. var self=this,$self=this;
  44835. $self["@supercall"]=aBoolean;
  44836. return self;
  44837. },
  44838. args: ["aBoolean"],
  44839. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  44840. referencedClasses: [],
  44841. messageSends: []
  44842. }),
  44843. $globals.AIContext);
  44844. $core.addMethod(
  44845. $core.method({
  44846. selector: "variableNotFound",
  44847. protocol: "error handling",
  44848. fn: function (){
  44849. var self=this,$self=this;
  44850. return $core.withContext(function($ctx1) {
  44851. $self._error_("Variable missing");
  44852. return self;
  44853. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  44854. },
  44855. args: [],
  44856. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  44857. referencedClasses: [],
  44858. messageSends: ["error:"]
  44859. }),
  44860. $globals.AIContext);
  44861. $core.addMethod(
  44862. $core.method({
  44863. selector: "fromMethodContext:",
  44864. protocol: "instance creation",
  44865. fn: function (aMethodContext){
  44866. var self=this,$self=this;
  44867. return $core.withContext(function($ctx1) {
  44868. var $1;
  44869. $1=$self._new();
  44870. $recv($1)._initializeFromMethodContext_(aMethodContext);
  44871. return $recv($1)._yourself();
  44872. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.a$cls)});
  44873. },
  44874. args: ["aMethodContext"],
  44875. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  44876. referencedClasses: [],
  44877. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  44878. }),
  44879. $globals.AIContext.a$cls);
  44880. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  44881. $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.";
  44882. $core.addMethod(
  44883. $core.method({
  44884. selector: "context",
  44885. protocol: "accessing",
  44886. fn: function (){
  44887. var self=this,$self=this;
  44888. return $self["@context"];
  44889. },
  44890. args: [],
  44891. source: "context\x0a\x09^ context",
  44892. referencedClasses: [],
  44893. messageSends: []
  44894. }),
  44895. $globals.AISemanticAnalyzer);
  44896. $core.addMethod(
  44897. $core.method({
  44898. selector: "context:",
  44899. protocol: "accessing",
  44900. fn: function (anAIContext){
  44901. var self=this,$self=this;
  44902. $self["@context"]=anAIContext;
  44903. return self;
  44904. },
  44905. args: ["anAIContext"],
  44906. source: "context: anAIContext\x0a\x09context := anAIContext",
  44907. referencedClasses: [],
  44908. messageSends: []
  44909. }),
  44910. $globals.AISemanticAnalyzer);
  44911. $core.addMethod(
  44912. $core.method({
  44913. selector: "visitVariableNode:",
  44914. protocol: "visiting",
  44915. fn: function (aNode){
  44916. var self=this,$self=this;
  44917. return $core.withContext(function($ctx1) {
  44918. var $1;
  44919. var $early={};
  44920. try {
  44921. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  44922. return $core.withContext(function($ctx2) {
  44923. $1=(
  44924. $ctx2.supercall = true,
  44925. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  44926. $ctx2.supercall = false;
  44927. throw $early=[$1];
  44928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44929. }));
  44930. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  44931. return self;
  44932. }
  44933. catch(e) {if(e===$early)return e[0]; throw e}
  44934. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  44935. },
  44936. args: ["aNode"],
  44937. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  44938. referencedClasses: ["ASTContextVar"],
  44939. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  44940. }),
  44941. $globals.AISemanticAnalyzer);
  44942. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  44943. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  44944. $core.addMethod(
  44945. $core.method({
  44946. selector: "context",
  44947. protocol: "accessing",
  44948. fn: function (){
  44949. var self=this,$self=this;
  44950. return $self["@context"];
  44951. },
  44952. args: [],
  44953. source: "context\x0a\x09^ context",
  44954. referencedClasses: [],
  44955. messageSends: []
  44956. }),
  44957. $globals.ASTContextVar);
  44958. $core.addMethod(
  44959. $core.method({
  44960. selector: "context:",
  44961. protocol: "accessing",
  44962. fn: function (anObject){
  44963. var self=this,$self=this;
  44964. $self["@context"]=anObject;
  44965. return self;
  44966. },
  44967. args: ["anObject"],
  44968. source: "context: anObject\x0a\x09context := anObject",
  44969. referencedClasses: [],
  44970. messageSends: []
  44971. }),
  44972. $globals.ASTContextVar);
  44973. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  44974. $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.";
  44975. $core.addMethod(
  44976. $core.method({
  44977. selector: "atEnd",
  44978. protocol: "testing",
  44979. fn: function (){
  44980. var self=this,$self=this;
  44981. return $core.withContext(function($ctx1) {
  44982. var $1,$receiver;
  44983. $1=$self._context();
  44984. $ctx1.sendIdx["context"]=1;
  44985. if(($receiver = $1) == null || $receiver.a$nil){
  44986. return true;
  44987. } else {
  44988. $1;
  44989. }
  44990. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  44991. return $core.withContext(function($ctx2) {
  44992. return $recv($self._context())._isTopContext();
  44993. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44994. }));
  44995. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  44996. },
  44997. args: [],
  44998. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  44999. referencedClasses: [],
  45000. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  45001. }),
  45002. $globals.ASTDebugger);
  45003. $core.addMethod(
  45004. $core.method({
  45005. selector: "context",
  45006. protocol: "accessing",
  45007. fn: function (){
  45008. var self=this,$self=this;
  45009. return $self["@context"];
  45010. },
  45011. args: [],
  45012. source: "context\x0a\x09^ context",
  45013. referencedClasses: [],
  45014. messageSends: []
  45015. }),
  45016. $globals.ASTDebugger);
  45017. $core.addMethod(
  45018. $core.method({
  45019. selector: "context:",
  45020. protocol: "accessing",
  45021. fn: function (aContext){
  45022. var self=this,$self=this;
  45023. $self["@context"]=aContext;
  45024. return self;
  45025. },
  45026. args: ["aContext"],
  45027. source: "context: aContext\x0a\x09context := aContext",
  45028. referencedClasses: [],
  45029. messageSends: []
  45030. }),
  45031. $globals.ASTDebugger);
  45032. $core.addMethod(
  45033. $core.method({
  45034. selector: "flushInnerContexts",
  45035. protocol: "actions",
  45036. fn: function (){
  45037. var self=this,$self=this;
  45038. return $core.withContext(function($ctx1) {
  45039. var $1,$receiver;
  45040. $1=$self._context();
  45041. if(($receiver = $1) == null || $receiver.a$nil){
  45042. $1;
  45043. } else {
  45044. var cxt;
  45045. cxt=$receiver;
  45046. $recv(cxt)._innerContext_(nil);
  45047. }
  45048. return self;
  45049. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  45050. },
  45051. args: [],
  45052. 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 ]",
  45053. referencedClasses: [],
  45054. messageSends: ["ifNotNil:", "context", "innerContext:"]
  45055. }),
  45056. $globals.ASTDebugger);
  45057. $core.addMethod(
  45058. $core.method({
  45059. selector: "interpreter",
  45060. protocol: "accessing",
  45061. fn: function (){
  45062. var self=this,$self=this;
  45063. return $core.withContext(function($ctx1) {
  45064. var $1,$receiver;
  45065. $1=$self._context();
  45066. if(($receiver = $1) == null || $receiver.a$nil){
  45067. return $1;
  45068. } else {
  45069. var ctx;
  45070. ctx=$receiver;
  45071. return $recv(ctx)._interpreter();
  45072. }
  45073. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  45074. },
  45075. args: [],
  45076. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  45077. referencedClasses: [],
  45078. messageSends: ["ifNotNil:", "context", "interpreter"]
  45079. }),
  45080. $globals.ASTDebugger);
  45081. $core.addMethod(
  45082. $core.method({
  45083. selector: "method",
  45084. protocol: "accessing",
  45085. fn: function (){
  45086. var self=this,$self=this;
  45087. return $core.withContext(function($ctx1) {
  45088. return $recv($self._context())._method();
  45089. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  45090. },
  45091. args: [],
  45092. source: "method\x0a\x09^ self context method",
  45093. referencedClasses: [],
  45094. messageSends: ["method", "context"]
  45095. }),
  45096. $globals.ASTDebugger);
  45097. $core.addMethod(
  45098. $core.method({
  45099. selector: "node",
  45100. protocol: "accessing",
  45101. fn: function (){
  45102. var self=this,$self=this;
  45103. return $core.withContext(function($ctx1) {
  45104. var $1,$receiver;
  45105. $1=$self._interpreter();
  45106. $ctx1.sendIdx["interpreter"]=1;
  45107. if(($receiver = $1) == null || $receiver.a$nil){
  45108. return $1;
  45109. } else {
  45110. return $recv($self._interpreter())._node();
  45111. }
  45112. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  45113. },
  45114. args: [],
  45115. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  45116. referencedClasses: [],
  45117. messageSends: ["ifNotNil:", "interpreter", "node"]
  45118. }),
  45119. $globals.ASTDebugger);
  45120. $core.addMethod(
  45121. $core.method({
  45122. selector: "onStep",
  45123. protocol: "private",
  45124. fn: function (){
  45125. var self=this,$self=this;
  45126. return $core.withContext(function($ctx1) {
  45127. var $1,$3,$2,$4,$6,$5,$receiver;
  45128. $1=$self._interpreter();
  45129. $ctx1.sendIdx["interpreter"]=1;
  45130. $self["@result"]=$recv($1)._result();
  45131. $3=$self._interpreter();
  45132. $ctx1.sendIdx["interpreter"]=2;
  45133. $2=$recv($3)._atEnd();
  45134. $ctx1.sendIdx["atEnd"]=1;
  45135. if($core.assert($2)){
  45136. $4=$recv($self._context())._outerContext();
  45137. if(($receiver = $4) == null || $receiver.a$nil){
  45138. $4;
  45139. } else {
  45140. var outerContext;
  45141. outerContext=$receiver;
  45142. $self._context_(outerContext);
  45143. }
  45144. $6=$self._interpreter();
  45145. $ctx1.sendIdx["interpreter"]=3;
  45146. $5=$recv($6)._atEnd();
  45147. if(!$core.assert($5)){
  45148. $recv($self._interpreter())._skip();
  45149. }
  45150. }
  45151. $self._flushInnerContexts();
  45152. return self;
  45153. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  45154. },
  45155. args: [],
  45156. 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",
  45157. referencedClasses: [],
  45158. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  45159. }),
  45160. $globals.ASTDebugger);
  45161. $core.addMethod(
  45162. $core.method({
  45163. selector: "proceed",
  45164. protocol: "stepping",
  45165. fn: function (){
  45166. var self=this,$self=this;
  45167. return $core.withContext(function($ctx1) {
  45168. $recv((function(){
  45169. return $core.withContext(function($ctx2) {
  45170. return $self._atEnd();
  45171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45172. }))._whileFalse_((function(){
  45173. return $core.withContext(function($ctx2) {
  45174. return $self._stepOver();
  45175. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45176. }));
  45177. return self;
  45178. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  45179. },
  45180. args: [],
  45181. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  45182. referencedClasses: [],
  45183. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  45184. }),
  45185. $globals.ASTDebugger);
  45186. $core.addMethod(
  45187. $core.method({
  45188. selector: "restart",
  45189. protocol: "stepping",
  45190. fn: function (){
  45191. var self=this,$self=this;
  45192. return $core.withContext(function($ctx1) {
  45193. $recv($self._interpreter())._restart();
  45194. $self._flushInnerContexts();
  45195. return self;
  45196. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  45197. },
  45198. args: [],
  45199. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  45200. referencedClasses: [],
  45201. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  45202. }),
  45203. $globals.ASTDebugger);
  45204. $core.addMethod(
  45205. $core.method({
  45206. selector: "result",
  45207. protocol: "accessing",
  45208. fn: function (){
  45209. var self=this,$self=this;
  45210. return $self["@result"];
  45211. },
  45212. args: [],
  45213. source: "result\x0a\x09^ result",
  45214. referencedClasses: [],
  45215. messageSends: []
  45216. }),
  45217. $globals.ASTDebugger);
  45218. $core.addMethod(
  45219. $core.method({
  45220. selector: "stepInto",
  45221. protocol: "stepping",
  45222. fn: function (){
  45223. var self=this,$self=this;
  45224. return $core.withContext(function($ctx1) {
  45225. $self._shouldBeImplemented();
  45226. return self;
  45227. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  45228. },
  45229. args: [],
  45230. source: "stepInto\x0a\x09self shouldBeImplemented",
  45231. referencedClasses: [],
  45232. messageSends: ["shouldBeImplemented"]
  45233. }),
  45234. $globals.ASTDebugger);
  45235. $core.addMethod(
  45236. $core.method({
  45237. selector: "stepOver",
  45238. protocol: "stepping",
  45239. fn: function (){
  45240. var self=this,$self=this;
  45241. return $core.withContext(function($ctx1) {
  45242. var $1,$2;
  45243. $1=$recv($self._context())._isTopContext();
  45244. if($core.assert($1)){
  45245. $recv($self._interpreter())._stepOver();
  45246. } else {
  45247. $2=$self._interpreter();
  45248. $ctx1.sendIdx["interpreter"]=1;
  45249. $recv($2)._skip();
  45250. }
  45251. $self._onStep();
  45252. return self;
  45253. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  45254. },
  45255. args: [],
  45256. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  45257. referencedClasses: [],
  45258. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  45259. }),
  45260. $globals.ASTDebugger);
  45261. $core.addMethod(
  45262. $core.method({
  45263. selector: "context:",
  45264. protocol: "instance creation",
  45265. fn: function (aContext){
  45266. var self=this,$self=this;
  45267. return $core.withContext(function($ctx1) {
  45268. var $1;
  45269. $1=$self._new();
  45270. $recv($1)._context_(aContext);
  45271. return $recv($1)._yourself();
  45272. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.a$cls)});
  45273. },
  45274. args: ["aContext"],
  45275. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  45276. referencedClasses: [],
  45277. messageSends: ["context:", "new", "yourself"]
  45278. }),
  45279. $globals.ASTDebugger.a$cls);
  45280. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  45281. $core.addMethod(
  45282. $core.method({
  45283. selector: "interpreter",
  45284. protocol: "accessing",
  45285. fn: function (){
  45286. var self=this,$self=this;
  45287. return $self["@interpreter"];
  45288. },
  45289. args: [],
  45290. source: "interpreter\x0a\x09^ interpreter",
  45291. referencedClasses: [],
  45292. messageSends: []
  45293. }),
  45294. $globals.ASTEnterNode);
  45295. $core.addMethod(
  45296. $core.method({
  45297. selector: "interpreter:",
  45298. protocol: "accessing",
  45299. fn: function (anObject){
  45300. var self=this,$self=this;
  45301. $self["@interpreter"]=anObject;
  45302. return self;
  45303. },
  45304. args: ["anObject"],
  45305. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  45306. referencedClasses: [],
  45307. messageSends: []
  45308. }),
  45309. $globals.ASTEnterNode);
  45310. $core.addMethod(
  45311. $core.method({
  45312. selector: "visitBlockNode:",
  45313. protocol: "visiting",
  45314. fn: function (aNode){
  45315. var self=this,$self=this;
  45316. return aNode;
  45317. },
  45318. args: ["aNode"],
  45319. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  45320. referencedClasses: [],
  45321. messageSends: []
  45322. }),
  45323. $globals.ASTEnterNode);
  45324. $core.addMethod(
  45325. $core.method({
  45326. selector: "visitDagNode:",
  45327. protocol: "visiting",
  45328. fn: function (aNode){
  45329. var self=this,$self=this;
  45330. return $core.withContext(function($ctx1) {
  45331. var $early={};
  45332. try {
  45333. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  45334. throw $early=[aNode];
  45335. }),(function(nodes){
  45336. return $core.withContext(function($ctx2) {
  45337. throw $early=[$self._visit_($recv(nodes)._first())];
  45338. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  45339. }));
  45340. return self;
  45341. }
  45342. catch(e) {if(e===$early)return e[0]; throw e}
  45343. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45344. },
  45345. args: ["aNode"],
  45346. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  45347. referencedClasses: [],
  45348. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  45349. }),
  45350. $globals.ASTEnterNode);
  45351. $core.addMethod(
  45352. $core.method({
  45353. selector: "visitSequenceNode:",
  45354. protocol: "visiting",
  45355. fn: function (aNode){
  45356. var self=this,$self=this;
  45357. return $core.withContext(function($ctx1) {
  45358. var $1;
  45359. $recv($recv(aNode)._temps())._do_((function(each){
  45360. return $core.withContext(function($ctx2) {
  45361. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  45362. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45363. }));
  45364. $1=(
  45365. $ctx1.supercall = true,
  45366. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  45367. $ctx1.supercall = false;
  45368. return $1;
  45369. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45370. },
  45371. args: ["aNode"],
  45372. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  45373. referencedClasses: [],
  45374. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  45375. }),
  45376. $globals.ASTEnterNode);
  45377. $core.addMethod(
  45378. $core.method({
  45379. selector: "on:",
  45380. protocol: "instance creation",
  45381. fn: function (anInterpreter){
  45382. var self=this,$self=this;
  45383. return $core.withContext(function($ctx1) {
  45384. var $1;
  45385. $1=$self._new();
  45386. $recv($1)._interpreter_(anInterpreter);
  45387. return $recv($1)._yourself();
  45388. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.a$cls)});
  45389. },
  45390. args: ["anInterpreter"],
  45391. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  45392. referencedClasses: [],
  45393. messageSends: ["interpreter:", "new", "yourself"]
  45394. }),
  45395. $globals.ASTEnterNode.a$cls);
  45396. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  45397. $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";
  45398. $core.addMethod(
  45399. $core.method({
  45400. selector: "assign:to:",
  45401. protocol: "private",
  45402. fn: function (aNode,anObject){
  45403. var self=this,$self=this;
  45404. return $core.withContext(function($ctx1) {
  45405. var $1,$3,$2,$4;
  45406. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  45407. if($core.assert($1)){
  45408. $3=$self._context();
  45409. $ctx1.sendIdx["context"]=1;
  45410. $2=$recv($3)._receiver();
  45411. $4=$recv(aNode)._value();
  45412. $ctx1.sendIdx["value"]=1;
  45413. $recv($2)._instVarAt_put_($4,anObject);
  45414. } else {
  45415. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  45416. }
  45417. return self;
  45418. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  45419. },
  45420. args: ["aNode", "anObject"],
  45421. 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 ]",
  45422. referencedClasses: [],
  45423. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  45424. }),
  45425. $globals.ASTInterpreter);
  45426. $core.addMethod(
  45427. $core.method({
  45428. selector: "atEnd",
  45429. protocol: "testing",
  45430. fn: function (){
  45431. var self=this,$self=this;
  45432. return $core.withContext(function($ctx1) {
  45433. var $1;
  45434. $1=$self["@forceAtEnd"];
  45435. if($core.assert($1)){
  45436. return true;
  45437. }
  45438. return $recv($self._hasReturned())._or_((function(){
  45439. return $core.withContext(function($ctx2) {
  45440. return $recv($self._node())._isNil();
  45441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45442. }));
  45443. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  45444. },
  45445. args: [],
  45446. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  45447. referencedClasses: [],
  45448. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  45449. }),
  45450. $globals.ASTInterpreter);
  45451. $core.addMethod(
  45452. $core.method({
  45453. selector: "context",
  45454. protocol: "accessing",
  45455. fn: function (){
  45456. var self=this,$self=this;
  45457. return $self["@context"];
  45458. },
  45459. args: [],
  45460. source: "context\x0a\x09^ context",
  45461. referencedClasses: [],
  45462. messageSends: []
  45463. }),
  45464. $globals.ASTInterpreter);
  45465. $core.addMethod(
  45466. $core.method({
  45467. selector: "context:",
  45468. protocol: "accessing",
  45469. fn: function (aContext){
  45470. var self=this,$self=this;
  45471. $self["@context"]=aContext;
  45472. return self;
  45473. },
  45474. args: ["aContext"],
  45475. source: "context: aContext\x0a\x09context := aContext",
  45476. referencedClasses: [],
  45477. messageSends: []
  45478. }),
  45479. $globals.ASTInterpreter);
  45480. $core.addMethod(
  45481. $core.method({
  45482. selector: "enterNode",
  45483. protocol: "interpreting",
  45484. fn: function (){
  45485. var self=this,$self=this;
  45486. return $core.withContext(function($ctx1) {
  45487. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  45488. return self;
  45489. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  45490. },
  45491. args: [],
  45492. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  45493. referencedClasses: ["ASTEnterNode"],
  45494. messageSends: ["node:", "visit:", "on:", "node"]
  45495. }),
  45496. $globals.ASTInterpreter);
  45497. $core.addMethod(
  45498. $core.method({
  45499. selector: "eval:",
  45500. protocol: "private",
  45501. fn: function (aString){
  45502. var self=this,$self=this;
  45503. var source,function_;
  45504. return $core.withContext(function($ctx1) {
  45505. var $3,$2,$1;
  45506. source=$recv($globals.String)._streamContents_((function(str){
  45507. return $core.withContext(function($ctx2) {
  45508. $recv(str)._nextPutAll_("0,(function(");
  45509. $ctx2.sendIdx["nextPutAll:"]=1;
  45510. $3=$self._context();
  45511. $ctx2.sendIdx["context"]=1;
  45512. $2=$recv($3)._locals();
  45513. $ctx2.sendIdx["locals"]=1;
  45514. $1=$recv($2)._keys();
  45515. $recv($1)._do_separatedBy_((function(each){
  45516. return $core.withContext(function($ctx3) {
  45517. return $recv(str)._nextPutAll_(each);
  45518. $ctx3.sendIdx["nextPutAll:"]=2;
  45519. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  45520. }),(function(){
  45521. return $core.withContext(function($ctx3) {
  45522. return $recv(str)._nextPutAll_(",");
  45523. $ctx3.sendIdx["nextPutAll:"]=3;
  45524. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  45525. }));
  45526. $recv(str)._nextPutAll_("){ return (function() {");
  45527. $ctx2.sendIdx["nextPutAll:"]=4;
  45528. $recv(str)._nextPutAll_(aString);
  45529. $ctx2.sendIdx["nextPutAll:"]=5;
  45530. return $recv(str)._nextPutAll_("})()})");
  45531. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  45532. }));
  45533. function_=$recv($globals.Compiler)._eval_(source);
  45534. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  45535. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  45536. },
  45537. args: ["aString"],
  45538. 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",
  45539. referencedClasses: ["String", "Compiler"],
  45540. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  45541. }),
  45542. $globals.ASTInterpreter);
  45543. $core.addMethod(
  45544. $core.method({
  45545. selector: "hasReturned",
  45546. protocol: "testing",
  45547. fn: function (){
  45548. var self=this,$self=this;
  45549. return $core.withContext(function($ctx1) {
  45550. var $1,$receiver;
  45551. $1=$self["@returned"];
  45552. if(($receiver = $1) == null || $receiver.a$nil){
  45553. return false;
  45554. } else {
  45555. return $1;
  45556. }
  45557. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  45558. },
  45559. args: [],
  45560. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  45561. referencedClasses: [],
  45562. messageSends: ["ifNil:"]
  45563. }),
  45564. $globals.ASTInterpreter);
  45565. $core.addMethod(
  45566. $core.method({
  45567. selector: "initialize",
  45568. protocol: "initialization",
  45569. fn: function (){
  45570. var self=this,$self=this;
  45571. return $core.withContext(function($ctx1) {
  45572. (
  45573. $ctx1.supercall = true,
  45574. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  45575. $ctx1.supercall = false;
  45576. $self["@forceAtEnd"]=false;
  45577. return self;
  45578. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  45579. },
  45580. args: [],
  45581. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  45582. referencedClasses: [],
  45583. messageSends: ["initialize"]
  45584. }),
  45585. $globals.ASTInterpreter);
  45586. $core.addMethod(
  45587. $core.method({
  45588. selector: "interpret",
  45589. protocol: "interpreting",
  45590. fn: function (){
  45591. var self=this,$self=this;
  45592. return $core.withContext(function($ctx1) {
  45593. $self._visit_($self._node());
  45594. return self;
  45595. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  45596. },
  45597. args: [],
  45598. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  45599. referencedClasses: [],
  45600. messageSends: ["visit:", "node"]
  45601. }),
  45602. $globals.ASTInterpreter);
  45603. $core.addMethod(
  45604. $core.method({
  45605. selector: "messageFromSendNode:arguments:",
  45606. protocol: "private",
  45607. fn: function (aSendNode,aCollection){
  45608. var self=this,$self=this;
  45609. return $core.withContext(function($ctx1) {
  45610. var $1;
  45611. $1=$recv($globals.Message)._new();
  45612. $recv($1)._selector_($recv(aSendNode)._selector());
  45613. $recv($1)._arguments_(aCollection);
  45614. return $recv($1)._yourself();
  45615. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  45616. },
  45617. args: ["aSendNode", "aCollection"],
  45618. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  45619. referencedClasses: ["Message"],
  45620. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  45621. }),
  45622. $globals.ASTInterpreter);
  45623. $core.addMethod(
  45624. $core.method({
  45625. selector: "messageNotUnderstood:receiver:",
  45626. protocol: "private",
  45627. fn: function (aMessage,anObject){
  45628. var self=this,$self=this;
  45629. return $core.withContext(function($ctx1) {
  45630. var $1;
  45631. $1=$recv($globals.MessageNotUnderstood)._new();
  45632. $recv($1)._message_(aMessage);
  45633. $recv($1)._receiver_(anObject);
  45634. $recv($1)._signal();
  45635. return self;
  45636. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  45637. },
  45638. args: ["aMessage", "anObject"],
  45639. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  45640. referencedClasses: ["MessageNotUnderstood"],
  45641. messageSends: ["message:", "new", "receiver:", "signal"]
  45642. }),
  45643. $globals.ASTInterpreter);
  45644. $core.addMethod(
  45645. $core.method({
  45646. selector: "next",
  45647. protocol: "interpreting",
  45648. fn: function (){
  45649. var self=this,$self=this;
  45650. var nd,nextNode;
  45651. return $core.withContext(function($ctx1) {
  45652. var $1,$2,$receiver;
  45653. nd=$self._node();
  45654. $1=$recv(nd)._parent();
  45655. if(($receiver = $1) == null || $receiver.a$nil){
  45656. nextNode=$1;
  45657. } else {
  45658. var parent;
  45659. parent=$receiver;
  45660. $2=$recv(parent)._nextSiblingNode_(nd);
  45661. if(($receiver = $2) == null || $receiver.a$nil){
  45662. nextNode=parent;
  45663. } else {
  45664. var sibling;
  45665. sibling=$receiver;
  45666. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  45667. }
  45668. }
  45669. $self._node_(nextNode);
  45670. return self;
  45671. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  45672. },
  45673. args: [],
  45674. 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",
  45675. referencedClasses: ["ASTEnterNode"],
  45676. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  45677. }),
  45678. $globals.ASTInterpreter);
  45679. $core.addMethod(
  45680. $core.method({
  45681. selector: "node",
  45682. protocol: "accessing",
  45683. fn: function (){
  45684. var self=this,$self=this;
  45685. return $self["@node"];
  45686. },
  45687. args: [],
  45688. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  45689. referencedClasses: [],
  45690. messageSends: []
  45691. }),
  45692. $globals.ASTInterpreter);
  45693. $core.addMethod(
  45694. $core.method({
  45695. selector: "node:",
  45696. protocol: "accessing",
  45697. fn: function (aNode){
  45698. var self=this,$self=this;
  45699. $self["@node"]=aNode;
  45700. return self;
  45701. },
  45702. args: ["aNode"],
  45703. source: "node: aNode\x0a\x09node := aNode",
  45704. referencedClasses: [],
  45705. messageSends: []
  45706. }),
  45707. $globals.ASTInterpreter);
  45708. $core.addMethod(
  45709. $core.method({
  45710. selector: "peek",
  45711. protocol: "stack",
  45712. fn: function (){
  45713. var self=this,$self=this;
  45714. return $core.withContext(function($ctx1) {
  45715. var $1;
  45716. var $early={};
  45717. try {
  45718. $1=$self._stack();
  45719. $ctx1.sendIdx["stack"]=1;
  45720. $recv($1)._ifEmpty_((function(){
  45721. throw $early=[nil];
  45722. }));
  45723. return $recv($self._stack())._last();
  45724. }
  45725. catch(e) {if(e===$early)return e[0]; throw e}
  45726. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  45727. },
  45728. args: [],
  45729. 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",
  45730. referencedClasses: [],
  45731. messageSends: ["ifEmpty:", "stack", "last"]
  45732. }),
  45733. $globals.ASTInterpreter);
  45734. $core.addMethod(
  45735. $core.method({
  45736. selector: "pop",
  45737. protocol: "stack",
  45738. fn: function (){
  45739. var self=this,$self=this;
  45740. var peekedValue;
  45741. return $core.withContext(function($ctx1) {
  45742. peekedValue=$self._peek();
  45743. $recv($self._stack())._removeLast();
  45744. return peekedValue;
  45745. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  45746. },
  45747. args: [],
  45748. 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",
  45749. referencedClasses: [],
  45750. messageSends: ["peek", "removeLast", "stack"]
  45751. }),
  45752. $globals.ASTInterpreter);
  45753. $core.addMethod(
  45754. $core.method({
  45755. selector: "proceed",
  45756. protocol: "interpreting",
  45757. fn: function (){
  45758. var self=this,$self=this;
  45759. return $core.withContext(function($ctx1) {
  45760. $recv((function(){
  45761. return $core.withContext(function($ctx2) {
  45762. return $self._atEnd();
  45763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45764. }))._whileFalse_((function(){
  45765. return $core.withContext(function($ctx2) {
  45766. return $self._step();
  45767. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45768. }));
  45769. return self;
  45770. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  45771. },
  45772. args: [],
  45773. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  45774. referencedClasses: [],
  45775. messageSends: ["whileFalse:", "atEnd", "step"]
  45776. }),
  45777. $globals.ASTInterpreter);
  45778. $core.addMethod(
  45779. $core.method({
  45780. selector: "push:",
  45781. protocol: "stack",
  45782. fn: function (anObject){
  45783. var self=this,$self=this;
  45784. return $core.withContext(function($ctx1) {
  45785. return $recv($self._stack())._add_(anObject);
  45786. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  45787. },
  45788. args: ["anObject"],
  45789. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  45790. referencedClasses: [],
  45791. messageSends: ["add:", "stack"]
  45792. }),
  45793. $globals.ASTInterpreter);
  45794. $core.addMethod(
  45795. $core.method({
  45796. selector: "restart",
  45797. protocol: "interpreting",
  45798. fn: function (){
  45799. var self=this,$self=this;
  45800. return $core.withContext(function($ctx1) {
  45801. $self._node_($recv($self._context())._ast());
  45802. $self._enterNode();
  45803. return self;
  45804. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  45805. },
  45806. args: [],
  45807. source: "restart\x0a\x09self node: self context ast; enterNode",
  45808. referencedClasses: [],
  45809. messageSends: ["node:", "ast", "context", "enterNode"]
  45810. }),
  45811. $globals.ASTInterpreter);
  45812. $core.addMethod(
  45813. $core.method({
  45814. selector: "result",
  45815. protocol: "accessing",
  45816. fn: function (){
  45817. var self=this,$self=this;
  45818. return $core.withContext(function($ctx1) {
  45819. var $1;
  45820. $1=$self._hasReturned();
  45821. if($core.assert($1)){
  45822. return $self._returnValue();
  45823. } else {
  45824. return $recv($self._context())._receiver();
  45825. }
  45826. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  45827. },
  45828. args: [],
  45829. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  45830. referencedClasses: [],
  45831. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  45832. }),
  45833. $globals.ASTInterpreter);
  45834. $core.addMethod(
  45835. $core.method({
  45836. selector: "returnValue",
  45837. protocol: "accessing",
  45838. fn: function (){
  45839. var self=this,$self=this;
  45840. return $self["@returnValue"];
  45841. },
  45842. args: [],
  45843. source: "returnValue\x0a\x09^ returnValue",
  45844. referencedClasses: [],
  45845. messageSends: []
  45846. }),
  45847. $globals.ASTInterpreter);
  45848. $core.addMethod(
  45849. $core.method({
  45850. selector: "returnValue:",
  45851. protocol: "accessing",
  45852. fn: function (anObject){
  45853. var self=this,$self=this;
  45854. $self["@returnValue"]=anObject;
  45855. return self;
  45856. },
  45857. args: ["anObject"],
  45858. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  45859. referencedClasses: [],
  45860. messageSends: []
  45861. }),
  45862. $globals.ASTInterpreter);
  45863. $core.addMethod(
  45864. $core.method({
  45865. selector: "sendMessage:to:superSend:",
  45866. protocol: "private",
  45867. fn: function (aMessage,anObject,aBoolean){
  45868. var self=this,$self=this;
  45869. var method;
  45870. return $core.withContext(function($ctx1) {
  45871. var $2,$1,$3,$receiver;
  45872. var $early={};
  45873. try {
  45874. if(!$core.assert(aBoolean)){
  45875. return $recv(aMessage)._sendTo_(anObject);
  45876. }
  45877. $2=$recv(anObject)._class();
  45878. $ctx1.sendIdx["class"]=1;
  45879. $1=$recv($2)._superclass();
  45880. $ctx1.sendIdx["superclass"]=1;
  45881. if(($receiver = $1) == null || $receiver.a$nil){
  45882. $3=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  45883. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  45884. return $3;
  45885. } else {
  45886. $1;
  45887. }
  45888. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  45889. return $core.withContext(function($ctx2) {
  45890. throw $early=[$self._messageNotUnderstood_receiver_(aMessage,anObject)];
  45891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45892. }));
  45893. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  45894. }
  45895. catch(e) {if(e===$early)return e[0]; throw e}
  45896. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  45897. },
  45898. args: ["aMessage", "anObject", "aBoolean"],
  45899. 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",
  45900. referencedClasses: [],
  45901. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  45902. }),
  45903. $globals.ASTInterpreter);
  45904. $core.addMethod(
  45905. $core.method({
  45906. selector: "setNonLocalReturnFromContext:",
  45907. protocol: "interpreting",
  45908. fn: function (aContext){
  45909. var self=this,$self=this;
  45910. return $core.withContext(function($ctx1) {
  45911. var $2,$1;
  45912. $2=$recv(aContext)._interpreter();
  45913. $ctx1.sendIdx["interpreter"]=1;
  45914. $1=$recv($2)._hasReturned();
  45915. if($core.assert($1)){
  45916. $self["@returned"]=true;
  45917. $self["@returned"];
  45918. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  45919. }
  45920. return self;
  45921. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  45922. },
  45923. args: ["aContext"],
  45924. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  45925. referencedClasses: [],
  45926. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  45927. }),
  45928. $globals.ASTInterpreter);
  45929. $core.addMethod(
  45930. $core.method({
  45931. selector: "skip",
  45932. protocol: "interpreting",
  45933. fn: function (){
  45934. var self=this,$self=this;
  45935. return $core.withContext(function($ctx1) {
  45936. $self._next();
  45937. return self;
  45938. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  45939. },
  45940. args: [],
  45941. source: "skip\x0a\x09self next",
  45942. referencedClasses: [],
  45943. messageSends: ["next"]
  45944. }),
  45945. $globals.ASTInterpreter);
  45946. $core.addMethod(
  45947. $core.method({
  45948. selector: "stack",
  45949. protocol: "accessing",
  45950. fn: function (){
  45951. var self=this,$self=this;
  45952. return $core.withContext(function($ctx1) {
  45953. var $1,$receiver;
  45954. $1=$self["@stack"];
  45955. if(($receiver = $1) == null || $receiver.a$nil){
  45956. $self["@stack"]=$recv($globals.OrderedCollection)._new();
  45957. return $self["@stack"];
  45958. } else {
  45959. return $1;
  45960. }
  45961. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  45962. },
  45963. args: [],
  45964. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  45965. referencedClasses: ["OrderedCollection"],
  45966. messageSends: ["ifNil:", "new"]
  45967. }),
  45968. $globals.ASTInterpreter);
  45969. $core.addMethod(
  45970. $core.method({
  45971. selector: "step",
  45972. protocol: "interpreting",
  45973. fn: function (){
  45974. var self=this,$self=this;
  45975. return $core.withContext(function($ctx1) {
  45976. $self._interpret();
  45977. $self._next();
  45978. return self;
  45979. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  45980. },
  45981. args: [],
  45982. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  45983. referencedClasses: [],
  45984. messageSends: ["interpret", "next"]
  45985. }),
  45986. $globals.ASTInterpreter);
  45987. $core.addMethod(
  45988. $core.method({
  45989. selector: "stepOver",
  45990. protocol: "interpreting",
  45991. fn: function (){
  45992. var self=this,$self=this;
  45993. return $core.withContext(function($ctx1) {
  45994. var $2,$1;
  45995. $self._step();
  45996. $ctx1.sendIdx["step"]=1;
  45997. $recv((function(){
  45998. return $core.withContext(function($ctx2) {
  45999. $2=$self._node();
  46000. $ctx2.sendIdx["node"]=1;
  46001. $1=$recv($2)._isNil();
  46002. return $recv($1)._or_((function(){
  46003. return $core.withContext(function($ctx3) {
  46004. return $recv($self._node())._isSteppingNode();
  46005. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46006. }));
  46007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46008. }))._whileFalse_((function(){
  46009. return $core.withContext(function($ctx2) {
  46010. return $self._step();
  46011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46012. }));
  46013. return self;
  46014. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  46015. },
  46016. args: [],
  46017. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  46018. referencedClasses: [],
  46019. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  46020. }),
  46021. $globals.ASTInterpreter);
  46022. $core.addMethod(
  46023. $core.method({
  46024. selector: "visit:",
  46025. protocol: "visiting",
  46026. fn: function (aNode){
  46027. var self=this,$self=this;
  46028. return $core.withContext(function($ctx1) {
  46029. var $1;
  46030. $1=$self._hasReturned();
  46031. if(!$core.assert($1)){
  46032. (
  46033. $ctx1.supercall = true,
  46034. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  46035. $ctx1.supercall = false;
  46036. }
  46037. return self;
  46038. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  46039. },
  46040. args: ["aNode"],
  46041. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  46042. referencedClasses: [],
  46043. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  46044. }),
  46045. $globals.ASTInterpreter);
  46046. $core.addMethod(
  46047. $core.method({
  46048. selector: "visitAssignmentNode:",
  46049. protocol: "visiting",
  46050. fn: function (aNode){
  46051. var self=this,$self=this;
  46052. var poppedValue;
  46053. return $core.withContext(function($ctx1) {
  46054. poppedValue=$self._pop();
  46055. $ctx1.sendIdx["pop"]=1;
  46056. $self._pop();
  46057. $self._push_(poppedValue);
  46058. $self._assign_to_($recv(aNode)._left(),poppedValue);
  46059. return self;
  46060. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  46061. },
  46062. args: ["aNode"],
  46063. 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",
  46064. referencedClasses: [],
  46065. messageSends: ["pop", "push:", "assign:to:", "left"]
  46066. }),
  46067. $globals.ASTInterpreter);
  46068. $core.addMethod(
  46069. $core.method({
  46070. selector: "visitBlockNode:",
  46071. protocol: "visiting",
  46072. fn: function (aNode){
  46073. var self=this,$self=this;
  46074. var block;
  46075. return $core.withContext(function($ctx1) {
  46076. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  46077. $self._push_(block);
  46078. return self;
  46079. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  46080. },
  46081. args: ["aNode"],
  46082. 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",
  46083. referencedClasses: ["AIBlockClosure"],
  46084. messageSends: ["forContext:node:", "context", "push:"]
  46085. }),
  46086. $globals.ASTInterpreter);
  46087. $core.addMethod(
  46088. $core.method({
  46089. selector: "visitBlockSequenceNode:",
  46090. protocol: "visiting",
  46091. fn: function (aNode){
  46092. var self=this,$self=this;
  46093. return $core.withContext(function($ctx1) {
  46094. (
  46095. $ctx1.supercall = true,
  46096. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  46097. $ctx1.supercall = false;
  46098. $self["@forceAtEnd"]=true;
  46099. return self;
  46100. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46101. },
  46102. args: ["aNode"],
  46103. 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",
  46104. referencedClasses: [],
  46105. messageSends: ["visitBlockSequenceNode:"]
  46106. }),
  46107. $globals.ASTInterpreter);
  46108. $core.addMethod(
  46109. $core.method({
  46110. selector: "visitDagNode:",
  46111. protocol: "visiting",
  46112. fn: function (aNode){
  46113. var self=this,$self=this;
  46114. return self;
  46115. },
  46116. args: ["aNode"],
  46117. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  46118. referencedClasses: [],
  46119. messageSends: []
  46120. }),
  46121. $globals.ASTInterpreter);
  46122. $core.addMethod(
  46123. $core.method({
  46124. selector: "visitDynamicArrayNode:",
  46125. protocol: "visiting",
  46126. fn: function (aNode){
  46127. var self=this,$self=this;
  46128. var array;
  46129. return $core.withContext(function($ctx1) {
  46130. array=[];
  46131. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46132. return $core.withContext(function($ctx2) {
  46133. return $recv(array)._addFirst_($self._pop());
  46134. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46135. }));
  46136. $self._push_(array);
  46137. return self;
  46138. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  46139. },
  46140. args: ["aNode"],
  46141. 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",
  46142. referencedClasses: [],
  46143. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  46144. }),
  46145. $globals.ASTInterpreter);
  46146. $core.addMethod(
  46147. $core.method({
  46148. selector: "visitDynamicDictionaryNode:",
  46149. protocol: "visiting",
  46150. fn: function (aNode){
  46151. var self=this,$self=this;
  46152. var keyValueList;
  46153. return $core.withContext(function($ctx1) {
  46154. keyValueList=$recv($globals.OrderedCollection)._new();
  46155. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46156. return $core.withContext(function($ctx2) {
  46157. return $recv(keyValueList)._add_($self._pop());
  46158. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46159. }));
  46160. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  46161. return self;
  46162. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  46163. },
  46164. args: ["aNode"],
  46165. 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)",
  46166. referencedClasses: ["OrderedCollection", "HashedCollection"],
  46167. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  46168. }),
  46169. $globals.ASTInterpreter);
  46170. $core.addMethod(
  46171. $core.method({
  46172. selector: "visitJSStatementNode:",
  46173. protocol: "visiting",
  46174. fn: function (aNode){
  46175. var self=this,$self=this;
  46176. return $core.withContext(function($ctx1) {
  46177. $self["@returned"]=true;
  46178. $self._returnValue_($self._eval_($recv(aNode)._source()));
  46179. return self;
  46180. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46181. },
  46182. args: ["aNode"],
  46183. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  46184. referencedClasses: [],
  46185. messageSends: ["returnValue:", "eval:", "source"]
  46186. }),
  46187. $globals.ASTInterpreter);
  46188. $core.addMethod(
  46189. $core.method({
  46190. selector: "visitReturnNode:",
  46191. protocol: "visiting",
  46192. fn: function (aNode){
  46193. var self=this,$self=this;
  46194. return $core.withContext(function($ctx1) {
  46195. $self["@returned"]=true;
  46196. $self._returnValue_($self._pop());
  46197. return self;
  46198. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46199. },
  46200. args: ["aNode"],
  46201. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  46202. referencedClasses: [],
  46203. messageSends: ["returnValue:", "pop"]
  46204. }),
  46205. $globals.ASTInterpreter);
  46206. $core.addMethod(
  46207. $core.method({
  46208. selector: "visitSendNode:",
  46209. protocol: "visiting",
  46210. fn: function (aNode){
  46211. var self=this,$self=this;
  46212. var receiver,args,message,result;
  46213. return $core.withContext(function($ctx1) {
  46214. var $1;
  46215. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  46216. return $core.withContext(function($ctx2) {
  46217. return $self._pop();
  46218. $ctx2.sendIdx["pop"]=1;
  46219. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46220. }));
  46221. receiver=$self._peek();
  46222. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  46223. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  46224. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  46225. return $core.withContext(function($ctx2) {
  46226. return $recv($recv(aNode)._isLastChild())._not();
  46227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46228. }));
  46229. if(!$core.assert($1)){
  46230. $self._pop();
  46231. $self._push_(result);
  46232. }
  46233. return self;
  46234. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  46235. },
  46236. args: ["aNode"],
  46237. 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 ]",
  46238. referencedClasses: [],
  46239. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  46240. }),
  46241. $globals.ASTInterpreter);
  46242. $core.addMethod(
  46243. $core.method({
  46244. selector: "visitValueNode:",
  46245. protocol: "visiting",
  46246. fn: function (aNode){
  46247. var self=this,$self=this;
  46248. return $core.withContext(function($ctx1) {
  46249. $self._push_($recv(aNode)._value());
  46250. return self;
  46251. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46252. },
  46253. args: ["aNode"],
  46254. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  46255. referencedClasses: [],
  46256. messageSends: ["push:", "value"]
  46257. }),
  46258. $globals.ASTInterpreter);
  46259. $core.addMethod(
  46260. $core.method({
  46261. selector: "visitVariableNode:",
  46262. protocol: "visiting",
  46263. fn: function (aNode){
  46264. var self=this,$self=this;
  46265. return $core.withContext(function($ctx1) {
  46266. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  46267. $2=$recv(aNode)._binding();
  46268. $ctx1.sendIdx["binding"]=1;
  46269. $1=$recv($2)._isUnknownVar();
  46270. if($core.assert($1)){
  46271. $5=$recv($globals.Platform)._globals();
  46272. $ctx1.sendIdx["globals"]=1;
  46273. $6=$recv(aNode)._value();
  46274. $ctx1.sendIdx["value"]=1;
  46275. $4=$recv($5)._at_ifAbsent_($6,(function(){
  46276. return $core.withContext(function($ctx2) {
  46277. return $self._error_("Unknown variable");
  46278. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46279. }));
  46280. $ctx1.sendIdx["at:ifAbsent:"]=1;
  46281. $3=$self._push_($4);
  46282. $ctx1.sendIdx["push:"]=1;
  46283. return $3;
  46284. }
  46285. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  46286. if($core.assert($8)){
  46287. $10=$self._context();
  46288. $ctx1.sendIdx["context"]=1;
  46289. $9=$recv($10)._receiver();
  46290. $11=$recv(aNode)._value();
  46291. $ctx1.sendIdx["value"]=2;
  46292. $7=$recv($9)._instVarAt_($11);
  46293. } else {
  46294. $12=$self._context();
  46295. $13=$recv(aNode)._value();
  46296. $ctx1.sendIdx["value"]=3;
  46297. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  46298. return $core.withContext(function($ctx2) {
  46299. $15=$recv(aNode)._value();
  46300. $ctx2.sendIdx["value"]=4;
  46301. $14=$recv($15)._isCapitalized();
  46302. if($core.assert($14)){
  46303. $16=$recv($globals.Smalltalk)._globals();
  46304. $ctx2.sendIdx["globals"]=2;
  46305. $17=$recv(aNode)._value();
  46306. $ctx2.sendIdx["value"]=5;
  46307. return $recv($16)._at_ifAbsent_($17,(function(){
  46308. return $core.withContext(function($ctx3) {
  46309. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  46310. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  46311. }));
  46312. }
  46313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  46314. }));
  46315. }
  46316. $self._push_($7);
  46317. return self;
  46318. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46319. },
  46320. args: ["aNode"],
  46321. 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 ] ] ] ])",
  46322. referencedClasses: ["Platform", "Smalltalk"],
  46323. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  46324. }),
  46325. $globals.ASTInterpreter);
  46326. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  46327. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  46328. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  46329. $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`";
  46330. $core.addMethod(
  46331. $core.method({
  46332. selector: "currentNode",
  46333. protocol: "accessing",
  46334. fn: function (){
  46335. var self=this,$self=this;
  46336. return $self["@currentNode"];
  46337. },
  46338. args: [],
  46339. source: "currentNode\x0a\x09^ currentNode",
  46340. referencedClasses: [],
  46341. messageSends: []
  46342. }),
  46343. $globals.ASTPCNodeVisitor);
  46344. $core.addMethod(
  46345. $core.method({
  46346. selector: "increaseTrackedIndex",
  46347. protocol: "accessing",
  46348. fn: function (){
  46349. var self=this,$self=this;
  46350. return $core.withContext(function($ctx1) {
  46351. $self["@trackedIndex"]=$recv($self._trackedIndex()).__plus((1));
  46352. return self;
  46353. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  46354. },
  46355. args: [],
  46356. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  46357. referencedClasses: [],
  46358. messageSends: ["+", "trackedIndex"]
  46359. }),
  46360. $globals.ASTPCNodeVisitor);
  46361. $core.addMethod(
  46362. $core.method({
  46363. selector: "index",
  46364. protocol: "accessing",
  46365. fn: function (){
  46366. var self=this,$self=this;
  46367. return $self["@index"];
  46368. },
  46369. args: [],
  46370. source: "index\x0a\x09^ index",
  46371. referencedClasses: [],
  46372. messageSends: []
  46373. }),
  46374. $globals.ASTPCNodeVisitor);
  46375. $core.addMethod(
  46376. $core.method({
  46377. selector: "index:",
  46378. protocol: "accessing",
  46379. fn: function (aNumber){
  46380. var self=this,$self=this;
  46381. $self["@index"]=aNumber;
  46382. return self;
  46383. },
  46384. args: ["aNumber"],
  46385. source: "index: aNumber\x0a\x09index := aNumber",
  46386. referencedClasses: [],
  46387. messageSends: []
  46388. }),
  46389. $globals.ASTPCNodeVisitor);
  46390. $core.addMethod(
  46391. $core.method({
  46392. selector: "selector",
  46393. protocol: "accessing",
  46394. fn: function (){
  46395. var self=this,$self=this;
  46396. return $self["@selector"];
  46397. },
  46398. args: [],
  46399. source: "selector\x0a\x09^ selector",
  46400. referencedClasses: [],
  46401. messageSends: []
  46402. }),
  46403. $globals.ASTPCNodeVisitor);
  46404. $core.addMethod(
  46405. $core.method({
  46406. selector: "selector:",
  46407. protocol: "accessing",
  46408. fn: function (aString){
  46409. var self=this,$self=this;
  46410. $self["@selector"]=aString;
  46411. return self;
  46412. },
  46413. args: ["aString"],
  46414. source: "selector: aString\x0a\x09selector := aString",
  46415. referencedClasses: [],
  46416. messageSends: []
  46417. }),
  46418. $globals.ASTPCNodeVisitor);
  46419. $core.addMethod(
  46420. $core.method({
  46421. selector: "trackedIndex",
  46422. protocol: "accessing",
  46423. fn: function (){
  46424. var self=this,$self=this;
  46425. return $core.withContext(function($ctx1) {
  46426. var $1,$receiver;
  46427. $1=$self["@trackedIndex"];
  46428. if(($receiver = $1) == null || $receiver.a$nil){
  46429. $self["@trackedIndex"]=(0);
  46430. return $self["@trackedIndex"];
  46431. } else {
  46432. return $1;
  46433. }
  46434. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  46435. },
  46436. args: [],
  46437. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  46438. referencedClasses: [],
  46439. messageSends: ["ifNil:"]
  46440. }),
  46441. $globals.ASTPCNodeVisitor);
  46442. $core.addMethod(
  46443. $core.method({
  46444. selector: "visitJSStatementNode:",
  46445. protocol: "visiting",
  46446. fn: function (aNode){
  46447. var self=this,$self=this;
  46448. $self["@currentNode"]=aNode;
  46449. return self;
  46450. },
  46451. args: ["aNode"],
  46452. 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",
  46453. referencedClasses: [],
  46454. messageSends: []
  46455. }),
  46456. $globals.ASTPCNodeVisitor);
  46457. $core.addMethod(
  46458. $core.method({
  46459. selector: "visitSendNode:",
  46460. protocol: "visiting",
  46461. fn: function (aNode){
  46462. var self=this,$self=this;
  46463. return $core.withContext(function($ctx1) {
  46464. var $2,$1,$3;
  46465. (
  46466. $ctx1.supercall = true,
  46467. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  46468. $ctx1.supercall = false;
  46469. $2=$self._selector();
  46470. $ctx1.sendIdx["selector"]=1;
  46471. $1=$recv($2).__eq($recv(aNode)._selector());
  46472. $ctx1.sendIdx["="]=1;
  46473. if($core.assert($1)){
  46474. $3=$recv($self._trackedIndex()).__eq($self._index());
  46475. if($core.assert($3)){
  46476. $self["@currentNode"]=aNode;
  46477. $self["@currentNode"];
  46478. }
  46479. $self._increaseTrackedIndex();
  46480. }
  46481. return self;
  46482. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  46483. },
  46484. args: ["aNode"],
  46485. 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 ]",
  46486. referencedClasses: [],
  46487. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  46488. }),
  46489. $globals.ASTPCNodeVisitor);
  46490. $core.addMethod(
  46491. $core.method({
  46492. selector: "isLastChild",
  46493. protocol: "*Compiler-Interpreter",
  46494. fn: function (){
  46495. var self=this,$self=this;
  46496. return $core.withContext(function($ctx1) {
  46497. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  46498. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  46499. },
  46500. args: [],
  46501. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  46502. referencedClasses: [],
  46503. messageSends: ["=", "last", "dagChildren", "parent"]
  46504. }),
  46505. $globals.ASTNode);
  46506. $core.addMethod(
  46507. $core.method({
  46508. selector: "isSteppingNode",
  46509. protocol: "*Compiler-Interpreter",
  46510. fn: function (){
  46511. var self=this,$self=this;
  46512. return false;
  46513. },
  46514. args: [],
  46515. source: "isSteppingNode\x0a\x09^ false",
  46516. referencedClasses: [],
  46517. messageSends: []
  46518. }),
  46519. $globals.ASTNode);
  46520. $core.addMethod(
  46521. $core.method({
  46522. selector: "nextSiblingNode:",
  46523. protocol: "*Compiler-Interpreter",
  46524. fn: function (aNode){
  46525. var self=this,$self=this;
  46526. return $core.withContext(function($ctx1) {
  46527. var $1;
  46528. var $early={};
  46529. try {
  46530. $1=$self._dagChildren();
  46531. $ctx1.sendIdx["dagChildren"]=1;
  46532. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  46533. throw $early=[nil];
  46534. }));
  46535. }
  46536. catch(e) {if(e===$early)return e[0]; throw e}
  46537. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  46538. },
  46539. args: ["aNode"],
  46540. 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 ]",
  46541. referencedClasses: [],
  46542. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  46543. }),
  46544. $globals.ASTNode);
  46545. $core.addMethod(
  46546. $core.method({
  46547. selector: "isSteppingNode",
  46548. protocol: "*Compiler-Interpreter",
  46549. fn: function (){
  46550. var self=this,$self=this;
  46551. return true;
  46552. },
  46553. args: [],
  46554. source: "isSteppingNode\x0a\x09^ true",
  46555. referencedClasses: [],
  46556. messageSends: []
  46557. }),
  46558. $globals.AssignmentNode);
  46559. $core.addMethod(
  46560. $core.method({
  46561. selector: "isSteppingNode",
  46562. protocol: "*Compiler-Interpreter",
  46563. fn: function (){
  46564. var self=this,$self=this;
  46565. return true;
  46566. },
  46567. args: [],
  46568. source: "isSteppingNode\x0a\x09^ true",
  46569. referencedClasses: [],
  46570. messageSends: []
  46571. }),
  46572. $globals.BlockNode);
  46573. $core.addMethod(
  46574. $core.method({
  46575. selector: "nextSiblingNode:",
  46576. protocol: "*Compiler-Interpreter",
  46577. fn: function (aNode){
  46578. var self=this,$self=this;
  46579. return nil;
  46580. },
  46581. args: ["aNode"],
  46582. 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",
  46583. referencedClasses: [],
  46584. messageSends: []
  46585. }),
  46586. $globals.BlockNode);
  46587. $core.addMethod(
  46588. $core.method({
  46589. selector: "isSteppingNode",
  46590. protocol: "*Compiler-Interpreter",
  46591. fn: function (){
  46592. var self=this,$self=this;
  46593. return true;
  46594. },
  46595. args: [],
  46596. source: "isSteppingNode\x0a\x09^ true",
  46597. referencedClasses: [],
  46598. messageSends: []
  46599. }),
  46600. $globals.DynamicArrayNode);
  46601. $core.addMethod(
  46602. $core.method({
  46603. selector: "isSteppingNode",
  46604. protocol: "*Compiler-Interpreter",
  46605. fn: function (){
  46606. var self=this,$self=this;
  46607. return true;
  46608. },
  46609. args: [],
  46610. source: "isSteppingNode\x0a\x09^ true",
  46611. referencedClasses: [],
  46612. messageSends: []
  46613. }),
  46614. $globals.DynamicDictionaryNode);
  46615. $core.addMethod(
  46616. $core.method({
  46617. selector: "isSteppingNode",
  46618. protocol: "*Compiler-Interpreter",
  46619. fn: function (){
  46620. var self=this,$self=this;
  46621. return true;
  46622. },
  46623. args: [],
  46624. source: "isSteppingNode\x0a\x09^ true",
  46625. referencedClasses: [],
  46626. messageSends: []
  46627. }),
  46628. $globals.JSStatementNode);
  46629. $core.addMethod(
  46630. $core.method({
  46631. selector: "isCascadeSendNode",
  46632. protocol: "*Compiler-Interpreter",
  46633. fn: function (){
  46634. var self=this,$self=this;
  46635. return $core.withContext(function($ctx1) {
  46636. return $recv($self._parent())._isCascadeNode();
  46637. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  46638. },
  46639. args: [],
  46640. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  46641. referencedClasses: [],
  46642. messageSends: ["isCascadeNode", "parent"]
  46643. }),
  46644. $globals.SendNode);
  46645. $core.addMethod(
  46646. $core.method({
  46647. selector: "isSteppingNode",
  46648. protocol: "*Compiler-Interpreter",
  46649. fn: function (){
  46650. var self=this,$self=this;
  46651. return true;
  46652. },
  46653. args: [],
  46654. source: "isSteppingNode\x0a\x09^ true",
  46655. referencedClasses: [],
  46656. messageSends: []
  46657. }),
  46658. $globals.SendNode);
  46659. });
  46660. define('amber/lang',[
  46661. './deploy',
  46662. './boot', // pre-fetch, dep of ./helpers
  46663. './helpers', // pre-fetch, dep of ./deploy
  46664. './parser',
  46665. // --- packages for the Amber reflection begin here ---
  46666. 'amber_core/Platform-ImportExport',
  46667. 'amber_core/Compiler-Core',
  46668. 'amber_core/Compiler-AST',
  46669. 'amber_core/Compiler-Semantic',
  46670. 'amber_core/Compiler-IR',
  46671. 'amber_core/Compiler-Inlining',
  46672. 'amber_core/Compiler-Interpreter'
  46673. // --- packages for the Amber reflection end here ---
  46674. ], function (amber) {
  46675. return amber;
  46676. });
  46677. define('amber_core/Platform-DOM',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  46678. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  46679. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  46680. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  46681. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  46682. $core.addPackage("Platform-DOM");
  46683. $core.packages["Platform-DOM"].innerEval = function (expr) { return eval(expr); };
  46684. $core.packages["Platform-DOM"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46685. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  46686. $core.addMethod(
  46687. $core.method({
  46688. selector: "isDomNode:",
  46689. protocol: "testing",
  46690. fn: function (anObject){
  46691. var self=this,$self=this;
  46692. return $core.withContext(function($ctx1) {
  46693. return anObject.nodeType > 0 &&
  46694. Object.prototype.toString.call(anObject) !== "[object Object]";
  46695. return self;
  46696. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.a$cls)});
  46697. },
  46698. args: ["anObject"],
  46699. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  46700. referencedClasses: [],
  46701. messageSends: []
  46702. }),
  46703. $globals.PlatformDom.a$cls);
  46704. $core.addMethod(
  46705. $core.method({
  46706. selector: "isFeasible",
  46707. protocol: "testing",
  46708. fn: function (){
  46709. var self=this,$self=this;
  46710. return $core.withContext(function($ctx1) {
  46711. if (typeof document === "undefined") return false;
  46712. try {
  46713. var d = document.createElement("div"),
  46714. f = document.createDocumentFragment(),
  46715. t = document.createTextNode("Hello, Amber!");
  46716. f.appendChild(t);
  46717. d.insertBefore(f, null);
  46718. return d.innerHTML === "Hello, Amber!";
  46719. } catch (e) {
  46720. return false;
  46721. };
  46722. return self;
  46723. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.a$cls)});
  46724. },
  46725. args: [],
  46726. 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'>",
  46727. referencedClasses: [],
  46728. messageSends: []
  46729. }),
  46730. $globals.PlatformDom.a$cls);
  46731. $core.addMethod(
  46732. $core.method({
  46733. selector: "newCustomEvent:detail:",
  46734. protocol: "creation",
  46735. fn: function (aString,anObject){
  46736. var self=this,$self=this;
  46737. return $core.withContext(function($ctx1) {
  46738. return new CustomEvent(aString, {detail: anObject});
  46739. return self;
  46740. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.a$cls)});
  46741. },
  46742. args: ["aString", "anObject"],
  46743. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  46744. referencedClasses: [],
  46745. messageSends: []
  46746. }),
  46747. $globals.PlatformDom.a$cls);
  46748. $core.addMethod(
  46749. $core.method({
  46750. selector: "toArray:",
  46751. protocol: "converting",
  46752. fn: function (aDomList){
  46753. var self=this,$self=this;
  46754. return $core.withContext(function($ctx1) {
  46755. return Array.prototype.slice.call(aDomList);
  46756. return self;
  46757. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.a$cls)});
  46758. },
  46759. args: ["aDomList"],
  46760. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  46761. referencedClasses: [],
  46762. messageSends: []
  46763. }),
  46764. $globals.PlatformDom.a$cls);
  46765. $core.addMethod(
  46766. $core.method({
  46767. selector: "asDomNode",
  46768. protocol: "*Platform-DOM",
  46769. fn: function (){
  46770. var self=this,$self=this;
  46771. return $core.withContext(function($ctx1) {
  46772. return $recv(document)._createTextNode_($self._asString());
  46773. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.CharacterArray)});
  46774. },
  46775. args: [],
  46776. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  46777. referencedClasses: [],
  46778. messageSends: ["createTextNode:", "asString"]
  46779. }),
  46780. $globals.CharacterArray);
  46781. $core.addMethod(
  46782. $core.method({
  46783. selector: "asDomNode",
  46784. protocol: "*Platform-DOM",
  46785. fn: function (){
  46786. var self=this,$self=this;
  46787. var fragment;
  46788. return $core.withContext(function($ctx1) {
  46789. fragment=$recv(document)._createDocumentFragment();
  46790. $self._do_((function(each){
  46791. return $core.withContext(function($ctx2) {
  46792. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  46793. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46794. }));
  46795. return fragment;
  46796. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  46797. },
  46798. args: [],
  46799. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  46800. referencedClasses: [],
  46801. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  46802. }),
  46803. $globals.Collection);
  46804. $core.addMethod(
  46805. $core.method({
  46806. selector: "asDomNode",
  46807. protocol: "*Platform-DOM",
  46808. fn: function (){
  46809. var self=this,$self=this;
  46810. return $core.withContext(function($ctx1) {
  46811. var $1,$2;
  46812. $1=$recv($globals.PlatformDom)._isDomNode_($self["@jsObject"]);
  46813. if($core.assert($1)){
  46814. return $self["@jsObject"];
  46815. } else {
  46816. $2=(
  46817. $ctx1.supercall = true,
  46818. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, []));
  46819. $ctx1.supercall = false;
  46820. return $2;
  46821. }
  46822. return self;
  46823. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  46824. },
  46825. args: [],
  46826. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  46827. referencedClasses: ["PlatformDom"],
  46828. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  46829. }),
  46830. $globals.JSObjectProxy);
  46831. $core.addMethod(
  46832. $core.method({
  46833. selector: "htmlTextContent",
  46834. protocol: "*Platform-DOM",
  46835. fn: function (){
  46836. var self=this,$self=this;
  46837. return $core.withContext(function($ctx1) {
  46838. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  46839. return self;
  46840. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  46841. },
  46842. args: [],
  46843. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  46844. referencedClasses: [],
  46845. messageSends: []
  46846. }),
  46847. $globals.String);
  46848. });
  46849. 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";
  46850. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  46851. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  46852. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  46853. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  46854. $core.addPackage("SUnit");
  46855. $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
  46856. $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46857. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  46858. $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.";
  46859. $core.addMethod(
  46860. $core.method({
  46861. selector: "result",
  46862. protocol: "accessing",
  46863. fn: function (){
  46864. var self=this,$self=this;
  46865. return $self["@result"];
  46866. },
  46867. args: [],
  46868. source: "result\x0a\x09^ result",
  46869. referencedClasses: [],
  46870. messageSends: []
  46871. }),
  46872. $globals.ResultAnnouncement);
  46873. $core.addMethod(
  46874. $core.method({
  46875. selector: "result:",
  46876. protocol: "accessing",
  46877. fn: function (aTestResult){
  46878. var self=this,$self=this;
  46879. $self["@result"]=aTestResult;
  46880. return self;
  46881. },
  46882. args: ["aTestResult"],
  46883. source: "result: aTestResult\x0a\x09result := aTestResult",
  46884. referencedClasses: [],
  46885. messageSends: []
  46886. }),
  46887. $globals.ResultAnnouncement);
  46888. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  46889. $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.";
  46890. $core.addMethod(
  46891. $core.method({
  46892. selector: "assert:",
  46893. protocol: "testing",
  46894. fn: function (aBoolean){
  46895. var self=this,$self=this;
  46896. return $core.withContext(function($ctx1) {
  46897. $self._assert_description_(aBoolean,"Assertion failed");
  46898. return self;
  46899. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  46900. },
  46901. args: ["aBoolean"],
  46902. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  46903. referencedClasses: [],
  46904. messageSends: ["assert:description:"]
  46905. }),
  46906. $globals.TestCase);
  46907. $core.addMethod(
  46908. $core.method({
  46909. selector: "assert:description:",
  46910. protocol: "testing",
  46911. fn: function (aBoolean,aString){
  46912. var self=this,$self=this;
  46913. return $core.withContext(function($ctx1) {
  46914. if(!$core.assert(aBoolean)){
  46915. $self._signalFailure_(aString);
  46916. }
  46917. return self;
  46918. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  46919. },
  46920. args: ["aBoolean", "aString"],
  46921. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  46922. referencedClasses: [],
  46923. messageSends: ["ifFalse:", "signalFailure:"]
  46924. }),
  46925. $globals.TestCase);
  46926. $core.addMethod(
  46927. $core.method({
  46928. selector: "assert:equals:",
  46929. protocol: "testing",
  46930. fn: function (actual,expected){
  46931. var self=this,$self=this;
  46932. return $core.withContext(function($ctx1) {
  46933. var $1,$5,$4,$3,$2;
  46934. $1=$recv(actual).__eq(expected);
  46935. $5=$recv(expected)._printString();
  46936. $ctx1.sendIdx["printString"]=1;
  46937. $4="Expected: ".__comma($5);
  46938. $3=$recv($4).__comma(" but was: ");
  46939. $ctx1.sendIdx[","]=2;
  46940. $2=$recv($3).__comma($recv(actual)._printString());
  46941. $ctx1.sendIdx[","]=1;
  46942. return $self._assert_description_($1,$2);
  46943. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  46944. },
  46945. args: ["actual", "expected"],
  46946. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  46947. referencedClasses: [],
  46948. messageSends: ["assert:description:", "=", ",", "printString"]
  46949. }),
  46950. $globals.TestCase);
  46951. $core.addMethod(
  46952. $core.method({
  46953. selector: "async:",
  46954. protocol: "async",
  46955. fn: function (aBlock){
  46956. var self=this,$self=this;
  46957. var c;
  46958. return $core.withContext(function($ctx1) {
  46959. var $1;
  46960. $self._errorIfNotAsync_("#async");
  46961. c=$self["@context"];
  46962. return (function(){
  46963. return $core.withContext(function($ctx2) {
  46964. $1=$self._isAsync();
  46965. if($core.assert($1)){
  46966. return $recv(c)._execute_(aBlock);
  46967. }
  46968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46969. });
  46970. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  46971. },
  46972. args: ["aBlock"],
  46973. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  46974. referencedClasses: [],
  46975. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  46976. }),
  46977. $globals.TestCase);
  46978. $core.addMethod(
  46979. $core.method({
  46980. selector: "context:",
  46981. protocol: "accessing",
  46982. fn: function (aRunningTestContext){
  46983. var self=this,$self=this;
  46984. $self["@context"]=aRunningTestContext;
  46985. return self;
  46986. },
  46987. args: ["aRunningTestContext"],
  46988. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  46989. referencedClasses: [],
  46990. messageSends: []
  46991. }),
  46992. $globals.TestCase);
  46993. $core.addMethod(
  46994. $core.method({
  46995. selector: "deny:",
  46996. protocol: "testing",
  46997. fn: function (aBoolean){
  46998. var self=this,$self=this;
  46999. return $core.withContext(function($ctx1) {
  47000. $self._assert_($recv(aBoolean)._not());
  47001. return self;
  47002. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  47003. },
  47004. args: ["aBoolean"],
  47005. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  47006. referencedClasses: [],
  47007. messageSends: ["assert:", "not"]
  47008. }),
  47009. $globals.TestCase);
  47010. $core.addMethod(
  47011. $core.method({
  47012. selector: "errorIfNotAsync:",
  47013. protocol: "error handling",
  47014. fn: function (aString){
  47015. var self=this,$self=this;
  47016. return $core.withContext(function($ctx1) {
  47017. var $1;
  47018. $1=$self._isAsync();
  47019. if(!$core.assert($1)){
  47020. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  47021. }
  47022. return self;
  47023. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  47024. },
  47025. args: ["aString"],
  47026. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  47027. referencedClasses: [],
  47028. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  47029. }),
  47030. $globals.TestCase);
  47031. $core.addMethod(
  47032. $core.method({
  47033. selector: "finished",
  47034. protocol: "async",
  47035. fn: function (){
  47036. var self=this,$self=this;
  47037. return $core.withContext(function($ctx1) {
  47038. $self._errorIfNotAsync_("#finished");
  47039. $self["@asyncTimeout"]=nil;
  47040. return self;
  47041. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  47042. },
  47043. args: [],
  47044. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  47045. referencedClasses: [],
  47046. messageSends: ["errorIfNotAsync:"]
  47047. }),
  47048. $globals.TestCase);
  47049. $core.addMethod(
  47050. $core.method({
  47051. selector: "isAsync",
  47052. protocol: "testing",
  47053. fn: function (){
  47054. var self=this,$self=this;
  47055. return $core.withContext(function($ctx1) {
  47056. return $recv($self["@asyncTimeout"])._notNil();
  47057. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  47058. },
  47059. args: [],
  47060. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  47061. referencedClasses: [],
  47062. messageSends: ["notNil"]
  47063. }),
  47064. $globals.TestCase);
  47065. $core.addMethod(
  47066. $core.method({
  47067. selector: "performTest",
  47068. protocol: "running",
  47069. fn: function (){
  47070. var self=this,$self=this;
  47071. return $core.withContext(function($ctx1) {
  47072. $self["@asyncTimeout"]=nil;
  47073. $self._perform_($self._selector());
  47074. return self;
  47075. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  47076. },
  47077. args: [],
  47078. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  47079. referencedClasses: [],
  47080. messageSends: ["perform:", "selector"]
  47081. }),
  47082. $globals.TestCase);
  47083. $core.addMethod(
  47084. $core.method({
  47085. selector: "runCase",
  47086. protocol: "running",
  47087. fn: function (){
  47088. var self=this,$self=this;
  47089. return $core.withContext(function($ctx1) {
  47090. $recv($recv($globals.TestContext)._testCase_(self))._start();
  47091. return self;
  47092. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  47093. },
  47094. args: [],
  47095. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  47096. referencedClasses: ["TestContext"],
  47097. messageSends: ["start", "testCase:"]
  47098. }),
  47099. $globals.TestCase);
  47100. $core.addMethod(
  47101. $core.method({
  47102. selector: "selector",
  47103. protocol: "accessing",
  47104. fn: function (){
  47105. var self=this,$self=this;
  47106. return $self["@testSelector"];
  47107. },
  47108. args: [],
  47109. source: "selector\x0a\x09^ testSelector",
  47110. referencedClasses: [],
  47111. messageSends: []
  47112. }),
  47113. $globals.TestCase);
  47114. $core.addMethod(
  47115. $core.method({
  47116. selector: "setTestSelector:",
  47117. protocol: "accessing",
  47118. fn: function (aSelector){
  47119. var self=this,$self=this;
  47120. $self["@testSelector"]=aSelector;
  47121. return self;
  47122. },
  47123. args: ["aSelector"],
  47124. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  47125. referencedClasses: [],
  47126. messageSends: []
  47127. }),
  47128. $globals.TestCase);
  47129. $core.addMethod(
  47130. $core.method({
  47131. selector: "setUp",
  47132. protocol: "running",
  47133. fn: function (){
  47134. var self=this,$self=this;
  47135. return self;
  47136. },
  47137. args: [],
  47138. source: "setUp",
  47139. referencedClasses: [],
  47140. messageSends: []
  47141. }),
  47142. $globals.TestCase);
  47143. $core.addMethod(
  47144. $core.method({
  47145. selector: "should:",
  47146. protocol: "testing",
  47147. fn: function (aBlock){
  47148. var self=this,$self=this;
  47149. return $core.withContext(function($ctx1) {
  47150. $self._assert_($recv(aBlock)._value());
  47151. return self;
  47152. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  47153. },
  47154. args: ["aBlock"],
  47155. source: "should: aBlock\x0a\x09self assert: aBlock value",
  47156. referencedClasses: [],
  47157. messageSends: ["assert:", "value"]
  47158. }),
  47159. $globals.TestCase);
  47160. $core.addMethod(
  47161. $core.method({
  47162. selector: "should:raise:",
  47163. protocol: "testing",
  47164. fn: function (aBlock,anExceptionClass){
  47165. var self=this,$self=this;
  47166. return $core.withContext(function($ctx1) {
  47167. $self._assert_($recv((function(){
  47168. return $core.withContext(function($ctx2) {
  47169. $recv(aBlock)._value();
  47170. return false;
  47171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47172. }))._on_do_(anExceptionClass,(function(ex){
  47173. return true;
  47174. })));
  47175. return self;
  47176. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47177. },
  47178. args: ["aBlock", "anExceptionClass"],
  47179. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  47180. referencedClasses: [],
  47181. messageSends: ["assert:", "on:do:", "value"]
  47182. }),
  47183. $globals.TestCase);
  47184. $core.addMethod(
  47185. $core.method({
  47186. selector: "shouldnt:raise:",
  47187. protocol: "testing",
  47188. fn: function (aBlock,anExceptionClass){
  47189. var self=this,$self=this;
  47190. return $core.withContext(function($ctx1) {
  47191. $self._assert_($recv((function(){
  47192. return $core.withContext(function($ctx2) {
  47193. $recv(aBlock)._value();
  47194. return true;
  47195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47196. }))._on_do_(anExceptionClass,(function(ex){
  47197. return false;
  47198. })));
  47199. return self;
  47200. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47201. },
  47202. args: ["aBlock", "anExceptionClass"],
  47203. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  47204. referencedClasses: [],
  47205. messageSends: ["assert:", "on:do:", "value"]
  47206. }),
  47207. $globals.TestCase);
  47208. $core.addMethod(
  47209. $core.method({
  47210. selector: "signalFailure:",
  47211. protocol: "private",
  47212. fn: function (aString){
  47213. var self=this,$self=this;
  47214. return $core.withContext(function($ctx1) {
  47215. var $1;
  47216. $1=$recv($globals.TestFailure)._new();
  47217. $recv($1)._messageText_(aString);
  47218. $recv($1)._signal();
  47219. return self;
  47220. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  47221. },
  47222. args: ["aString"],
  47223. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  47224. referencedClasses: ["TestFailure"],
  47225. messageSends: ["messageText:", "new", "signal"]
  47226. }),
  47227. $globals.TestCase);
  47228. $core.addMethod(
  47229. $core.method({
  47230. selector: "tearDown",
  47231. protocol: "running",
  47232. fn: function (){
  47233. var self=this,$self=this;
  47234. return self;
  47235. },
  47236. args: [],
  47237. source: "tearDown",
  47238. referencedClasses: [],
  47239. messageSends: []
  47240. }),
  47241. $globals.TestCase);
  47242. $core.addMethod(
  47243. $core.method({
  47244. selector: "timeout:",
  47245. protocol: "async",
  47246. fn: function (aNumber){
  47247. var self=this,$self=this;
  47248. return $core.withContext(function($ctx1) {
  47249. var $1,$receiver;
  47250. $1=$self["@asyncTimeout"];
  47251. if(($receiver = $1) == null || $receiver.a$nil){
  47252. $1;
  47253. } else {
  47254. $recv($self["@asyncTimeout"])._clearTimeout();
  47255. }
  47256. $self["@asyncTimeout"]=(0);
  47257. $self["@asyncTimeout"]=$recv($self._async_((function(){
  47258. return $core.withContext(function($ctx2) {
  47259. return $self._assert_description_(false,"SUnit grace time exhausted");
  47260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47261. })))._valueWithTimeout_(aNumber);
  47262. return self;
  47263. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  47264. },
  47265. args: ["aNumber"],
  47266. 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",
  47267. referencedClasses: [],
  47268. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  47269. }),
  47270. $globals.TestCase);
  47271. $core.addMethod(
  47272. $core.method({
  47273. selector: "allTestSelectors",
  47274. protocol: "accessing",
  47275. fn: function (){
  47276. var self=this,$self=this;
  47277. var selectors;
  47278. return $core.withContext(function($ctx1) {
  47279. var $1;
  47280. selectors=$self._testSelectors();
  47281. $1=$self._shouldInheritSelectors();
  47282. if($core.assert($1)){
  47283. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  47284. }
  47285. return selectors;
  47286. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.a$cls)});
  47287. },
  47288. args: [],
  47289. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  47290. referencedClasses: [],
  47291. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  47292. }),
  47293. $globals.TestCase.a$cls);
  47294. $core.addMethod(
  47295. $core.method({
  47296. selector: "buildSuite",
  47297. protocol: "accessing",
  47298. fn: function (){
  47299. var self=this,$self=this;
  47300. return $core.withContext(function($ctx1) {
  47301. return $recv($self._allTestSelectors())._collect_((function(each){
  47302. return $core.withContext(function($ctx2) {
  47303. return $self._selector_(each);
  47304. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47305. }));
  47306. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.a$cls)});
  47307. },
  47308. args: [],
  47309. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  47310. referencedClasses: [],
  47311. messageSends: ["collect:", "allTestSelectors", "selector:"]
  47312. }),
  47313. $globals.TestCase.a$cls);
  47314. $core.addMethod(
  47315. $core.method({
  47316. selector: "classTag",
  47317. protocol: "accessing",
  47318. fn: function (){
  47319. var self=this,$self=this;
  47320. return "test";
  47321. },
  47322. args: [],
  47323. 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'",
  47324. referencedClasses: [],
  47325. messageSends: []
  47326. }),
  47327. $globals.TestCase.a$cls);
  47328. $core.addMethod(
  47329. $core.method({
  47330. selector: "isAbstract",
  47331. protocol: "testing",
  47332. fn: function (){
  47333. var self=this,$self=this;
  47334. return $core.withContext(function($ctx1) {
  47335. return $recv($self._name()).__eq("TestCase");
  47336. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.a$cls)});
  47337. },
  47338. args: [],
  47339. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  47340. referencedClasses: [],
  47341. messageSends: ["=", "name"]
  47342. }),
  47343. $globals.TestCase.a$cls);
  47344. $core.addMethod(
  47345. $core.method({
  47346. selector: "isTestClass",
  47347. protocol: "testing",
  47348. fn: function (){
  47349. var self=this,$self=this;
  47350. return $core.withContext(function($ctx1) {
  47351. return $recv($self._isAbstract())._not();
  47352. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.a$cls)});
  47353. },
  47354. args: [],
  47355. source: "isTestClass\x0a\x09^ self isAbstract not",
  47356. referencedClasses: [],
  47357. messageSends: ["not", "isAbstract"]
  47358. }),
  47359. $globals.TestCase.a$cls);
  47360. $core.addMethod(
  47361. $core.method({
  47362. selector: "lookupHierarchyRoot",
  47363. protocol: "accessing",
  47364. fn: function (){
  47365. var self=this,$self=this;
  47366. return $globals.TestCase;
  47367. },
  47368. args: [],
  47369. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  47370. referencedClasses: ["TestCase"],
  47371. messageSends: []
  47372. }),
  47373. $globals.TestCase.a$cls);
  47374. $core.addMethod(
  47375. $core.method({
  47376. selector: "selector:",
  47377. protocol: "accessing",
  47378. fn: function (aSelector){
  47379. var self=this,$self=this;
  47380. return $core.withContext(function($ctx1) {
  47381. var $1;
  47382. $1=$self._new();
  47383. $recv($1)._setTestSelector_(aSelector);
  47384. return $recv($1)._yourself();
  47385. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.a$cls)});
  47386. },
  47387. args: ["aSelector"],
  47388. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  47389. referencedClasses: [],
  47390. messageSends: ["setTestSelector:", "new", "yourself"]
  47391. }),
  47392. $globals.TestCase.a$cls);
  47393. $core.addMethod(
  47394. $core.method({
  47395. selector: "shouldInheritSelectors",
  47396. protocol: "testing",
  47397. fn: function (){
  47398. var self=this,$self=this;
  47399. return $core.withContext(function($ctx1) {
  47400. return $self.__tild_eq($self._lookupHierarchyRoot());
  47401. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.a$cls)});
  47402. },
  47403. args: [],
  47404. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  47405. referencedClasses: [],
  47406. messageSends: ["~=", "lookupHierarchyRoot"]
  47407. }),
  47408. $globals.TestCase.a$cls);
  47409. $core.addMethod(
  47410. $core.method({
  47411. selector: "testSelectors",
  47412. protocol: "accessing",
  47413. fn: function (){
  47414. var self=this,$self=this;
  47415. return $core.withContext(function($ctx1) {
  47416. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  47417. return $core.withContext(function($ctx2) {
  47418. return $recv(each)._match_("^test");
  47419. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47420. }));
  47421. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.a$cls)});
  47422. },
  47423. args: [],
  47424. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  47425. referencedClasses: [],
  47426. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  47427. }),
  47428. $globals.TestCase.a$cls);
  47429. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  47430. $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).";
  47431. $core.addMethod(
  47432. $core.method({
  47433. selector: "execute:",
  47434. protocol: "running",
  47435. fn: function (aBlock){
  47436. var self=this,$self=this;
  47437. var failed;
  47438. return $core.withContext(function($ctx1) {
  47439. var $1,$2;
  47440. $recv($self["@testCase"])._context_(self);
  47441. $ctx1.sendIdx["context:"]=1;
  47442. $recv((function(){
  47443. return $core.withContext(function($ctx2) {
  47444. failed=true;
  47445. failed;
  47446. $recv(aBlock)._value();
  47447. failed=false;
  47448. return failed;
  47449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47450. }))._ensure_((function(){
  47451. return $core.withContext(function($ctx2) {
  47452. $recv($self["@testCase"])._context_(nil);
  47453. $1=$recv(failed)._and_((function(){
  47454. return $core.withContext(function($ctx3) {
  47455. return $recv($self["@testCase"])._isAsync();
  47456. $ctx3.sendIdx["isAsync"]=1;
  47457. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  47458. }));
  47459. if($core.assert($1)){
  47460. $recv($self["@testCase"])._finished();
  47461. }
  47462. $2=$recv($self["@testCase"])._isAsync();
  47463. if(!$core.assert($2)){
  47464. return $recv($self["@testCase"])._tearDown();
  47465. }
  47466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47467. }));
  47468. return self;
  47469. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  47470. },
  47471. args: ["aBlock"],
  47472. 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 ] ]",
  47473. referencedClasses: [],
  47474. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  47475. }),
  47476. $globals.TestContext);
  47477. $core.addMethod(
  47478. $core.method({
  47479. selector: "start",
  47480. protocol: "running",
  47481. fn: function (){
  47482. var self=this,$self=this;
  47483. return $core.withContext(function($ctx1) {
  47484. $self._execute_((function(){
  47485. return $core.withContext(function($ctx2) {
  47486. $recv($self["@testCase"])._setUp();
  47487. return $recv($self["@testCase"])._performTest();
  47488. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47489. }));
  47490. return self;
  47491. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  47492. },
  47493. args: [],
  47494. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  47495. referencedClasses: [],
  47496. messageSends: ["execute:", "setUp", "performTest"]
  47497. }),
  47498. $globals.TestContext);
  47499. $core.addMethod(
  47500. $core.method({
  47501. selector: "testCase:",
  47502. protocol: "accessing",
  47503. fn: function (aTestCase){
  47504. var self=this,$self=this;
  47505. $self["@testCase"]=aTestCase;
  47506. return self;
  47507. },
  47508. args: ["aTestCase"],
  47509. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  47510. referencedClasses: [],
  47511. messageSends: []
  47512. }),
  47513. $globals.TestContext);
  47514. $core.addMethod(
  47515. $core.method({
  47516. selector: "testCase:",
  47517. protocol: "instance creation",
  47518. fn: function (aTestCase){
  47519. var self=this,$self=this;
  47520. return $core.withContext(function($ctx1) {
  47521. var $1;
  47522. $1=$self._new();
  47523. $recv($1)._testCase_(aTestCase);
  47524. return $recv($1)._yourself();
  47525. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.a$cls)});
  47526. },
  47527. args: ["aTestCase"],
  47528. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  47529. referencedClasses: [],
  47530. messageSends: ["testCase:", "new", "yourself"]
  47531. }),
  47532. $globals.TestContext.a$cls);
  47533. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  47534. $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`.";
  47535. $core.addMethod(
  47536. $core.method({
  47537. selector: "execute:",
  47538. protocol: "running",
  47539. fn: function (aBlock){
  47540. var self=this,$self=this;
  47541. return $core.withContext(function($ctx1) {
  47542. var $1;
  47543. $recv((function(){
  47544. return $core.withContext(function($ctx2) {
  47545. return $self._withErrorReporting_((function(){
  47546. return $core.withContext(function($ctx3) {
  47547. return (
  47548. $ctx3.supercall = true,
  47549. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
  47550. $ctx3.supercall = false;
  47551. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47552. }));
  47553. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47554. }))._ensure_((function(){
  47555. return $core.withContext(function($ctx2) {
  47556. $1=$recv($self["@testCase"])._isAsync();
  47557. if(!$core.assert($1)){
  47558. $recv($self["@result"])._increaseRuns();
  47559. return $recv($self["@finished"])._value();
  47560. }
  47561. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47562. }));
  47563. return self;
  47564. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  47565. },
  47566. args: ["aBlock"],
  47567. 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 ] ]",
  47568. referencedClasses: [],
  47569. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  47570. }),
  47571. $globals.ReportingTestContext);
  47572. $core.addMethod(
  47573. $core.method({
  47574. selector: "finished:",
  47575. protocol: "accessing",
  47576. fn: function (aBlock){
  47577. var self=this,$self=this;
  47578. $self["@finished"]=aBlock;
  47579. return self;
  47580. },
  47581. args: ["aBlock"],
  47582. source: "finished: aBlock\x0a\x09finished := aBlock",
  47583. referencedClasses: [],
  47584. messageSends: []
  47585. }),
  47586. $globals.ReportingTestContext);
  47587. $core.addMethod(
  47588. $core.method({
  47589. selector: "result:",
  47590. protocol: "accessing",
  47591. fn: function (aTestResult){
  47592. var self=this,$self=this;
  47593. $self["@result"]=aTestResult;
  47594. return self;
  47595. },
  47596. args: ["aTestResult"],
  47597. source: "result: aTestResult\x0a\x09result := aTestResult",
  47598. referencedClasses: [],
  47599. messageSends: []
  47600. }),
  47601. $globals.ReportingTestContext);
  47602. $core.addMethod(
  47603. $core.method({
  47604. selector: "withErrorReporting:",
  47605. protocol: "private",
  47606. fn: function (aBlock){
  47607. var self=this,$self=this;
  47608. return $core.withContext(function($ctx1) {
  47609. $recv((function(){
  47610. return $core.withContext(function($ctx2) {
  47611. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  47612. return $core.withContext(function($ctx3) {
  47613. return $recv($self["@result"])._addFailure_($self["@testCase"]);
  47614. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  47615. }));
  47616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47617. }))._on_do_($globals.Error,(function(ex){
  47618. return $core.withContext(function($ctx2) {
  47619. return $recv($self["@result"])._addError_($self["@testCase"]);
  47620. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  47621. }));
  47622. $ctx1.sendIdx["on:do:"]=1;
  47623. return self;
  47624. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  47625. },
  47626. args: ["aBlock"],
  47627. 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 ]",
  47628. referencedClasses: ["TestFailure", "Error"],
  47629. messageSends: ["on:do:", "addFailure:", "addError:"]
  47630. }),
  47631. $globals.ReportingTestContext);
  47632. $core.addMethod(
  47633. $core.method({
  47634. selector: "testCase:result:finished:",
  47635. protocol: "instance creation",
  47636. fn: function (aTestCase,aTestResult,aBlock){
  47637. var self=this,$self=this;
  47638. return $core.withContext(function($ctx1) {
  47639. var $1;
  47640. $1=(
  47641. $ctx1.supercall = true,
  47642. ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
  47643. $ctx1.supercall = false;
  47644. $recv($1)._result_(aTestResult);
  47645. $recv($1)._finished_(aBlock);
  47646. return $recv($1)._yourself();
  47647. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.a$cls)});
  47648. },
  47649. args: ["aTestCase", "aTestResult", "aBlock"],
  47650. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  47651. referencedClasses: [],
  47652. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  47653. }),
  47654. $globals.ReportingTestContext.a$cls);
  47655. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  47656. $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.";
  47657. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  47658. $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";
  47659. $core.addMethod(
  47660. $core.method({
  47661. selector: "addError:",
  47662. protocol: "accessing",
  47663. fn: function (anError){
  47664. var self=this,$self=this;
  47665. return $core.withContext(function($ctx1) {
  47666. $recv($self._errors())._add_(anError);
  47667. return self;
  47668. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  47669. },
  47670. args: ["anError"],
  47671. source: "addError: anError\x0a\x09self errors add: anError",
  47672. referencedClasses: [],
  47673. messageSends: ["add:", "errors"]
  47674. }),
  47675. $globals.TestResult);
  47676. $core.addMethod(
  47677. $core.method({
  47678. selector: "addFailure:",
  47679. protocol: "accessing",
  47680. fn: function (aFailure){
  47681. var self=this,$self=this;
  47682. return $core.withContext(function($ctx1) {
  47683. $recv($self._failures())._add_(aFailure);
  47684. return self;
  47685. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  47686. },
  47687. args: ["aFailure"],
  47688. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  47689. referencedClasses: [],
  47690. messageSends: ["add:", "failures"]
  47691. }),
  47692. $globals.TestResult);
  47693. $core.addMethod(
  47694. $core.method({
  47695. selector: "errors",
  47696. protocol: "accessing",
  47697. fn: function (){
  47698. var self=this,$self=this;
  47699. return $self["@errors"];
  47700. },
  47701. args: [],
  47702. source: "errors\x0a\x09^ errors",
  47703. referencedClasses: [],
  47704. messageSends: []
  47705. }),
  47706. $globals.TestResult);
  47707. $core.addMethod(
  47708. $core.method({
  47709. selector: "failures",
  47710. protocol: "accessing",
  47711. fn: function (){
  47712. var self=this,$self=this;
  47713. return $self["@failures"];
  47714. },
  47715. args: [],
  47716. source: "failures\x0a\x09^ failures",
  47717. referencedClasses: [],
  47718. messageSends: []
  47719. }),
  47720. $globals.TestResult);
  47721. $core.addMethod(
  47722. $core.method({
  47723. selector: "increaseRuns",
  47724. protocol: "accessing",
  47725. fn: function (){
  47726. var self=this,$self=this;
  47727. return $core.withContext(function($ctx1) {
  47728. $self["@runs"]=$recv($self["@runs"]).__plus((1));
  47729. return self;
  47730. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  47731. },
  47732. args: [],
  47733. source: "increaseRuns\x0a\x09runs := runs + 1",
  47734. referencedClasses: [],
  47735. messageSends: ["+"]
  47736. }),
  47737. $globals.TestResult);
  47738. $core.addMethod(
  47739. $core.method({
  47740. selector: "initialize",
  47741. protocol: "initialization",
  47742. fn: function (){
  47743. var self=this,$self=this;
  47744. return $core.withContext(function($ctx1) {
  47745. (
  47746. $ctx1.supercall = true,
  47747. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  47748. $ctx1.supercall = false;
  47749. $self["@timestamp"]=$recv($globals.Date)._now();
  47750. $self["@runs"]=(0);
  47751. $self["@errors"]=$recv($globals.Array)._new();
  47752. $ctx1.sendIdx["new"]=1;
  47753. $self["@failures"]=$recv($globals.Array)._new();
  47754. $self["@total"]=(0);
  47755. return self;
  47756. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  47757. },
  47758. args: [],
  47759. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  47760. referencedClasses: ["Date", "Array"],
  47761. messageSends: ["initialize", "now", "new"]
  47762. }),
  47763. $globals.TestResult);
  47764. $core.addMethod(
  47765. $core.method({
  47766. selector: "nextRunDo:",
  47767. protocol: "running",
  47768. fn: function (aBlock){
  47769. var self=this,$self=this;
  47770. return $core.withContext(function($ctx1) {
  47771. var $2,$1;
  47772. $2=$self._runs();
  47773. $ctx1.sendIdx["runs"]=1;
  47774. $1=$recv($2).__eq_eq($self._total());
  47775. if(!$core.assert($1)){
  47776. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  47777. }
  47778. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  47779. },
  47780. args: ["aBlock"],
  47781. 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 ]",
  47782. referencedClasses: [],
  47783. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  47784. }),
  47785. $globals.TestResult);
  47786. $core.addMethod(
  47787. $core.method({
  47788. selector: "runCase:",
  47789. protocol: "running",
  47790. fn: function (aTestCase){
  47791. var self=this,$self=this;
  47792. return $core.withContext(function($ctx1) {
  47793. $recv((function(){
  47794. return $core.withContext(function($ctx2) {
  47795. return $recv((function(){
  47796. return $core.withContext(function($ctx3) {
  47797. $self._increaseRuns();
  47798. return $recv(aTestCase)._runCase();
  47799. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47800. }))._on_do_($globals.TestFailure,(function(ex){
  47801. return $core.withContext(function($ctx3) {
  47802. return $self._addFailure_(aTestCase);
  47803. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  47804. }));
  47805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47806. }))._on_do_($globals.Error,(function(ex){
  47807. return $core.withContext(function($ctx2) {
  47808. return $self._addError_(aTestCase);
  47809. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  47810. }));
  47811. $ctx1.sendIdx["on:do:"]=1;
  47812. return self;
  47813. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  47814. },
  47815. args: ["aTestCase"],
  47816. 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 ]",
  47817. referencedClasses: ["TestFailure", "Error"],
  47818. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  47819. }),
  47820. $globals.TestResult);
  47821. $core.addMethod(
  47822. $core.method({
  47823. selector: "runs",
  47824. protocol: "accessing",
  47825. fn: function (){
  47826. var self=this,$self=this;
  47827. return $self["@runs"];
  47828. },
  47829. args: [],
  47830. source: "runs\x0a\x09^ runs",
  47831. referencedClasses: [],
  47832. messageSends: []
  47833. }),
  47834. $globals.TestResult);
  47835. $core.addMethod(
  47836. $core.method({
  47837. selector: "status",
  47838. protocol: "accessing",
  47839. fn: function (){
  47840. var self=this,$self=this;
  47841. return $core.withContext(function($ctx1) {
  47842. var $1;
  47843. $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  47844. return "error";
  47845. }),(function(){
  47846. return $core.withContext(function($ctx2) {
  47847. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  47848. return "failure";
  47849. }),(function(){
  47850. return "success";
  47851. }));
  47852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47853. }));
  47854. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  47855. return $1;
  47856. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  47857. },
  47858. args: [],
  47859. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  47860. referencedClasses: [],
  47861. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  47862. }),
  47863. $globals.TestResult);
  47864. $core.addMethod(
  47865. $core.method({
  47866. selector: "timestamp",
  47867. protocol: "accessing",
  47868. fn: function (){
  47869. var self=this,$self=this;
  47870. return $self["@timestamp"];
  47871. },
  47872. args: [],
  47873. source: "timestamp\x0a\x09^ timestamp",
  47874. referencedClasses: [],
  47875. messageSends: []
  47876. }),
  47877. $globals.TestResult);
  47878. $core.addMethod(
  47879. $core.method({
  47880. selector: "total",
  47881. protocol: "accessing",
  47882. fn: function (){
  47883. var self=this,$self=this;
  47884. return $self["@total"];
  47885. },
  47886. args: [],
  47887. source: "total\x0a\x09^ total",
  47888. referencedClasses: [],
  47889. messageSends: []
  47890. }),
  47891. $globals.TestResult);
  47892. $core.addMethod(
  47893. $core.method({
  47894. selector: "total:",
  47895. protocol: "accessing",
  47896. fn: function (aNumber){
  47897. var self=this,$self=this;
  47898. $self["@total"]=aNumber;
  47899. return self;
  47900. },
  47901. args: ["aNumber"],
  47902. source: "total: aNumber\x0a\x09total := aNumber",
  47903. referencedClasses: [],
  47904. messageSends: []
  47905. }),
  47906. $globals.TestResult);
  47907. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  47908. $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`.";
  47909. $core.addMethod(
  47910. $core.method({
  47911. selector: "announcer",
  47912. protocol: "accessing",
  47913. fn: function (){
  47914. var self=this,$self=this;
  47915. return $self["@announcer"];
  47916. },
  47917. args: [],
  47918. source: "announcer\x0a\x09^ announcer",
  47919. referencedClasses: [],
  47920. messageSends: []
  47921. }),
  47922. $globals.TestSuiteRunner);
  47923. $core.addMethod(
  47924. $core.method({
  47925. selector: "contextOf:",
  47926. protocol: "private",
  47927. fn: function (anInteger){
  47928. var self=this,$self=this;
  47929. return $core.withContext(function($ctx1) {
  47930. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self["@suite"])._at_(anInteger),$self["@result"],(function(){
  47931. return $core.withContext(function($ctx2) {
  47932. return $self._resume();
  47933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47934. }));
  47935. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  47936. },
  47937. args: ["anInteger"],
  47938. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  47939. referencedClasses: ["ReportingTestContext"],
  47940. messageSends: ["testCase:result:finished:", "at:", "resume"]
  47941. }),
  47942. $globals.TestSuiteRunner);
  47943. $core.addMethod(
  47944. $core.method({
  47945. selector: "initialize",
  47946. protocol: "initialization",
  47947. fn: function (){
  47948. var self=this,$self=this;
  47949. return $core.withContext(function($ctx1) {
  47950. var $1;
  47951. (
  47952. $ctx1.supercall = true,
  47953. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  47954. $ctx1.supercall = false;
  47955. $self["@announcer"]=$recv($globals.Announcer)._new();
  47956. $ctx1.sendIdx["new"]=1;
  47957. $self["@result"]=$recv($globals.TestResult)._new();
  47958. $self["@runNextTest"]=(function(){
  47959. var runs;
  47960. return $core.withContext(function($ctx2) {
  47961. runs=$recv($self["@result"])._runs();
  47962. runs;
  47963. $1=$recv(runs).__lt($recv($self["@result"])._total());
  47964. if($core.assert($1)){
  47965. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  47966. }
  47967. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  47968. });
  47969. return self;
  47970. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  47971. },
  47972. args: [],
  47973. 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 ] ].",
  47974. referencedClasses: ["Announcer", "TestResult"],
  47975. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  47976. }),
  47977. $globals.TestSuiteRunner);
  47978. $core.addMethod(
  47979. $core.method({
  47980. selector: "result",
  47981. protocol: "accessing",
  47982. fn: function (){
  47983. var self=this,$self=this;
  47984. return $self["@result"];
  47985. },
  47986. args: [],
  47987. source: "result\x0a\x09^ result",
  47988. referencedClasses: [],
  47989. messageSends: []
  47990. }),
  47991. $globals.TestSuiteRunner);
  47992. $core.addMethod(
  47993. $core.method({
  47994. selector: "resume",
  47995. protocol: "actions",
  47996. fn: function (){
  47997. var self=this,$self=this;
  47998. return $core.withContext(function($ctx1) {
  47999. $recv($self["@runNextTest"])._fork();
  48000. $recv($self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self["@result"]));
  48001. return self;
  48002. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  48003. },
  48004. args: [],
  48005. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  48006. referencedClasses: ["ResultAnnouncement"],
  48007. messageSends: ["fork", "announce:", "result:", "new"]
  48008. }),
  48009. $globals.TestSuiteRunner);
  48010. $core.addMethod(
  48011. $core.method({
  48012. selector: "run",
  48013. protocol: "actions",
  48014. fn: function (){
  48015. var self=this,$self=this;
  48016. return $core.withContext(function($ctx1) {
  48017. $recv($self["@result"])._total_($recv($self["@suite"])._size());
  48018. $self._resume();
  48019. return self;
  48020. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  48021. },
  48022. args: [],
  48023. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  48024. referencedClasses: [],
  48025. messageSends: ["total:", "size", "resume"]
  48026. }),
  48027. $globals.TestSuiteRunner);
  48028. $core.addMethod(
  48029. $core.method({
  48030. selector: "suite:",
  48031. protocol: "accessing",
  48032. fn: function (aCollection){
  48033. var self=this,$self=this;
  48034. $self["@suite"]=aCollection;
  48035. return self;
  48036. },
  48037. args: ["aCollection"],
  48038. source: "suite: aCollection\x0a\x09suite := aCollection",
  48039. referencedClasses: [],
  48040. messageSends: []
  48041. }),
  48042. $globals.TestSuiteRunner);
  48043. $core.addMethod(
  48044. $core.method({
  48045. selector: "new",
  48046. protocol: "instance creation",
  48047. fn: function (){
  48048. var self=this,$self=this;
  48049. return $core.withContext(function($ctx1) {
  48050. $self._shouldNotImplement();
  48051. return self;
  48052. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.a$cls)});
  48053. },
  48054. args: [],
  48055. source: "new\x0a\x09self shouldNotImplement",
  48056. referencedClasses: [],
  48057. messageSends: ["shouldNotImplement"]
  48058. }),
  48059. $globals.TestSuiteRunner.a$cls);
  48060. $core.addMethod(
  48061. $core.method({
  48062. selector: "on:",
  48063. protocol: "instance creation",
  48064. fn: function (aCollection){
  48065. var self=this,$self=this;
  48066. return $core.withContext(function($ctx1) {
  48067. var $1;
  48068. $1=(
  48069. $ctx1.supercall = true,
  48070. ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  48071. $ctx1.supercall = false;
  48072. return $recv($1)._suite_(aCollection);
  48073. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.a$cls)});
  48074. },
  48075. args: ["aCollection"],
  48076. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  48077. referencedClasses: [],
  48078. messageSends: ["suite:", "new"]
  48079. }),
  48080. $globals.TestSuiteRunner.a$cls);
  48081. $core.addMethod(
  48082. $core.method({
  48083. selector: "isTestPackage",
  48084. protocol: "*SUnit",
  48085. fn: function (){
  48086. var self=this,$self=this;
  48087. return $core.withContext(function($ctx1) {
  48088. return $recv($self._classes())._anySatisfy_((function(each){
  48089. return $core.withContext(function($ctx2) {
  48090. return $recv(each)._isTestClass();
  48091. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48092. }));
  48093. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  48094. },
  48095. args: [],
  48096. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  48097. referencedClasses: [],
  48098. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  48099. }),
  48100. $globals.Package);
  48101. $core.addMethod(
  48102. $core.method({
  48103. selector: "isTestClass",
  48104. protocol: "*SUnit",
  48105. fn: function (){
  48106. var self=this,$self=this;
  48107. return false;
  48108. },
  48109. args: [],
  48110. source: "isTestClass\x0a\x09^ false",
  48111. referencedClasses: [],
  48112. messageSends: []
  48113. }),
  48114. $globals.TBehaviorDefaults);
  48115. });
  48116. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  48117. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  48118. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  48119. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48120. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  48121. $core.addPackage("Compiler-Tests");
  48122. $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  48123. $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  48124. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  48125. $core.addMethod(
  48126. $core.method({
  48127. selector: "analyze:forClass:",
  48128. protocol: "convenience",
  48129. fn: function (aNode,aClass){
  48130. var self=this,$self=this;
  48131. return $core.withContext(function($ctx1) {
  48132. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  48133. return aNode;
  48134. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  48135. },
  48136. args: ["aNode", "aClass"],
  48137. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  48138. referencedClasses: ["SemanticAnalyzer"],
  48139. messageSends: ["visit:", "on:"]
  48140. }),
  48141. $globals.ASTParsingTest);
  48142. $core.addMethod(
  48143. $core.method({
  48144. selector: "parse:",
  48145. protocol: "parsing",
  48146. fn: function (aString){
  48147. var self=this,$self=this;
  48148. return $core.withContext(function($ctx1) {
  48149. return $recv($globals.Smalltalk)._parse_(aString);
  48150. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  48151. },
  48152. args: ["aString"],
  48153. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  48154. referencedClasses: ["Smalltalk"],
  48155. messageSends: ["parse:"]
  48156. }),
  48157. $globals.ASTParsingTest);
  48158. $core.addMethod(
  48159. $core.method({
  48160. selector: "parse:forClass:",
  48161. protocol: "parsing",
  48162. fn: function (aString,aClass){
  48163. var self=this,$self=this;
  48164. return $core.withContext(function($ctx1) {
  48165. return $self._analyze_forClass_($self._parse_(aString),aClass);
  48166. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  48167. },
  48168. args: ["aString", "aClass"],
  48169. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  48170. referencedClasses: [],
  48171. messageSends: ["analyze:forClass:", "parse:"]
  48172. }),
  48173. $globals.ASTParsingTest);
  48174. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48175. $core.addMethod(
  48176. $core.method({
  48177. selector: "astPCNodeVisitor",
  48178. protocol: "factory",
  48179. fn: function (){
  48180. var self=this,$self=this;
  48181. return $core.withContext(function($ctx1) {
  48182. var $1;
  48183. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48184. $recv($1)._index_((0));
  48185. return $recv($1)._yourself();
  48186. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  48187. },
  48188. args: [],
  48189. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48190. referencedClasses: ["ASTPCNodeVisitor"],
  48191. messageSends: ["index:", "new", "yourself"]
  48192. }),
  48193. $globals.ASTPCNodeVisitorTest);
  48194. $core.addMethod(
  48195. $core.method({
  48196. selector: "astPCNodeVisitorForSelector:",
  48197. protocol: "factory",
  48198. fn: function (aString){
  48199. var self=this,$self=this;
  48200. return $core.withContext(function($ctx1) {
  48201. var $1;
  48202. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48203. $recv($1)._selector_(aString);
  48204. $recv($1)._index_((0));
  48205. return $recv($1)._yourself();
  48206. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  48207. },
  48208. args: ["aString"],
  48209. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48210. referencedClasses: ["ASTPCNodeVisitor"],
  48211. messageSends: ["selector:", "new", "index:", "yourself"]
  48212. }),
  48213. $globals.ASTPCNodeVisitorTest);
  48214. $core.addMethod(
  48215. $core.method({
  48216. selector: "testJSStatementNode",
  48217. protocol: "tests",
  48218. fn: function (){
  48219. var self=this,$self=this;
  48220. var ast,visitor;
  48221. return $core.withContext(function($ctx1) {
  48222. var $3,$2,$1;
  48223. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  48224. $3=$self._astPCNodeVisitor();
  48225. $recv($3)._visit_(ast);
  48226. $2=$recv($3)._currentNode();
  48227. $1=$recv($2)._isJSStatementNode();
  48228. $self._assert_($1);
  48229. return self;
  48230. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48231. },
  48232. args: [],
  48233. 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",
  48234. referencedClasses: ["Object"],
  48235. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48236. }),
  48237. $globals.ASTPCNodeVisitorTest);
  48238. $core.addMethod(
  48239. $core.method({
  48240. selector: "testLegacyJSStatementNode",
  48241. protocol: "tests",
  48242. fn: function (){
  48243. var self=this,$self=this;
  48244. var ast,visitor;
  48245. return $core.withContext(function($ctx1) {
  48246. var $3,$2,$1;
  48247. ast=$self._parse_forClass_("foo <consolee.log(1)>",$globals.Object);
  48248. $3=$self._astPCNodeVisitor();
  48249. $recv($3)._visit_(ast);
  48250. $2=$recv($3)._currentNode();
  48251. $1=$recv($2)._isJSStatementNode();
  48252. $self._assert_($1);
  48253. return self;
  48254. }, function($ctx1) {$ctx1.fill(self,"testLegacyJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48255. },
  48256. args: [],
  48257. source: "testLegacyJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <consolee.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  48258. referencedClasses: ["Object"],
  48259. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48260. }),
  48261. $globals.ASTPCNodeVisitorTest);
  48262. $core.addMethod(
  48263. $core.method({
  48264. selector: "testMessageSend",
  48265. protocol: "tests",
  48266. fn: function (){
  48267. var self=this,$self=this;
  48268. var ast;
  48269. return $core.withContext(function($ctx1) {
  48270. var $3,$2,$1;
  48271. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  48272. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48273. $recv($3)._visit_(ast);
  48274. $2=$recv($3)._currentNode();
  48275. $1=$recv($2)._selector();
  48276. $self._assert_equals_($1,"yourself");
  48277. return self;
  48278. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48279. },
  48280. args: [],
  48281. 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'",
  48282. referencedClasses: ["Object"],
  48283. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48284. }),
  48285. $globals.ASTPCNodeVisitorTest);
  48286. $core.addMethod(
  48287. $core.method({
  48288. selector: "testMessageSendWithBlocks",
  48289. protocol: "tests",
  48290. fn: function (){
  48291. var self=this,$self=this;
  48292. var ast;
  48293. return $core.withContext(function($ctx1) {
  48294. var $3,$2,$1;
  48295. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  48296. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48297. $recv($3)._visit_(ast);
  48298. $2=$recv($3)._currentNode();
  48299. $1=$recv($2)._selector();
  48300. $self._assert_equals_($1,"yourself");
  48301. return self;
  48302. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48303. },
  48304. args: [],
  48305. 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'",
  48306. referencedClasses: ["Object"],
  48307. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48308. }),
  48309. $globals.ASTPCNodeVisitorTest);
  48310. $core.addMethod(
  48311. $core.method({
  48312. selector: "testMessageSendWithInlining",
  48313. protocol: "tests",
  48314. fn: function (){
  48315. var self=this,$self=this;
  48316. var ast;
  48317. return $core.withContext(function($ctx1) {
  48318. var $3,$4,$2,$1,$7,$6,$5;
  48319. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48320. $ctx1.sendIdx["parse:forClass:"]=1;
  48321. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48322. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  48323. $recv($3)._visit_(ast);
  48324. $ctx1.sendIdx["visit:"]=1;
  48325. $4=$recv($3)._currentNode();
  48326. $ctx1.sendIdx["currentNode"]=1;
  48327. $2=$4;
  48328. $1=$recv($2)._selector();
  48329. $ctx1.sendIdx["selector"]=1;
  48330. $self._assert_equals_($1,"yourself");
  48331. $ctx1.sendIdx["assert:equals:"]=1;
  48332. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48333. $7=$self._astPCNodeVisitorForSelector_("asBoolean");
  48334. $recv($7)._visit_(ast);
  48335. $6=$recv($7)._currentNode();
  48336. $5=$recv($6)._selector();
  48337. $self._assert_equals_($5,"asBoolean");
  48338. return self;
  48339. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48340. },
  48341. args: [],
  48342. 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'",
  48343. referencedClasses: ["Object"],
  48344. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48345. }),
  48346. $globals.ASTPCNodeVisitorTest);
  48347. $core.addMethod(
  48348. $core.method({
  48349. selector: "testNoMessageSend",
  48350. protocol: "tests",
  48351. fn: function (){
  48352. var self=this,$self=this;
  48353. var ast;
  48354. return $core.withContext(function($ctx1) {
  48355. var $3,$2,$1;
  48356. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  48357. $3=$self._astPCNodeVisitor();
  48358. $recv($3)._visit_(ast);
  48359. $2=$recv($3)._currentNode();
  48360. $1=$recv($2)._isNil();
  48361. $self._assert_($1);
  48362. return self;
  48363. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48364. },
  48365. args: [],
  48366. 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",
  48367. referencedClasses: ["Object"],
  48368. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  48369. }),
  48370. $globals.ASTPCNodeVisitorTest);
  48371. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48372. $core.addMethod(
  48373. $core.method({
  48374. selector: "testNodeAtPosition",
  48375. protocol: "tests",
  48376. fn: function (){
  48377. var self=this,$self=this;
  48378. var node;
  48379. return $core.withContext(function($ctx1) {
  48380. var $3,$4,$2,$1,$7,$8,$6,$5;
  48381. node=$self._parse_("yourself\x0a\x09^ self");
  48382. $ctx1.sendIdx["parse:"]=1;
  48383. $3=node;
  48384. $4=(2).__at((4));
  48385. $ctx1.sendIdx["@"]=1;
  48386. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  48387. return nil;
  48388. }));
  48389. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  48390. $1=$recv($2)._source();
  48391. $self._assert_equals_($1,"self");
  48392. $ctx1.sendIdx["assert:equals:"]=1;
  48393. node=$self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  48394. $ctx1.sendIdx["parse:"]=2;
  48395. $7=node;
  48396. $8=(2).__at((7));
  48397. $ctx1.sendIdx["@"]=2;
  48398. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  48399. return nil;
  48400. }));
  48401. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  48402. $5=$recv($6)._selector();
  48403. $ctx1.sendIdx["selector"]=1;
  48404. $self._assert_equals_($5,"ifTrue:");
  48405. $ctx1.sendIdx["assert:equals:"]=2;
  48406. node=$self._parse_("foo\x0a\x09self foo; bar; baz");
  48407. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  48408. return nil;
  48409. })))._selector(),"foo");
  48410. return self;
  48411. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  48412. },
  48413. args: [],
  48414. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  48415. referencedClasses: [],
  48416. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  48417. }),
  48418. $globals.ASTPositionTest);
  48419. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  48420. $core.addMethod(
  48421. $core.method({
  48422. selector: "codeGeneratorClass",
  48423. protocol: "accessing",
  48424. fn: function (){
  48425. var self=this,$self=this;
  48426. return $globals.CodeGenerator;
  48427. },
  48428. args: [],
  48429. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  48430. referencedClasses: ["CodeGenerator"],
  48431. messageSends: []
  48432. }),
  48433. $globals.CodeGeneratorTest);
  48434. $core.addMethod(
  48435. $core.method({
  48436. selector: "compiler",
  48437. protocol: "factory",
  48438. fn: function (){
  48439. var self=this,$self=this;
  48440. return $core.withContext(function($ctx1) {
  48441. var $1;
  48442. $1=$recv($globals.Compiler)._new();
  48443. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  48444. return $recv($1)._yourself();
  48445. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  48446. },
  48447. args: [],
  48448. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  48449. referencedClasses: ["Compiler"],
  48450. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  48451. }),
  48452. $globals.CodeGeneratorTest);
  48453. $core.addMethod(
  48454. $core.method({
  48455. selector: "setUp",
  48456. protocol: "initialization",
  48457. fn: function (){
  48458. var self=this,$self=this;
  48459. return $core.withContext(function($ctx1) {
  48460. $self["@receiver"]=$recv($globals.DoIt)._new();
  48461. return self;
  48462. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  48463. },
  48464. args: [],
  48465. source: "setUp\x0a\x09receiver := DoIt new",
  48466. referencedClasses: ["DoIt"],
  48467. messageSends: ["new"]
  48468. }),
  48469. $globals.CodeGeneratorTest);
  48470. $core.addMethod(
  48471. $core.method({
  48472. selector: "should:receiver:raise:",
  48473. protocol: "testing",
  48474. fn: function (aString,anObject,anErrorClass){
  48475. var self=this,$self=this;
  48476. var method,result;
  48477. return $core.withContext(function($ctx1) {
  48478. var $1,$2,$3,$receiver;
  48479. $self["@receiver"]=anObject;
  48480. $recv((function(){
  48481. return $core.withContext(function($ctx2) {
  48482. return $self._should_raise_((function(){
  48483. return $core.withContext(function($ctx3) {
  48484. $1=$self._compiler();
  48485. $2=$recv(anObject)._class();
  48486. $ctx3.sendIdx["class"]=1;
  48487. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48488. method;
  48489. return $recv($self["@receiver"])._perform_($recv(method)._selector());
  48490. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48491. }),anErrorClass);
  48492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48493. }))._ensure_((function(){
  48494. return $core.withContext(function($ctx2) {
  48495. $3=method;
  48496. if(($receiver = $3) == null || $receiver.a$nil){
  48497. return $3;
  48498. } else {
  48499. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48500. }
  48501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48502. }));
  48503. return self;
  48504. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  48505. },
  48506. args: ["aString", "anObject", "anErrorClass"],
  48507. 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 ] ]",
  48508. referencedClasses: [],
  48509. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  48510. }),
  48511. $globals.CodeGeneratorTest);
  48512. $core.addMethod(
  48513. $core.method({
  48514. selector: "should:receiver:return:",
  48515. protocol: "testing",
  48516. fn: function (aString,anObject,aResult){
  48517. var self=this,$self=this;
  48518. var method,result;
  48519. return $core.withContext(function($ctx1) {
  48520. var $1,$2;
  48521. $self["@receiver"]=anObject;
  48522. $1=$self._compiler();
  48523. $2=$recv(anObject)._class();
  48524. $ctx1.sendIdx["class"]=1;
  48525. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48526. result=$recv($self["@receiver"])._perform_($recv(method)._selector());
  48527. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48528. $self._assert_equals_(aResult,result);
  48529. return self;
  48530. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  48531. },
  48532. args: ["aString", "anObject", "aResult"],
  48533. 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",
  48534. referencedClasses: [],
  48535. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  48536. }),
  48537. $globals.CodeGeneratorTest);
  48538. $core.addMethod(
  48539. $core.method({
  48540. selector: "should:return:",
  48541. protocol: "testing",
  48542. fn: function (aString,anObject){
  48543. var self=this,$self=this;
  48544. return $core.withContext(function($ctx1) {
  48545. return $self._should_receiver_return_(aString,$self["@receiver"],anObject);
  48546. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  48547. },
  48548. args: ["aString", "anObject"],
  48549. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  48550. referencedClasses: [],
  48551. messageSends: ["should:receiver:return:"]
  48552. }),
  48553. $globals.CodeGeneratorTest);
  48554. $core.addMethod(
  48555. $core.method({
  48556. selector: "tearDown",
  48557. protocol: "initialization",
  48558. fn: function (){
  48559. var self=this,$self=this;
  48560. return self;
  48561. },
  48562. args: [],
  48563. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  48564. referencedClasses: [],
  48565. messageSends: []
  48566. }),
  48567. $globals.CodeGeneratorTest);
  48568. $core.addMethod(
  48569. $core.method({
  48570. selector: "testAssignment",
  48571. protocol: "tests",
  48572. fn: function (){
  48573. var self=this,$self=this;
  48574. return $core.withContext(function($ctx1) {
  48575. $self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  48576. $ctx1.sendIdx["should:return:"]=1;
  48577. $self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  48578. $ctx1.sendIdx["should:return:"]=2;
  48579. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  48580. return self;
  48581. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  48582. },
  48583. args: [],
  48584. 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",
  48585. referencedClasses: [],
  48586. messageSends: ["should:return:"]
  48587. }),
  48588. $globals.CodeGeneratorTest);
  48589. $core.addMethod(
  48590. $core.method({
  48591. selector: "testBackslashSelectors",
  48592. protocol: "tests",
  48593. fn: function (){
  48594. var self=this,$self=this;
  48595. return $core.withContext(function($ctx1) {
  48596. $self._should_return_("\x5c arg ^ 4",(4));
  48597. $ctx1.sendIdx["should:return:"]=1;
  48598. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  48599. return self;
  48600. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  48601. },
  48602. args: [],
  48603. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  48604. referencedClasses: [],
  48605. messageSends: ["should:return:"]
  48606. }),
  48607. $globals.CodeGeneratorTest);
  48608. $core.addMethod(
  48609. $core.method({
  48610. selector: "testBlockReturn",
  48611. protocol: "tests",
  48612. fn: function (){
  48613. var self=this,$self=this;
  48614. return $core.withContext(function($ctx1) {
  48615. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  48616. $ctx1.sendIdx["should:return:"]=1;
  48617. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  48618. $ctx1.sendIdx["should:return:"]=2;
  48619. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  48620. return self;
  48621. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  48622. },
  48623. args: [],
  48624. 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).",
  48625. referencedClasses: [],
  48626. messageSends: ["should:return:"]
  48627. }),
  48628. $globals.CodeGeneratorTest);
  48629. $core.addMethod(
  48630. $core.method({
  48631. selector: "testCascades",
  48632. protocol: "tests",
  48633. fn: function (){
  48634. var self=this,$self=this;
  48635. return $core.withContext(function($ctx1) {
  48636. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  48637. return self;
  48638. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  48639. },
  48640. args: [],
  48641. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  48642. referencedClasses: [],
  48643. messageSends: ["should:return:"]
  48644. }),
  48645. $globals.CodeGeneratorTest);
  48646. $core.addMethod(
  48647. $core.method({
  48648. selector: "testCascadesInDynamicArray",
  48649. protocol: "tests",
  48650. fn: function (){
  48651. var self=this,$self=this;
  48652. return $core.withContext(function($ctx1) {
  48653. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  48654. return self;
  48655. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  48656. },
  48657. args: [],
  48658. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  48659. referencedClasses: [],
  48660. messageSends: ["should:return:"]
  48661. }),
  48662. $globals.CodeGeneratorTest);
  48663. $core.addMethod(
  48664. $core.method({
  48665. selector: "testCascadesInDynamicDictioary",
  48666. protocol: "tests",
  48667. fn: function (){
  48668. var self=this,$self=this;
  48669. return $core.withContext(function($ctx1) {
  48670. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  48671. return self;
  48672. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  48673. },
  48674. args: [],
  48675. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  48676. referencedClasses: [],
  48677. messageSends: ["should:return:"]
  48678. }),
  48679. $globals.CodeGeneratorTest);
  48680. $core.addMethod(
  48681. $core.method({
  48682. selector: "testCascadesInSend",
  48683. protocol: "tests",
  48684. fn: function (){
  48685. var self=this,$self=this;
  48686. return $core.withContext(function($ctx1) {
  48687. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  48688. return self;
  48689. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  48690. },
  48691. args: [],
  48692. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  48693. referencedClasses: [],
  48694. messageSends: ["should:return:"]
  48695. }),
  48696. $globals.CodeGeneratorTest);
  48697. $core.addMethod(
  48698. $core.method({
  48699. selector: "testCascadesWithInlining",
  48700. protocol: "tests",
  48701. fn: function (){
  48702. var self=this,$self=this;
  48703. return $core.withContext(function($ctx1) {
  48704. $self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  48705. $ctx1.sendIdx["should:return:"]=1;
  48706. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  48707. return self;
  48708. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  48709. },
  48710. args: [],
  48711. 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",
  48712. referencedClasses: [],
  48713. messageSends: ["should:return:"]
  48714. }),
  48715. $globals.CodeGeneratorTest);
  48716. $core.addMethod(
  48717. $core.method({
  48718. selector: "testDynamicArrayElementsOrdered",
  48719. protocol: "tests",
  48720. fn: function (){
  48721. var self=this,$self=this;
  48722. return $core.withContext(function($ctx1) {
  48723. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  48724. $ctx1.sendIdx["should:return:"]=1;
  48725. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  48726. return self;
  48727. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  48728. },
  48729. args: [],
  48730. 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).",
  48731. referencedClasses: [],
  48732. messageSends: ["should:return:"]
  48733. }),
  48734. $globals.CodeGeneratorTest);
  48735. $core.addMethod(
  48736. $core.method({
  48737. selector: "testDynamicDictionaryElementsOrdered",
  48738. protocol: "tests",
  48739. fn: function (){
  48740. var self=this,$self=this;
  48741. return $core.withContext(function($ctx1) {
  48742. $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)]));
  48743. return self;
  48744. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  48745. },
  48746. args: [],
  48747. 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}.",
  48748. referencedClasses: [],
  48749. messageSends: ["should:return:"]
  48750. }),
  48751. $globals.CodeGeneratorTest);
  48752. $core.addMethod(
  48753. $core.method({
  48754. selector: "testDynamicDictionaryWithMoreArrows",
  48755. protocol: "tests",
  48756. fn: function (){
  48757. var self=this,$self=this;
  48758. return $core.withContext(function($ctx1) {
  48759. var $2,$1;
  48760. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  48761. $ctx1.sendIdx["->"]=1;
  48762. $1=$recv($globals.HashedCollection)._with_($2);
  48763. $self._should_return_("foo ^ #{1->2->3}",$1);
  48764. return self;
  48765. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  48766. },
  48767. args: [],
  48768. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  48769. referencedClasses: ["HashedCollection"],
  48770. messageSends: ["should:return:", "with:", "->"]
  48771. }),
  48772. $globals.CodeGeneratorTest);
  48773. $core.addMethod(
  48774. $core.method({
  48775. selector: "testGlobalVar",
  48776. protocol: "tests",
  48777. fn: function (){
  48778. var self=this,$self=this;
  48779. return $core.withContext(function($ctx1) {
  48780. $self._should_return_("foo ^ eval class",$globals.BlockClosure);
  48781. $ctx1.sendIdx["should:return:"]=1;
  48782. $self._should_return_("foo ^ Math cos: 0",(1));
  48783. $ctx1.sendIdx["should:return:"]=2;
  48784. $self._should_return_("foo ^ NonExistingVar",nil);
  48785. return self;
  48786. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  48787. },
  48788. args: [],
  48789. 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",
  48790. referencedClasses: ["BlockClosure"],
  48791. messageSends: ["should:return:"]
  48792. }),
  48793. $globals.CodeGeneratorTest);
  48794. $core.addMethod(
  48795. $core.method({
  48796. selector: "testInnerTemporalDependentElementsOrdered",
  48797. protocol: "tests",
  48798. fn: function (){
  48799. var self=this,$self=this;
  48800. return $core.withContext(function($ctx1) {
  48801. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  48802. $2="foo".__minus_gt($globals.Array);
  48803. $ctx1.sendIdx["->"]=1;
  48804. $3="bar".__minus_gt((2));
  48805. $ctx1.sendIdx["->"]=2;
  48806. $1=[$2,$3];
  48807. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  48808. $ctx1.sendIdx["should:return:"]=1;
  48809. $5="foo".__minus_gt($globals.Array);
  48810. $ctx1.sendIdx["->"]=3;
  48811. $6="bar".__minus_gt((2));
  48812. $ctx1.sendIdx["->"]=4;
  48813. $4=[$5,$6];
  48814. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  48815. $ctx1.sendIdx["should:return:"]=2;
  48816. $8="foo".__minus_gt((1));
  48817. $ctx1.sendIdx["->"]=5;
  48818. $9="bar".__minus_gt((2));
  48819. $ctx1.sendIdx["->"]=6;
  48820. $7=[$8,$9];
  48821. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  48822. $ctx1.sendIdx["should:return:"]=3;
  48823. $11="foo".__minus_gt((1));
  48824. $ctx1.sendIdx["->"]=7;
  48825. $10=[$11,"bar".__minus_gt((2))];
  48826. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  48827. $ctx1.sendIdx["should:return:"]=4;
  48828. $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)]));
  48829. return self;
  48830. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  48831. },
  48832. args: [],
  48833. 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}.",
  48834. referencedClasses: ["Array"],
  48835. messageSends: ["should:return:", "->"]
  48836. }),
  48837. $globals.CodeGeneratorTest);
  48838. $core.addMethod(
  48839. $core.method({
  48840. selector: "testJSStatement",
  48841. protocol: "tests",
  48842. fn: function (){
  48843. var self=this,$self=this;
  48844. return $core.withContext(function($ctx1) {
  48845. $self._should_return_("foo <return 2+3>",(5));
  48846. return self;
  48847. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  48848. },
  48849. args: [],
  48850. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  48851. referencedClasses: [],
  48852. messageSends: ["should:return:"]
  48853. }),
  48854. $globals.CodeGeneratorTest);
  48855. $core.addMethod(
  48856. $core.method({
  48857. selector: "testLexicalScope",
  48858. protocol: "tests",
  48859. fn: function (){
  48860. var self=this,$self=this;
  48861. return $core.withContext(function($ctx1) {
  48862. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  48863. return self;
  48864. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  48865. },
  48866. args: [],
  48867. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  48868. referencedClasses: [],
  48869. messageSends: ["should:return:"]
  48870. }),
  48871. $globals.CodeGeneratorTest);
  48872. $core.addMethod(
  48873. $core.method({
  48874. selector: "testLiterals",
  48875. protocol: "tests",
  48876. fn: function (){
  48877. var self=this,$self=this;
  48878. return $core.withContext(function($ctx1) {
  48879. $self._should_return_("foo ^ 1",(1));
  48880. $ctx1.sendIdx["should:return:"]=1;
  48881. $self._should_return_("foo ^ 'hello'","hello");
  48882. $ctx1.sendIdx["should:return:"]=2;
  48883. $self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  48884. $ctx1.sendIdx["should:return:"]=3;
  48885. $self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  48886. $ctx1.sendIdx["should:return:"]=4;
  48887. $self._should_return_("foo ^ true",true);
  48888. $ctx1.sendIdx["should:return:"]=5;
  48889. $self._should_return_("foo ^ false",false);
  48890. $ctx1.sendIdx["should:return:"]=6;
  48891. $self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  48892. $ctx1.sendIdx["should:return:"]=7;
  48893. $self._should_return_("foo ^ #hello","hello");
  48894. $ctx1.sendIdx["should:return:"]=8;
  48895. $self._should_return_("foo ^ $h","h");
  48896. $ctx1.sendIdx["should:return:"]=9;
  48897. $self._should_return_("foo ^ -123.456",(-123.456));
  48898. $ctx1.sendIdx["should:return:"]=10;
  48899. $self._should_return_("foo ^ -2.5e4",(-25000));
  48900. return self;
  48901. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  48902. },
  48903. args: [],
  48904. 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.",
  48905. referencedClasses: [],
  48906. messageSends: ["should:return:"]
  48907. }),
  48908. $globals.CodeGeneratorTest);
  48909. $core.addMethod(
  48910. $core.method({
  48911. selector: "testLocalReturn",
  48912. protocol: "tests",
  48913. fn: function (){
  48914. var self=this,$self=this;
  48915. return $core.withContext(function($ctx1) {
  48916. $self._should_return_("foo ^ 1",(1));
  48917. $ctx1.sendIdx["should:return:"]=1;
  48918. $self._should_return_("foo ^ 1 + 1",(2));
  48919. $ctx1.sendIdx["should:return:"]=2;
  48920. $self._should_return_("foo ",$self["@receiver"]);
  48921. $ctx1.sendIdx["should:return:"]=3;
  48922. $self._should_return_("foo self asString",$self["@receiver"]);
  48923. $ctx1.sendIdx["should:return:"]=4;
  48924. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  48925. return self;
  48926. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  48927. },
  48928. args: [],
  48929. 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",
  48930. referencedClasses: [],
  48931. messageSends: ["should:return:"]
  48932. }),
  48933. $globals.CodeGeneratorTest);
  48934. $core.addMethod(
  48935. $core.method({
  48936. selector: "testMessageSends",
  48937. protocol: "tests",
  48938. fn: function (){
  48939. var self=this,$self=this;
  48940. return $core.withContext(function($ctx1) {
  48941. $self._should_return_("foo ^ 1 asString","1");
  48942. $ctx1.sendIdx["should:return:"]=1;
  48943. $self._should_return_("foo ^ 1 + 1",(2));
  48944. $ctx1.sendIdx["should:return:"]=2;
  48945. $self._should_return_("foo ^ 1 + 2 * 3",(9));
  48946. $ctx1.sendIdx["should:return:"]=3;
  48947. $self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  48948. $ctx1.sendIdx["should:return:"]=4;
  48949. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  48950. return self;
  48951. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  48952. },
  48953. args: [],
  48954. 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)",
  48955. referencedClasses: [],
  48956. messageSends: ["should:return:"]
  48957. }),
  48958. $globals.CodeGeneratorTest);
  48959. $core.addMethod(
  48960. $core.method({
  48961. selector: "testMistypedPragmaJSStatement",
  48962. protocol: "tests",
  48963. fn: function (){
  48964. var self=this,$self=this;
  48965. return $core.withContext(function($ctx1) {
  48966. $self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",$self["@receiver"],$globals.ParseError);
  48967. return self;
  48968. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  48969. },
  48970. args: [],
  48971. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  48972. referencedClasses: ["ParseError"],
  48973. messageSends: ["should:receiver:raise:"]
  48974. }),
  48975. $globals.CodeGeneratorTest);
  48976. $core.addMethod(
  48977. $core.method({
  48978. selector: "testMultipleSequences",
  48979. protocol: "tests",
  48980. fn: function (){
  48981. var self=this,$self=this;
  48982. return $core.withContext(function($ctx1) {
  48983. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  48984. return self;
  48985. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  48986. },
  48987. args: [],
  48988. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  48989. referencedClasses: [],
  48990. messageSends: ["should:return:"]
  48991. }),
  48992. $globals.CodeGeneratorTest);
  48993. $core.addMethod(
  48994. $core.method({
  48995. selector: "testMutableLiterals",
  48996. protocol: "tests",
  48997. fn: function (){
  48998. var self=this,$self=this;
  48999. return $core.withContext(function($ctx1) {
  49000. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  49001. return self;
  49002. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  49003. },
  49004. args: [],
  49005. 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)",
  49006. referencedClasses: [],
  49007. messageSends: ["should:return:"]
  49008. }),
  49009. $globals.CodeGeneratorTest);
  49010. $core.addMethod(
  49011. $core.method({
  49012. selector: "testNestedIfTrue",
  49013. protocol: "tests",
  49014. fn: function (){
  49015. var self=this,$self=this;
  49016. return $core.withContext(function($ctx1) {
  49017. $self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  49018. $ctx1.sendIdx["should:return:"]=1;
  49019. $self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  49020. $ctx1.sendIdx["should:return:"]=2;
  49021. $self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  49022. $ctx1.sendIdx["should:return:"]=3;
  49023. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self["@receiver"]);
  49024. return self;
  49025. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  49026. },
  49027. args: [],
  49028. 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.",
  49029. referencedClasses: [],
  49030. messageSends: ["should:return:"]
  49031. }),
  49032. $globals.CodeGeneratorTest);
  49033. $core.addMethod(
  49034. $core.method({
  49035. selector: "testNestedSends",
  49036. protocol: "tests",
  49037. fn: function (){
  49038. var self=this,$self=this;
  49039. return $core.withContext(function($ctx1) {
  49040. $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());
  49041. return self;
  49042. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  49043. },
  49044. args: [],
  49045. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  49046. referencedClasses: ["Point"],
  49047. messageSends: ["should:return:", "asString", "x:y:", "@"]
  49048. }),
  49049. $globals.CodeGeneratorTest);
  49050. $core.addMethod(
  49051. $core.method({
  49052. selector: "testNonLocalReturn",
  49053. protocol: "tests",
  49054. fn: function (){
  49055. var self=this,$self=this;
  49056. return $core.withContext(function($ctx1) {
  49057. $self._should_return_("foo [ ^ 1 ] value",(1));
  49058. $ctx1.sendIdx["should:return:"]=1;
  49059. $self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  49060. $ctx1.sendIdx["should:return:"]=2;
  49061. $self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  49062. $ctx1.sendIdx["should:return:"]=3;
  49063. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  49064. return self;
  49065. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  49066. },
  49067. args: [],
  49068. 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",
  49069. referencedClasses: [],
  49070. messageSends: ["should:return:"]
  49071. }),
  49072. $globals.CodeGeneratorTest);
  49073. $core.addMethod(
  49074. $core.method({
  49075. selector: "testPascalCaseGlobal",
  49076. protocol: "tests",
  49077. fn: function (){
  49078. var self=this,$self=this;
  49079. return $core.withContext(function($ctx1) {
  49080. $self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  49081. $ctx1.sendIdx["should:return:"]=1;
  49082. $self._should_return_("foo ^NonExistent",nil);
  49083. return self;
  49084. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  49085. },
  49086. args: [],
  49087. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  49088. referencedClasses: ["Smalltalk"],
  49089. messageSends: ["should:return:", "at:", "globals"]
  49090. }),
  49091. $globals.CodeGeneratorTest);
  49092. $core.addMethod(
  49093. $core.method({
  49094. selector: "testPragmaJSStatement",
  49095. protocol: "tests",
  49096. fn: function (){
  49097. var self=this,$self=this;
  49098. return $core.withContext(function($ctx1) {
  49099. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  49100. return self;
  49101. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49102. },
  49103. args: [],
  49104. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  49105. referencedClasses: [],
  49106. messageSends: ["should:return:"]
  49107. }),
  49108. $globals.CodeGeneratorTest);
  49109. $core.addMethod(
  49110. $core.method({
  49111. selector: "testRootSuperSend",
  49112. protocol: "tests",
  49113. fn: function (){
  49114. var self=this,$self=this;
  49115. return $core.withContext(function($ctx1) {
  49116. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  49117. return self;
  49118. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  49119. },
  49120. args: [],
  49121. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  49122. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  49123. messageSends: ["should:receiver:raise:", "new"]
  49124. }),
  49125. $globals.CodeGeneratorTest);
  49126. $core.addMethod(
  49127. $core.method({
  49128. selector: "testSendReceiverAndArgumentsOrdered",
  49129. protocol: "tests",
  49130. fn: function (){
  49131. var self=this,$self=this;
  49132. return $core.withContext(function($ctx1) {
  49133. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  49134. $ctx1.sendIdx["should:return:"]=1;
  49135. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  49136. return self;
  49137. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  49138. },
  49139. args: [],
  49140. 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}.",
  49141. referencedClasses: ["Array"],
  49142. messageSends: ["should:return:"]
  49143. }),
  49144. $globals.CodeGeneratorTest);
  49145. $core.addMethod(
  49146. $core.method({
  49147. selector: "testSuperSend",
  49148. protocol: "tests",
  49149. fn: function (){
  49150. var self=this,$self=this;
  49151. return $core.withContext(function($ctx1) {
  49152. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  49153. return self;
  49154. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  49155. },
  49156. args: [],
  49157. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  49158. referencedClasses: [],
  49159. messageSends: ["should:receiver:return:"]
  49160. }),
  49161. $globals.CodeGeneratorTest);
  49162. $core.addMethod(
  49163. $core.method({
  49164. selector: "testTempVariables",
  49165. protocol: "tests",
  49166. fn: function (){
  49167. var self=this,$self=this;
  49168. return $core.withContext(function($ctx1) {
  49169. $self._should_return_("foo | a | ^ a",nil);
  49170. $ctx1.sendIdx["should:return:"]=1;
  49171. $self._should_return_("foo | AVariable | ^ AVariable",nil);
  49172. $ctx1.sendIdx["should:return:"]=2;
  49173. $self._should_return_("foo | a b c | ^ c",nil);
  49174. $ctx1.sendIdx["should:return:"]=3;
  49175. $self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  49176. $ctx1.sendIdx["should:return:"]=4;
  49177. $self._should_return_("foo | a | a:= 1. ^ a",(1));
  49178. $ctx1.sendIdx["should:return:"]=5;
  49179. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  49180. return self;
  49181. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  49182. },
  49183. args: [],
  49184. 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.",
  49185. referencedClasses: [],
  49186. messageSends: ["should:return:"]
  49187. }),
  49188. $globals.CodeGeneratorTest);
  49189. $core.addMethod(
  49190. $core.method({
  49191. selector: "testThisContext",
  49192. protocol: "tests",
  49193. fn: function (){
  49194. var self=this,$self=this;
  49195. return $core.withContext(function($ctx1) {
  49196. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  49197. return self;
  49198. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  49199. },
  49200. args: [],
  49201. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  49202. referencedClasses: [],
  49203. messageSends: ["should:return:"]
  49204. }),
  49205. $globals.CodeGeneratorTest);
  49206. $core.addMethod(
  49207. $core.method({
  49208. selector: "testifFalse",
  49209. protocol: "tests",
  49210. fn: function (){
  49211. var self=this,$self=this;
  49212. return $core.withContext(function($ctx1) {
  49213. $self._should_return_("foo true ifFalse: [ ^ 1 ]",$self["@receiver"]);
  49214. $ctx1.sendIdx["should:return:"]=1;
  49215. $self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  49216. $ctx1.sendIdx["should:return:"]=2;
  49217. $self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  49218. $ctx1.sendIdx["should:return:"]=3;
  49219. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  49220. return self;
  49221. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  49222. },
  49223. args: [],
  49224. 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.",
  49225. referencedClasses: [],
  49226. messageSends: ["should:return:"]
  49227. }),
  49228. $globals.CodeGeneratorTest);
  49229. $core.addMethod(
  49230. $core.method({
  49231. selector: "testifFalseIfTrue",
  49232. protocol: "tests",
  49233. fn: function (){
  49234. var self=this,$self=this;
  49235. return $core.withContext(function($ctx1) {
  49236. $self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  49237. $ctx1.sendIdx["should:return:"]=1;
  49238. $self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  49239. $ctx1.sendIdx["should:return:"]=2;
  49240. $self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  49241. $ctx1.sendIdx["should:return:"]=3;
  49242. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  49243. return self;
  49244. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  49245. },
  49246. args: [],
  49247. 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.",
  49248. referencedClasses: [],
  49249. messageSends: ["should:return:"]
  49250. }),
  49251. $globals.CodeGeneratorTest);
  49252. $core.addMethod(
  49253. $core.method({
  49254. selector: "testifNil",
  49255. protocol: "tests",
  49256. fn: function (){
  49257. var self=this,$self=this;
  49258. return $core.withContext(function($ctx1) {
  49259. $self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  49260. $ctx1.sendIdx["should:return:"]=1;
  49261. $self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  49262. $ctx1.sendIdx["should:return:"]=2;
  49263. $self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self["@receiver"]);
  49264. $ctx1.sendIdx["should:return:"]=3;
  49265. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  49266. return self;
  49267. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  49268. },
  49269. args: [],
  49270. 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.",
  49271. referencedClasses: [],
  49272. messageSends: ["should:return:"]
  49273. }),
  49274. $globals.CodeGeneratorTest);
  49275. $core.addMethod(
  49276. $core.method({
  49277. selector: "testifNilIfNotNil",
  49278. protocol: "tests",
  49279. fn: function (){
  49280. var self=this,$self=this;
  49281. return $core.withContext(function($ctx1) {
  49282. $self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  49283. $ctx1.sendIdx["should:return:"]=1;
  49284. $self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  49285. $ctx1.sendIdx["should:return:"]=2;
  49286. $self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  49287. $ctx1.sendIdx["should:return:"]=3;
  49288. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  49289. return self;
  49290. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  49291. },
  49292. args: [],
  49293. 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.",
  49294. referencedClasses: [],
  49295. messageSends: ["should:return:"]
  49296. }),
  49297. $globals.CodeGeneratorTest);
  49298. $core.addMethod(
  49299. $core.method({
  49300. selector: "testifNotNil",
  49301. protocol: "tests",
  49302. fn: function (){
  49303. var self=this,$self=this;
  49304. return $core.withContext(function($ctx1) {
  49305. $self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  49306. $ctx1.sendIdx["should:return:"]=1;
  49307. $self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  49308. $ctx1.sendIdx["should:return:"]=2;
  49309. $self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  49310. $ctx1.sendIdx["should:return:"]=3;
  49311. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self["@receiver"]);
  49312. return self;
  49313. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  49314. },
  49315. args: [],
  49316. 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.",
  49317. referencedClasses: [],
  49318. messageSends: ["should:return:"]
  49319. }),
  49320. $globals.CodeGeneratorTest);
  49321. $core.addMethod(
  49322. $core.method({
  49323. selector: "testifNotNilWithArgument",
  49324. protocol: "tests",
  49325. fn: function (){
  49326. var self=this,$self=this;
  49327. return $core.withContext(function($ctx1) {
  49328. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  49329. $ctx1.sendIdx["should:return:"]=1;
  49330. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  49331. $ctx1.sendIdx["should:return:"]=2;
  49332. $self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  49333. $ctx1.sendIdx["should:return:"]=3;
  49334. $self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  49335. $ctx1.sendIdx["should:return:"]=4;
  49336. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  49337. $ctx1.sendIdx["should:return:"]=5;
  49338. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  49339. return self;
  49340. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  49341. },
  49342. args: [],
  49343. 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",
  49344. referencedClasses: [],
  49345. messageSends: ["should:return:"]
  49346. }),
  49347. $globals.CodeGeneratorTest);
  49348. $core.addMethod(
  49349. $core.method({
  49350. selector: "testifTrue",
  49351. protocol: "tests",
  49352. fn: function (){
  49353. var self=this,$self=this;
  49354. return $core.withContext(function($ctx1) {
  49355. $self._should_return_("foo false ifTrue: [ ^ 1 ]",$self["@receiver"]);
  49356. $ctx1.sendIdx["should:return:"]=1;
  49357. $self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  49358. $ctx1.sendIdx["should:return:"]=2;
  49359. $self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  49360. $ctx1.sendIdx["should:return:"]=3;
  49361. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  49362. return self;
  49363. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  49364. },
  49365. args: [],
  49366. 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.",
  49367. referencedClasses: [],
  49368. messageSends: ["should:return:"]
  49369. }),
  49370. $globals.CodeGeneratorTest);
  49371. $core.addMethod(
  49372. $core.method({
  49373. selector: "testifTrueIfFalse",
  49374. protocol: "tests",
  49375. fn: function (){
  49376. var self=this,$self=this;
  49377. return $core.withContext(function($ctx1) {
  49378. $self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  49379. $ctx1.sendIdx["should:return:"]=1;
  49380. $self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  49381. $ctx1.sendIdx["should:return:"]=2;
  49382. $self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  49383. $ctx1.sendIdx["should:return:"]=3;
  49384. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  49385. return self;
  49386. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  49387. },
  49388. args: [],
  49389. 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.",
  49390. referencedClasses: [],
  49391. messageSends: ["should:return:"]
  49392. }),
  49393. $globals.CodeGeneratorTest);
  49394. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49395. $core.addMethod(
  49396. $core.method({
  49397. selector: "analyze:forClass:",
  49398. protocol: "parsing",
  49399. fn: function (aNode,aClass){
  49400. var self=this,$self=this;
  49401. return $core.withContext(function($ctx1) {
  49402. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  49403. return aNode;
  49404. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  49405. },
  49406. args: ["aNode", "aClass"],
  49407. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  49408. referencedClasses: ["SemanticAnalyzer"],
  49409. messageSends: ["visit:", "on:"]
  49410. }),
  49411. $globals.ASTInterpreterTest);
  49412. $core.addMethod(
  49413. $core.method({
  49414. selector: "interpret:receiver:withArguments:",
  49415. protocol: "private",
  49416. fn: function (aString,anObject,aDictionary){
  49417. var self=this,$self=this;
  49418. var ctx,ast,interpreter;
  49419. return $core.withContext(function($ctx1) {
  49420. var $1,$2,$3,$receiver;
  49421. interpreter=$recv($globals.ASTInterpreter)._new();
  49422. $ctx1.sendIdx["new"]=1;
  49423. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49424. $1=$recv($globals.AIContext)._new();
  49425. $recv($1)._receiver_(anObject);
  49426. $recv($1)._interpreter_(interpreter);
  49427. ctx=$recv($1)._yourself();
  49428. $2=$recv(ast)._sequenceNode();
  49429. if(($receiver = $2) == null || $receiver.a$nil){
  49430. $2;
  49431. } else {
  49432. var sequence;
  49433. sequence=$receiver;
  49434. $recv($recv(sequence)._temps())._do_((function(each){
  49435. return $core.withContext(function($ctx2) {
  49436. return $recv(ctx)._defineLocal_(each);
  49437. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49438. }));
  49439. }
  49440. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49441. return $core.withContext(function($ctx2) {
  49442. return $recv(ctx)._localAt_put_(key,value);
  49443. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49444. }));
  49445. $3=interpreter;
  49446. $recv($3)._context_(ctx);
  49447. $recv($3)._node_(ast);
  49448. $recv($3)._enterNode();
  49449. $recv($3)._proceed();
  49450. return $recv($3)._result();
  49451. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  49452. },
  49453. args: ["aString", "anObject", "aDictionary"],
  49454. 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",
  49455. referencedClasses: ["ASTInterpreter", "AIContext"],
  49456. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  49457. }),
  49458. $globals.ASTInterpreterTest);
  49459. $core.addMethod(
  49460. $core.method({
  49461. selector: "parse:",
  49462. protocol: "parsing",
  49463. fn: function (aString){
  49464. var self=this,$self=this;
  49465. return $core.withContext(function($ctx1) {
  49466. return $recv($globals.Smalltalk)._parse_(aString);
  49467. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  49468. },
  49469. args: ["aString"],
  49470. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  49471. referencedClasses: ["Smalltalk"],
  49472. messageSends: ["parse:"]
  49473. }),
  49474. $globals.ASTInterpreterTest);
  49475. $core.addMethod(
  49476. $core.method({
  49477. selector: "parse:forClass:",
  49478. protocol: "parsing",
  49479. fn: function (aString,aClass){
  49480. var self=this,$self=this;
  49481. return $core.withContext(function($ctx1) {
  49482. return $self._analyze_forClass_($self._parse_(aString),aClass);
  49483. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  49484. },
  49485. args: ["aString", "aClass"],
  49486. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  49487. referencedClasses: [],
  49488. messageSends: ["analyze:forClass:", "parse:"]
  49489. }),
  49490. $globals.ASTInterpreterTest);
  49491. $core.addMethod(
  49492. $core.method({
  49493. selector: "should:receiver:return:",
  49494. protocol: "testing",
  49495. fn: function (aString,anObject,aResult){
  49496. var self=this,$self=this;
  49497. return $core.withContext(function($ctx1) {
  49498. $self["@receiver"]=anObject;
  49499. return $self._assert_equals_($self._interpret_receiver_withArguments_(aString,$self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  49500. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  49501. },
  49502. args: ["aString", "anObject", "aResult"],
  49503. 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",
  49504. referencedClasses: [],
  49505. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  49506. }),
  49507. $globals.ASTInterpreterTest);
  49508. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  49509. $core.addMethod(
  49510. $core.method({
  49511. selector: "interpret:receiver:withArguments:",
  49512. protocol: "private",
  49513. fn: function (aString,anObject,aDictionary){
  49514. var self=this,$self=this;
  49515. var ctx,ast,debugger_;
  49516. return $core.withContext(function($ctx1) {
  49517. var $1,$2,$3,$4,$5,$receiver;
  49518. $1=$recv($globals.AIContext)._new();
  49519. $ctx1.sendIdx["new"]=1;
  49520. $recv($1)._receiver_(anObject);
  49521. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  49522. ctx=$recv($1)._yourself();
  49523. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49524. $2=$recv(ast)._sequenceNode();
  49525. if(($receiver = $2) == null || $receiver.a$nil){
  49526. $2;
  49527. } else {
  49528. var sequence;
  49529. sequence=$receiver;
  49530. $recv($recv(sequence)._temps())._do_((function(each){
  49531. return $core.withContext(function($ctx2) {
  49532. return $recv(ctx)._defineLocal_(each);
  49533. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49534. }));
  49535. }
  49536. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49537. return $core.withContext(function($ctx2) {
  49538. return $recv(ctx)._localAt_put_(key,value);
  49539. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49540. }));
  49541. $3=$recv(ctx)._interpreter();
  49542. $ctx1.sendIdx["interpreter"]=1;
  49543. $recv($3)._context_(ctx);
  49544. $ctx1.sendIdx["context:"]=1;
  49545. $4=$recv(ctx)._interpreter();
  49546. $recv($4)._node_(ast);
  49547. $recv($4)._enterNode();
  49548. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  49549. $5=debugger_;
  49550. $recv($5)._proceed();
  49551. return $recv($5)._result();
  49552. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  49553. },
  49554. args: ["aString", "anObject", "aDictionary"],
  49555. 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",
  49556. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  49557. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  49558. }),
  49559. $globals.ASTDebuggerTest);
  49560. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49561. $core.addMethod(
  49562. $core.method({
  49563. selector: "codeGeneratorClass",
  49564. protocol: "accessing",
  49565. fn: function (){
  49566. var self=this,$self=this;
  49567. return $globals.InliningCodeGenerator;
  49568. },
  49569. args: [],
  49570. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  49571. referencedClasses: ["InliningCodeGenerator"],
  49572. messageSends: []
  49573. }),
  49574. $globals.InliningCodeGeneratorTest);
  49575. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  49576. $core.addMethod(
  49577. $core.method({
  49578. selector: "testClassRefVar",
  49579. protocol: "tests",
  49580. fn: function (){
  49581. var self=this,$self=this;
  49582. var node;
  49583. return $core.withContext(function($ctx1) {
  49584. var $1,$2;
  49585. $1=$recv($globals.VariableNode)._new();
  49586. $ctx1.sendIdx["new"]=1;
  49587. $recv($1)._value_("Object");
  49588. node=$recv($1)._yourself();
  49589. $2=$recv($globals.SemanticAnalyzer)._new();
  49590. $ctx1.sendIdx["new"]=2;
  49591. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  49592. $recv($2)._visit_(node);
  49593. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  49594. return self;
  49595. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  49596. },
  49597. args: [],
  49598. 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",
  49599. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  49600. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  49601. }),
  49602. $globals.ScopeVarTest);
  49603. $core.addMethod(
  49604. $core.method({
  49605. selector: "testInstanceVar",
  49606. protocol: "tests",
  49607. fn: function (){
  49608. var self=this,$self=this;
  49609. var node,scope;
  49610. return $core.withContext(function($ctx1) {
  49611. var $1;
  49612. $1=$recv($globals.VariableNode)._new();
  49613. $ctx1.sendIdx["new"]=1;
  49614. $recv($1)._value_("bzzz");
  49615. node=$recv($1)._yourself();
  49616. scope=$recv($globals.MethodLexicalScope)._new();
  49617. $recv(scope)._addIVar_("bzzz");
  49618. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  49619. return self;
  49620. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  49621. },
  49622. args: [],
  49623. 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",
  49624. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49625. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  49626. }),
  49627. $globals.ScopeVarTest);
  49628. $core.addMethod(
  49629. $core.method({
  49630. selector: "testPseudoVar",
  49631. protocol: "tests",
  49632. fn: function (){
  49633. var self=this,$self=this;
  49634. var node,pseudoVars;
  49635. return $core.withContext(function($ctx1) {
  49636. var $1;
  49637. pseudoVars=["self", "super", "true", "false", "nil"];
  49638. $recv(pseudoVars)._do_((function(each){
  49639. return $core.withContext(function($ctx2) {
  49640. $1=$recv($globals.VariableNode)._new();
  49641. $ctx2.sendIdx["new"]=1;
  49642. $recv($1)._value_(each);
  49643. node=$recv($1)._yourself();
  49644. node;
  49645. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  49646. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49647. }));
  49648. return self;
  49649. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  49650. },
  49651. args: [],
  49652. 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]",
  49653. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49654. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  49655. }),
  49656. $globals.ScopeVarTest);
  49657. $core.addMethod(
  49658. $core.method({
  49659. selector: "testTempVar",
  49660. protocol: "tests",
  49661. fn: function (){
  49662. var self=this,$self=this;
  49663. var node,scope;
  49664. return $core.withContext(function($ctx1) {
  49665. var $1;
  49666. $1=$recv($globals.VariableNode)._new();
  49667. $ctx1.sendIdx["new"]=1;
  49668. $recv($1)._value_("bzzz");
  49669. node=$recv($1)._yourself();
  49670. scope=$recv($globals.MethodLexicalScope)._new();
  49671. $recv(scope)._addTemp_("bzzz");
  49672. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  49673. return self;
  49674. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  49675. },
  49676. args: [],
  49677. 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",
  49678. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49679. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  49680. }),
  49681. $globals.ScopeVarTest);
  49682. $core.addMethod(
  49683. $core.method({
  49684. selector: "testUnknownVar",
  49685. protocol: "tests",
  49686. fn: function (){
  49687. var self=this,$self=this;
  49688. var node;
  49689. return $core.withContext(function($ctx1) {
  49690. var $1;
  49691. $1=$recv($globals.VariableNode)._new();
  49692. $ctx1.sendIdx["new"]=1;
  49693. $recv($1)._value_("bzzz");
  49694. node=$recv($1)._yourself();
  49695. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  49696. return self;
  49697. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  49698. },
  49699. args: [],
  49700. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  49701. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49702. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  49703. }),
  49704. $globals.ScopeVarTest);
  49705. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  49706. $core.addMethod(
  49707. $core.method({
  49708. selector: "setUp",
  49709. protocol: "running",
  49710. fn: function (){
  49711. var self=this,$self=this;
  49712. return $core.withContext(function($ctx1) {
  49713. $self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  49714. return self;
  49715. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  49716. },
  49717. args: [],
  49718. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  49719. referencedClasses: ["SemanticAnalyzer", "Object"],
  49720. messageSends: ["on:"]
  49721. }),
  49722. $globals.SemanticAnalyzerTest);
  49723. $core.addMethod(
  49724. $core.method({
  49725. selector: "testAssignment",
  49726. protocol: "tests",
  49727. fn: function (){
  49728. var self=this,$self=this;
  49729. var src,ast;
  49730. return $core.withContext(function($ctx1) {
  49731. src="foo self := 1";
  49732. ast=$recv($globals.Smalltalk)._parse_(src);
  49733. $self._should_raise_((function(){
  49734. return $core.withContext(function($ctx2) {
  49735. return $recv($self["@analyzer"])._visit_(ast);
  49736. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49737. }),$globals.InvalidAssignmentError);
  49738. return self;
  49739. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49740. },
  49741. args: [],
  49742. 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",
  49743. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  49744. messageSends: ["parse:", "should:raise:", "visit:"]
  49745. }),
  49746. $globals.SemanticAnalyzerTest);
  49747. $core.addMethod(
  49748. $core.method({
  49749. selector: "testNonLocalReturn",
  49750. protocol: "tests",
  49751. fn: function (){
  49752. var self=this,$self=this;
  49753. var src,ast;
  49754. return $core.withContext(function($ctx1) {
  49755. src="foo | a | a + 1. ^ a";
  49756. ast=$recv($globals.Smalltalk)._parse_(src);
  49757. $recv($self["@analyzer"])._visit_(ast);
  49758. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  49759. return self;
  49760. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49761. },
  49762. args: [],
  49763. 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",
  49764. referencedClasses: ["Smalltalk"],
  49765. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  49766. }),
  49767. $globals.SemanticAnalyzerTest);
  49768. $core.addMethod(
  49769. $core.method({
  49770. selector: "testNonLocalReturn2",
  49771. protocol: "tests",
  49772. fn: function (){
  49773. var self=this,$self=this;
  49774. var src,ast;
  49775. return $core.withContext(function($ctx1) {
  49776. src="foo | a | a + 1. [ [ ^ a] ]";
  49777. ast=$recv($globals.Smalltalk)._parse_(src);
  49778. $recv($self["@analyzer"])._visit_(ast);
  49779. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  49780. return self;
  49781. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49782. },
  49783. args: [],
  49784. 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",
  49785. referencedClasses: ["Smalltalk"],
  49786. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  49787. }),
  49788. $globals.SemanticAnalyzerTest);
  49789. $core.addMethod(
  49790. $core.method({
  49791. selector: "testScope",
  49792. protocol: "tests",
  49793. fn: function (){
  49794. var self=this,$self=this;
  49795. var src,ast;
  49796. return $core.withContext(function($ctx1) {
  49797. var $4,$3,$2,$1;
  49798. src="foo | a | a + 1. [ | b | b := a ]";
  49799. ast=$recv($globals.Smalltalk)._parse_(src);
  49800. $recv($self["@analyzer"])._visit_(ast);
  49801. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  49802. $ctx1.sendIdx["dagChildren"]=1;
  49803. $3=$recv($4)._last();
  49804. $2=$recv($3)._scope();
  49805. $ctx1.sendIdx["scope"]=1;
  49806. $1=$recv($2).__eq_eq($recv(ast)._scope());
  49807. $self._deny_($1);
  49808. return self;
  49809. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49810. },
  49811. args: [],
  49812. 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.",
  49813. referencedClasses: ["Smalltalk"],
  49814. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  49815. }),
  49816. $globals.SemanticAnalyzerTest);
  49817. $core.addMethod(
  49818. $core.method({
  49819. selector: "testScope2",
  49820. protocol: "tests",
  49821. fn: function (){
  49822. var self=this,$self=this;
  49823. var src,ast;
  49824. return $core.withContext(function($ctx1) {
  49825. var $8,$7,$6,$5,$4,$3,$2,$1;
  49826. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  49827. ast=$recv($globals.Smalltalk)._parse_(src);
  49828. $recv($self["@analyzer"])._visit_(ast);
  49829. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  49830. $ctx1.sendIdx["dagChildren"]=3;
  49831. $7=$recv($8)._last();
  49832. $6=$recv($7)._dagChildren();
  49833. $ctx1.sendIdx["dagChildren"]=2;
  49834. $5=$recv($6)._first();
  49835. $ctx1.sendIdx["first"]=2;
  49836. $4=$recv($5)._dagChildren();
  49837. $ctx1.sendIdx["dagChildren"]=1;
  49838. $3=$recv($4)._first();
  49839. $ctx1.sendIdx["first"]=1;
  49840. $2=$recv($3)._scope();
  49841. $ctx1.sendIdx["scope"]=1;
  49842. $1=$recv($2).__eq_eq($recv(ast)._scope());
  49843. $self._deny_($1);
  49844. return self;
  49845. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49846. },
  49847. args: [],
  49848. 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.",
  49849. referencedClasses: ["Smalltalk"],
  49850. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  49851. }),
  49852. $globals.SemanticAnalyzerTest);
  49853. $core.addMethod(
  49854. $core.method({
  49855. selector: "testScopeLevel",
  49856. protocol: "tests",
  49857. fn: function (){
  49858. var self=this,$self=this;
  49859. var src,ast;
  49860. return $core.withContext(function($ctx1) {
  49861. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  49862. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  49863. ast=$recv($globals.Smalltalk)._parse_(src);
  49864. $recv($self["@analyzer"])._visit_(ast);
  49865. $2=$recv(ast)._scope();
  49866. $ctx1.sendIdx["scope"]=1;
  49867. $1=$recv($2)._scopeLevel();
  49868. $ctx1.sendIdx["scopeLevel"]=1;
  49869. $self._assert_equals_($1,(1));
  49870. $ctx1.sendIdx["assert:equals:"]=1;
  49871. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  49872. $ctx1.sendIdx["dagChildren"]=3;
  49873. $9=$recv($10)._last();
  49874. $8=$recv($9)._dagChildren();
  49875. $ctx1.sendIdx["dagChildren"]=2;
  49876. $7=$recv($8)._first();
  49877. $ctx1.sendIdx["first"]=2;
  49878. $6=$recv($7)._dagChildren();
  49879. $ctx1.sendIdx["dagChildren"]=1;
  49880. $5=$recv($6)._first();
  49881. $ctx1.sendIdx["first"]=1;
  49882. $4=$recv($5)._scope();
  49883. $3=$recv($4)._scopeLevel();
  49884. $self._assert_equals_($3,(3));
  49885. return self;
  49886. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49887. },
  49888. args: [],
  49889. 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",
  49890. referencedClasses: ["Smalltalk"],
  49891. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  49892. }),
  49893. $globals.SemanticAnalyzerTest);
  49894. $core.addMethod(
  49895. $core.method({
  49896. selector: "testUnknownVariables",
  49897. protocol: "tests",
  49898. fn: function (){
  49899. var self=this,$self=this;
  49900. var src,ast;
  49901. return $core.withContext(function($ctx1) {
  49902. src="foo | a | b + a";
  49903. ast=$recv($globals.Smalltalk)._parse_(src);
  49904. $self._should_raise_((function(){
  49905. return $core.withContext(function($ctx2) {
  49906. return $recv($self["@analyzer"])._visit_(ast);
  49907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49908. }),$globals.UnknownVariableError);
  49909. return self;
  49910. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49911. },
  49912. args: [],
  49913. 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",
  49914. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  49915. messageSends: ["parse:", "should:raise:", "visit:"]
  49916. }),
  49917. $globals.SemanticAnalyzerTest);
  49918. $core.addMethod(
  49919. $core.method({
  49920. selector: "testUnknownVariablesWithScope",
  49921. protocol: "tests",
  49922. fn: function (){
  49923. var self=this,$self=this;
  49924. var src,ast;
  49925. return $core.withContext(function($ctx1) {
  49926. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  49927. ast=$recv($globals.Smalltalk)._parse_(src);
  49928. $self._should_raise_((function(){
  49929. return $core.withContext(function($ctx2) {
  49930. return $recv($self["@analyzer"])._visit_(ast);
  49931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49932. }),$globals.UnknownVariableError);
  49933. return self;
  49934. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49935. },
  49936. args: [],
  49937. 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",
  49938. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  49939. messageSends: ["parse:", "should:raise:", "visit:"]
  49940. }),
  49941. $globals.SemanticAnalyzerTest);
  49942. $core.addMethod(
  49943. $core.method({
  49944. selector: "testVariableShadowing",
  49945. protocol: "tests",
  49946. fn: function (){
  49947. var self=this,$self=this;
  49948. var src,ast;
  49949. return $core.withContext(function($ctx1) {
  49950. src="foo | a | a + 1";
  49951. ast=$recv($globals.Smalltalk)._parse_(src);
  49952. $recv($self["@analyzer"])._visit_(ast);
  49953. return self;
  49954. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49955. },
  49956. args: [],
  49957. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  49958. referencedClasses: ["Smalltalk"],
  49959. messageSends: ["parse:", "visit:"]
  49960. }),
  49961. $globals.SemanticAnalyzerTest);
  49962. $core.addMethod(
  49963. $core.method({
  49964. selector: "testVariableShadowing2",
  49965. protocol: "tests",
  49966. fn: function (){
  49967. var self=this,$self=this;
  49968. var src,ast;
  49969. return $core.withContext(function($ctx1) {
  49970. src="foo | a | a + 1. [ | a | a := 2 ]";
  49971. ast=$recv($globals.Smalltalk)._parse_(src);
  49972. $self._should_raise_((function(){
  49973. return $core.withContext(function($ctx2) {
  49974. return $recv($self["@analyzer"])._visit_(ast);
  49975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49976. }),$globals.ShadowingVariableError);
  49977. return self;
  49978. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49979. },
  49980. args: [],
  49981. 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",
  49982. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  49983. messageSends: ["parse:", "should:raise:", "visit:"]
  49984. }),
  49985. $globals.SemanticAnalyzerTest);
  49986. $core.addMethod(
  49987. $core.method({
  49988. selector: "testVariableShadowing3",
  49989. protocol: "tests",
  49990. fn: function (){
  49991. var self=this,$self=this;
  49992. var src,ast;
  49993. return $core.withContext(function($ctx1) {
  49994. src="foo | a | a + 1. [ | b | b := 2 ]";
  49995. ast=$recv($globals.Smalltalk)._parse_(src);
  49996. $recv($self["@analyzer"])._visit_(ast);
  49997. return self;
  49998. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49999. },
  50000. args: [],
  50001. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50002. referencedClasses: ["Smalltalk"],
  50003. messageSends: ["parse:", "visit:"]
  50004. }),
  50005. $globals.SemanticAnalyzerTest);
  50006. $core.addMethod(
  50007. $core.method({
  50008. selector: "testVariableShadowing4",
  50009. protocol: "tests",
  50010. fn: function (){
  50011. var self=this,$self=this;
  50012. var src,ast;
  50013. return $core.withContext(function($ctx1) {
  50014. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  50015. ast=$recv($globals.Smalltalk)._parse_(src);
  50016. $recv($self["@analyzer"])._visit_(ast);
  50017. return self;
  50018. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50019. },
  50020. args: [],
  50021. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50022. referencedClasses: ["Smalltalk"],
  50023. messageSends: ["parse:", "visit:"]
  50024. }),
  50025. $globals.SemanticAnalyzerTest);
  50026. $core.addMethod(
  50027. $core.method({
  50028. selector: "testVariableShadowing5",
  50029. protocol: "tests",
  50030. fn: function (){
  50031. var self=this,$self=this;
  50032. var src,ast;
  50033. return $core.withContext(function($ctx1) {
  50034. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  50035. ast=$recv($globals.Smalltalk)._parse_(src);
  50036. $self._should_raise_((function(){
  50037. return $core.withContext(function($ctx2) {
  50038. return $recv($self["@analyzer"])._visit_(ast);
  50039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50040. }),$globals.ShadowingVariableError);
  50041. return self;
  50042. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50043. },
  50044. args: [],
  50045. 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",
  50046. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50047. messageSends: ["parse:", "should:raise:", "visit:"]
  50048. }),
  50049. $globals.SemanticAnalyzerTest);
  50050. $core.addMethod(
  50051. $core.method({
  50052. selector: "testVariablesLookup",
  50053. protocol: "tests",
  50054. fn: function (){
  50055. var self=this,$self=this;
  50056. var src,ast;
  50057. return $core.withContext(function($ctx1) {
  50058. 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;
  50059. src="foo | a | a + 1. [ | b | b := a ]";
  50060. ast=$recv($globals.Smalltalk)._parse_(src);
  50061. $recv($self["@analyzer"])._visit_(ast);
  50062. $7=$recv(ast)._dagChildren();
  50063. $ctx1.sendIdx["dagChildren"]=2;
  50064. $6=$recv($7)._first();
  50065. $ctx1.sendIdx["first"]=2;
  50066. $5=$recv($6)._dagChildren();
  50067. $ctx1.sendIdx["dagChildren"]=1;
  50068. $4=$recv($5)._first();
  50069. $ctx1.sendIdx["first"]=1;
  50070. $3=$recv($4)._receiver();
  50071. $ctx1.sendIdx["receiver"]=1;
  50072. $2=$recv($3)._binding();
  50073. $ctx1.sendIdx["binding"]=1;
  50074. $1=$recv($2)._isTempVar();
  50075. $ctx1.sendIdx["isTempVar"]=1;
  50076. $self._assert_($1);
  50077. $ctx1.sendIdx["assert:"]=1;
  50078. $15=$recv(ast)._dagChildren();
  50079. $ctx1.sendIdx["dagChildren"]=4;
  50080. $14=$recv($15)._first();
  50081. $ctx1.sendIdx["first"]=4;
  50082. $13=$recv($14)._dagChildren();
  50083. $ctx1.sendIdx["dagChildren"]=3;
  50084. $12=$recv($13)._first();
  50085. $ctx1.sendIdx["first"]=3;
  50086. $11=$recv($12)._receiver();
  50087. $10=$recv($11)._binding();
  50088. $ctx1.sendIdx["binding"]=2;
  50089. $9=$recv($10)._scope();
  50090. $ctx1.sendIdx["scope"]=1;
  50091. $16=$recv(ast)._scope();
  50092. $ctx1.sendIdx["scope"]=2;
  50093. $8=$recv($9).__eq_eq($16);
  50094. $ctx1.sendIdx["=="]=1;
  50095. $self._assert_($8);
  50096. $ctx1.sendIdx["assert:"]=2;
  50097. $27=$recv(ast)._dagChildren();
  50098. $ctx1.sendIdx["dagChildren"]=8;
  50099. $26=$recv($27)._first();
  50100. $ctx1.sendIdx["first"]=7;
  50101. $25=$recv($26)._dagChildren();
  50102. $ctx1.sendIdx["dagChildren"]=7;
  50103. $24=$recv($25)._last();
  50104. $ctx1.sendIdx["last"]=1;
  50105. $23=$recv($24)._dagChildren();
  50106. $ctx1.sendIdx["dagChildren"]=6;
  50107. $22=$recv($23)._first();
  50108. $ctx1.sendIdx["first"]=6;
  50109. $21=$recv($22)._dagChildren();
  50110. $ctx1.sendIdx["dagChildren"]=5;
  50111. $20=$recv($21)._first();
  50112. $ctx1.sendIdx["first"]=5;
  50113. $19=$recv($20)._left();
  50114. $ctx1.sendIdx["left"]=1;
  50115. $18=$recv($19)._binding();
  50116. $ctx1.sendIdx["binding"]=3;
  50117. $17=$recv($18)._isTempVar();
  50118. $self._assert_($17);
  50119. $ctx1.sendIdx["assert:"]=3;
  50120. $39=$recv(ast)._dagChildren();
  50121. $ctx1.sendIdx["dagChildren"]=12;
  50122. $38=$recv($39)._first();
  50123. $ctx1.sendIdx["first"]=10;
  50124. $37=$recv($38)._dagChildren();
  50125. $ctx1.sendIdx["dagChildren"]=11;
  50126. $36=$recv($37)._last();
  50127. $ctx1.sendIdx["last"]=2;
  50128. $35=$recv($36)._dagChildren();
  50129. $ctx1.sendIdx["dagChildren"]=10;
  50130. $34=$recv($35)._first();
  50131. $ctx1.sendIdx["first"]=9;
  50132. $33=$recv($34)._dagChildren();
  50133. $ctx1.sendIdx["dagChildren"]=9;
  50134. $32=$recv($33)._first();
  50135. $ctx1.sendIdx["first"]=8;
  50136. $31=$recv($32)._left();
  50137. $30=$recv($31)._binding();
  50138. $29=$recv($30)._scope();
  50139. $ctx1.sendIdx["scope"]=3;
  50140. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50141. $ctx1.sendIdx["dagChildren"]=13;
  50142. $41=$recv($42)._last();
  50143. $40=$recv($41)._scope();
  50144. $28=$recv($29).__eq_eq($40);
  50145. $self._assert_($28);
  50146. return self;
  50147. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50148. },
  50149. args: [],
  50150. 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.",
  50151. referencedClasses: ["Smalltalk"],
  50152. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  50153. }),
  50154. $globals.SemanticAnalyzerTest);
  50155. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  50156. $core.addMethod(
  50157. $core.method({
  50158. selector: "setUp",
  50159. protocol: "running",
  50160. fn: function (){
  50161. var self=this,$self=this;
  50162. return $core.withContext(function($ctx1) {
  50163. var $1,$3,$4,$2;
  50164. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  50165. $3=$recv($globals.AIContext)._new();
  50166. $recv($3)._defineLocal_("local");
  50167. $recv($3)._localAt_put_("local",(3));
  50168. $4=$recv($3)._yourself();
  50169. $ctx1.sendIdx["yourself"]=1;
  50170. $2=$4;
  50171. $recv($1)._context_($2);
  50172. $self["@analyzer"]=$recv($1)._yourself();
  50173. return self;
  50174. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  50175. },
  50176. args: [],
  50177. 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",
  50178. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  50179. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  50180. }),
  50181. $globals.AISemanticAnalyzerTest);
  50182. $core.addMethod(
  50183. $core.method({
  50184. selector: "testContextVariables",
  50185. protocol: "tests",
  50186. fn: function (){
  50187. var self=this,$self=this;
  50188. var src,ast;
  50189. return $core.withContext(function($ctx1) {
  50190. src="foo | a | local + a";
  50191. ast=$recv($globals.Smalltalk)._parse_(src);
  50192. $self._shouldnt_raise_((function(){
  50193. return $core.withContext(function($ctx2) {
  50194. return $recv($self["@analyzer"])._visit_(ast);
  50195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50196. }),$globals.UnknownVariableError);
  50197. return self;
  50198. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  50199. },
  50200. args: [],
  50201. 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",
  50202. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50203. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  50204. }),
  50205. $globals.AISemanticAnalyzerTest);
  50206. });
  50207. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  50208. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  50209. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  50210. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  50211. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  50212. $core.addPackage("Kernel-Tests");
  50213. $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  50214. $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  50215. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  50216. $core.addMethod(
  50217. $core.method({
  50218. selector: "testAddExtensionMethod",
  50219. protocol: "tests",
  50220. fn: function (){
  50221. var self=this,$self=this;
  50222. var method,dirty;
  50223. return $core.withContext(function($ctx1) {
  50224. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  50225. $2=$self._class();
  50226. $ctx1.sendIdx["class"]=1;
  50227. $1=$recv($2)._package();
  50228. $ctx1.sendIdx["package"]=1;
  50229. dirty=$recv($1)._isDirty();
  50230. $ctx1.sendIdx["isDirty"]=1;
  50231. $4=$self._class();
  50232. $ctx1.sendIdx["class"]=2;
  50233. $3=$recv($4)._package();
  50234. $ctx1.sendIdx["package"]=2;
  50235. $recv($3)._beClean();
  50236. $5=$self._class();
  50237. $ctx1.sendIdx["class"]=3;
  50238. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  50239. $8=$self._class();
  50240. $ctx1.sendIdx["class"]=4;
  50241. $7=$recv($8)._package();
  50242. $ctx1.sendIdx["package"]=3;
  50243. $6=$recv($7)._isDirty();
  50244. $self._deny_($6);
  50245. $9=$self._class();
  50246. $ctx1.sendIdx["class"]=5;
  50247. $recv($9)._removeCompiledMethod_(method);
  50248. $10=dirty;
  50249. if($core.assert($10)){
  50250. $recv($recv($self._class())._package())._beDirty();
  50251. }
  50252. return self;
  50253. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  50254. },
  50255. args: [],
  50256. 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 ]",
  50257. referencedClasses: [],
  50258. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  50259. }),
  50260. $globals.AnnouncementSubscriptionTest);
  50261. $core.addMethod(
  50262. $core.method({
  50263. selector: "testHandlesAnnouncement",
  50264. protocol: "tests",
  50265. fn: function (){
  50266. var self=this,$self=this;
  50267. var subscription,announcementClass1,announcementClass2,classBuilder;
  50268. return $core.withContext(function($ctx1) {
  50269. var $1,$2;
  50270. classBuilder=$recv($globals.ClassBuilder)._new();
  50271. $ctx1.sendIdx["new"]=1;
  50272. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  50273. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  50274. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  50275. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  50276. $self._assert_equals_($1,true);
  50277. $ctx1.sendIdx["assert:equals:"]=1;
  50278. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  50279. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  50280. $self._assert_equals_($2,true);
  50281. $ctx1.sendIdx["assert:equals:"]=2;
  50282. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  50283. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  50284. return self;
  50285. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  50286. },
  50287. args: [],
  50288. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  50289. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  50290. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  50291. }),
  50292. $globals.AnnouncementSubscriptionTest);
  50293. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  50294. $core.addMethod(
  50295. $core.method({
  50296. selector: "testOnDo",
  50297. protocol: "tests",
  50298. fn: function (){
  50299. var self=this,$self=this;
  50300. var counter,announcer;
  50301. return $core.withContext(function($ctx1) {
  50302. var $1,$2;
  50303. counter=(0);
  50304. announcer=$recv($globals.Announcer)._new();
  50305. $ctx1.sendIdx["new"]=1;
  50306. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  50307. return $core.withContext(function($ctx2) {
  50308. counter=$recv(counter).__plus((1));
  50309. return counter;
  50310. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50311. }));
  50312. $1=announcer;
  50313. $2=$recv($globals.SystemAnnouncement)._new();
  50314. $ctx1.sendIdx["new"]=2;
  50315. $recv($1)._announce_($2);
  50316. $ctx1.sendIdx["announce:"]=1;
  50317. $self._assert_equals_(counter,(1));
  50318. $ctx1.sendIdx["assert:equals:"]=1;
  50319. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50320. $self._assert_equals_(counter,(2));
  50321. return self;
  50322. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50323. },
  50324. args: [],
  50325. 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.",
  50326. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50327. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  50328. }),
  50329. $globals.AnnouncerTest);
  50330. $core.addMethod(
  50331. $core.method({
  50332. selector: "testOnDoFor",
  50333. protocol: "tests",
  50334. fn: function (){
  50335. var self=this,$self=this;
  50336. var counter,announcer;
  50337. return $core.withContext(function($ctx1) {
  50338. var $1,$2,$3,$4;
  50339. counter=(0);
  50340. announcer=$recv($globals.Announcer)._new();
  50341. $ctx1.sendIdx["new"]=1;
  50342. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  50343. return $core.withContext(function($ctx2) {
  50344. counter=$recv(counter).__plus((1));
  50345. return counter;
  50346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50347. }),self);
  50348. $1=announcer;
  50349. $2=$recv($globals.SystemAnnouncement)._new();
  50350. $ctx1.sendIdx["new"]=2;
  50351. $recv($1)._announce_($2);
  50352. $ctx1.sendIdx["announce:"]=1;
  50353. $self._assert_equals_(counter,(1));
  50354. $ctx1.sendIdx["assert:equals:"]=1;
  50355. $3=announcer;
  50356. $4=$recv($globals.SystemAnnouncement)._new();
  50357. $ctx1.sendIdx["new"]=3;
  50358. $recv($3)._announce_($4);
  50359. $ctx1.sendIdx["announce:"]=2;
  50360. $self._assert_equals_(counter,(2));
  50361. $ctx1.sendIdx["assert:equals:"]=2;
  50362. $recv(announcer)._unsubscribe_(self);
  50363. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50364. $self._assert_equals_(counter,(2));
  50365. return self;
  50366. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50367. },
  50368. args: [],
  50369. 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.",
  50370. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50371. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  50372. }),
  50373. $globals.AnnouncerTest);
  50374. $core.addMethod(
  50375. $core.method({
  50376. selector: "testOnDoOnce",
  50377. protocol: "tests",
  50378. fn: function (){
  50379. var self=this,$self=this;
  50380. var counter,announcer;
  50381. return $core.withContext(function($ctx1) {
  50382. var $1,$2;
  50383. counter=(0);
  50384. announcer=$recv($globals.Announcer)._new();
  50385. $ctx1.sendIdx["new"]=1;
  50386. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  50387. return $core.withContext(function($ctx2) {
  50388. counter=$recv(counter).__plus((1));
  50389. return counter;
  50390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50391. }));
  50392. $1=announcer;
  50393. $2=$recv($globals.SystemAnnouncement)._new();
  50394. $ctx1.sendIdx["new"]=2;
  50395. $recv($1)._announce_($2);
  50396. $ctx1.sendIdx["announce:"]=1;
  50397. $self._assert_equals_(counter,(1));
  50398. $ctx1.sendIdx["assert:equals:"]=1;
  50399. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50400. $self._assert_equals_(counter,(1));
  50401. return self;
  50402. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50403. },
  50404. args: [],
  50405. 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.",
  50406. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50407. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  50408. }),
  50409. $globals.AnnouncerTest);
  50410. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  50411. $core.addMethod(
  50412. $core.method({
  50413. selector: "localReturnOnDoCatch",
  50414. protocol: "fixture",
  50415. fn: function (){
  50416. var self=this,$self=this;
  50417. return $core.withContext(function($ctx1) {
  50418. var $early={};
  50419. try {
  50420. $recv((function(){
  50421. throw $early=[(2)];
  50422. }))._on_do_($globals.Error,(function(){
  50423. }));
  50424. return (3);
  50425. }
  50426. catch(e) {if(e===$early)return e[0]; throw e}
  50427. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50428. },
  50429. args: [],
  50430. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  50431. referencedClasses: ["Error"],
  50432. messageSends: ["on:do:"]
  50433. }),
  50434. $globals.BlockClosureTest);
  50435. $core.addMethod(
  50436. $core.method({
  50437. selector: "localReturnOnDoMiss",
  50438. protocol: "fixture",
  50439. fn: function (){
  50440. var self=this,$self=this;
  50441. return $core.withContext(function($ctx1) {
  50442. var $early={};
  50443. try {
  50444. $recv((function(){
  50445. throw $early=[(2)];
  50446. }))._on_do_($globals.Class,(function(){
  50447. }));
  50448. return (3);
  50449. }
  50450. catch(e) {if(e===$early)return e[0]; throw e}
  50451. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  50452. },
  50453. args: [],
  50454. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  50455. referencedClasses: ["Class"],
  50456. messageSends: ["on:do:"]
  50457. }),
  50458. $globals.BlockClosureTest);
  50459. $core.addMethod(
  50460. $core.method({
  50461. selector: "testCanClearInterval",
  50462. protocol: "tests",
  50463. fn: function (){
  50464. var self=this,$self=this;
  50465. return $core.withContext(function($ctx1) {
  50466. $self._shouldnt_raise_((function(){
  50467. return $core.withContext(function($ctx2) {
  50468. return $recv($recv((function(){
  50469. return $core.withContext(function($ctx3) {
  50470. return $recv($recv($globals.Error)._new())._signal();
  50471. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50472. }))._valueWithInterval_((0)))._clearInterval();
  50473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50474. }),$globals.Error);
  50475. return self;
  50476. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  50477. },
  50478. args: [],
  50479. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  50480. referencedClasses: ["Error"],
  50481. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  50482. }),
  50483. $globals.BlockClosureTest);
  50484. $core.addMethod(
  50485. $core.method({
  50486. selector: "testCanClearTimeout",
  50487. protocol: "tests",
  50488. fn: function (){
  50489. var self=this,$self=this;
  50490. return $core.withContext(function($ctx1) {
  50491. $self._shouldnt_raise_((function(){
  50492. return $core.withContext(function($ctx2) {
  50493. return $recv($recv((function(){
  50494. return $core.withContext(function($ctx3) {
  50495. return $recv($recv($globals.Error)._new())._signal();
  50496. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50497. }))._valueWithTimeout_((0)))._clearTimeout();
  50498. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50499. }),$globals.Error);
  50500. return self;
  50501. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  50502. },
  50503. args: [],
  50504. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  50505. referencedClasses: ["Error"],
  50506. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  50507. }),
  50508. $globals.BlockClosureTest);
  50509. $core.addMethod(
  50510. $core.method({
  50511. selector: "testCompiledSource",
  50512. protocol: "tests",
  50513. fn: function (){
  50514. var self=this,$self=this;
  50515. return $core.withContext(function($ctx1) {
  50516. $self._assert_($recv($recv((function(){
  50517. return $core.withContext(function($ctx2) {
  50518. return (1).__plus((1));
  50519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50520. }))._compiledSource())._includesSubString_("function"));
  50521. return self;
  50522. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  50523. },
  50524. args: [],
  50525. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  50526. referencedClasses: [],
  50527. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  50528. }),
  50529. $globals.BlockClosureTest);
  50530. $core.addMethod(
  50531. $core.method({
  50532. selector: "testCurrySelf",
  50533. protocol: "tests",
  50534. fn: function (){
  50535. var self=this,$self=this;
  50536. var curriedMethod,array;
  50537. return $core.withContext(function($ctx1) {
  50538. curriedMethod=$recv($recv((function(selfarg,x){
  50539. return $core.withContext(function($ctx2) {
  50540. return $recv(selfarg)._at_(x);
  50541. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  50542. }))._currySelf())._asCompiledMethod_("foo:");
  50543. array=[(3), (1), (4)];
  50544. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  50545. $recv((function(){
  50546. return $core.withContext(function($ctx2) {
  50547. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  50548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50549. }))._ensure_((function(){
  50550. return $core.withContext(function($ctx2) {
  50551. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  50552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50553. }));
  50554. return self;
  50555. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  50556. },
  50557. args: [],
  50558. 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 ]",
  50559. referencedClasses: ["ClassBuilder", "Array"],
  50560. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  50561. }),
  50562. $globals.BlockClosureTest);
  50563. $core.addMethod(
  50564. $core.method({
  50565. selector: "testEnsure",
  50566. protocol: "tests",
  50567. fn: function (){
  50568. var self=this,$self=this;
  50569. return $core.withContext(function($ctx1) {
  50570. $self._assert_equals_($recv((function(){
  50571. return (3);
  50572. }))._ensure_((function(){
  50573. return (4);
  50574. })),(3));
  50575. return self;
  50576. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  50577. },
  50578. args: [],
  50579. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  50580. referencedClasses: [],
  50581. messageSends: ["assert:equals:", "ensure:"]
  50582. }),
  50583. $globals.BlockClosureTest);
  50584. $core.addMethod(
  50585. $core.method({
  50586. selector: "testEnsureRaises",
  50587. protocol: "tests",
  50588. fn: function (){
  50589. var self=this,$self=this;
  50590. return $core.withContext(function($ctx1) {
  50591. $self._should_raise_((function(){
  50592. return $core.withContext(function($ctx2) {
  50593. return $recv((function(){
  50594. return $core.withContext(function($ctx3) {
  50595. return $recv($recv($globals.Error)._new())._signal();
  50596. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50597. }))._ensure_((function(){
  50598. return true;
  50599. }));
  50600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50601. }),$globals.Error);
  50602. return self;
  50603. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  50604. },
  50605. args: [],
  50606. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  50607. referencedClasses: ["Error"],
  50608. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  50609. }),
  50610. $globals.BlockClosureTest);
  50611. $core.addMethod(
  50612. $core.method({
  50613. selector: "testExceptionSemantics",
  50614. protocol: "tests",
  50615. fn: function (){
  50616. var self=this,$self=this;
  50617. return $core.withContext(function($ctx1) {
  50618. $self._timeout_((100));
  50619. $recv($self._async_((function(){
  50620. return $core.withContext(function($ctx2) {
  50621. return $recv((function(){
  50622. return $core.withContext(function($ctx3) {
  50623. $self._assert_(true);
  50624. $recv($globals.Error)._signal();
  50625. $self._deny_(true);
  50626. return $self._finished();
  50627. $ctx3.sendIdx["finished"]=1;
  50628. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50629. }))._on_do_($globals.Error,(function(ex){
  50630. return $core.withContext(function($ctx3) {
  50631. return $self._finished();
  50632. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  50633. }));
  50634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50635. })))._valueWithTimeout_((0));
  50636. return self;
  50637. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  50638. },
  50639. args: [],
  50640. 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",
  50641. referencedClasses: ["Error"],
  50642. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  50643. }),
  50644. $globals.BlockClosureTest);
  50645. $core.addMethod(
  50646. $core.method({
  50647. selector: "testLocalReturnOnDoCatch",
  50648. protocol: "tests",
  50649. fn: function (){
  50650. var self=this,$self=this;
  50651. return $core.withContext(function($ctx1) {
  50652. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  50653. return self;
  50654. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50655. },
  50656. args: [],
  50657. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  50658. referencedClasses: [],
  50659. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  50660. }),
  50661. $globals.BlockClosureTest);
  50662. $core.addMethod(
  50663. $core.method({
  50664. selector: "testLocalReturnOnDoMiss",
  50665. protocol: "tests",
  50666. fn: function (){
  50667. var self=this,$self=this;
  50668. return $core.withContext(function($ctx1) {
  50669. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  50670. return self;
  50671. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  50672. },
  50673. args: [],
  50674. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  50675. referencedClasses: [],
  50676. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  50677. }),
  50678. $globals.BlockClosureTest);
  50679. $core.addMethod(
  50680. $core.method({
  50681. selector: "testNewWithValues",
  50682. protocol: "tests",
  50683. fn: function (){
  50684. var self=this,$self=this;
  50685. return $core.withContext(function($ctx1) {
  50686. function TestConstructor(arg1, arg2, arg3) {}
  50687. TestConstructor.prototype.name = "theTestPrototype";
  50688. var wrappedConstructor = $recv(TestConstructor);
  50689. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  50690. $self._assert_(result instanceof TestConstructor);
  50691. $self._assert_equals_(result.name, "theTestPrototype");
  50692. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  50693. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  50694. return self;
  50695. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  50696. },
  50697. args: [],
  50698. 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'>",
  50699. referencedClasses: [],
  50700. messageSends: []
  50701. }),
  50702. $globals.BlockClosureTest);
  50703. $core.addMethod(
  50704. $core.method({
  50705. selector: "testNumArgs",
  50706. protocol: "tests",
  50707. fn: function (){
  50708. var self=this,$self=this;
  50709. return $core.withContext(function($ctx1) {
  50710. var $1;
  50711. $1=$recv((function(){
  50712. }))._numArgs();
  50713. $ctx1.sendIdx["numArgs"]=1;
  50714. $self._assert_equals_($1,(0));
  50715. $ctx1.sendIdx["assert:equals:"]=1;
  50716. $self._assert_equals_($recv((function(a,b){
  50717. }))._numArgs(),(2));
  50718. return self;
  50719. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  50720. },
  50721. args: [],
  50722. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  50723. referencedClasses: [],
  50724. messageSends: ["assert:equals:", "numArgs"]
  50725. }),
  50726. $globals.BlockClosureTest);
  50727. $core.addMethod(
  50728. $core.method({
  50729. selector: "testOnDo",
  50730. protocol: "tests",
  50731. fn: function (){
  50732. var self=this,$self=this;
  50733. return $core.withContext(function($ctx1) {
  50734. $self._assert_($recv((function(){
  50735. return $core.withContext(function($ctx2) {
  50736. return $recv($recv($globals.Error)._new())._signal();
  50737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50738. }))._on_do_($globals.Error,(function(ex){
  50739. return true;
  50740. })));
  50741. return self;
  50742. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  50743. },
  50744. args: [],
  50745. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  50746. referencedClasses: ["Error"],
  50747. messageSends: ["assert:", "on:do:", "signal", "new"]
  50748. }),
  50749. $globals.BlockClosureTest);
  50750. $core.addMethod(
  50751. $core.method({
  50752. selector: "testValue",
  50753. protocol: "tests",
  50754. fn: function (){
  50755. var self=this,$self=this;
  50756. return $core.withContext(function($ctx1) {
  50757. var $1;
  50758. $1=$recv((function(){
  50759. return $core.withContext(function($ctx2) {
  50760. return (1).__plus((1));
  50761. $ctx2.sendIdx["+"]=1;
  50762. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50763. }))._value();
  50764. $ctx1.sendIdx["value"]=1;
  50765. $self._assert_equals_($1,(2));
  50766. $ctx1.sendIdx["assert:equals:"]=1;
  50767. $self._assert_equals_($recv((function(x){
  50768. return $core.withContext(function($ctx2) {
  50769. return $recv(x).__plus((1));
  50770. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  50771. }))._value_((2)),(3));
  50772. $ctx1.sendIdx["assert:equals:"]=2;
  50773. $self._assert_equals_($recv((function(x,y){
  50774. return $core.withContext(function($ctx2) {
  50775. return $recv(x).__star(y);
  50776. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  50777. }))._value_value_((2),(4)),(8));
  50778. $ctx1.sendIdx["assert:equals:"]=3;
  50779. $self._assert_equals_($recv((function(a,b,c){
  50780. return (1);
  50781. }))._value(),(1));
  50782. return self;
  50783. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  50784. },
  50785. args: [],
  50786. 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",
  50787. referencedClasses: [],
  50788. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  50789. }),
  50790. $globals.BlockClosureTest);
  50791. $core.addMethod(
  50792. $core.method({
  50793. selector: "testValueWithPossibleArguments",
  50794. protocol: "tests",
  50795. fn: function (){
  50796. var self=this,$self=this;
  50797. return $core.withContext(function($ctx1) {
  50798. var $1,$2;
  50799. $1=$recv((function(){
  50800. return (1);
  50801. }))._valueWithPossibleArguments_([(3), (4)]);
  50802. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  50803. $self._assert_equals_($1,(1));
  50804. $ctx1.sendIdx["assert:equals:"]=1;
  50805. $2=$recv((function(a){
  50806. return $core.withContext(function($ctx2) {
  50807. return $recv(a).__plus((4));
  50808. $ctx2.sendIdx["+"]=1;
  50809. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  50810. }))._valueWithPossibleArguments_([(3), (4)]);
  50811. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  50812. $self._assert_equals_($2,(7));
  50813. $ctx1.sendIdx["assert:equals:"]=2;
  50814. $self._assert_equals_($recv((function(a,b){
  50815. return $core.withContext(function($ctx2) {
  50816. return $recv(a).__plus(b);
  50817. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  50818. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  50819. return self;
  50820. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  50821. },
  50822. args: [],
  50823. 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.",
  50824. referencedClasses: [],
  50825. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  50826. }),
  50827. $globals.BlockClosureTest);
  50828. $core.addMethod(
  50829. $core.method({
  50830. selector: "testWhileFalse",
  50831. protocol: "tests",
  50832. fn: function (){
  50833. var self=this,$self=this;
  50834. var i;
  50835. return $core.withContext(function($ctx1) {
  50836. i=(0);
  50837. $recv((function(){
  50838. return $core.withContext(function($ctx2) {
  50839. return $recv(i).__gt((5));
  50840. $ctx2.sendIdx[">"]=1;
  50841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50842. }))._whileFalse_((function(){
  50843. return $core.withContext(function($ctx2) {
  50844. i=$recv(i).__plus((1));
  50845. $ctx2.sendIdx["+"]=1;
  50846. return i;
  50847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50848. }));
  50849. $self._assert_equals_(i,(6));
  50850. $ctx1.sendIdx["assert:equals:"]=1;
  50851. i=(0);
  50852. $recv((function(){
  50853. return $core.withContext(function($ctx2) {
  50854. i=$recv(i).__plus((1));
  50855. i;
  50856. return $recv(i).__gt((5));
  50857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50858. }))._whileFalse();
  50859. $self._assert_equals_(i,(6));
  50860. return self;
  50861. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  50862. },
  50863. args: [],
  50864. 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",
  50865. referencedClasses: [],
  50866. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  50867. }),
  50868. $globals.BlockClosureTest);
  50869. $core.addMethod(
  50870. $core.method({
  50871. selector: "testWhileTrue",
  50872. protocol: "tests",
  50873. fn: function (){
  50874. var self=this,$self=this;
  50875. var i;
  50876. return $core.withContext(function($ctx1) {
  50877. i=(0);
  50878. $recv((function(){
  50879. return $core.withContext(function($ctx2) {
  50880. return $recv(i).__lt((5));
  50881. $ctx2.sendIdx["<"]=1;
  50882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50883. }))._whileTrue_((function(){
  50884. return $core.withContext(function($ctx2) {
  50885. i=$recv(i).__plus((1));
  50886. $ctx2.sendIdx["+"]=1;
  50887. return i;
  50888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50889. }));
  50890. $self._assert_equals_(i,(5));
  50891. $ctx1.sendIdx["assert:equals:"]=1;
  50892. i=(0);
  50893. $recv((function(){
  50894. return $core.withContext(function($ctx2) {
  50895. i=$recv(i).__plus((1));
  50896. i;
  50897. return $recv(i).__lt((5));
  50898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50899. }))._whileTrue();
  50900. $self._assert_equals_(i,(5));
  50901. return self;
  50902. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  50903. },
  50904. args: [],
  50905. 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",
  50906. referencedClasses: [],
  50907. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  50908. }),
  50909. $globals.BlockClosureTest);
  50910. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  50911. $core.addMethod(
  50912. $core.method({
  50913. selector: "testEquality",
  50914. protocol: "tests",
  50915. fn: function (){
  50916. var self=this,$self=this;
  50917. return $core.withContext(function($ctx1) {
  50918. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  50919. $1=(0).__eq(false);
  50920. $ctx1.sendIdx["="]=1;
  50921. $self._deny_($1);
  50922. $ctx1.sendIdx["deny:"]=1;
  50923. $2=false.__eq((0));
  50924. $ctx1.sendIdx["="]=2;
  50925. $self._deny_($2);
  50926. $ctx1.sendIdx["deny:"]=2;
  50927. $3="".__eq(false);
  50928. $ctx1.sendIdx["="]=3;
  50929. $self._deny_($3);
  50930. $ctx1.sendIdx["deny:"]=3;
  50931. $4=false.__eq("");
  50932. $ctx1.sendIdx["="]=4;
  50933. $self._deny_($4);
  50934. $ctx1.sendIdx["deny:"]=4;
  50935. $5=true.__eq(true);
  50936. $ctx1.sendIdx["="]=5;
  50937. $self._assert_($5);
  50938. $ctx1.sendIdx["assert:"]=1;
  50939. $6=false.__eq(true);
  50940. $ctx1.sendIdx["="]=6;
  50941. $self._deny_($6);
  50942. $ctx1.sendIdx["deny:"]=5;
  50943. $7=true.__eq(false);
  50944. $ctx1.sendIdx["="]=7;
  50945. $self._deny_($7);
  50946. $8=false.__eq(false);
  50947. $ctx1.sendIdx["="]=8;
  50948. $self._assert_($8);
  50949. $ctx1.sendIdx["assert:"]=2;
  50950. $10=true._yourself();
  50951. $ctx1.sendIdx["yourself"]=1;
  50952. $9=$recv($10).__eq(true);
  50953. $ctx1.sendIdx["="]=9;
  50954. $self._assert_($9);
  50955. $ctx1.sendIdx["assert:"]=3;
  50956. $12=true._yourself();
  50957. $ctx1.sendIdx["yourself"]=2;
  50958. $11=$recv($12).__eq(true._yourself());
  50959. $self._assert_($11);
  50960. return self;
  50961. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  50962. },
  50963. args: [],
  50964. 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)",
  50965. referencedClasses: [],
  50966. messageSends: ["deny:", "=", "assert:", "yourself"]
  50967. }),
  50968. $globals.BooleanTest);
  50969. $core.addMethod(
  50970. $core.method({
  50971. selector: "testIdentity",
  50972. protocol: "tests",
  50973. fn: function (){
  50974. var self=this,$self=this;
  50975. return $core.withContext(function($ctx1) {
  50976. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  50977. $1=(0).__eq_eq(false);
  50978. $ctx1.sendIdx["=="]=1;
  50979. $self._deny_($1);
  50980. $ctx1.sendIdx["deny:"]=1;
  50981. $2=false.__eq_eq((0));
  50982. $ctx1.sendIdx["=="]=2;
  50983. $self._deny_($2);
  50984. $ctx1.sendIdx["deny:"]=2;
  50985. $3="".__eq_eq(false);
  50986. $ctx1.sendIdx["=="]=3;
  50987. $self._deny_($3);
  50988. $ctx1.sendIdx["deny:"]=3;
  50989. $4=false.__eq_eq("");
  50990. $ctx1.sendIdx["=="]=4;
  50991. $self._deny_($4);
  50992. $ctx1.sendIdx["deny:"]=4;
  50993. $5=true.__eq_eq(true);
  50994. $ctx1.sendIdx["=="]=5;
  50995. $self._assert_($5);
  50996. $ctx1.sendIdx["assert:"]=1;
  50997. $6=false.__eq_eq(true);
  50998. $ctx1.sendIdx["=="]=6;
  50999. $self._deny_($6);
  51000. $ctx1.sendIdx["deny:"]=5;
  51001. $7=true.__eq_eq(false);
  51002. $ctx1.sendIdx["=="]=7;
  51003. $self._deny_($7);
  51004. $8=false.__eq_eq(false);
  51005. $ctx1.sendIdx["=="]=8;
  51006. $self._assert_($8);
  51007. $ctx1.sendIdx["assert:"]=2;
  51008. $10=true._yourself();
  51009. $ctx1.sendIdx["yourself"]=1;
  51010. $9=$recv($10).__eq_eq(true);
  51011. $ctx1.sendIdx["=="]=9;
  51012. $self._assert_($9);
  51013. $ctx1.sendIdx["assert:"]=3;
  51014. $12=true._yourself();
  51015. $ctx1.sendIdx["yourself"]=2;
  51016. $11=$recv($12).__eq_eq(true._yourself());
  51017. $self._assert_($11);
  51018. return self;
  51019. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  51020. },
  51021. args: [],
  51022. 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",
  51023. referencedClasses: [],
  51024. messageSends: ["deny:", "==", "assert:", "yourself"]
  51025. }),
  51026. $globals.BooleanTest);
  51027. $core.addMethod(
  51028. $core.method({
  51029. selector: "testIfTrueIfFalse",
  51030. protocol: "tests",
  51031. fn: function (){
  51032. var self=this,$self=this;
  51033. return $core.withContext(function($ctx1) {
  51034. var $1,$2,$3,$4,$5,$6,$7,$8;
  51035. if($core.assert(true)){
  51036. $1="alternative block";
  51037. }
  51038. $self._assert_equals_($1,"alternative block");
  51039. $ctx1.sendIdx["assert:equals:"]=1;
  51040. if(!$core.assert(true)){
  51041. $2="alternative block";
  51042. }
  51043. $self._assert_equals_($2,nil);
  51044. $ctx1.sendIdx["assert:equals:"]=2;
  51045. if($core.assert(false)){
  51046. $3="alternative block";
  51047. }
  51048. $self._assert_equals_($3,nil);
  51049. $ctx1.sendIdx["assert:equals:"]=3;
  51050. if(!$core.assert(false)){
  51051. $4="alternative block";
  51052. }
  51053. $self._assert_equals_($4,"alternative block");
  51054. $ctx1.sendIdx["assert:equals:"]=4;
  51055. if($core.assert(false)){
  51056. $5="alternative block";
  51057. } else {
  51058. $5="alternative block2";
  51059. }
  51060. $self._assert_equals_($5,"alternative block2");
  51061. $ctx1.sendIdx["assert:equals:"]=5;
  51062. if($core.assert(false)){
  51063. $6="alternative block2";
  51064. } else {
  51065. $6="alternative block";
  51066. }
  51067. $self._assert_equals_($6,"alternative block");
  51068. $ctx1.sendIdx["assert:equals:"]=6;
  51069. if($core.assert(true)){
  51070. $7="alternative block";
  51071. } else {
  51072. $7="alternative block2";
  51073. }
  51074. $self._assert_equals_($7,"alternative block");
  51075. $ctx1.sendIdx["assert:equals:"]=7;
  51076. if($core.assert(true)){
  51077. $8="alternative block2";
  51078. } else {
  51079. $8="alternative block";
  51080. }
  51081. $self._assert_equals_($8,"alternative block2");
  51082. return self;
  51083. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  51084. },
  51085. args: [],
  51086. 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'.",
  51087. referencedClasses: [],
  51088. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51089. }),
  51090. $globals.BooleanTest);
  51091. $core.addMethod(
  51092. $core.method({
  51093. selector: "testIfTrueIfFalseWithBoxing",
  51094. protocol: "tests",
  51095. fn: function (){
  51096. var self=this,$self=this;
  51097. return $core.withContext(function($ctx1) {
  51098. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  51099. $2=true._yourself();
  51100. $ctx1.sendIdx["yourself"]=1;
  51101. if($core.assert($2)){
  51102. $1="alternative block";
  51103. }
  51104. $self._assert_equals_($1,"alternative block");
  51105. $ctx1.sendIdx["assert:equals:"]=1;
  51106. $4=true._yourself();
  51107. $ctx1.sendIdx["yourself"]=2;
  51108. if(!$core.assert($4)){
  51109. $3="alternative block";
  51110. }
  51111. $self._assert_equals_($3,nil);
  51112. $ctx1.sendIdx["assert:equals:"]=2;
  51113. $6=false._yourself();
  51114. $ctx1.sendIdx["yourself"]=3;
  51115. if($core.assert($6)){
  51116. $5="alternative block";
  51117. }
  51118. $self._assert_equals_($5,nil);
  51119. $ctx1.sendIdx["assert:equals:"]=3;
  51120. $8=false._yourself();
  51121. $ctx1.sendIdx["yourself"]=4;
  51122. if(!$core.assert($8)){
  51123. $7="alternative block";
  51124. }
  51125. $self._assert_equals_($7,"alternative block");
  51126. $ctx1.sendIdx["assert:equals:"]=4;
  51127. $10=false._yourself();
  51128. $ctx1.sendIdx["yourself"]=5;
  51129. if($core.assert($10)){
  51130. $9="alternative block";
  51131. } else {
  51132. $9="alternative block2";
  51133. }
  51134. $self._assert_equals_($9,"alternative block2");
  51135. $ctx1.sendIdx["assert:equals:"]=5;
  51136. $12=false._yourself();
  51137. $ctx1.sendIdx["yourself"]=6;
  51138. if($core.assert($12)){
  51139. $11="alternative block2";
  51140. } else {
  51141. $11="alternative block";
  51142. }
  51143. $self._assert_equals_($11,"alternative block");
  51144. $ctx1.sendIdx["assert:equals:"]=6;
  51145. $14=true._yourself();
  51146. $ctx1.sendIdx["yourself"]=7;
  51147. if($core.assert($14)){
  51148. $13="alternative block";
  51149. } else {
  51150. $13="alternative block2";
  51151. }
  51152. $self._assert_equals_($13,"alternative block");
  51153. $ctx1.sendIdx["assert:equals:"]=7;
  51154. $16=true._yourself();
  51155. if($core.assert($16)){
  51156. $15="alternative block2";
  51157. } else {
  51158. $15="alternative block";
  51159. }
  51160. $self._assert_equals_($15,"alternative block2");
  51161. return self;
  51162. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  51163. },
  51164. args: [],
  51165. 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'.",
  51166. referencedClasses: [],
  51167. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51168. }),
  51169. $globals.BooleanTest);
  51170. $core.addMethod(
  51171. $core.method({
  51172. selector: "testLogic",
  51173. protocol: "tests",
  51174. fn: function (){
  51175. var self=this,$self=this;
  51176. return $core.withContext(function($ctx1) {
  51177. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  51178. $1=true.__and(true);
  51179. $ctx1.sendIdx["&"]=1;
  51180. $self._assert_($1);
  51181. $ctx1.sendIdx["assert:"]=1;
  51182. $2=true.__and(false);
  51183. $ctx1.sendIdx["&"]=2;
  51184. $self._deny_($2);
  51185. $ctx1.sendIdx["deny:"]=1;
  51186. $3=false.__and(true);
  51187. $ctx1.sendIdx["&"]=3;
  51188. $self._deny_($3);
  51189. $ctx1.sendIdx["deny:"]=2;
  51190. $5=false.__and(false);
  51191. $ctx1.sendIdx["&"]=4;
  51192. $4=$self._deny_($5);
  51193. $ctx1.sendIdx["deny:"]=3;
  51194. $6=true.__or(true);
  51195. $ctx1.sendIdx["|"]=1;
  51196. $self._assert_($6);
  51197. $ctx1.sendIdx["assert:"]=2;
  51198. $7=true.__or(false);
  51199. $ctx1.sendIdx["|"]=2;
  51200. $self._assert_($7);
  51201. $ctx1.sendIdx["assert:"]=3;
  51202. $8=false.__or(true);
  51203. $ctx1.sendIdx["|"]=3;
  51204. $self._assert_($8);
  51205. $ctx1.sendIdx["assert:"]=4;
  51206. $10=false.__or(false);
  51207. $ctx1.sendIdx["|"]=4;
  51208. $9=$self._deny_($10);
  51209. $ctx1.sendIdx["deny:"]=4;
  51210. $12=(1).__gt((0));
  51211. $ctx1.sendIdx[">"]=1;
  51212. $11=true.__and($12);
  51213. $ctx1.sendIdx["&"]=5;
  51214. $self._assert_($11);
  51215. $ctx1.sendIdx["assert:"]=5;
  51216. $14=(1).__gt((0));
  51217. $ctx1.sendIdx[">"]=2;
  51218. $13=$recv($14).__and(false);
  51219. $ctx1.sendIdx["&"]=6;
  51220. $self._deny_($13);
  51221. $ctx1.sendIdx["deny:"]=5;
  51222. $16=(1).__gt((0));
  51223. $ctx1.sendIdx[">"]=3;
  51224. $17=(1).__gt((2));
  51225. $ctx1.sendIdx[">"]=4;
  51226. $15=$recv($16).__and($17);
  51227. $self._deny_($15);
  51228. $19=(1).__gt((0));
  51229. $ctx1.sendIdx[">"]=5;
  51230. $18=false.__or($19);
  51231. $ctx1.sendIdx["|"]=5;
  51232. $self._assert_($18);
  51233. $ctx1.sendIdx["assert:"]=6;
  51234. $21=(1).__gt((0));
  51235. $ctx1.sendIdx[">"]=6;
  51236. $20=$recv($21).__or(false);
  51237. $ctx1.sendIdx["|"]=6;
  51238. $self._assert_($20);
  51239. $ctx1.sendIdx["assert:"]=7;
  51240. $23=(1).__gt((0));
  51241. $ctx1.sendIdx[">"]=7;
  51242. $22=$recv($23).__or((1).__gt((2)));
  51243. $self._assert_($22);
  51244. return self;
  51245. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  51246. },
  51247. args: [],
  51248. 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))",
  51249. referencedClasses: [],
  51250. messageSends: ["assert:", "&", "deny:", "|", ">"]
  51251. }),
  51252. $globals.BooleanTest);
  51253. $core.addMethod(
  51254. $core.method({
  51255. selector: "testLogicKeywords",
  51256. protocol: "tests",
  51257. fn: function (){
  51258. var self=this,$self=this;
  51259. return $core.withContext(function($ctx1) {
  51260. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  51261. $1=true._and_((function(){
  51262. return true;
  51263. }));
  51264. $ctx1.sendIdx["and:"]=1;
  51265. $self._assert_($1);
  51266. $ctx1.sendIdx["assert:"]=1;
  51267. $2=true._and_((function(){
  51268. return false;
  51269. }));
  51270. $ctx1.sendIdx["and:"]=2;
  51271. $self._deny_($2);
  51272. $ctx1.sendIdx["deny:"]=1;
  51273. $3=false._and_((function(){
  51274. return true;
  51275. }));
  51276. $ctx1.sendIdx["and:"]=3;
  51277. $self._deny_($3);
  51278. $ctx1.sendIdx["deny:"]=2;
  51279. $5=false._and_((function(){
  51280. return false;
  51281. }));
  51282. $ctx1.sendIdx["and:"]=4;
  51283. $4=$self._deny_($5);
  51284. $ctx1.sendIdx["deny:"]=3;
  51285. $6=true._or_((function(){
  51286. return true;
  51287. }));
  51288. $ctx1.sendIdx["or:"]=1;
  51289. $self._assert_($6);
  51290. $ctx1.sendIdx["assert:"]=2;
  51291. $7=true._or_((function(){
  51292. return false;
  51293. }));
  51294. $ctx1.sendIdx["or:"]=2;
  51295. $self._assert_($7);
  51296. $ctx1.sendIdx["assert:"]=3;
  51297. $8=false._or_((function(){
  51298. return true;
  51299. }));
  51300. $ctx1.sendIdx["or:"]=3;
  51301. $self._assert_($8);
  51302. $ctx1.sendIdx["assert:"]=4;
  51303. $10=false._or_((function(){
  51304. return false;
  51305. }));
  51306. $ctx1.sendIdx["or:"]=4;
  51307. $9=$self._deny_($10);
  51308. $ctx1.sendIdx["deny:"]=4;
  51309. $11=true._and_((function(){
  51310. return $core.withContext(function($ctx2) {
  51311. return (1).__gt((0));
  51312. $ctx2.sendIdx[">"]=1;
  51313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  51314. }));
  51315. $ctx1.sendIdx["and:"]=5;
  51316. $self._assert_($11);
  51317. $ctx1.sendIdx["assert:"]=5;
  51318. $13=(1).__gt((0));
  51319. $ctx1.sendIdx[">"]=2;
  51320. $12=$recv($13)._and_((function(){
  51321. return false;
  51322. }));
  51323. $ctx1.sendIdx["and:"]=6;
  51324. $self._deny_($12);
  51325. $ctx1.sendIdx["deny:"]=5;
  51326. $15=(1).__gt((0));
  51327. $ctx1.sendIdx[">"]=3;
  51328. $14=$recv($15)._and_((function(){
  51329. return $core.withContext(function($ctx2) {
  51330. return (1).__gt((2));
  51331. $ctx2.sendIdx[">"]=4;
  51332. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  51333. }));
  51334. $self._deny_($14);
  51335. $16=false._or_((function(){
  51336. return $core.withContext(function($ctx2) {
  51337. return (1).__gt((0));
  51338. $ctx2.sendIdx[">"]=5;
  51339. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  51340. }));
  51341. $ctx1.sendIdx["or:"]=5;
  51342. $self._assert_($16);
  51343. $ctx1.sendIdx["assert:"]=6;
  51344. $18=(1).__gt((0));
  51345. $ctx1.sendIdx[">"]=6;
  51346. $17=$recv($18)._or_((function(){
  51347. return false;
  51348. }));
  51349. $ctx1.sendIdx["or:"]=6;
  51350. $self._assert_($17);
  51351. $ctx1.sendIdx["assert:"]=7;
  51352. $20=(1).__gt((0));
  51353. $ctx1.sendIdx[">"]=7;
  51354. $19=$recv($20)._or_((function(){
  51355. return $core.withContext(function($ctx2) {
  51356. return (1).__gt((2));
  51357. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  51358. }));
  51359. $self._assert_($19);
  51360. return self;
  51361. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  51362. },
  51363. args: [],
  51364. 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 ])",
  51365. referencedClasses: [],
  51366. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  51367. }),
  51368. $globals.BooleanTest);
  51369. $core.addMethod(
  51370. $core.method({
  51371. selector: "testNonBooleanError",
  51372. protocol: "tests",
  51373. fn: function (){
  51374. var self=this,$self=this;
  51375. return $core.withContext(function($ctx1) {
  51376. $self._should_raise_((function(){
  51377. return $core.withContext(function($ctx2) {
  51378. if($core.assert("")){
  51379. } else {
  51380. }
  51381. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51382. }),$globals.NonBooleanReceiver);
  51383. return self;
  51384. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  51385. },
  51386. args: [],
  51387. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  51388. referencedClasses: ["NonBooleanReceiver"],
  51389. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  51390. }),
  51391. $globals.BooleanTest);
  51392. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51393. $core.addMethod(
  51394. $core.method({
  51395. selector: "setUp",
  51396. protocol: "running",
  51397. fn: function (){
  51398. var self=this,$self=this;
  51399. return $core.withContext(function($ctx1) {
  51400. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  51401. return self;
  51402. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  51403. },
  51404. args: [],
  51405. source: "setUp\x0a\x09builder := ClassBuilder new",
  51406. referencedClasses: ["ClassBuilder"],
  51407. messageSends: ["new"]
  51408. }),
  51409. $globals.ClassBuilderTest);
  51410. $core.addMethod(
  51411. $core.method({
  51412. selector: "tearDown",
  51413. protocol: "running",
  51414. fn: function (){
  51415. var self=this,$self=this;
  51416. return $core.withContext(function($ctx1) {
  51417. var $1,$receiver;
  51418. $1=$self["@theClass"];
  51419. if(($receiver = $1) == null || $receiver.a$nil){
  51420. $1;
  51421. } else {
  51422. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  51423. $self._deny_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51424. $self["@theClass"]=nil;
  51425. $self["@theClass"];
  51426. }
  51427. return self;
  51428. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  51429. },
  51430. args: [],
  51431. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09self deny: (theClass package classes includes: theClass).\x0a\x09\x09theClass := nil ]",
  51432. referencedClasses: ["Smalltalk"],
  51433. messageSends: ["ifNotNil:", "removeClass:", "deny:", "includes:", "classes", "package"]
  51434. }),
  51435. $globals.ClassBuilderTest);
  51436. $core.addMethod(
  51437. $core.method({
  51438. selector: "testAddTrait",
  51439. protocol: "tests",
  51440. fn: function (){
  51441. var self=this,$self=this;
  51442. return $core.withContext(function($ctx1) {
  51443. var $3,$2,$1,$4;
  51444. $self["@theClass"]=$recv($self["@builder"])._addTraitNamed_package_("ObjectMock2","Kernel-Tests");
  51445. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51446. $ctx1.sendIdx["assert:equals:"]=1;
  51447. $3=$recv($self["@theClass"])._package();
  51448. $ctx1.sendIdx["package"]=1;
  51449. $2=$recv($3)._classes();
  51450. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51451. $self._assert_equals_($1,(1));
  51452. $ctx1.sendIdx["assert:equals:"]=2;
  51453. $4=$recv($self["@theClass"])._package();
  51454. $ctx1.sendIdx["package"]=2;
  51455. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  51456. return self;
  51457. }, function($ctx1) {$ctx1.fill(self,"testAddTrait",{},$globals.ClassBuilderTest)});
  51458. },
  51459. args: [],
  51460. 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",
  51461. referencedClasses: ["ObjectMock"],
  51462. messageSends: ["addTraitNamed:package:", "assert:equals:", "name", "occurrencesOf:", "classes", "package"]
  51463. }),
  51464. $globals.ClassBuilderTest);
  51465. $core.addMethod(
  51466. $core.method({
  51467. selector: "testClassCopy",
  51468. protocol: "tests",
  51469. fn: function (){
  51470. var self=this,$self=this;
  51471. return $core.withContext(function($ctx1) {
  51472. var $2,$1,$4,$3,$6,$7,$5,$9,$8;
  51473. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51474. $2=$recv($self["@theClass"])._superclass();
  51475. $ctx1.sendIdx["superclass"]=1;
  51476. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51477. $ctx1.sendIdx["=="]=1;
  51478. $self._assert_($1);
  51479. $ctx1.sendIdx["assert:"]=1;
  51480. $4=$recv($self["@theClass"])._instanceVariableNames();
  51481. $ctx1.sendIdx["instanceVariableNames"]=1;
  51482. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51483. $ctx1.sendIdx["=="]=2;
  51484. $self._assert_($3);
  51485. $ctx1.sendIdx["assert:"]=2;
  51486. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51487. $ctx1.sendIdx["assert:equals:"]=1;
  51488. $6=$recv($self["@theClass"])._package();
  51489. $ctx1.sendIdx["package"]=1;
  51490. $7=$recv($globals.ObjectMock)._package();
  51491. $ctx1.sendIdx["package"]=2;
  51492. $5=$recv($6).__eq_eq($7);
  51493. $self._assert_($5);
  51494. $ctx1.sendIdx["assert:"]=3;
  51495. $self._assert_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51496. $9=$recv($self["@theClass"])._methodDictionary();
  51497. $ctx1.sendIdx["methodDictionary"]=1;
  51498. $8=$recv($9)._keys();
  51499. $ctx1.sendIdx["keys"]=1;
  51500. $self._assert_equals_($8,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51501. return self;
  51502. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  51503. },
  51504. args: [],
  51505. 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",
  51506. referencedClasses: ["ObjectMock"],
  51507. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "includes:", "classes", "keys", "methodDictionary"]
  51508. }),
  51509. $globals.ClassBuilderTest);
  51510. $core.addMethod(
  51511. $core.method({
  51512. selector: "testClassMigration",
  51513. protocol: "tests",
  51514. fn: function (){
  51515. var self=this,$self=this;
  51516. var instance,oldClass;
  51517. return $core.withContext(function($ctx1) {
  51518. var $2,$1,$4,$3,$5,$6,$7,$8,$10,$9,$12,$11;
  51519. oldClass=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51520. $2=$recv($globals.Smalltalk)._globals();
  51521. $ctx1.sendIdx["globals"]=1;
  51522. $1=$recv($2)._at_("ObjectMock2");
  51523. $ctx1.sendIdx["at:"]=1;
  51524. instance=$recv($1)._new();
  51525. $4=$recv($globals.Smalltalk)._globals();
  51526. $ctx1.sendIdx["globals"]=2;
  51527. $3=$recv($4)._at_("ObjectMock2");
  51528. $ctx1.sendIdx["at:"]=2;
  51529. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  51530. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  51531. $ctx1.sendIdx["=="]=1;
  51532. $self._deny_($5);
  51533. $ctx1.sendIdx["deny:"]=1;
  51534. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  51535. $ctx1.sendIdx["=="]=2;
  51536. $self._assert_($6);
  51537. $ctx1.sendIdx["assert:"]=1;
  51538. $self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  51539. $ctx1.sendIdx["assert:"]=2;
  51540. $7=$recv($globals.ObjectMock2)._selectors();
  51541. $ctx1.sendIdx["selectors"]=1;
  51542. $self._assert_equals_($7,$recv(oldClass)._selectors());
  51543. $ctx1.sendIdx["assert:equals:"]=1;
  51544. $8=$recv($globals.ObjectMock2)._comment();
  51545. $ctx1.sendIdx["comment"]=1;
  51546. $self._assert_equals_($8,$recv(oldClass)._comment());
  51547. $ctx1.sendIdx["assert:equals:"]=2;
  51548. $10=$recv($globals.ObjectMock2)._package();
  51549. $ctx1.sendIdx["package"]=1;
  51550. $9=$recv($10)._name();
  51551. $ctx1.sendIdx["name"]=1;
  51552. $self._assert_equals_($9,"Kernel-Tests");
  51553. $self._assert_($recv($recv($recv($globals.ObjectMock2)._package())._classes())._includes_($globals.ObjectMock2));
  51554. $ctx1.sendIdx["assert:"]=3;
  51555. $12=$recv(instance)._class();
  51556. $ctx1.sendIdx["class"]=1;
  51557. $11=$recv($12).__eq_eq($globals.ObjectMock2);
  51558. $self._deny_($11);
  51559. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  51560. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51561. return self;
  51562. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  51563. },
  51564. args: [],
  51565. 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",
  51566. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  51567. 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:"]
  51568. }),
  51569. $globals.ClassBuilderTest);
  51570. $core.addMethod(
  51571. $core.method({
  51572. selector: "testClassMigrationWithClassInstanceVariables",
  51573. protocol: "tests",
  51574. fn: function (){
  51575. var self=this,$self=this;
  51576. return $core.withContext(function($ctx1) {
  51577. var $1;
  51578. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51579. $1=$recv($globals.ObjectMock2)._class();
  51580. $ctx1.sendIdx["class"]=1;
  51581. $recv($1)._instanceVariableNames_("foo bar");
  51582. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  51583. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  51584. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51585. return self;
  51586. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  51587. },
  51588. args: [],
  51589. 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",
  51590. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  51591. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  51592. }),
  51593. $globals.ClassBuilderTest);
  51594. $core.addMethod(
  51595. $core.method({
  51596. selector: "testClassMigrationWithSubclasses",
  51597. protocol: "tests",
  51598. fn: function (){
  51599. var self=this,$self=this;
  51600. return $core.withContext(function($ctx1) {
  51601. var $2,$1,$4,$3;
  51602. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51603. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  51604. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  51605. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  51606. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  51607. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  51608. $2=$recv($globals.ObjectMock)._subclasses();
  51609. $ctx1.sendIdx["subclasses"]=1;
  51610. $1=$recv($2)._includes_($globals.ObjectMock2);
  51611. $ctx1.sendIdx["includes:"]=1;
  51612. $self._assert_($1);
  51613. $ctx1.sendIdx["assert:"]=1;
  51614. $4=$recv($globals.ObjectMock2)._subclasses();
  51615. $ctx1.sendIdx["subclasses"]=2;
  51616. $3=$recv($4)._includes_($globals.ObjectMock3);
  51617. $ctx1.sendIdx["includes:"]=2;
  51618. $self._assert_($3);
  51619. $ctx1.sendIdx["assert:"]=2;
  51620. $self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  51621. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  51622. return $core.withContext(function($ctx2) {
  51623. return $recv($globals.Smalltalk)._removeClass_(each);
  51624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51625. }));
  51626. return self;
  51627. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  51628. },
  51629. args: [],
  51630. 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 ]",
  51631. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  51632. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  51633. }),
  51634. $globals.ClassBuilderTest);
  51635. $core.addMethod(
  51636. $core.method({
  51637. selector: "testInstanceVariableNames",
  51638. protocol: "tests",
  51639. fn: function (){
  51640. var self=this,$self=this;
  51641. return $core.withContext(function($ctx1) {
  51642. $self._assert_equals_($recv($self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  51643. return self;
  51644. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  51645. },
  51646. args: [],
  51647. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  51648. referencedClasses: [],
  51649. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  51650. }),
  51651. $globals.ClassBuilderTest);
  51652. $core.addMethod(
  51653. $core.method({
  51654. selector: "testSubclass",
  51655. protocol: "tests",
  51656. fn: function (){
  51657. var self=this,$self=this;
  51658. return $core.withContext(function($ctx1) {
  51659. var $3,$2,$1,$4;
  51660. $self["@theClass"]=$recv($self["@builder"])._addSubclassOf_named_instanceVariableNames_package_($globals.ObjectMock,"ObjectMock2","foo bar","Kernel-Tests");
  51661. $self._assert_equals_($recv($self["@theClass"])._superclass(),$globals.ObjectMock);
  51662. $ctx1.sendIdx["assert:equals:"]=1;
  51663. $self._assert_equals_($recv($self["@theClass"])._instanceVariableNames(),"foo bar");
  51664. $ctx1.sendIdx["assert:equals:"]=2;
  51665. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51666. $ctx1.sendIdx["assert:equals:"]=3;
  51667. $3=$recv($self["@theClass"])._package();
  51668. $ctx1.sendIdx["package"]=1;
  51669. $2=$recv($3)._classes();
  51670. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51671. $self._assert_equals_($1,(1));
  51672. $ctx1.sendIdx["assert:equals:"]=4;
  51673. $4=$recv($self["@theClass"])._package();
  51674. $ctx1.sendIdx["package"]=2;
  51675. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  51676. $ctx1.sendIdx["assert:equals:"]=5;
  51677. $self._assert_equals_($recv($recv($recv($self["@theClass"])._methodDictionary())._keys())._size(),(0));
  51678. return self;
  51679. }, function($ctx1) {$ctx1.fill(self,"testSubclass",{},$globals.ClassBuilderTest)});
  51680. },
  51681. args: [],
  51682. 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",
  51683. referencedClasses: ["ObjectMock"],
  51684. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "assert:equals:", "superclass", "instanceVariableNames", "name", "occurrencesOf:", "classes", "package", "size", "keys", "methodDictionary"]
  51685. }),
  51686. $globals.ClassBuilderTest);
  51687. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51688. $core.addMethod(
  51689. $core.method({
  51690. selector: "jsConstructor",
  51691. protocol: "running",
  51692. fn: function (){
  51693. var self=this,$self=this;
  51694. return $core.withContext(function($ctx1) {
  51695. function Foo(){}
  51696. Foo.prototype.valueOf = function () {return 4;};
  51697. return Foo;
  51698. ;
  51699. return self;
  51700. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  51701. },
  51702. args: [],
  51703. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  51704. referencedClasses: [],
  51705. messageSends: []
  51706. }),
  51707. $globals.ClassTest);
  51708. $core.addMethod(
  51709. $core.method({
  51710. selector: "setUp",
  51711. protocol: "running",
  51712. fn: function (){
  51713. var self=this,$self=this;
  51714. return $core.withContext(function($ctx1) {
  51715. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  51716. return self;
  51717. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  51718. },
  51719. args: [],
  51720. source: "setUp\x0a\x09builder := ClassBuilder new",
  51721. referencedClasses: ["ClassBuilder"],
  51722. messageSends: ["new"]
  51723. }),
  51724. $globals.ClassTest);
  51725. $core.addMethod(
  51726. $core.method({
  51727. selector: "tearDown",
  51728. protocol: "running",
  51729. fn: function (){
  51730. var self=this,$self=this;
  51731. return $core.withContext(function($ctx1) {
  51732. var $1,$receiver;
  51733. $1=$self["@theClass"];
  51734. if(($receiver = $1) == null || $receiver.a$nil){
  51735. $1;
  51736. } else {
  51737. $recv($recv($self["@theClass"])._allSubclasses())._reverseDo_((function(each){
  51738. return $core.withContext(function($ctx2) {
  51739. return $recv($globals.Smalltalk)._removeClass_(each);
  51740. $ctx2.sendIdx["removeClass:"]=1;
  51741. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51742. }));
  51743. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  51744. $self["@theClass"]=nil;
  51745. $self["@theClass"];
  51746. }
  51747. return self;
  51748. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  51749. },
  51750. args: [],
  51751. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  51752. referencedClasses: ["Smalltalk"],
  51753. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  51754. }),
  51755. $globals.ClassTest);
  51756. $core.addMethod(
  51757. $core.method({
  51758. selector: "testAllSubclasses",
  51759. protocol: "tests",
  51760. fn: function (){
  51761. var self=this,$self=this;
  51762. var subclasses,index;
  51763. return $core.withContext(function($ctx1) {
  51764. subclasses=$recv($globals.Object)._subclasses();
  51765. $ctx1.sendIdx["subclasses"]=1;
  51766. index=(1);
  51767. $recv((function(){
  51768. return $core.withContext(function($ctx2) {
  51769. return $recv(index).__gt($recv(subclasses)._size());
  51770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51771. }))._whileFalse_((function(){
  51772. return $core.withContext(function($ctx2) {
  51773. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  51774. index=$recv(index).__plus((1));
  51775. return index;
  51776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51777. }));
  51778. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  51779. return self;
  51780. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  51781. },
  51782. args: [],
  51783. 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",
  51784. referencedClasses: ["Object"],
  51785. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  51786. }),
  51787. $globals.ClassTest);
  51788. $core.addMethod(
  51789. $core.method({
  51790. selector: "testMetaclassSubclasses",
  51791. protocol: "tests",
  51792. fn: function (){
  51793. var self=this,$self=this;
  51794. var subclasses;
  51795. return $core.withContext(function($ctx1) {
  51796. var $4,$3,$2,$1;
  51797. $4=$recv($globals.Object)._class();
  51798. $ctx1.sendIdx["class"]=1;
  51799. $3=$recv($4)._instanceClass();
  51800. $2=$recv($3)._subclasses();
  51801. $ctx1.sendIdx["subclasses"]=1;
  51802. $1=$recv($2)._select_((function(each){
  51803. return $core.withContext(function($ctx2) {
  51804. return $recv($recv(each)._isMetaclass())._not();
  51805. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51806. }));
  51807. subclasses=$recv($1)._collect_((function(each){
  51808. return $core.withContext(function($ctx2) {
  51809. return $recv(each)._theMetaClass();
  51810. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51811. }));
  51812. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  51813. return self;
  51814. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  51815. },
  51816. args: [],
  51817. 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",
  51818. referencedClasses: ["Object"],
  51819. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  51820. }),
  51821. $globals.ClassTest);
  51822. $core.addMethod(
  51823. $core.method({
  51824. selector: "testSetJavaScriptConstructor",
  51825. protocol: "tests",
  51826. fn: function (){
  51827. var self=this,$self=this;
  51828. var instance;
  51829. return $core.withContext(function($ctx1) {
  51830. var $2,$1,$4,$3,$6,$5,$8,$7;
  51831. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51832. $recv($self["@theClass"])._javascriptConstructor_($self._jsConstructor());
  51833. $2=$recv($self["@theClass"])._superclass();
  51834. $ctx1.sendIdx["superclass"]=1;
  51835. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51836. $ctx1.sendIdx["=="]=1;
  51837. $self._assert_($1);
  51838. $ctx1.sendIdx["assert:"]=1;
  51839. $4=$recv($self["@theClass"])._instanceVariableNames();
  51840. $ctx1.sendIdx["instanceVariableNames"]=1;
  51841. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51842. $ctx1.sendIdx["=="]=2;
  51843. $self._assert_($3);
  51844. $ctx1.sendIdx["assert:"]=2;
  51845. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51846. $ctx1.sendIdx["assert:equals:"]=1;
  51847. $6=$recv($self["@theClass"])._package();
  51848. $ctx1.sendIdx["package"]=1;
  51849. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  51850. $ctx1.sendIdx["=="]=3;
  51851. $self._assert_($5);
  51852. $ctx1.sendIdx["assert:"]=3;
  51853. $8=$recv($self["@theClass"])._methodDictionary();
  51854. $ctx1.sendIdx["methodDictionary"]=1;
  51855. $7=$recv($8)._keys();
  51856. $ctx1.sendIdx["keys"]=1;
  51857. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51858. $ctx1.sendIdx["assert:equals:"]=2;
  51859. instance=$recv($self["@theClass"])._new();
  51860. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  51861. $self._assert_equals_($recv(instance)._value(),(4));
  51862. $ctx1.sendIdx["assert:equals:"]=3;
  51863. $self._shouldnt_raise_((function(){
  51864. return $core.withContext(function($ctx2) {
  51865. return $recv(instance)._foo_((9));
  51866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51867. }),$globals.Error);
  51868. $self._assert_equals_($recv(instance)._foo(),(9));
  51869. return self;
  51870. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  51871. },
  51872. args: [],
  51873. 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",
  51874. referencedClasses: ["ObjectMock", "Error"],
  51875. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  51876. }),
  51877. $globals.ClassTest);
  51878. $core.addMethod(
  51879. $core.method({
  51880. selector: "testTrickySetJavaScriptConstructor",
  51881. protocol: "tests",
  51882. fn: function (){
  51883. var self=this,$self=this;
  51884. var instance;
  51885. return $core.withContext(function($ctx1) {
  51886. var $2,$1,$4,$3,$6,$5,$8,$7;
  51887. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51888. $recv($self["@theClass"])._javascriptConstructor_($self._trickyJsConstructor());
  51889. $2=$recv($self["@theClass"])._superclass();
  51890. $ctx1.sendIdx["superclass"]=1;
  51891. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51892. $ctx1.sendIdx["=="]=1;
  51893. $self._assert_($1);
  51894. $ctx1.sendIdx["assert:"]=1;
  51895. $4=$recv($self["@theClass"])._instanceVariableNames();
  51896. $ctx1.sendIdx["instanceVariableNames"]=1;
  51897. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51898. $ctx1.sendIdx["=="]=2;
  51899. $self._assert_($3);
  51900. $ctx1.sendIdx["assert:"]=2;
  51901. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51902. $ctx1.sendIdx["assert:equals:"]=1;
  51903. $6=$recv($self["@theClass"])._package();
  51904. $ctx1.sendIdx["package"]=1;
  51905. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  51906. $ctx1.sendIdx["=="]=3;
  51907. $self._assert_($5);
  51908. $ctx1.sendIdx["assert:"]=3;
  51909. $8=$recv($self["@theClass"])._methodDictionary();
  51910. $ctx1.sendIdx["methodDictionary"]=1;
  51911. $7=$recv($8)._keys();
  51912. $ctx1.sendIdx["keys"]=1;
  51913. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51914. $ctx1.sendIdx["assert:equals:"]=2;
  51915. instance=$recv($self["@theClass"])._new();
  51916. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  51917. $self._assert_equals_($recv(instance)._value(),(4));
  51918. $ctx1.sendIdx["assert:equals:"]=3;
  51919. $self._shouldnt_raise_((function(){
  51920. return $core.withContext(function($ctx2) {
  51921. return $recv(instance)._foo_((9));
  51922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51923. }),$globals.Error);
  51924. $self._assert_equals_($recv(instance)._foo(),(9));
  51925. return self;
  51926. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  51927. },
  51928. args: [],
  51929. 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",
  51930. referencedClasses: ["ObjectMock", "Error"],
  51931. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  51932. }),
  51933. $globals.ClassTest);
  51934. $core.addMethod(
  51935. $core.method({
  51936. selector: "trickyJsConstructor",
  51937. protocol: "running",
  51938. fn: function (){
  51939. var self=this,$self=this;
  51940. return $core.withContext(function($ctx1) {
  51941. function Foo(){}
  51942. Foo.prototype.valueOf = function () {return 4;};
  51943. Foo.prototype._foo = function () {return "bar";};
  51944. return Foo;
  51945. ;
  51946. return self;
  51947. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  51948. },
  51949. args: [],
  51950. 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'>",
  51951. referencedClasses: [],
  51952. messageSends: []
  51953. }),
  51954. $globals.ClassTest);
  51955. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  51956. $core.addMethod(
  51957. $core.method({
  51958. selector: "assertSameContents:as:",
  51959. protocol: "convenience",
  51960. fn: function (aCollection,anotherCollection){
  51961. var self=this,$self=this;
  51962. return $core.withContext(function($ctx1) {
  51963. var $2,$1,$4,$3;
  51964. $2=$recv(aCollection)._size();
  51965. $ctx1.sendIdx["size"]=1;
  51966. $1=$recv($2).__eq($recv(anotherCollection)._size());
  51967. $ctx1.sendIdx["="]=1;
  51968. $self._assert_($1);
  51969. $ctx1.sendIdx["assert:"]=1;
  51970. $recv(aCollection)._do_((function(each){
  51971. return $core.withContext(function($ctx2) {
  51972. $4=$recv(aCollection)._occurrencesOf_(each);
  51973. $ctx2.sendIdx["occurrencesOf:"]=1;
  51974. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  51975. return $self._assert_($3);
  51976. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51977. }));
  51978. return self;
  51979. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  51980. },
  51981. args: ["aCollection", "anotherCollection"],
  51982. 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)) ]",
  51983. referencedClasses: [],
  51984. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  51985. }),
  51986. $globals.CollectionTest);
  51987. $core.addMethod(
  51988. $core.method({
  51989. selector: "collection",
  51990. protocol: "fixture",
  51991. fn: function (){
  51992. var self=this,$self=this;
  51993. return $core.withContext(function($ctx1) {
  51994. $self._subclassResponsibility();
  51995. return self;
  51996. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  51997. },
  51998. args: [],
  51999. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  52000. referencedClasses: [],
  52001. messageSends: ["subclassResponsibility"]
  52002. }),
  52003. $globals.CollectionTest);
  52004. $core.addMethod(
  52005. $core.method({
  52006. selector: "collectionClass",
  52007. protocol: "fixture",
  52008. fn: function (){
  52009. var self=this,$self=this;
  52010. return $core.withContext(function($ctx1) {
  52011. return $recv($self._class())._collectionClass();
  52012. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  52013. },
  52014. args: [],
  52015. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  52016. referencedClasses: [],
  52017. messageSends: ["collectionClass", "class"]
  52018. }),
  52019. $globals.CollectionTest);
  52020. $core.addMethod(
  52021. $core.method({
  52022. selector: "collectionOfPrintStrings",
  52023. protocol: "fixture",
  52024. fn: function (){
  52025. var self=this,$self=this;
  52026. return $core.withContext(function($ctx1) {
  52027. $self._subclassResponsibility();
  52028. return self;
  52029. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  52030. },
  52031. args: [],
  52032. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  52033. referencedClasses: [],
  52034. messageSends: ["subclassResponsibility"]
  52035. }),
  52036. $globals.CollectionTest);
  52037. $core.addMethod(
  52038. $core.method({
  52039. selector: "collectionSize",
  52040. protocol: "fixture",
  52041. fn: function (){
  52042. var self=this,$self=this;
  52043. return $core.withContext(function($ctx1) {
  52044. $self._subclassResponsibility();
  52045. return self;
  52046. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  52047. },
  52048. args: [],
  52049. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  52050. referencedClasses: [],
  52051. messageSends: ["subclassResponsibility"]
  52052. }),
  52053. $globals.CollectionTest);
  52054. $core.addMethod(
  52055. $core.method({
  52056. selector: "collectionWithDuplicates",
  52057. protocol: "fixture",
  52058. fn: function (){
  52059. var self=this,$self=this;
  52060. return $core.withContext(function($ctx1) {
  52061. $self._subclassResponsibility();
  52062. return self;
  52063. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  52064. },
  52065. args: [],
  52066. 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",
  52067. referencedClasses: [],
  52068. messageSends: ["subclassResponsibility"]
  52069. }),
  52070. $globals.CollectionTest);
  52071. $core.addMethod(
  52072. $core.method({
  52073. selector: "collectionWithNewValue",
  52074. protocol: "fixture",
  52075. fn: function (){
  52076. var self=this,$self=this;
  52077. return $core.withContext(function($ctx1) {
  52078. $self._subclassResponsibility();
  52079. return self;
  52080. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  52081. },
  52082. args: [],
  52083. 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",
  52084. referencedClasses: [],
  52085. messageSends: ["subclassResponsibility"]
  52086. }),
  52087. $globals.CollectionTest);
  52088. $core.addMethod(
  52089. $core.method({
  52090. selector: "initialize",
  52091. protocol: "initialization",
  52092. fn: function (){
  52093. var self=this,$self=this;
  52094. return $core.withContext(function($ctx1) {
  52095. (
  52096. $ctx1.supercall = true,
  52097. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  52098. $ctx1.supercall = false;
  52099. $self["@sampleBlock"]=(function(){
  52100. });
  52101. return self;
  52102. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  52103. },
  52104. args: [],
  52105. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  52106. referencedClasses: [],
  52107. messageSends: ["initialize"]
  52108. }),
  52109. $globals.CollectionTest);
  52110. $core.addMethod(
  52111. $core.method({
  52112. selector: "sampleNewValue",
  52113. protocol: "fixture",
  52114. fn: function (){
  52115. var self=this,$self=this;
  52116. return "N";
  52117. },
  52118. args: [],
  52119. 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'",
  52120. referencedClasses: [],
  52121. messageSends: []
  52122. }),
  52123. $globals.CollectionTest);
  52124. $core.addMethod(
  52125. $core.method({
  52126. selector: "sampleNewValueAsCollection",
  52127. protocol: "fixture",
  52128. fn: function (){
  52129. var self=this,$self=this;
  52130. return $core.withContext(function($ctx1) {
  52131. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  52132. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  52133. },
  52134. args: [],
  52135. 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",
  52136. referencedClasses: [],
  52137. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  52138. }),
  52139. $globals.CollectionTest);
  52140. $core.addMethod(
  52141. $core.method({
  52142. selector: "testAddAll",
  52143. protocol: "tests",
  52144. fn: function (){
  52145. var self=this,$self=this;
  52146. return $core.withContext(function($ctx1) {
  52147. 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;
  52148. $2=$self._collection();
  52149. $ctx1.sendIdx["collection"]=1;
  52150. $4=$self._collectionClass();
  52151. $ctx1.sendIdx["collectionClass"]=1;
  52152. $3=$recv($4)._new();
  52153. $ctx1.sendIdx["new"]=1;
  52154. $recv($2)._addAll_($3);
  52155. $ctx1.sendIdx["addAll:"]=1;
  52156. $5=$recv($2)._yourself();
  52157. $ctx1.sendIdx["yourself"]=1;
  52158. $1=$5;
  52159. $6=$self._collection();
  52160. $ctx1.sendIdx["collection"]=2;
  52161. $self._assert_equals_($1,$6);
  52162. $ctx1.sendIdx["assert:equals:"]=1;
  52163. $9=$self._collectionClass();
  52164. $ctx1.sendIdx["collectionClass"]=2;
  52165. $8=$recv($9)._new();
  52166. $ctx1.sendIdx["new"]=2;
  52167. $10=$self._collection();
  52168. $ctx1.sendIdx["collection"]=3;
  52169. $recv($8)._addAll_($10);
  52170. $ctx1.sendIdx["addAll:"]=2;
  52171. $11=$recv($8)._yourself();
  52172. $ctx1.sendIdx["yourself"]=2;
  52173. $7=$11;
  52174. $12=$self._collection();
  52175. $ctx1.sendIdx["collection"]=4;
  52176. $self._assert_equals_($7,$12);
  52177. $ctx1.sendIdx["assert:equals:"]=2;
  52178. $15=$self._collectionClass();
  52179. $ctx1.sendIdx["collectionClass"]=3;
  52180. $14=$recv($15)._new();
  52181. $ctx1.sendIdx["new"]=3;
  52182. $17=$self._collectionClass();
  52183. $ctx1.sendIdx["collectionClass"]=4;
  52184. $16=$recv($17)._new();
  52185. $ctx1.sendIdx["new"]=4;
  52186. $recv($14)._addAll_($16);
  52187. $ctx1.sendIdx["addAll:"]=3;
  52188. $18=$recv($14)._yourself();
  52189. $ctx1.sendIdx["yourself"]=3;
  52190. $13=$18;
  52191. $self._assert_equals_($13,$recv($self._collectionClass())._new());
  52192. $ctx1.sendIdx["assert:equals:"]=3;
  52193. $20=$self._collection();
  52194. $ctx1.sendIdx["collection"]=5;
  52195. $21=$self._sampleNewValueAsCollection();
  52196. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52197. $recv($20)._addAll_($21);
  52198. $ctx1.sendIdx["addAll:"]=4;
  52199. $22=$recv($20)._yourself();
  52200. $ctx1.sendIdx["yourself"]=4;
  52201. $19=$22;
  52202. $23=$self._collectionWithNewValue();
  52203. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52204. $self._assert_equals_($19,$23);
  52205. $25=$self._sampleNewValueAsCollection();
  52206. $recv($25)._addAll_($self._collection());
  52207. $24=$recv($25)._yourself();
  52208. $self._assertSameContents_as_($24,$self._collectionWithNewValue());
  52209. return self;
  52210. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  52211. },
  52212. args: [],
  52213. 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",
  52214. referencedClasses: [],
  52215. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52216. }),
  52217. $globals.CollectionTest);
  52218. $core.addMethod(
  52219. $core.method({
  52220. selector: "testAllSatisfy",
  52221. protocol: "tests",
  52222. fn: function (){
  52223. var self=this,$self=this;
  52224. var collection,anyOne;
  52225. return $core.withContext(function($ctx1) {
  52226. var $1;
  52227. collection=$self._collection();
  52228. anyOne=$recv(collection)._anyOne();
  52229. $1=$recv(collection)._allSatisfy_((function(each){
  52230. return $core.withContext(function($ctx2) {
  52231. return $recv(collection)._includes_(each);
  52232. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52233. }));
  52234. $ctx1.sendIdx["allSatisfy:"]=1;
  52235. $self._assert_($1);
  52236. $self._deny_($recv(collection)._allSatisfy_((function(each){
  52237. return $core.withContext(function($ctx2) {
  52238. return $recv(each).__tild_eq(anyOne);
  52239. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52240. })));
  52241. return self;
  52242. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  52243. },
  52244. args: [],
  52245. 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 ])",
  52246. referencedClasses: [],
  52247. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  52248. }),
  52249. $globals.CollectionTest);
  52250. $core.addMethod(
  52251. $core.method({
  52252. selector: "testAnyOne",
  52253. protocol: "tests",
  52254. fn: function (){
  52255. var self=this,$self=this;
  52256. return $core.withContext(function($ctx1) {
  52257. var $2,$1;
  52258. $self._should_raise_((function(){
  52259. return $core.withContext(function($ctx2) {
  52260. return $recv($recv($self._collectionClass())._new())._anyOne();
  52261. $ctx2.sendIdx["anyOne"]=1;
  52262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52263. }),$globals.Error);
  52264. $2=$self._collection();
  52265. $ctx1.sendIdx["collection"]=1;
  52266. $1=$recv($2)._includes_($recv($self._collection())._anyOne());
  52267. $self._assert_($1);
  52268. return self;
  52269. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  52270. },
  52271. args: [],
  52272. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  52273. referencedClasses: ["Error"],
  52274. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  52275. }),
  52276. $globals.CollectionTest);
  52277. $core.addMethod(
  52278. $core.method({
  52279. selector: "testAnySatisfy",
  52280. protocol: "tests",
  52281. fn: function (){
  52282. var self=this,$self=this;
  52283. var anyOne;
  52284. return $core.withContext(function($ctx1) {
  52285. var $1,$3,$2;
  52286. $1=$self._collection();
  52287. $ctx1.sendIdx["collection"]=1;
  52288. anyOne=$recv($1)._anyOne();
  52289. $3=$self._collection();
  52290. $ctx1.sendIdx["collection"]=2;
  52291. $2=$recv($3)._anySatisfy_((function(each){
  52292. return $core.withContext(function($ctx2) {
  52293. return $recv(each).__eq(anyOne);
  52294. $ctx2.sendIdx["="]=1;
  52295. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52296. }));
  52297. $ctx1.sendIdx["anySatisfy:"]=1;
  52298. $self._assert_($2);
  52299. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  52300. return $core.withContext(function($ctx2) {
  52301. return $recv(each).__eq($recv($globals.Object)._new());
  52302. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52303. })));
  52304. return self;
  52305. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  52306. },
  52307. args: [],
  52308. 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 ])",
  52309. referencedClasses: ["Object"],
  52310. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  52311. }),
  52312. $globals.CollectionTest);
  52313. $core.addMethod(
  52314. $core.method({
  52315. selector: "testAsArray",
  52316. protocol: "tests",
  52317. fn: function (){
  52318. var self=this,$self=this;
  52319. return $core.withContext(function($ctx1) {
  52320. var $1;
  52321. $1=$self._collection();
  52322. $ctx1.sendIdx["collection"]=1;
  52323. $self._assertSameContents_as_($1,$recv($self._collection())._asArray());
  52324. return self;
  52325. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  52326. },
  52327. args: [],
  52328. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  52329. referencedClasses: [],
  52330. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  52331. }),
  52332. $globals.CollectionTest);
  52333. $core.addMethod(
  52334. $core.method({
  52335. selector: "testAsOrderedCollection",
  52336. protocol: "tests",
  52337. fn: function (){
  52338. var self=this,$self=this;
  52339. return $core.withContext(function($ctx1) {
  52340. var $1;
  52341. $1=$self._collection();
  52342. $ctx1.sendIdx["collection"]=1;
  52343. $self._assertSameContents_as_($1,$recv($self._collection())._asOrderedCollection());
  52344. return self;
  52345. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  52346. },
  52347. args: [],
  52348. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  52349. referencedClasses: [],
  52350. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  52351. }),
  52352. $globals.CollectionTest);
  52353. $core.addMethod(
  52354. $core.method({
  52355. selector: "testAsSet",
  52356. protocol: "tests",
  52357. fn: function (){
  52358. var self=this,$self=this;
  52359. var c,set;
  52360. return $core.withContext(function($ctx1) {
  52361. c=$self._collectionWithDuplicates();
  52362. set=$recv(c)._asSet();
  52363. $self._assert_equals_($recv(set)._size(),(6));
  52364. $recv(c)._do_((function(each){
  52365. return $core.withContext(function($ctx2) {
  52366. return $self._assert_($recv(set)._includes_(each));
  52367. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52368. }));
  52369. return self;
  52370. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  52371. },
  52372. args: [],
  52373. 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) ]",
  52374. referencedClasses: [],
  52375. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  52376. }),
  52377. $globals.CollectionTest);
  52378. $core.addMethod(
  52379. $core.method({
  52380. selector: "testCollect",
  52381. protocol: "tests",
  52382. fn: function (){
  52383. var self=this,$self=this;
  52384. return $core.withContext(function($ctx1) {
  52385. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  52386. $2=$self._collection();
  52387. $ctx1.sendIdx["collection"]=1;
  52388. $1=$recv($2)._collect_((function(each){
  52389. return each;
  52390. }));
  52391. $ctx1.sendIdx["collect:"]=1;
  52392. $3=$self._collection();
  52393. $ctx1.sendIdx["collection"]=2;
  52394. $self._assert_equals_($1,$3);
  52395. $ctx1.sendIdx["assert:equals:"]=1;
  52396. $5=$self._collectionWithNewValue();
  52397. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52398. $4=$recv($5)._collect_((function(each){
  52399. return each;
  52400. }));
  52401. $ctx1.sendIdx["collect:"]=2;
  52402. $self._assert_equals_($4,$self._collectionWithNewValue());
  52403. $ctx1.sendIdx["assert:equals:"]=2;
  52404. $8=$self._collectionClass();
  52405. $ctx1.sendIdx["collectionClass"]=1;
  52406. $7=$recv($8)._new();
  52407. $ctx1.sendIdx["new"]=1;
  52408. $6=$recv($7)._collect_((function(each){
  52409. return $core.withContext(function($ctx2) {
  52410. return $recv(each)._printString();
  52411. $ctx2.sendIdx["printString"]=1;
  52412. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  52413. }));
  52414. $ctx1.sendIdx["collect:"]=3;
  52415. $self._assert_equals_($6,$recv($self._collectionClass())._new());
  52416. $ctx1.sendIdx["assert:equals:"]=3;
  52417. $11=$self._collection();
  52418. $ctx1.sendIdx["collection"]=3;
  52419. $10=$recv($11)._collect_((function(){
  52420. return $core.withContext(function($ctx2) {
  52421. return $self._sampleNewValue();
  52422. $ctx2.sendIdx["sampleNewValue"]=1;
  52423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  52424. }));
  52425. $ctx1.sendIdx["collect:"]=4;
  52426. $9=$recv($10)._detect_((function(){
  52427. return true;
  52428. }));
  52429. $self._assert_equals_($9,$self._sampleNewValue());
  52430. $ctx1.sendIdx["assert:equals:"]=4;
  52431. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  52432. return $core.withContext(function($ctx2) {
  52433. return $recv(each)._printString();
  52434. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52435. })),$self._collectionOfPrintStrings());
  52436. return self;
  52437. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  52438. },
  52439. args: [],
  52440. 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",
  52441. referencedClasses: [],
  52442. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  52443. }),
  52444. $globals.CollectionTest);
  52445. $core.addMethod(
  52446. $core.method({
  52447. selector: "testComma",
  52448. protocol: "tests",
  52449. fn: function (){
  52450. var self=this,$self=this;
  52451. return $core.withContext(function($ctx1) {
  52452. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  52453. $2=$self._collection();
  52454. $ctx1.sendIdx["collection"]=1;
  52455. $4=$self._collectionClass();
  52456. $ctx1.sendIdx["collectionClass"]=1;
  52457. $3=$recv($4)._new();
  52458. $ctx1.sendIdx["new"]=1;
  52459. $1=$recv($2).__comma($3);
  52460. $ctx1.sendIdx[","]=1;
  52461. $5=$self._collection();
  52462. $ctx1.sendIdx["collection"]=2;
  52463. $self._assert_equals_($1,$5);
  52464. $ctx1.sendIdx["assert:equals:"]=1;
  52465. $8=$self._collectionClass();
  52466. $ctx1.sendIdx["collectionClass"]=2;
  52467. $7=$recv($8)._new();
  52468. $ctx1.sendIdx["new"]=2;
  52469. $9=$self._collection();
  52470. $ctx1.sendIdx["collection"]=3;
  52471. $6=$recv($7).__comma($9);
  52472. $ctx1.sendIdx[","]=2;
  52473. $10=$self._collection();
  52474. $ctx1.sendIdx["collection"]=4;
  52475. $self._assert_equals_($6,$10);
  52476. $ctx1.sendIdx["assert:equals:"]=2;
  52477. $13=$self._collectionClass();
  52478. $ctx1.sendIdx["collectionClass"]=3;
  52479. $12=$recv($13)._new();
  52480. $ctx1.sendIdx["new"]=3;
  52481. $15=$self._collectionClass();
  52482. $ctx1.sendIdx["collectionClass"]=4;
  52483. $14=$recv($15)._new();
  52484. $ctx1.sendIdx["new"]=4;
  52485. $11=$recv($12).__comma($14);
  52486. $ctx1.sendIdx[","]=3;
  52487. $self._assert_equals_($11,$recv($self._collectionClass())._new());
  52488. $ctx1.sendIdx["assert:equals:"]=3;
  52489. $17=$self._collection();
  52490. $ctx1.sendIdx["collection"]=5;
  52491. $18=$self._sampleNewValueAsCollection();
  52492. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52493. $16=$recv($17).__comma($18);
  52494. $ctx1.sendIdx[","]=4;
  52495. $19=$self._collectionWithNewValue();
  52496. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52497. $self._assert_equals_($16,$19);
  52498. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  52499. return self;
  52500. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  52501. },
  52502. args: [],
  52503. 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",
  52504. referencedClasses: [],
  52505. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52506. }),
  52507. $globals.CollectionTest);
  52508. $core.addMethod(
  52509. $core.method({
  52510. selector: "testCopy",
  52511. protocol: "tests",
  52512. fn: function (){
  52513. var self=this,$self=this;
  52514. return $core.withContext(function($ctx1) {
  52515. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  52516. $3=$self._collectionClass();
  52517. $ctx1.sendIdx["collectionClass"]=1;
  52518. $2=$recv($3)._new();
  52519. $ctx1.sendIdx["new"]=1;
  52520. $1=$recv($2)._copy();
  52521. $ctx1.sendIdx["copy"]=1;
  52522. $5=$self._collectionClass();
  52523. $ctx1.sendIdx["collectionClass"]=2;
  52524. $4=$recv($5)._new();
  52525. $ctx1.sendIdx["new"]=2;
  52526. $self._assert_equals_($1,$4);
  52527. $ctx1.sendIdx["assert:equals:"]=1;
  52528. $7=$self._collection();
  52529. $ctx1.sendIdx["collection"]=1;
  52530. $6=$recv($7)._copy();
  52531. $ctx1.sendIdx["copy"]=2;
  52532. $8=$self._collection();
  52533. $ctx1.sendIdx["collection"]=2;
  52534. $self._assert_equals_($6,$8);
  52535. $ctx1.sendIdx["assert:equals:"]=2;
  52536. $10=$self._collectionWithNewValue();
  52537. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52538. $9=$recv($10)._copy();
  52539. $ctx1.sendIdx["copy"]=3;
  52540. $11=$self._collectionWithNewValue();
  52541. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52542. $self._assert_equals_($9,$11);
  52543. $15=$self._collectionClass();
  52544. $ctx1.sendIdx["collectionClass"]=3;
  52545. $14=$recv($15)._new();
  52546. $ctx1.sendIdx["new"]=3;
  52547. $13=$recv($14)._copy();
  52548. $ctx1.sendIdx["copy"]=4;
  52549. $16=$self._collection();
  52550. $ctx1.sendIdx["collection"]=3;
  52551. $12=$recv($13).__eq($16);
  52552. $ctx1.sendIdx["="]=1;
  52553. $self._deny_($12);
  52554. $ctx1.sendIdx["deny:"]=1;
  52555. $19=$self._collection();
  52556. $ctx1.sendIdx["collection"]=4;
  52557. $18=$recv($19)._copy();
  52558. $ctx1.sendIdx["copy"]=5;
  52559. $17=$recv($18).__eq($recv($self._collectionClass())._new());
  52560. $ctx1.sendIdx["="]=2;
  52561. $self._deny_($17);
  52562. $ctx1.sendIdx["deny:"]=2;
  52563. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  52564. return self;
  52565. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  52566. },
  52567. args: [],
  52568. 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",
  52569. referencedClasses: [],
  52570. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  52571. }),
  52572. $globals.CollectionTest);
  52573. $core.addMethod(
  52574. $core.method({
  52575. selector: "testCopySeparates",
  52576. protocol: "tests",
  52577. fn: function (){
  52578. var self=this,$self=this;
  52579. var original,copy;
  52580. return $core.withContext(function($ctx1) {
  52581. original=$self._collection();
  52582. $ctx1.sendIdx["collection"]=1;
  52583. copy=$recv(original)._copy();
  52584. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  52585. $self._assert_($recv(original).__eq($self._collection()));
  52586. return self;
  52587. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  52588. },
  52589. args: [],
  52590. 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",
  52591. referencedClasses: [],
  52592. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  52593. }),
  52594. $globals.CollectionTest);
  52595. $core.addMethod(
  52596. $core.method({
  52597. selector: "testDetect",
  52598. protocol: "tests",
  52599. fn: function (){
  52600. var self=this,$self=this;
  52601. return $core.withContext(function($ctx1) {
  52602. var $1,$2,$3,$4,$6,$5,$7;
  52603. $self._shouldnt_raise_((function(){
  52604. return $core.withContext(function($ctx2) {
  52605. $1=$self._collection();
  52606. $ctx2.sendIdx["collection"]=1;
  52607. return $recv($1)._detect_((function(){
  52608. return true;
  52609. }));
  52610. $ctx2.sendIdx["detect:"]=1;
  52611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52612. }),$globals.Error);
  52613. $self._should_raise_((function(){
  52614. return $core.withContext(function($ctx2) {
  52615. $2=$self._collection();
  52616. $ctx2.sendIdx["collection"]=2;
  52617. return $recv($2)._detect_((function(){
  52618. return false;
  52619. }));
  52620. $ctx2.sendIdx["detect:"]=2;
  52621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  52622. }),$globals.Error);
  52623. $ctx1.sendIdx["should:raise:"]=1;
  52624. $3=$recv($self._sampleNewValueAsCollection())._detect_((function(){
  52625. return true;
  52626. }));
  52627. $ctx1.sendIdx["detect:"]=3;
  52628. $4=$self._sampleNewValue();
  52629. $ctx1.sendIdx["sampleNewValue"]=1;
  52630. $self._assert_equals_($3,$4);
  52631. $ctx1.sendIdx["assert:equals:"]=1;
  52632. $5=$recv($self._collectionWithNewValue())._detect_((function(each){
  52633. return $core.withContext(function($ctx2) {
  52634. $6=$self._sampleNewValue();
  52635. $ctx2.sendIdx["sampleNewValue"]=2;
  52636. return $recv(each).__eq($6);
  52637. $ctx2.sendIdx["="]=1;
  52638. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52639. }));
  52640. $ctx1.sendIdx["detect:"]=4;
  52641. $7=$self._sampleNewValue();
  52642. $ctx1.sendIdx["sampleNewValue"]=3;
  52643. $self._assert_equals_($5,$7);
  52644. $self._should_raise_((function(){
  52645. return $core.withContext(function($ctx2) {
  52646. return $recv($self._collection())._detect_((function(each){
  52647. return $core.withContext(function($ctx3) {
  52648. return $recv(each).__eq($self._sampleNewValue());
  52649. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  52650. }));
  52651. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  52652. }),$globals.Error);
  52653. return self;
  52654. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  52655. },
  52656. args: [],
  52657. 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",
  52658. referencedClasses: ["Error"],
  52659. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  52660. }),
  52661. $globals.CollectionTest);
  52662. $core.addMethod(
  52663. $core.method({
  52664. selector: "testDetectIfNone",
  52665. protocol: "tests",
  52666. fn: function (){
  52667. var self=this,$self=this;
  52668. var sentinel;
  52669. return $core.withContext(function($ctx1) {
  52670. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  52671. sentinel=$recv($globals.Object)._new();
  52672. $3=$self._collection();
  52673. $ctx1.sendIdx["collection"]=1;
  52674. $2=$recv($3)._detect_ifNone_((function(){
  52675. return true;
  52676. }),(function(){
  52677. return sentinel;
  52678. }));
  52679. $ctx1.sendIdx["detect:ifNone:"]=1;
  52680. $1=$recv($2).__tild_eq(sentinel);
  52681. $self._assert_($1);
  52682. $5=$self._collection();
  52683. $ctx1.sendIdx["collection"]=2;
  52684. $4=$recv($5)._detect_ifNone_((function(){
  52685. return false;
  52686. }),(function(){
  52687. return sentinel;
  52688. }));
  52689. $ctx1.sendIdx["detect:ifNone:"]=2;
  52690. $self._assert_equals_($4,sentinel);
  52691. $ctx1.sendIdx["assert:equals:"]=1;
  52692. $6=$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  52693. return true;
  52694. }),(function(){
  52695. return sentinel;
  52696. }));
  52697. $ctx1.sendIdx["detect:ifNone:"]=3;
  52698. $7=$self._sampleNewValue();
  52699. $ctx1.sendIdx["sampleNewValue"]=1;
  52700. $self._assert_equals_($6,$7);
  52701. $ctx1.sendIdx["assert:equals:"]=2;
  52702. $8=$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  52703. return $core.withContext(function($ctx2) {
  52704. $9=$self._sampleNewValue();
  52705. $ctx2.sendIdx["sampleNewValue"]=2;
  52706. return $recv(each).__eq($9);
  52707. $ctx2.sendIdx["="]=1;
  52708. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  52709. }),(function(){
  52710. return sentinel;
  52711. }));
  52712. $ctx1.sendIdx["detect:ifNone:"]=4;
  52713. $10=$self._sampleNewValue();
  52714. $ctx1.sendIdx["sampleNewValue"]=3;
  52715. $self._assert_equals_($8,$10);
  52716. $ctx1.sendIdx["assert:equals:"]=3;
  52717. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  52718. return $core.withContext(function($ctx2) {
  52719. return $recv(each).__eq($self._sampleNewValue());
  52720. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  52721. }),(function(){
  52722. return sentinel;
  52723. })),sentinel);
  52724. return self;
  52725. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  52726. },
  52727. args: [],
  52728. 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",
  52729. referencedClasses: ["Object"],
  52730. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  52731. }),
  52732. $globals.CollectionTest);
  52733. $core.addMethod(
  52734. $core.method({
  52735. selector: "testDo",
  52736. protocol: "tests",
  52737. fn: function (){
  52738. var self=this,$self=this;
  52739. var newCollection;
  52740. return $core.withContext(function($ctx1) {
  52741. var $1,$2;
  52742. newCollection=$recv($globals.OrderedCollection)._new();
  52743. $ctx1.sendIdx["new"]=1;
  52744. $1=$self._collection();
  52745. $ctx1.sendIdx["collection"]=1;
  52746. $recv($1)._do_((function(each){
  52747. return $core.withContext(function($ctx2) {
  52748. return $recv(newCollection)._add_(each);
  52749. $ctx2.sendIdx["add:"]=1;
  52750. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52751. }));
  52752. $ctx1.sendIdx["do:"]=1;
  52753. $self._assertSameContents_as_($self._collection(),newCollection);
  52754. $ctx1.sendIdx["assertSameContents:as:"]=1;
  52755. newCollection=$recv($globals.OrderedCollection)._new();
  52756. $2=$self._collectionWithDuplicates();
  52757. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  52758. $recv($2)._do_((function(each){
  52759. return $core.withContext(function($ctx2) {
  52760. return $recv(newCollection)._add_(each);
  52761. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52762. }));
  52763. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  52764. return self;
  52765. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  52766. },
  52767. args: [],
  52768. 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",
  52769. referencedClasses: ["OrderedCollection"],
  52770. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  52771. }),
  52772. $globals.CollectionTest);
  52773. $core.addMethod(
  52774. $core.method({
  52775. selector: "testEquality",
  52776. protocol: "tests",
  52777. fn: function (){
  52778. var self=this,$self=this;
  52779. return $core.withContext(function($ctx1) {
  52780. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  52781. $2=$self._collectionClass();
  52782. $ctx1.sendIdx["collectionClass"]=1;
  52783. $1=$recv($2)._new();
  52784. $ctx1.sendIdx["new"]=1;
  52785. $4=$self._collectionClass();
  52786. $ctx1.sendIdx["collectionClass"]=2;
  52787. $3=$recv($4)._new();
  52788. $ctx1.sendIdx["new"]=2;
  52789. $self._assert_equals_($1,$3);
  52790. $ctx1.sendIdx["assert:equals:"]=1;
  52791. $5=$self._collection();
  52792. $ctx1.sendIdx["collection"]=1;
  52793. $6=$self._collection();
  52794. $ctx1.sendIdx["collection"]=2;
  52795. $self._assert_equals_($5,$6);
  52796. $ctx1.sendIdx["assert:equals:"]=2;
  52797. $7=$self._collectionWithNewValue();
  52798. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52799. $8=$self._collectionWithNewValue();
  52800. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52801. $self._assert_equals_($7,$8);
  52802. $11=$self._collectionClass();
  52803. $ctx1.sendIdx["collectionClass"]=3;
  52804. $10=$recv($11)._new();
  52805. $ctx1.sendIdx["new"]=3;
  52806. $12=$self._collection();
  52807. $ctx1.sendIdx["collection"]=3;
  52808. $9=$recv($10).__eq($12);
  52809. $ctx1.sendIdx["="]=1;
  52810. $self._deny_($9);
  52811. $ctx1.sendIdx["deny:"]=1;
  52812. $14=$self._collection();
  52813. $ctx1.sendIdx["collection"]=4;
  52814. $13=$recv($14).__eq($recv($self._collectionClass())._new());
  52815. $ctx1.sendIdx["="]=2;
  52816. $self._deny_($13);
  52817. $ctx1.sendIdx["deny:"]=2;
  52818. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  52819. return self;
  52820. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  52821. },
  52822. args: [],
  52823. 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",
  52824. referencedClasses: [],
  52825. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  52826. }),
  52827. $globals.CollectionTest);
  52828. $core.addMethod(
  52829. $core.method({
  52830. selector: "testIfEmptyFamily",
  52831. protocol: "tests",
  52832. fn: function (){
  52833. var self=this,$self=this;
  52834. return $core.withContext(function($ctx1) {
  52835. 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;
  52836. $3=$self._collectionClass();
  52837. $ctx1.sendIdx["collectionClass"]=1;
  52838. $2=$recv($3)._new();
  52839. $ctx1.sendIdx["new"]=1;
  52840. $1=$recv($2)._ifEmpty_((function(){
  52841. return (42);
  52842. }));
  52843. $ctx1.sendIdx["ifEmpty:"]=1;
  52844. $self._assert_equals_($1,(42));
  52845. $ctx1.sendIdx["assert:equals:"]=1;
  52846. $5=$self._collection();
  52847. $ctx1.sendIdx["collection"]=1;
  52848. $4=$recv($5)._ifEmpty_((function(){
  52849. return (42);
  52850. }));
  52851. $6=$self._collection();
  52852. $ctx1.sendIdx["collection"]=2;
  52853. $self._assert_equals_($4,$6);
  52854. $ctx1.sendIdx["assert:equals:"]=2;
  52855. $9=$self._collectionClass();
  52856. $ctx1.sendIdx["collectionClass"]=2;
  52857. $8=$recv($9)._new();
  52858. $ctx1.sendIdx["new"]=2;
  52859. $7=$recv($8)._ifNotEmpty_((function(){
  52860. return (42);
  52861. }));
  52862. $ctx1.sendIdx["ifNotEmpty:"]=1;
  52863. $11=$self._collectionClass();
  52864. $ctx1.sendIdx["collectionClass"]=3;
  52865. $10=$recv($11)._new();
  52866. $ctx1.sendIdx["new"]=3;
  52867. $self._assert_equals_($7,$10);
  52868. $ctx1.sendIdx["assert:equals:"]=3;
  52869. $13=$self._collection();
  52870. $ctx1.sendIdx["collection"]=3;
  52871. $12=$recv($13)._ifNotEmpty_((function(){
  52872. return (42);
  52873. }));
  52874. $ctx1.sendIdx["ifNotEmpty:"]=2;
  52875. $self._assert_equals_($12,(42));
  52876. $ctx1.sendIdx["assert:equals:"]=4;
  52877. $15=$self._collection();
  52878. $ctx1.sendIdx["collection"]=4;
  52879. $14=$recv($15)._ifNotEmpty_((function(col){
  52880. return col;
  52881. }));
  52882. $16=$self._collection();
  52883. $ctx1.sendIdx["collection"]=5;
  52884. $self._assert_equals_($14,$16);
  52885. $ctx1.sendIdx["assert:equals:"]=5;
  52886. $19=$self._collectionClass();
  52887. $ctx1.sendIdx["collectionClass"]=4;
  52888. $18=$recv($19)._new();
  52889. $ctx1.sendIdx["new"]=4;
  52890. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  52891. return (42);
  52892. }),(function(){
  52893. return (999);
  52894. }));
  52895. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  52896. $self._assert_equals_($17,(42));
  52897. $ctx1.sendIdx["assert:equals:"]=6;
  52898. $21=$self._collection();
  52899. $ctx1.sendIdx["collection"]=6;
  52900. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  52901. return (42);
  52902. }),(function(){
  52903. return (999);
  52904. }));
  52905. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  52906. $self._assert_equals_($20,(999));
  52907. $ctx1.sendIdx["assert:equals:"]=7;
  52908. $23=$self._collection();
  52909. $ctx1.sendIdx["collection"]=7;
  52910. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  52911. return (42);
  52912. }),(function(col){
  52913. return col;
  52914. }));
  52915. $24=$self._collection();
  52916. $ctx1.sendIdx["collection"]=8;
  52917. $self._assert_equals_($22,$24);
  52918. $ctx1.sendIdx["assert:equals:"]=8;
  52919. $25=$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  52920. return (42);
  52921. }),(function(){
  52922. return (999);
  52923. }));
  52924. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  52925. $self._assert_equals_($25,(999));
  52926. $ctx1.sendIdx["assert:equals:"]=9;
  52927. $27=$self._collection();
  52928. $ctx1.sendIdx["collection"]=9;
  52929. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  52930. return (42);
  52931. }),(function(){
  52932. return (999);
  52933. }));
  52934. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  52935. $self._assert_equals_($26,(42));
  52936. $ctx1.sendIdx["assert:equals:"]=10;
  52937. $29=$self._collection();
  52938. $ctx1.sendIdx["collection"]=10;
  52939. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  52940. return col;
  52941. }),(function(){
  52942. return (999);
  52943. }));
  52944. $self._assert_equals_($28,$self._collection());
  52945. return self;
  52946. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  52947. },
  52948. args: [],
  52949. 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.",
  52950. referencedClasses: [],
  52951. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  52952. }),
  52953. $globals.CollectionTest);
  52954. $core.addMethod(
  52955. $core.method({
  52956. selector: "testIsEmpty",
  52957. protocol: "tests",
  52958. fn: function (){
  52959. var self=this,$self=this;
  52960. return $core.withContext(function($ctx1) {
  52961. var $1;
  52962. $1=$recv($recv($self._collectionClass())._new())._isEmpty();
  52963. $ctx1.sendIdx["isEmpty"]=1;
  52964. $self._assert_($1);
  52965. $self._deny_($recv($self._collection())._isEmpty());
  52966. return self;
  52967. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  52968. },
  52969. args: [],
  52970. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  52971. referencedClasses: [],
  52972. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  52973. }),
  52974. $globals.CollectionTest);
  52975. $core.addMethod(
  52976. $core.method({
  52977. selector: "testNoneSatisfy",
  52978. protocol: "tests",
  52979. fn: function (){
  52980. var self=this,$self=this;
  52981. var anyOne;
  52982. return $core.withContext(function($ctx1) {
  52983. var $1,$3,$2;
  52984. $1=$self._collection();
  52985. $ctx1.sendIdx["collection"]=1;
  52986. anyOne=$recv($1)._anyOne();
  52987. $3=$self._collection();
  52988. $ctx1.sendIdx["collection"]=2;
  52989. $2=$recv($3)._noneSatisfy_((function(each){
  52990. return $core.withContext(function($ctx2) {
  52991. return $recv(each).__eq(anyOne);
  52992. $ctx2.sendIdx["="]=1;
  52993. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52994. }));
  52995. $ctx1.sendIdx["noneSatisfy:"]=1;
  52996. $self._deny_($2);
  52997. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  52998. return $core.withContext(function($ctx2) {
  52999. return $recv(each).__eq($recv($globals.Object)._new());
  53000. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53001. })));
  53002. return self;
  53003. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  53004. },
  53005. args: [],
  53006. 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 ])",
  53007. referencedClasses: ["Object"],
  53008. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  53009. }),
  53010. $globals.CollectionTest);
  53011. $core.addMethod(
  53012. $core.method({
  53013. selector: "testRegression1224",
  53014. protocol: "tests",
  53015. fn: function (){
  53016. var self=this,$self=this;
  53017. return $core.withContext(function($ctx1) {
  53018. var $3,$2,$1;
  53019. $3=$recv($self._collectionClass())._new();
  53020. $recv($3)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  53021. }));
  53022. $2=$recv($3)._yourself();
  53023. $1=$recv($2)._size();
  53024. $self._assert_equals_($1,(0));
  53025. return self;
  53026. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.CollectionTest)});
  53027. },
  53028. args: [],
  53029. source: "testRegression1224\x0a\x09self assert: (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size equals: 0",
  53030. referencedClasses: [],
  53031. messageSends: ["assert:equals:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  53032. }),
  53033. $globals.CollectionTest);
  53034. $core.addMethod(
  53035. $core.method({
  53036. selector: "testRemoveAll",
  53037. protocol: "tests",
  53038. fn: function (){
  53039. var self=this,$self=this;
  53040. return $core.withContext(function($ctx1) {
  53041. var $2,$1;
  53042. $2=$self._collection();
  53043. $recv($2)._removeAll();
  53044. $1=$recv($2)._yourself();
  53045. $self._assert_equals_($1,$recv($self._collectionClass())._new());
  53046. return self;
  53047. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  53048. },
  53049. args: [],
  53050. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  53051. referencedClasses: [],
  53052. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  53053. }),
  53054. $globals.CollectionTest);
  53055. $core.addMethod(
  53056. $core.method({
  53057. selector: "testSelect",
  53058. protocol: "tests",
  53059. fn: function (){
  53060. var self=this,$self=this;
  53061. return $core.withContext(function($ctx1) {
  53062. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  53063. $2=$self._collection();
  53064. $ctx1.sendIdx["collection"]=1;
  53065. $1=$recv($2)._select_((function(){
  53066. return false;
  53067. }));
  53068. $ctx1.sendIdx["select:"]=1;
  53069. $4=$self._collectionClass();
  53070. $ctx1.sendIdx["collectionClass"]=1;
  53071. $3=$recv($4)._new();
  53072. $ctx1.sendIdx["new"]=1;
  53073. $self._assert_equals_($1,$3);
  53074. $ctx1.sendIdx["assert:equals:"]=1;
  53075. $6=$self._collection();
  53076. $ctx1.sendIdx["collection"]=2;
  53077. $5=$recv($6)._select_((function(){
  53078. return true;
  53079. }));
  53080. $ctx1.sendIdx["select:"]=2;
  53081. $7=$self._collection();
  53082. $ctx1.sendIdx["collection"]=3;
  53083. $self._assert_equals_($5,$7);
  53084. $ctx1.sendIdx["assert:equals:"]=2;
  53085. $9=$self._collectionWithNewValue();
  53086. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53087. $8=$recv($9)._select_((function(each){
  53088. return $core.withContext(function($ctx2) {
  53089. $10=$self._sampleNewValue();
  53090. $ctx2.sendIdx["sampleNewValue"]=1;
  53091. return $recv(each).__eq($10);
  53092. $ctx2.sendIdx["="]=1;
  53093. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  53094. }));
  53095. $ctx1.sendIdx["select:"]=3;
  53096. $self._assert_equals_($8,$self._sampleNewValueAsCollection());
  53097. $ctx1.sendIdx["assert:equals:"]=3;
  53098. $12=$self._collectionWithNewValue();
  53099. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53100. $11=$recv($12)._select_((function(each){
  53101. return $core.withContext(function($ctx2) {
  53102. $13=$self._sampleNewValue();
  53103. $ctx2.sendIdx["sampleNewValue"]=2;
  53104. return $recv(each).__tild_eq($13);
  53105. $ctx2.sendIdx["~="]=1;
  53106. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53107. }));
  53108. $ctx1.sendIdx["select:"]=4;
  53109. $14=$self._collection();
  53110. $ctx1.sendIdx["collection"]=4;
  53111. $self._assert_equals_($11,$14);
  53112. $ctx1.sendIdx["assert:equals:"]=4;
  53113. $16=$self._collection();
  53114. $ctx1.sendIdx["collection"]=5;
  53115. $15=$recv($16)._select_((function(each){
  53116. return $core.withContext(function($ctx2) {
  53117. $17=$self._sampleNewValue();
  53118. $ctx2.sendIdx["sampleNewValue"]=3;
  53119. return $recv(each).__eq($17);
  53120. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  53121. }));
  53122. $ctx1.sendIdx["select:"]=5;
  53123. $self._assert_equals_($15,$recv($self._collectionClass())._new());
  53124. $ctx1.sendIdx["assert:equals:"]=5;
  53125. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  53126. return $core.withContext(function($ctx2) {
  53127. return $recv(each).__tild_eq($self._sampleNewValue());
  53128. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53129. })),$self._collection());
  53130. return self;
  53131. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  53132. },
  53133. args: [],
  53134. 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",
  53135. referencedClasses: [],
  53136. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  53137. }),
  53138. $globals.CollectionTest);
  53139. $core.addMethod(
  53140. $core.method({
  53141. selector: "testSelectThenCollect",
  53142. protocol: "tests",
  53143. fn: function (){
  53144. var self=this,$self=this;
  53145. return $core.withContext(function($ctx1) {
  53146. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  53147. $2=$self._collection();
  53148. $ctx1.sendIdx["collection"]=1;
  53149. $1=$recv($2)._select_thenCollect_((function(){
  53150. return false;
  53151. }),"isString");
  53152. $ctx1.sendIdx["select:thenCollect:"]=1;
  53153. $4=$self._collectionClass();
  53154. $ctx1.sendIdx["collectionClass"]=1;
  53155. $3=$recv($4)._new();
  53156. $ctx1.sendIdx["new"]=1;
  53157. $self._assert_equals_($1,$3);
  53158. $ctx1.sendIdx["assert:equals:"]=1;
  53159. $6=$self._collection();
  53160. $ctx1.sendIdx["collection"]=2;
  53161. $5=$recv($6)._select_thenCollect_((function(){
  53162. return true;
  53163. }),(function(x){
  53164. return x;
  53165. }));
  53166. $ctx1.sendIdx["select:thenCollect:"]=2;
  53167. $7=$self._collection();
  53168. $ctx1.sendIdx["collection"]=3;
  53169. $self._assert_equals_($5,$7);
  53170. $ctx1.sendIdx["assert:equals:"]=2;
  53171. $8=$recv($self._collection())._select_thenCollect_((function(each){
  53172. return $core.withContext(function($ctx2) {
  53173. $9=$self._sampleNewValue();
  53174. $ctx2.sendIdx["sampleNewValue"]=1;
  53175. return $recv(each).__eq($9);
  53176. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53177. }),(function(x){
  53178. return x;
  53179. }));
  53180. $ctx1.sendIdx["select:thenCollect:"]=3;
  53181. $self._assert_equals_($8,$recv($self._collectionClass())._new());
  53182. $ctx1.sendIdx["assert:equals:"]=3;
  53183. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  53184. return $core.withContext(function($ctx2) {
  53185. return $recv(each).__tild_eq($self._sampleNewValue());
  53186. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53187. }),"printString"),$self._collectionOfPrintStrings());
  53188. return self;
  53189. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{},$globals.CollectionTest)});
  53190. },
  53191. args: [],
  53192. 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",
  53193. referencedClasses: [],
  53194. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  53195. }),
  53196. $globals.CollectionTest);
  53197. $core.addMethod(
  53198. $core.method({
  53199. selector: "testSingle",
  53200. protocol: "tests",
  53201. fn: function (){
  53202. var self=this,$self=this;
  53203. return $core.withContext(function($ctx1) {
  53204. $self._should_raise_((function(){
  53205. return $core.withContext(function($ctx2) {
  53206. return $recv($recv($self._collectionClass())._new())._single();
  53207. $ctx2.sendIdx["single"]=1;
  53208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53209. }),$globals.Error);
  53210. $ctx1.sendIdx["should:raise:"]=1;
  53211. $self._should_raise_((function(){
  53212. return $core.withContext(function($ctx2) {
  53213. return $recv($self._collection())._single();
  53214. $ctx2.sendIdx["single"]=2;
  53215. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53216. }),$globals.Error);
  53217. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  53218. return self;
  53219. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  53220. },
  53221. args: [],
  53222. 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",
  53223. referencedClasses: ["Error"],
  53224. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  53225. }),
  53226. $globals.CollectionTest);
  53227. $core.addMethod(
  53228. $core.method({
  53229. selector: "testSize",
  53230. protocol: "tests",
  53231. fn: function (){
  53232. var self=this,$self=this;
  53233. return $core.withContext(function($ctx1) {
  53234. var $1,$2;
  53235. $1=$recv($recv($self._collectionClass())._new())._size();
  53236. $ctx1.sendIdx["size"]=1;
  53237. $self._assert_equals_($1,(0));
  53238. $ctx1.sendIdx["assert:equals:"]=1;
  53239. $2=$recv($self._sampleNewValueAsCollection())._size();
  53240. $ctx1.sendIdx["size"]=2;
  53241. $self._assert_equals_($2,(1));
  53242. $ctx1.sendIdx["assert:equals:"]=2;
  53243. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  53244. return self;
  53245. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  53246. },
  53247. args: [],
  53248. 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",
  53249. referencedClasses: [],
  53250. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  53251. }),
  53252. $globals.CollectionTest);
  53253. $core.addMethod(
  53254. $core.method({
  53255. selector: "collectionClass",
  53256. protocol: "fixture",
  53257. fn: function (){
  53258. var self=this,$self=this;
  53259. return nil;
  53260. },
  53261. args: [],
  53262. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  53263. referencedClasses: [],
  53264. messageSends: []
  53265. }),
  53266. $globals.CollectionTest.a$cls);
  53267. $core.addMethod(
  53268. $core.method({
  53269. selector: "isAbstract",
  53270. protocol: "testing",
  53271. fn: function (){
  53272. var self=this,$self=this;
  53273. return $core.withContext(function($ctx1) {
  53274. return $recv($self._collectionClass())._isNil();
  53275. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.a$cls)});
  53276. },
  53277. args: [],
  53278. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  53279. referencedClasses: [],
  53280. messageSends: ["isNil", "collectionClass"]
  53281. }),
  53282. $globals.CollectionTest.a$cls);
  53283. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  53284. $core.addMethod(
  53285. $core.method({
  53286. selector: "collectionWithNewValue",
  53287. protocol: "fixture",
  53288. fn: function (){
  53289. var self=this,$self=this;
  53290. return $core.withContext(function($ctx1) {
  53291. $self._subclassResponsibility();
  53292. return self;
  53293. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  53294. },
  53295. args: [],
  53296. 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",
  53297. referencedClasses: [],
  53298. messageSends: ["subclassResponsibility"]
  53299. }),
  53300. $globals.IndexableCollectionTest);
  53301. $core.addMethod(
  53302. $core.method({
  53303. selector: "nonIndexesDo:",
  53304. protocol: "fixture",
  53305. fn: function (aBlock){
  53306. var self=this,$self=this;
  53307. return $core.withContext(function($ctx1) {
  53308. $self._subclassResponsibility();
  53309. return self;
  53310. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53311. },
  53312. args: ["aBlock"],
  53313. 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",
  53314. referencedClasses: [],
  53315. messageSends: ["subclassResponsibility"]
  53316. }),
  53317. $globals.IndexableCollectionTest);
  53318. $core.addMethod(
  53319. $core.method({
  53320. selector: "sampleNewIndex",
  53321. protocol: "fixture",
  53322. fn: function (){
  53323. var self=this,$self=this;
  53324. return $core.withContext(function($ctx1) {
  53325. $self._subclassResponsibility();
  53326. return self;
  53327. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  53328. },
  53329. args: [],
  53330. 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",
  53331. referencedClasses: [],
  53332. messageSends: ["subclassResponsibility"]
  53333. }),
  53334. $globals.IndexableCollectionTest);
  53335. $core.addMethod(
  53336. $core.method({
  53337. selector: "samplesDo:",
  53338. protocol: "fixture",
  53339. fn: function (aBlock){
  53340. var self=this,$self=this;
  53341. return $core.withContext(function($ctx1) {
  53342. $self._subclassResponsibility();
  53343. return self;
  53344. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53345. },
  53346. args: ["aBlock"],
  53347. 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",
  53348. referencedClasses: [],
  53349. messageSends: ["subclassResponsibility"]
  53350. }),
  53351. $globals.IndexableCollectionTest);
  53352. $core.addMethod(
  53353. $core.method({
  53354. selector: "testAt",
  53355. protocol: "tests",
  53356. fn: function (){
  53357. var self=this,$self=this;
  53358. return $core.withContext(function($ctx1) {
  53359. var $1;
  53360. $self._nonIndexesDo_((function(each){
  53361. return $core.withContext(function($ctx2) {
  53362. return $self._should_raise_((function(){
  53363. return $core.withContext(function($ctx3) {
  53364. $1=$self._collection();
  53365. $ctx3.sendIdx["collection"]=1;
  53366. return $recv($1)._at_(each);
  53367. $ctx3.sendIdx["at:"]=1;
  53368. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53369. }),$globals.Error);
  53370. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53371. }));
  53372. $self._samplesDo_((function(index,value){
  53373. return $core.withContext(function($ctx2) {
  53374. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  53375. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53376. }));
  53377. return self;
  53378. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  53379. },
  53380. args: [],
  53381. 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 ]",
  53382. referencedClasses: ["Error"],
  53383. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  53384. }),
  53385. $globals.IndexableCollectionTest);
  53386. $core.addMethod(
  53387. $core.method({
  53388. selector: "testAtIfAbsent",
  53389. protocol: "tests",
  53390. fn: function (){
  53391. var self=this,$self=this;
  53392. return $core.withContext(function($ctx1) {
  53393. var $2,$1,$3;
  53394. $self._nonIndexesDo_((function(each){
  53395. return $core.withContext(function($ctx2) {
  53396. $2=$self._collection();
  53397. $ctx2.sendIdx["collection"]=1;
  53398. $1=$recv($2)._at_ifAbsent_(each,(function(){
  53399. return $core.withContext(function($ctx3) {
  53400. return $self._sampleNewValue();
  53401. $ctx3.sendIdx["sampleNewValue"]=1;
  53402. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53403. }));
  53404. $ctx2.sendIdx["at:ifAbsent:"]=1;
  53405. $3=$self._sampleNewValue();
  53406. $ctx2.sendIdx["sampleNewValue"]=2;
  53407. return $self._assert_equals_($1,$3);
  53408. $ctx2.sendIdx["assert:equals:"]=1;
  53409. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53410. }));
  53411. $self._samplesDo_((function(index,value){
  53412. return $core.withContext(function($ctx2) {
  53413. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  53414. return $core.withContext(function($ctx3) {
  53415. return $self._sampleNewValue();
  53416. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  53417. })),value);
  53418. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53419. }));
  53420. return self;
  53421. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  53422. },
  53423. args: [],
  53424. 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 ].",
  53425. referencedClasses: [],
  53426. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  53427. }),
  53428. $globals.IndexableCollectionTest);
  53429. $core.addMethod(
  53430. $core.method({
  53431. selector: "testAtIfAbsentPut",
  53432. protocol: "tests",
  53433. fn: function (){
  53434. var self=this,$self=this;
  53435. var newCollection;
  53436. return $core.withContext(function($ctx1) {
  53437. var $1;
  53438. newCollection=$self._collection();
  53439. $ctx1.sendIdx["collection"]=1;
  53440. $self._samplesDo_((function(index,value){
  53441. return $core.withContext(function($ctx2) {
  53442. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  53443. return $core.withContext(function($ctx3) {
  53444. return $self._sampleNewValue();
  53445. $ctx3.sendIdx["sampleNewValue"]=1;
  53446. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53447. }));
  53448. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  53449. return $self._assert_equals_($1,value);
  53450. $ctx2.sendIdx["assert:equals:"]=1;
  53451. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53452. }));
  53453. $self._assert_equals_(newCollection,$self._collection());
  53454. $ctx1.sendIdx["assert:equals:"]=2;
  53455. $self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  53456. return $core.withContext(function($ctx2) {
  53457. return $self._sampleNewValue();
  53458. $ctx2.sendIdx["sampleNewValue"]=2;
  53459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53460. })),$self._sampleNewValue());
  53461. $ctx1.sendIdx["assert:equals:"]=3;
  53462. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53463. return self;
  53464. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53465. },
  53466. args: [],
  53467. 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",
  53468. referencedClasses: [],
  53469. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  53470. }),
  53471. $globals.IndexableCollectionTest);
  53472. $core.addMethod(
  53473. $core.method({
  53474. selector: "testAtIfPresent",
  53475. protocol: "tests",
  53476. fn: function (){
  53477. var self=this,$self=this;
  53478. var visited,sentinel;
  53479. return $core.withContext(function($ctx1) {
  53480. var $2,$1,$4,$3;
  53481. sentinel=$recv($globals.Object)._new();
  53482. $self._nonIndexesDo_((function(each){
  53483. return $core.withContext(function($ctx2) {
  53484. visited=nil;
  53485. visited;
  53486. $2=$self._collection();
  53487. $ctx2.sendIdx["collection"]=1;
  53488. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  53489. visited=value1;
  53490. visited;
  53491. return sentinel;
  53492. }));
  53493. $ctx2.sendIdx["at:ifPresent:"]=1;
  53494. $self._assert_equals_($1,nil);
  53495. $ctx2.sendIdx["assert:equals:"]=1;
  53496. return $self._assert_($recv(visited)._isNil());
  53497. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53498. }));
  53499. $self._samplesDo_((function(index,value){
  53500. return $core.withContext(function($ctx2) {
  53501. visited=nil;
  53502. visited;
  53503. $4=$self._collection();
  53504. $ctx2.sendIdx["collection"]=2;
  53505. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  53506. visited=value2;
  53507. visited;
  53508. return sentinel;
  53509. }));
  53510. $self._assert_equals_($3,sentinel);
  53511. $ctx2.sendIdx["assert:equals:"]=2;
  53512. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53513. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53514. }));
  53515. return self;
  53516. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53517. },
  53518. args: [],
  53519. 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) ]",
  53520. referencedClasses: ["Object"],
  53521. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  53522. }),
  53523. $globals.IndexableCollectionTest);
  53524. $core.addMethod(
  53525. $core.method({
  53526. selector: "testAtIfPresentIfAbsent",
  53527. protocol: "tests",
  53528. fn: function (){
  53529. var self=this,$self=this;
  53530. var visited,sentinel;
  53531. return $core.withContext(function($ctx1) {
  53532. var $2,$1,$3,$5,$4;
  53533. sentinel=$recv($globals.Object)._new();
  53534. $self._nonIndexesDo_((function(each){
  53535. return $core.withContext(function($ctx2) {
  53536. visited=nil;
  53537. visited;
  53538. $2=$self._collection();
  53539. $ctx2.sendIdx["collection"]=1;
  53540. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  53541. visited=value1;
  53542. visited;
  53543. return sentinel;
  53544. }),(function(){
  53545. return $core.withContext(function($ctx3) {
  53546. return $self._sampleNewValue();
  53547. $ctx3.sendIdx["sampleNewValue"]=1;
  53548. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  53549. }));
  53550. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  53551. $3=$self._sampleNewValue();
  53552. $ctx2.sendIdx["sampleNewValue"]=2;
  53553. $self._assert_equals_($1,$3);
  53554. $ctx2.sendIdx["assert:equals:"]=1;
  53555. return $self._assert_($recv(visited)._isNil());
  53556. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53557. }));
  53558. $self._samplesDo_((function(index,value){
  53559. return $core.withContext(function($ctx2) {
  53560. visited=nil;
  53561. visited;
  53562. $5=$self._collection();
  53563. $ctx2.sendIdx["collection"]=2;
  53564. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  53565. visited=value2;
  53566. visited;
  53567. return sentinel;
  53568. }),(function(){
  53569. return $core.withContext(function($ctx3) {
  53570. return $self._sampleNewValue();
  53571. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  53572. }));
  53573. $self._assert_equals_($4,sentinel);
  53574. $ctx2.sendIdx["assert:equals:"]=2;
  53575. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53576. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  53577. }));
  53578. return self;
  53579. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53580. },
  53581. args: [],
  53582. 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) ]",
  53583. referencedClasses: ["Object"],
  53584. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  53585. }),
  53586. $globals.IndexableCollectionTest);
  53587. $core.addMethod(
  53588. $core.method({
  53589. selector: "testAtPut",
  53590. protocol: "tests",
  53591. fn: function (){
  53592. var self=this,$self=this;
  53593. var newCollection;
  53594. return $core.withContext(function($ctx1) {
  53595. newCollection=$self._collection();
  53596. $ctx1.sendIdx["collection"]=1;
  53597. $self._samplesDo_((function(index,value){
  53598. return $core.withContext(function($ctx2) {
  53599. return $recv(newCollection)._at_put_(index,value);
  53600. $ctx2.sendIdx["at:put:"]=1;
  53601. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53602. }));
  53603. $self._assert_equals_(newCollection,$self._collection());
  53604. $ctx1.sendIdx["assert:equals:"]=1;
  53605. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  53606. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53607. return self;
  53608. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53609. },
  53610. args: [],
  53611. 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",
  53612. referencedClasses: [],
  53613. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  53614. }),
  53615. $globals.IndexableCollectionTest);
  53616. $core.addMethod(
  53617. $core.method({
  53618. selector: "testIndexOf",
  53619. protocol: "tests",
  53620. fn: function (){
  53621. var self=this,$self=this;
  53622. return $core.withContext(function($ctx1) {
  53623. var $1;
  53624. $self._should_raise_((function(){
  53625. return $core.withContext(function($ctx2) {
  53626. $1=$self._collection();
  53627. $ctx2.sendIdx["collection"]=1;
  53628. return $recv($1)._indexOf_($self._sampleNewValue());
  53629. $ctx2.sendIdx["indexOf:"]=1;
  53630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53631. }),$globals.Error);
  53632. $self._samplesDo_((function(index,value){
  53633. return $core.withContext(function($ctx2) {
  53634. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  53635. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  53636. }));
  53637. return self;
  53638. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  53639. },
  53640. args: [],
  53641. 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 ]",
  53642. referencedClasses: ["Error"],
  53643. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  53644. }),
  53645. $globals.IndexableCollectionTest);
  53646. $core.addMethod(
  53647. $core.method({
  53648. selector: "testIndexOfWithNull",
  53649. protocol: "tests",
  53650. fn: function (){
  53651. var self=this,$self=this;
  53652. var jsNull;
  53653. return $core.withContext(function($ctx1) {
  53654. var $2,$1;
  53655. jsNull=$recv($globals.JSON)._parse_("null");
  53656. $self._samplesDo_((function(index,value){
  53657. return $core.withContext(function($ctx2) {
  53658. $2=$self._collection();
  53659. $recv($2)._at_put_(index,jsNull);
  53660. $1=$recv($2)._indexOf_(jsNull);
  53661. return $self._assert_equals_($1,index);
  53662. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53663. }));
  53664. return self;
  53665. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  53666. },
  53667. args: [],
  53668. 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 ]",
  53669. referencedClasses: ["JSON"],
  53670. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  53671. }),
  53672. $globals.IndexableCollectionTest);
  53673. $core.addMethod(
  53674. $core.method({
  53675. selector: "testWithIndexDo",
  53676. protocol: "tests",
  53677. fn: function (){
  53678. var self=this,$self=this;
  53679. var collection;
  53680. return $core.withContext(function($ctx1) {
  53681. collection=$self._collection();
  53682. $ctx1.sendIdx["collection"]=1;
  53683. $recv($self._collection())._withIndexDo_((function(each,index){
  53684. return $core.withContext(function($ctx2) {
  53685. return $self._assert_equals_($recv(collection)._at_(index),each);
  53686. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  53687. }));
  53688. return self;
  53689. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  53690. },
  53691. args: [],
  53692. 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 ]",
  53693. referencedClasses: [],
  53694. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  53695. }),
  53696. $globals.IndexableCollectionTest);
  53697. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  53698. $core.addMethod(
  53699. $core.method({
  53700. selector: "collectionKeys",
  53701. protocol: "fixture",
  53702. fn: function (){
  53703. var self=this,$self=this;
  53704. return $core.withContext(function($ctx1) {
  53705. $self._subclassResponsibility();
  53706. return self;
  53707. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  53708. },
  53709. args: [],
  53710. source: "collectionKeys\x0a\x09self subclassResponsibility",
  53711. referencedClasses: [],
  53712. messageSends: ["subclassResponsibility"]
  53713. }),
  53714. $globals.AssociativeCollectionTest);
  53715. $core.addMethod(
  53716. $core.method({
  53717. selector: "collectionValues",
  53718. protocol: "fixture",
  53719. fn: function (){
  53720. var self=this,$self=this;
  53721. return $core.withContext(function($ctx1) {
  53722. $self._subclassResponsibility();
  53723. return self;
  53724. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  53725. },
  53726. args: [],
  53727. source: "collectionValues\x0a\x09self subclassResponsibility",
  53728. referencedClasses: [],
  53729. messageSends: ["subclassResponsibility"]
  53730. }),
  53731. $globals.AssociativeCollectionTest);
  53732. $core.addMethod(
  53733. $core.method({
  53734. selector: "nonIndexesDo:",
  53735. protocol: "fixture",
  53736. fn: function (aBlock){
  53737. var self=this,$self=this;
  53738. return $core.withContext(function($ctx1) {
  53739. $recv(aBlock)._value_((5));
  53740. $ctx1.sendIdx["value:"]=1;
  53741. $recv(aBlock)._value_((function(){
  53742. }));
  53743. $ctx1.sendIdx["value:"]=2;
  53744. $recv(aBlock)._value_($recv($globals.Object)._new());
  53745. $ctx1.sendIdx["value:"]=3;
  53746. $recv(aBlock)._value_("z");
  53747. return self;
  53748. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  53749. },
  53750. args: ["aBlock"],
  53751. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  53752. referencedClasses: ["Object"],
  53753. messageSends: ["value:", "new"]
  53754. }),
  53755. $globals.AssociativeCollectionTest);
  53756. $core.addMethod(
  53757. $core.method({
  53758. selector: "sampleNewIndex",
  53759. protocol: "fixture",
  53760. fn: function (){
  53761. var self=this,$self=this;
  53762. return "new";
  53763. },
  53764. args: [],
  53765. source: "sampleNewIndex\x0a\x09^ 'new'",
  53766. referencedClasses: [],
  53767. messageSends: []
  53768. }),
  53769. $globals.AssociativeCollectionTest);
  53770. $core.addMethod(
  53771. $core.method({
  53772. selector: "samplesDo:",
  53773. protocol: "fixture",
  53774. fn: function (aBlock){
  53775. var self=this,$self=this;
  53776. return $core.withContext(function($ctx1) {
  53777. $recv(aBlock)._value_value_("a",(2));
  53778. return self;
  53779. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  53780. },
  53781. args: ["aBlock"],
  53782. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  53783. referencedClasses: [],
  53784. messageSends: ["value:value:"]
  53785. }),
  53786. $globals.AssociativeCollectionTest);
  53787. $core.addMethod(
  53788. $core.method({
  53789. selector: "testAddAll",
  53790. protocol: "tests",
  53791. fn: function (){
  53792. var self=this,$self=this;
  53793. return $core.withContext(function($ctx1) {
  53794. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  53795. (
  53796. $ctx1.supercall = true,
  53797. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  53798. $ctx1.supercall = false;
  53799. $2=$self._collection();
  53800. $ctx1.sendIdx["collection"]=1;
  53801. $3=$self._collection();
  53802. $ctx1.sendIdx["collection"]=2;
  53803. $recv($2)._addAll_($3);
  53804. $ctx1.sendIdx["addAll:"]=1;
  53805. $4=$recv($2)._yourself();
  53806. $ctx1.sendIdx["yourself"]=1;
  53807. $1=$4;
  53808. $5=$self._collection();
  53809. $ctx1.sendIdx["collection"]=3;
  53810. $self._assert_equals_($1,$5);
  53811. $ctx1.sendIdx["assert:equals:"]=1;
  53812. $7=$self._collection();
  53813. $ctx1.sendIdx["collection"]=4;
  53814. $8=$self._collectionWithNewValue();
  53815. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53816. $recv($7)._addAll_($8);
  53817. $ctx1.sendIdx["addAll:"]=2;
  53818. $9=$recv($7)._yourself();
  53819. $ctx1.sendIdx["yourself"]=2;
  53820. $6=$9;
  53821. $10=$self._collectionWithNewValue();
  53822. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53823. $self._assert_equals_($6,$10);
  53824. $ctx1.sendIdx["assert:equals:"]=2;
  53825. $12=$self._collectionWithNewValue();
  53826. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53827. $recv($12)._addAll_($self._collection());
  53828. $11=$recv($12)._yourself();
  53829. $self._assert_equals_($11,$self._collectionWithNewValue());
  53830. return self;
  53831. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  53832. },
  53833. args: [],
  53834. 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",
  53835. referencedClasses: [],
  53836. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  53837. }),
  53838. $globals.AssociativeCollectionTest);
  53839. $core.addMethod(
  53840. $core.method({
  53841. selector: "testAsDictionary",
  53842. protocol: "tests",
  53843. fn: function (){
  53844. var self=this,$self=this;
  53845. return $core.withContext(function($ctx1) {
  53846. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  53847. return self;
  53848. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  53849. },
  53850. args: [],
  53851. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  53852. referencedClasses: ["Dictionary"],
  53853. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  53854. }),
  53855. $globals.AssociativeCollectionTest);
  53856. $core.addMethod(
  53857. $core.method({
  53858. selector: "testAsHashedCollection",
  53859. protocol: "tests",
  53860. fn: function (){
  53861. var self=this,$self=this;
  53862. return $core.withContext(function($ctx1) {
  53863. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  53864. return self;
  53865. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  53866. },
  53867. args: [],
  53868. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  53869. referencedClasses: ["HashedCollection"],
  53870. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  53871. }),
  53872. $globals.AssociativeCollectionTest);
  53873. $core.addMethod(
  53874. $core.method({
  53875. selector: "testComma",
  53876. protocol: "tests",
  53877. fn: function (){
  53878. var self=this,$self=this;
  53879. return $core.withContext(function($ctx1) {
  53880. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  53881. (
  53882. $ctx1.supercall = true,
  53883. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  53884. $ctx1.supercall = false;
  53885. $2=$self._collection();
  53886. $ctx1.sendIdx["collection"]=1;
  53887. $3=$self._collection();
  53888. $ctx1.sendIdx["collection"]=2;
  53889. $1=$recv($2).__comma($3);
  53890. $ctx1.sendIdx[","]=1;
  53891. $4=$self._collection();
  53892. $ctx1.sendIdx["collection"]=3;
  53893. $self._assert_equals_($1,$4);
  53894. $ctx1.sendIdx["assert:equals:"]=1;
  53895. $6=$self._collection();
  53896. $ctx1.sendIdx["collection"]=4;
  53897. $7=$self._collectionWithNewValue();
  53898. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53899. $5=$recv($6).__comma($7);
  53900. $ctx1.sendIdx[","]=2;
  53901. $8=$self._collectionWithNewValue();
  53902. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53903. $self._assert_equals_($5,$8);
  53904. $ctx1.sendIdx["assert:equals:"]=2;
  53905. $10=$self._collectionWithNewValue();
  53906. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53907. $9=$recv($10).__comma($self._collection());
  53908. $self._assert_equals_($9,$self._collectionWithNewValue());
  53909. return self;
  53910. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  53911. },
  53912. args: [],
  53913. 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",
  53914. referencedClasses: [],
  53915. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  53916. }),
  53917. $globals.AssociativeCollectionTest);
  53918. $core.addMethod(
  53919. $core.method({
  53920. selector: "testFrom",
  53921. protocol: "tests",
  53922. fn: function (){
  53923. var self=this,$self=this;
  53924. var associations;
  53925. return $core.withContext(function($ctx1) {
  53926. var $1;
  53927. $1="a".__minus_gt((1));
  53928. $ctx1.sendIdx["->"]=1;
  53929. associations=[$1,"b".__minus_gt((2))];
  53930. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  53931. return self;
  53932. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  53933. },
  53934. args: [],
  53935. 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 }.",
  53936. referencedClasses: [],
  53937. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  53938. }),
  53939. $globals.AssociativeCollectionTest);
  53940. $core.addMethod(
  53941. $core.method({
  53942. selector: "testKeys",
  53943. protocol: "tests",
  53944. fn: function (){
  53945. var self=this,$self=this;
  53946. return $core.withContext(function($ctx1) {
  53947. var $2,$1,$3,$4;
  53948. $2=$recv($recv($self._collectionClass())._new())._keys();
  53949. $ctx1.sendIdx["keys"]=1;
  53950. $1=$recv($2)._isEmpty();
  53951. $self._assert_($1);
  53952. $3=$recv($self._collection())._keys();
  53953. $ctx1.sendIdx["keys"]=2;
  53954. $4=$self._collectionKeys();
  53955. $ctx1.sendIdx["collectionKeys"]=1;
  53956. $self._assertSameContents_as_($3,$4);
  53957. $ctx1.sendIdx["assertSameContents:as:"]=1;
  53958. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  53959. return self;
  53960. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  53961. },
  53962. args: [],
  53963. 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 }",
  53964. referencedClasses: [],
  53965. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  53966. }),
  53967. $globals.AssociativeCollectionTest);
  53968. $core.addMethod(
  53969. $core.method({
  53970. selector: "testNewFromPairs",
  53971. protocol: "tests",
  53972. fn: function (){
  53973. var self=this,$self=this;
  53974. var flattenedAssociations;
  53975. return $core.withContext(function($ctx1) {
  53976. flattenedAssociations=["a",(1),"b",(2)];
  53977. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  53978. return self;
  53979. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  53980. },
  53981. args: [],
  53982. 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 }.",
  53983. referencedClasses: [],
  53984. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  53985. }),
  53986. $globals.AssociativeCollectionTest);
  53987. $core.addMethod(
  53988. $core.method({
  53989. selector: "testPrintString",
  53990. protocol: "tests",
  53991. fn: function (){
  53992. var self=this,$self=this;
  53993. return $core.withContext(function($ctx1) {
  53994. var $3,$2,$1,$4;
  53995. $3=$self._collectionClass();
  53996. $ctx1.sendIdx["collectionClass"]=1;
  53997. $2=$recv($3)._new();
  53998. $recv($2)._at_put_("firstname","James");
  53999. $ctx1.sendIdx["at:put:"]=1;
  54000. $recv($2)._at_put_("lastname","Bond");
  54001. $1=$recv($2)._printString();
  54002. $4=$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  54003. $ctx1.sendIdx[","]=1;
  54004. $self._assert_equals_($1,$4);
  54005. return self;
  54006. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  54007. },
  54008. args: [],
  54009. 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'')'",
  54010. referencedClasses: [],
  54011. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  54012. }),
  54013. $globals.AssociativeCollectionTest);
  54014. $core.addMethod(
  54015. $core.method({
  54016. selector: "testRemoveKey",
  54017. protocol: "tests",
  54018. fn: function (){
  54019. var self=this,$self=this;
  54020. return $core.withContext(function($ctx1) {
  54021. var $1,$2,$3,$5,$6,$4,$8,$7;
  54022. $self._nonIndexesDo_((function(each){
  54023. var collection;
  54024. return $core.withContext(function($ctx2) {
  54025. collection=$self._collection();
  54026. $ctx2.sendIdx["collection"]=1;
  54027. collection;
  54028. $self._should_raise_((function(){
  54029. return $core.withContext(function($ctx3) {
  54030. return $recv(collection)._removeKey_(each);
  54031. $ctx3.sendIdx["removeKey:"]=1;
  54032. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54033. }),$globals.Error);
  54034. $1=collection;
  54035. $2=$self._collection();
  54036. $ctx2.sendIdx["collection"]=2;
  54037. return $self._assert_equals_($1,$2);
  54038. $ctx2.sendIdx["assert:equals:"]=1;
  54039. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54040. }));
  54041. $self._samplesDo_((function(index,value){
  54042. var collection;
  54043. return $core.withContext(function($ctx2) {
  54044. collection=$self._collection();
  54045. $ctx2.sendIdx["collection"]=3;
  54046. collection;
  54047. $3=$recv(collection)._removeKey_(index);
  54048. $ctx2.sendIdx["removeKey:"]=2;
  54049. $self._assert_equals_($3,value);
  54050. $ctx2.sendIdx["assert:equals:"]=2;
  54051. $5=collection;
  54052. $6=$self._collection();
  54053. $ctx2.sendIdx["collection"]=4;
  54054. $4=$recv($5).__eq($6);
  54055. return $self._deny_($4);
  54056. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54057. }));
  54058. $8=$self._collectionWithNewValue();
  54059. $recv($8)._removeKey_($self._sampleNewIndex());
  54060. $7=$recv($8)._yourself();
  54061. $self._assert_equals_($7,$self._collection());
  54062. return self;
  54063. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  54064. },
  54065. args: [],
  54066. 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",
  54067. referencedClasses: ["Error"],
  54068. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  54069. }),
  54070. $globals.AssociativeCollectionTest);
  54071. $core.addMethod(
  54072. $core.method({
  54073. selector: "testRemoveKeyIfAbsent",
  54074. protocol: "tests",
  54075. fn: function (){
  54076. var self=this,$self=this;
  54077. return $core.withContext(function($ctx1) {
  54078. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  54079. $self._nonIndexesDo_((function(each){
  54080. var collection;
  54081. return $core.withContext(function($ctx2) {
  54082. collection=$self._collection();
  54083. $ctx2.sendIdx["collection"]=1;
  54084. collection;
  54085. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  54086. return $core.withContext(function($ctx3) {
  54087. return $self._sampleNewValue();
  54088. $ctx3.sendIdx["sampleNewValue"]=1;
  54089. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54090. }));
  54091. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  54092. $2=$self._sampleNewValue();
  54093. $ctx2.sendIdx["sampleNewValue"]=2;
  54094. $self._assert_equals_($1,$2);
  54095. $ctx2.sendIdx["assert:equals:"]=1;
  54096. $3=collection;
  54097. $4=$self._collection();
  54098. $ctx2.sendIdx["collection"]=2;
  54099. return $self._assert_equals_($3,$4);
  54100. $ctx2.sendIdx["assert:equals:"]=2;
  54101. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54102. }));
  54103. $self._samplesDo_((function(index,value){
  54104. var collection;
  54105. return $core.withContext(function($ctx2) {
  54106. collection=$self._collection();
  54107. $ctx2.sendIdx["collection"]=3;
  54108. collection;
  54109. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  54110. return $core.withContext(function($ctx3) {
  54111. return $self._sampleNewValue();
  54112. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  54113. }));
  54114. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  54115. $self._assert_equals_($5,value);
  54116. $ctx2.sendIdx["assert:equals:"]=3;
  54117. $7=collection;
  54118. $8=$self._collection();
  54119. $ctx2.sendIdx["collection"]=4;
  54120. $6=$recv($7).__eq($8);
  54121. return $self._deny_($6);
  54122. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54123. }));
  54124. $10=$self._collectionWithNewValue();
  54125. $recv($10)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  54126. return $core.withContext(function($ctx2) {
  54127. return $self._assert_(false);
  54128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54129. }));
  54130. $9=$recv($10)._yourself();
  54131. $self._assert_equals_($9,$self._collection());
  54132. return self;
  54133. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  54134. },
  54135. args: [],
  54136. 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",
  54137. referencedClasses: [],
  54138. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  54139. }),
  54140. $globals.AssociativeCollectionTest);
  54141. $core.addMethod(
  54142. $core.method({
  54143. selector: "testValues",
  54144. protocol: "tests",
  54145. fn: function (){
  54146. var self=this,$self=this;
  54147. return $core.withContext(function($ctx1) {
  54148. var $2,$1,$3,$4;
  54149. $2=$recv($recv($self._collectionClass())._new())._values();
  54150. $ctx1.sendIdx["values"]=1;
  54151. $1=$recv($2)._isEmpty();
  54152. $self._assert_($1);
  54153. $3=$recv($self._collection())._values();
  54154. $ctx1.sendIdx["values"]=2;
  54155. $4=$self._collectionValues();
  54156. $ctx1.sendIdx["collectionValues"]=1;
  54157. $self._assertSameContents_as_($3,$4);
  54158. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54159. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  54160. return self;
  54161. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  54162. },
  54163. args: [],
  54164. 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 }",
  54165. referencedClasses: [],
  54166. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  54167. }),
  54168. $globals.AssociativeCollectionTest);
  54169. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54170. $core.addMethod(
  54171. $core.method({
  54172. selector: "collection",
  54173. protocol: "fixture",
  54174. fn: function (){
  54175. var self=this,$self=this;
  54176. return $core.withContext(function($ctx1) {
  54177. var $1;
  54178. $1=$recv($globals.Dictionary)._new();
  54179. $recv($1)._at_put_((1),(1));
  54180. $ctx1.sendIdx["at:put:"]=1;
  54181. $recv($1)._at_put_("a",(2));
  54182. $ctx1.sendIdx["at:put:"]=2;
  54183. $recv($1)._at_put_(true,(3));
  54184. $ctx1.sendIdx["at:put:"]=3;
  54185. $recv($1)._at_put_((1).__at((3)),(-4));
  54186. $ctx1.sendIdx["at:put:"]=4;
  54187. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54188. return $recv($1)._yourself();
  54189. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  54190. },
  54191. args: [],
  54192. 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",
  54193. referencedClasses: ["Dictionary"],
  54194. messageSends: ["at:put:", "new", "@", "yourself"]
  54195. }),
  54196. $globals.DictionaryTest);
  54197. $core.addMethod(
  54198. $core.method({
  54199. selector: "collectionKeys",
  54200. protocol: "fixture",
  54201. fn: function (){
  54202. var self=this,$self=this;
  54203. return $core.withContext(function($ctx1) {
  54204. return [(1),"a",true,(1).__at((3)),$self["@sampleBlock"]];
  54205. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  54206. },
  54207. args: [],
  54208. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  54209. referencedClasses: [],
  54210. messageSends: ["@"]
  54211. }),
  54212. $globals.DictionaryTest);
  54213. $core.addMethod(
  54214. $core.method({
  54215. selector: "collectionOfPrintStrings",
  54216. protocol: "fixture",
  54217. fn: function (){
  54218. var self=this,$self=this;
  54219. return $core.withContext(function($ctx1) {
  54220. var $1;
  54221. $1=$recv($globals.Dictionary)._new();
  54222. $recv($1)._at_put_((1),"1");
  54223. $ctx1.sendIdx["at:put:"]=1;
  54224. $recv($1)._at_put_("a","2");
  54225. $ctx1.sendIdx["at:put:"]=2;
  54226. $recv($1)._at_put_(true,"3");
  54227. $ctx1.sendIdx["at:put:"]=3;
  54228. $recv($1)._at_put_((1).__at((3)),"-4");
  54229. $ctx1.sendIdx["at:put:"]=4;
  54230. $recv($1)._at_put_($self["@sampleBlock"],"9");
  54231. return $recv($1)._yourself();
  54232. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  54233. },
  54234. args: [],
  54235. 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",
  54236. referencedClasses: ["Dictionary"],
  54237. messageSends: ["at:put:", "new", "@", "yourself"]
  54238. }),
  54239. $globals.DictionaryTest);
  54240. $core.addMethod(
  54241. $core.method({
  54242. selector: "collectionSize",
  54243. protocol: "fixture",
  54244. fn: function (){
  54245. var self=this,$self=this;
  54246. return (5);
  54247. },
  54248. args: [],
  54249. source: "collectionSize\x0a\x09^ 5",
  54250. referencedClasses: [],
  54251. messageSends: []
  54252. }),
  54253. $globals.DictionaryTest);
  54254. $core.addMethod(
  54255. $core.method({
  54256. selector: "collectionValues",
  54257. protocol: "fixture",
  54258. fn: function (){
  54259. var self=this,$self=this;
  54260. return [(1),(2),(3),(-4),(9)];
  54261. },
  54262. args: [],
  54263. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  54264. referencedClasses: [],
  54265. messageSends: []
  54266. }),
  54267. $globals.DictionaryTest);
  54268. $core.addMethod(
  54269. $core.method({
  54270. selector: "collectionWithDuplicates",
  54271. protocol: "fixture",
  54272. fn: function (){
  54273. var self=this,$self=this;
  54274. return $core.withContext(function($ctx1) {
  54275. var $1;
  54276. $1=$recv($globals.Dictionary)._new();
  54277. $recv($1)._at_put_((1),(1));
  54278. $ctx1.sendIdx["at:put:"]=1;
  54279. $recv($1)._at_put_("a",(2));
  54280. $ctx1.sendIdx["at:put:"]=2;
  54281. $recv($1)._at_put_(true,(3));
  54282. $ctx1.sendIdx["at:put:"]=3;
  54283. $recv($1)._at_put_((4),(-4));
  54284. $ctx1.sendIdx["at:put:"]=4;
  54285. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54286. $ctx1.sendIdx["at:put:"]=5;
  54287. $recv($1)._at_put_("b",(1));
  54288. $ctx1.sendIdx["at:put:"]=6;
  54289. $recv($1)._at_put_((3),(3));
  54290. $ctx1.sendIdx["at:put:"]=7;
  54291. $recv($1)._at_put_(false,(12));
  54292. return $recv($1)._yourself();
  54293. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  54294. },
  54295. args: [],
  54296. 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",
  54297. referencedClasses: ["Dictionary"],
  54298. messageSends: ["at:put:", "new", "yourself"]
  54299. }),
  54300. $globals.DictionaryTest);
  54301. $core.addMethod(
  54302. $core.method({
  54303. selector: "collectionWithNewValue",
  54304. protocol: "fixture",
  54305. fn: function (){
  54306. var self=this,$self=this;
  54307. return $core.withContext(function($ctx1) {
  54308. var $1;
  54309. $1=$recv($globals.Dictionary)._new();
  54310. $recv($1)._at_put_((1),(1));
  54311. $ctx1.sendIdx["at:put:"]=1;
  54312. $recv($1)._at_put_("a",(2));
  54313. $ctx1.sendIdx["at:put:"]=2;
  54314. $recv($1)._at_put_(true,(3));
  54315. $ctx1.sendIdx["at:put:"]=3;
  54316. $recv($1)._at_put_((1).__at((3)),(-4));
  54317. $ctx1.sendIdx["at:put:"]=4;
  54318. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54319. $ctx1.sendIdx["at:put:"]=5;
  54320. $recv($1)._at_put_("new","N");
  54321. return $recv($1)._yourself();
  54322. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  54323. },
  54324. args: [],
  54325. 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",
  54326. referencedClasses: ["Dictionary"],
  54327. messageSends: ["at:put:", "new", "@", "yourself"]
  54328. }),
  54329. $globals.DictionaryTest);
  54330. $core.addMethod(
  54331. $core.method({
  54332. selector: "sampleNewValueAsCollection",
  54333. protocol: "fixture",
  54334. fn: function (){
  54335. var self=this,$self=this;
  54336. return $core.withContext(function($ctx1) {
  54337. var $1;
  54338. $1=$recv($globals.Dictionary)._new();
  54339. $recv($1)._at_put_("new","N");
  54340. return $recv($1)._yourself();
  54341. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  54342. },
  54343. args: [],
  54344. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  54345. referencedClasses: ["Dictionary"],
  54346. messageSends: ["at:put:", "new", "yourself"]
  54347. }),
  54348. $globals.DictionaryTest);
  54349. $core.addMethod(
  54350. $core.method({
  54351. selector: "samplesDo:",
  54352. protocol: "fixture",
  54353. fn: function (aBlock){
  54354. var self=this,$self=this;
  54355. return $core.withContext(function($ctx1) {
  54356. (
  54357. $ctx1.supercall = true,
  54358. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  54359. $ctx1.supercall = false;
  54360. $recv(aBlock)._value_value_(true,(3));
  54361. $ctx1.sendIdx["value:value:"]=1;
  54362. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  54363. $ctx1.sendIdx["value:value:"]=2;
  54364. $recv(aBlock)._value_value_($self["@sampleBlock"],(9));
  54365. return self;
  54366. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  54367. },
  54368. args: ["aBlock"],
  54369. 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",
  54370. referencedClasses: [],
  54371. messageSends: ["samplesDo:", "value:value:", "@"]
  54372. }),
  54373. $globals.DictionaryTest);
  54374. $core.addMethod(
  54375. $core.method({
  54376. selector: "testAccessing",
  54377. protocol: "tests",
  54378. fn: function (){
  54379. var self=this,$self=this;
  54380. var d;
  54381. return $core.withContext(function($ctx1) {
  54382. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  54383. d=$recv($globals.Dictionary)._new();
  54384. $recv(d)._at_put_("hello","world");
  54385. $ctx1.sendIdx["at:put:"]=1;
  54386. $1=$recv(d)._at_("hello");
  54387. $ctx1.sendIdx["at:"]=1;
  54388. $self._assert_equals_($1,"world");
  54389. $ctx1.sendIdx["assert:equals:"]=1;
  54390. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  54391. return nil;
  54392. }));
  54393. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54394. $self._assert_equals_($2,"world");
  54395. $ctx1.sendIdx["assert:equals:"]=2;
  54396. $self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  54397. return nil;
  54398. }))).__eq("world"));
  54399. $ctx1.sendIdx["deny:"]=1;
  54400. $3=$recv(d)._includesKey_("hello");
  54401. $ctx1.sendIdx["includesKey:"]=1;
  54402. $self._assert_($3);
  54403. $ctx1.sendIdx["assert:"]=1;
  54404. $4=$recv(d)._includesKey_("foo");
  54405. $ctx1.sendIdx["includesKey:"]=2;
  54406. $self._deny_($4);
  54407. $ctx1.sendIdx["deny:"]=2;
  54408. $recv(d)._at_put_((1),(2));
  54409. $ctx1.sendIdx["at:put:"]=2;
  54410. $5=$recv(d)._at_((1));
  54411. $ctx1.sendIdx["at:"]=2;
  54412. $self._assert_equals_($5,(2));
  54413. $ctx1.sendIdx["assert:equals:"]=3;
  54414. $6=d;
  54415. $7=(1).__at((3));
  54416. $ctx1.sendIdx["@"]=1;
  54417. $recv($6)._at_put_($7,(3));
  54418. $9=d;
  54419. $10=(1).__at((3));
  54420. $ctx1.sendIdx["@"]=2;
  54421. $8=$recv($9)._at_($10);
  54422. $self._assert_equals_($8,(3));
  54423. $12=d;
  54424. $13=(1).__at((3));
  54425. $ctx1.sendIdx["@"]=3;
  54426. $11=$recv($12)._includesKey_($13);
  54427. $ctx1.sendIdx["includesKey:"]=3;
  54428. $self._assert_($11);
  54429. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  54430. return self;
  54431. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  54432. },
  54433. args: [],
  54434. 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)",
  54435. referencedClasses: ["Dictionary"],
  54436. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  54437. }),
  54438. $globals.DictionaryTest);
  54439. $core.addMethod(
  54440. $core.method({
  54441. selector: "testDynamicDictionaries",
  54442. protocol: "tests",
  54443. fn: function (){
  54444. var self=this,$self=this;
  54445. return $core.withContext(function($ctx1) {
  54446. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  54447. return self;
  54448. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  54449. },
  54450. args: [],
  54451. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  54452. referencedClasses: ["Dictionary"],
  54453. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  54454. }),
  54455. $globals.DictionaryTest);
  54456. $core.addMethod(
  54457. $core.method({
  54458. selector: "collectionClass",
  54459. protocol: "fixture",
  54460. fn: function (){
  54461. var self=this,$self=this;
  54462. return $globals.Dictionary;
  54463. },
  54464. args: [],
  54465. source: "collectionClass\x0a\x09^ Dictionary",
  54466. referencedClasses: ["Dictionary"],
  54467. messageSends: []
  54468. }),
  54469. $globals.DictionaryTest.a$cls);
  54470. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54471. $core.addMethod(
  54472. $core.method({
  54473. selector: "collection",
  54474. protocol: "fixture",
  54475. fn: function (){
  54476. var self=this,$self=this;
  54477. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  54478. },
  54479. args: [],
  54480. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  54481. referencedClasses: [],
  54482. messageSends: []
  54483. }),
  54484. $globals.HashedCollectionTest);
  54485. $core.addMethod(
  54486. $core.method({
  54487. selector: "collectionKeys",
  54488. protocol: "fixture",
  54489. fn: function (){
  54490. var self=this,$self=this;
  54491. return ["b","a","c","d"];
  54492. },
  54493. args: [],
  54494. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  54495. referencedClasses: [],
  54496. messageSends: []
  54497. }),
  54498. $globals.HashedCollectionTest);
  54499. $core.addMethod(
  54500. $core.method({
  54501. selector: "collectionOfPrintStrings",
  54502. protocol: "fixture",
  54503. fn: function (){
  54504. var self=this,$self=this;
  54505. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  54506. },
  54507. args: [],
  54508. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  54509. referencedClasses: [],
  54510. messageSends: []
  54511. }),
  54512. $globals.HashedCollectionTest);
  54513. $core.addMethod(
  54514. $core.method({
  54515. selector: "collectionSize",
  54516. protocol: "fixture",
  54517. fn: function (){
  54518. var self=this,$self=this;
  54519. return (4);
  54520. },
  54521. args: [],
  54522. source: "collectionSize\x0a\x09^ 4",
  54523. referencedClasses: [],
  54524. messageSends: []
  54525. }),
  54526. $globals.HashedCollectionTest);
  54527. $core.addMethod(
  54528. $core.method({
  54529. selector: "collectionValues",
  54530. protocol: "fixture",
  54531. fn: function (){
  54532. var self=this,$self=this;
  54533. return [(1),(2),(3),(-4)];
  54534. },
  54535. args: [],
  54536. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  54537. referencedClasses: [],
  54538. messageSends: []
  54539. }),
  54540. $globals.HashedCollectionTest);
  54541. $core.addMethod(
  54542. $core.method({
  54543. selector: "collectionWithDuplicates",
  54544. protocol: "fixture",
  54545. fn: function (){
  54546. var self=this,$self=this;
  54547. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  54548. },
  54549. args: [],
  54550. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  54551. referencedClasses: [],
  54552. messageSends: []
  54553. }),
  54554. $globals.HashedCollectionTest);
  54555. $core.addMethod(
  54556. $core.method({
  54557. selector: "collectionWithNewValue",
  54558. protocol: "fixture",
  54559. fn: function (){
  54560. var self=this,$self=this;
  54561. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  54562. },
  54563. args: [],
  54564. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  54565. referencedClasses: [],
  54566. messageSends: []
  54567. }),
  54568. $globals.HashedCollectionTest);
  54569. $core.addMethod(
  54570. $core.method({
  54571. selector: "sampleNewValueAsCollection",
  54572. protocol: "fixture",
  54573. fn: function (){
  54574. var self=this,$self=this;
  54575. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  54576. },
  54577. args: [],
  54578. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  54579. referencedClasses: [],
  54580. messageSends: []
  54581. }),
  54582. $globals.HashedCollectionTest);
  54583. $core.addMethod(
  54584. $core.method({
  54585. selector: "testDynamicDictionaries",
  54586. protocol: "tests",
  54587. fn: function (){
  54588. var self=this,$self=this;
  54589. return $core.withContext(function($ctx1) {
  54590. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  54591. return self;
  54592. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  54593. },
  54594. args: [],
  54595. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  54596. referencedClasses: ["HashedCollection"],
  54597. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  54598. }),
  54599. $globals.HashedCollectionTest);
  54600. $core.addMethod(
  54601. $core.method({
  54602. selector: "collectionClass",
  54603. protocol: "fixture",
  54604. fn: function (){
  54605. var self=this,$self=this;
  54606. return $globals.HashedCollection;
  54607. },
  54608. args: [],
  54609. source: "collectionClass\x0a\x09^ HashedCollection",
  54610. referencedClasses: ["HashedCollection"],
  54611. messageSends: []
  54612. }),
  54613. $globals.HashedCollectionTest.a$cls);
  54614. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  54615. $core.addMethod(
  54616. $core.method({
  54617. selector: "collectionFirst",
  54618. protocol: "fixture",
  54619. fn: function (){
  54620. var self=this,$self=this;
  54621. return $core.withContext(function($ctx1) {
  54622. $self._subclassResponsibility();
  54623. return self;
  54624. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  54625. },
  54626. args: [],
  54627. source: "collectionFirst\x0a\x09self subclassResponsibility",
  54628. referencedClasses: [],
  54629. messageSends: ["subclassResponsibility"]
  54630. }),
  54631. $globals.SequenceableCollectionTest);
  54632. $core.addMethod(
  54633. $core.method({
  54634. selector: "collectionFirstTwo",
  54635. protocol: "fixture",
  54636. fn: function (){
  54637. var self=this,$self=this;
  54638. return $core.withContext(function($ctx1) {
  54639. $self._subclassResponsibility();
  54640. return self;
  54641. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  54642. },
  54643. args: [],
  54644. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  54645. referencedClasses: [],
  54646. messageSends: ["subclassResponsibility"]
  54647. }),
  54648. $globals.SequenceableCollectionTest);
  54649. $core.addMethod(
  54650. $core.method({
  54651. selector: "collectionLast",
  54652. protocol: "fixture",
  54653. fn: function (){
  54654. var self=this,$self=this;
  54655. return $core.withContext(function($ctx1) {
  54656. $self._subclassResponsibility();
  54657. return self;
  54658. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  54659. },
  54660. args: [],
  54661. source: "collectionLast\x0a\x09self subclassResponsibility",
  54662. referencedClasses: [],
  54663. messageSends: ["subclassResponsibility"]
  54664. }),
  54665. $globals.SequenceableCollectionTest);
  54666. $core.addMethod(
  54667. $core.method({
  54668. selector: "collectionLastTwo",
  54669. protocol: "fixture",
  54670. fn: function (){
  54671. var self=this,$self=this;
  54672. return $core.withContext(function($ctx1) {
  54673. $self._subclassResponsibility();
  54674. return self;
  54675. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  54676. },
  54677. args: [],
  54678. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  54679. referencedClasses: [],
  54680. messageSends: ["subclassResponsibility"]
  54681. }),
  54682. $globals.SequenceableCollectionTest);
  54683. $core.addMethod(
  54684. $core.method({
  54685. selector: "nonIndexesDo:",
  54686. protocol: "fixture",
  54687. fn: function (aBlock){
  54688. var self=this,$self=this;
  54689. return $core.withContext(function($ctx1) {
  54690. $recv(aBlock)._value_((0));
  54691. $ctx1.sendIdx["value:"]=1;
  54692. $recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)));
  54693. $ctx1.sendIdx["value:"]=2;
  54694. $recv(aBlock)._value_("z");
  54695. return self;
  54696. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  54697. },
  54698. args: ["aBlock"],
  54699. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  54700. referencedClasses: [],
  54701. messageSends: ["value:", "+", "collectionSize"]
  54702. }),
  54703. $globals.SequenceableCollectionTest);
  54704. $core.addMethod(
  54705. $core.method({
  54706. selector: "samplesDo:",
  54707. protocol: "fixture",
  54708. fn: function (aBlock){
  54709. var self=this,$self=this;
  54710. return $core.withContext(function($ctx1) {
  54711. $recv(aBlock)._value_value_((1),$self._collectionFirst());
  54712. $ctx1.sendIdx["value:value:"]=1;
  54713. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  54714. return self;
  54715. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  54716. },
  54717. args: ["aBlock"],
  54718. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  54719. referencedClasses: [],
  54720. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  54721. }),
  54722. $globals.SequenceableCollectionTest);
  54723. $core.addMethod(
  54724. $core.method({
  54725. selector: "testBeginsWith",
  54726. protocol: "tests",
  54727. fn: function (){
  54728. var self=this,$self=this;
  54729. return $core.withContext(function($ctx1) {
  54730. var $2,$1,$4,$5,$3,$7,$6;
  54731. $2=$self._collection();
  54732. $ctx1.sendIdx["collection"]=1;
  54733. $1=$recv($2)._beginsWith_($recv($self._collectionClass())._new());
  54734. $ctx1.sendIdx["beginsWith:"]=1;
  54735. $self._assert_($1);
  54736. $ctx1.sendIdx["assert:"]=1;
  54737. $4=$self._collection();
  54738. $ctx1.sendIdx["collection"]=2;
  54739. $5=$self._collection();
  54740. $ctx1.sendIdx["collection"]=3;
  54741. $3=$recv($4)._beginsWith_($5);
  54742. $ctx1.sendIdx["beginsWith:"]=2;
  54743. $self._assert_($3);
  54744. $ctx1.sendIdx["assert:"]=2;
  54745. $7=$self._collection();
  54746. $ctx1.sendIdx["collection"]=4;
  54747. $6=$recv($7)._beginsWith_($self._collectionFirstTwo());
  54748. $ctx1.sendIdx["beginsWith:"]=3;
  54749. $self._assert_($6);
  54750. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  54751. return self;
  54752. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  54753. },
  54754. args: [],
  54755. 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)",
  54756. referencedClasses: [],
  54757. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  54758. }),
  54759. $globals.SequenceableCollectionTest);
  54760. $core.addMethod(
  54761. $core.method({
  54762. selector: "testEndsWith",
  54763. protocol: "tests",
  54764. fn: function (){
  54765. var self=this,$self=this;
  54766. return $core.withContext(function($ctx1) {
  54767. var $2,$1,$4,$5,$3,$7,$6;
  54768. $2=$self._collection();
  54769. $ctx1.sendIdx["collection"]=1;
  54770. $1=$recv($2)._endsWith_($recv($self._collectionClass())._new());
  54771. $ctx1.sendIdx["endsWith:"]=1;
  54772. $self._assert_($1);
  54773. $ctx1.sendIdx["assert:"]=1;
  54774. $4=$self._collection();
  54775. $ctx1.sendIdx["collection"]=2;
  54776. $5=$self._collection();
  54777. $ctx1.sendIdx["collection"]=3;
  54778. $3=$recv($4)._endsWith_($5);
  54779. $ctx1.sendIdx["endsWith:"]=2;
  54780. $self._assert_($3);
  54781. $ctx1.sendIdx["assert:"]=2;
  54782. $7=$self._collection();
  54783. $ctx1.sendIdx["collection"]=4;
  54784. $6=$recv($7)._endsWith_($self._collectionLastTwo());
  54785. $ctx1.sendIdx["endsWith:"]=3;
  54786. $self._assert_($6);
  54787. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  54788. return self;
  54789. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  54790. },
  54791. args: [],
  54792. 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)",
  54793. referencedClasses: [],
  54794. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  54795. }),
  54796. $globals.SequenceableCollectionTest);
  54797. $core.addMethod(
  54798. $core.method({
  54799. selector: "testFirst",
  54800. protocol: "tests",
  54801. fn: function (){
  54802. var self=this,$self=this;
  54803. return $core.withContext(function($ctx1) {
  54804. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  54805. return self;
  54806. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  54807. },
  54808. args: [],
  54809. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  54810. referencedClasses: [],
  54811. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  54812. }),
  54813. $globals.SequenceableCollectionTest);
  54814. $core.addMethod(
  54815. $core.method({
  54816. selector: "testFirstN",
  54817. protocol: "tests",
  54818. fn: function (){
  54819. var self=this,$self=this;
  54820. return $core.withContext(function($ctx1) {
  54821. var $2,$1,$4,$3,$6,$5,$7;
  54822. $2=$self._collection();
  54823. $ctx1.sendIdx["collection"]=1;
  54824. $1=$recv($2)._first_((2));
  54825. $ctx1.sendIdx["first:"]=1;
  54826. $self._assert_equals_($1,$self._collectionFirstTwo());
  54827. $ctx1.sendIdx["assert:equals:"]=1;
  54828. $4=$self._collection();
  54829. $ctx1.sendIdx["collection"]=2;
  54830. $3=$recv($4)._first_((0));
  54831. $ctx1.sendIdx["first:"]=2;
  54832. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  54833. $ctx1.sendIdx["assert:equals:"]=2;
  54834. $6=$self._collection();
  54835. $ctx1.sendIdx["collection"]=3;
  54836. $5=$recv($6)._first_($self._collectionSize());
  54837. $ctx1.sendIdx["first:"]=3;
  54838. $7=$self._collection();
  54839. $ctx1.sendIdx["collection"]=4;
  54840. $self._assert_equals_($5,$7);
  54841. $self._should_raise_((function(){
  54842. return $core.withContext(function($ctx2) {
  54843. return $recv($self._collection())._first_((33));
  54844. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54845. }),$globals.Error);
  54846. return self;
  54847. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  54848. },
  54849. args: [],
  54850. 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",
  54851. referencedClasses: ["Error"],
  54852. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  54853. }),
  54854. $globals.SequenceableCollectionTest);
  54855. $core.addMethod(
  54856. $core.method({
  54857. selector: "testFourth",
  54858. protocol: "tests",
  54859. fn: function (){
  54860. var self=this,$self=this;
  54861. return $core.withContext(function($ctx1) {
  54862. var $2,$1;
  54863. $2=$self._collection();
  54864. $ctx1.sendIdx["collection"]=1;
  54865. $1=$recv($2)._fourth();
  54866. $self._assert_equals_($1,$recv($self._collection())._at_((4)));
  54867. return self;
  54868. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  54869. },
  54870. args: [],
  54871. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  54872. referencedClasses: [],
  54873. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  54874. }),
  54875. $globals.SequenceableCollectionTest);
  54876. $core.addMethod(
  54877. $core.method({
  54878. selector: "testIndexOfStartingAt",
  54879. protocol: "tests",
  54880. fn: function (){
  54881. var self=this,$self=this;
  54882. var jsNull;
  54883. return $core.withContext(function($ctx1) {
  54884. var $2,$1,$4,$3;
  54885. jsNull=$recv($globals.JSON)._parse_("null");
  54886. $self._samplesDo_((function(index,value){
  54887. return $core.withContext(function($ctx2) {
  54888. $2=$self._collection();
  54889. $ctx2.sendIdx["collection"]=1;
  54890. $1=$recv($2)._indexOf_startingAt_(value,(1));
  54891. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  54892. $self._assert_equals_($1,index);
  54893. $ctx2.sendIdx["assert:equals:"]=1;
  54894. $4=$self._collection();
  54895. $ctx2.sendIdx["collection"]=2;
  54896. $3=$recv($4)._indexOf_startingAt_(value,index);
  54897. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  54898. $self._assert_equals_($3,index);
  54899. $ctx2.sendIdx["assert:equals:"]=2;
  54900. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  54901. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54902. }));
  54903. return self;
  54904. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  54905. },
  54906. args: [],
  54907. 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 ]",
  54908. referencedClasses: ["JSON"],
  54909. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  54910. }),
  54911. $globals.SequenceableCollectionTest);
  54912. $core.addMethod(
  54913. $core.method({
  54914. selector: "testIndexOfStartingAtWithNull",
  54915. protocol: "tests",
  54916. fn: function (){
  54917. var self=this,$self=this;
  54918. var jsNull;
  54919. return $core.withContext(function($ctx1) {
  54920. var $1,$2;
  54921. jsNull=$recv($globals.JSON)._parse_("null");
  54922. $self._samplesDo_((function(index,value){
  54923. var collection;
  54924. return $core.withContext(function($ctx2) {
  54925. collection=$self._collection();
  54926. collection;
  54927. $recv(collection)._at_put_(index,jsNull);
  54928. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  54929. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  54930. $self._assert_equals_($1,index);
  54931. $ctx2.sendIdx["assert:equals:"]=1;
  54932. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  54933. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  54934. $self._assert_equals_($2,index);
  54935. $ctx2.sendIdx["assert:equals:"]=2;
  54936. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  54937. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  54938. }));
  54939. return self;
  54940. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  54941. },
  54942. args: [],
  54943. 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 ]",
  54944. referencedClasses: ["JSON"],
  54945. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  54946. }),
  54947. $globals.SequenceableCollectionTest);
  54948. $core.addMethod(
  54949. $core.method({
  54950. selector: "testLast",
  54951. protocol: "tests",
  54952. fn: function (){
  54953. var self=this,$self=this;
  54954. return $core.withContext(function($ctx1) {
  54955. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  54956. return self;
  54957. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  54958. },
  54959. args: [],
  54960. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  54961. referencedClasses: [],
  54962. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  54963. }),
  54964. $globals.SequenceableCollectionTest);
  54965. $core.addMethod(
  54966. $core.method({
  54967. selector: "testLastN",
  54968. protocol: "tests",
  54969. fn: function (){
  54970. var self=this,$self=this;
  54971. return $core.withContext(function($ctx1) {
  54972. var $2,$1,$4,$3,$6,$5,$7;
  54973. $2=$self._collection();
  54974. $ctx1.sendIdx["collection"]=1;
  54975. $1=$recv($2)._last_((2));
  54976. $ctx1.sendIdx["last:"]=1;
  54977. $self._assert_equals_($1,$self._collectionLastTwo());
  54978. $ctx1.sendIdx["assert:equals:"]=1;
  54979. $4=$self._collection();
  54980. $ctx1.sendIdx["collection"]=2;
  54981. $3=$recv($4)._last_((0));
  54982. $ctx1.sendIdx["last:"]=2;
  54983. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  54984. $ctx1.sendIdx["assert:equals:"]=2;
  54985. $6=$self._collection();
  54986. $ctx1.sendIdx["collection"]=3;
  54987. $5=$recv($6)._last_($self._collectionSize());
  54988. $ctx1.sendIdx["last:"]=3;
  54989. $7=$self._collection();
  54990. $ctx1.sendIdx["collection"]=4;
  54991. $self._assert_equals_($5,$7);
  54992. $self._should_raise_((function(){
  54993. return $core.withContext(function($ctx2) {
  54994. return $recv($self._collection())._last_((33));
  54995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54996. }),$globals.Error);
  54997. return self;
  54998. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  54999. },
  55000. args: [],
  55001. 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",
  55002. referencedClasses: ["Error"],
  55003. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55004. }),
  55005. $globals.SequenceableCollectionTest);
  55006. $core.addMethod(
  55007. $core.method({
  55008. selector: "testSecond",
  55009. protocol: "tests",
  55010. fn: function (){
  55011. var self=this,$self=this;
  55012. return $core.withContext(function($ctx1) {
  55013. var $2,$1;
  55014. $2=$self._collection();
  55015. $ctx1.sendIdx["collection"]=1;
  55016. $1=$recv($2)._second();
  55017. $self._assert_equals_($1,$recv($self._collection())._at_((2)));
  55018. return self;
  55019. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  55020. },
  55021. args: [],
  55022. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  55023. referencedClasses: [],
  55024. messageSends: ["assert:equals:", "second", "collection", "at:"]
  55025. }),
  55026. $globals.SequenceableCollectionTest);
  55027. $core.addMethod(
  55028. $core.method({
  55029. selector: "testThird",
  55030. protocol: "tests",
  55031. fn: function (){
  55032. var self=this,$self=this;
  55033. return $core.withContext(function($ctx1) {
  55034. var $2,$1;
  55035. $2=$self._collection();
  55036. $ctx1.sendIdx["collection"]=1;
  55037. $1=$recv($2)._third();
  55038. $self._assert_equals_($1,$recv($self._collection())._at_((3)));
  55039. return self;
  55040. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  55041. },
  55042. args: [],
  55043. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  55044. referencedClasses: [],
  55045. messageSends: ["assert:equals:", "third", "collection", "at:"]
  55046. }),
  55047. $globals.SequenceableCollectionTest);
  55048. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55049. $core.addMethod(
  55050. $core.method({
  55051. selector: "collection",
  55052. protocol: "fixture",
  55053. fn: function (){
  55054. var self=this,$self=this;
  55055. return [(1), (2), (3), (-4)];
  55056. },
  55057. args: [],
  55058. source: "collection\x0a\x09^ #(1 2 3 -4)",
  55059. referencedClasses: [],
  55060. messageSends: []
  55061. }),
  55062. $globals.ArrayTest);
  55063. $core.addMethod(
  55064. $core.method({
  55065. selector: "collectionFirst",
  55066. protocol: "fixture",
  55067. fn: function (){
  55068. var self=this,$self=this;
  55069. return (1);
  55070. },
  55071. args: [],
  55072. source: "collectionFirst\x0a\x09^ 1",
  55073. referencedClasses: [],
  55074. messageSends: []
  55075. }),
  55076. $globals.ArrayTest);
  55077. $core.addMethod(
  55078. $core.method({
  55079. selector: "collectionFirstTwo",
  55080. protocol: "fixture",
  55081. fn: function (){
  55082. var self=this,$self=this;
  55083. return [(1), (2)];
  55084. },
  55085. args: [],
  55086. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  55087. referencedClasses: [],
  55088. messageSends: []
  55089. }),
  55090. $globals.ArrayTest);
  55091. $core.addMethod(
  55092. $core.method({
  55093. selector: "collectionLast",
  55094. protocol: "fixture",
  55095. fn: function (){
  55096. var self=this,$self=this;
  55097. return (-4);
  55098. },
  55099. args: [],
  55100. source: "collectionLast\x0a\x09^ -4",
  55101. referencedClasses: [],
  55102. messageSends: []
  55103. }),
  55104. $globals.ArrayTest);
  55105. $core.addMethod(
  55106. $core.method({
  55107. selector: "collectionLastTwo",
  55108. protocol: "fixture",
  55109. fn: function (){
  55110. var self=this,$self=this;
  55111. return [(3), (-4)];
  55112. },
  55113. args: [],
  55114. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  55115. referencedClasses: [],
  55116. messageSends: []
  55117. }),
  55118. $globals.ArrayTest);
  55119. $core.addMethod(
  55120. $core.method({
  55121. selector: "collectionOfPrintStrings",
  55122. protocol: "fixture",
  55123. fn: function (){
  55124. var self=this,$self=this;
  55125. return ["1", "2", "3", "-4"];
  55126. },
  55127. args: [],
  55128. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  55129. referencedClasses: [],
  55130. messageSends: []
  55131. }),
  55132. $globals.ArrayTest);
  55133. $core.addMethod(
  55134. $core.method({
  55135. selector: "collectionSize",
  55136. protocol: "fixture",
  55137. fn: function (){
  55138. var self=this,$self=this;
  55139. return (4);
  55140. },
  55141. args: [],
  55142. source: "collectionSize\x0a\x09^ 4",
  55143. referencedClasses: [],
  55144. messageSends: []
  55145. }),
  55146. $globals.ArrayTest);
  55147. $core.addMethod(
  55148. $core.method({
  55149. selector: "collectionWithDuplicates",
  55150. protocol: "fixture",
  55151. fn: function (){
  55152. var self=this,$self=this;
  55153. return ["a", "b", "c", (1), (2), (1), "a", []];
  55154. },
  55155. args: [],
  55156. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  55157. referencedClasses: [],
  55158. messageSends: []
  55159. }),
  55160. $globals.ArrayTest);
  55161. $core.addMethod(
  55162. $core.method({
  55163. selector: "collectionWithNewValue",
  55164. protocol: "fixture",
  55165. fn: function (){
  55166. var self=this,$self=this;
  55167. return [(1), (2), (3), (-4), "N"];
  55168. },
  55169. args: [],
  55170. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  55171. referencedClasses: [],
  55172. messageSends: []
  55173. }),
  55174. $globals.ArrayTest);
  55175. $core.addMethod(
  55176. $core.method({
  55177. selector: "sampleNewIndex",
  55178. protocol: "fixture",
  55179. fn: function (){
  55180. var self=this,$self=this;
  55181. return (5);
  55182. },
  55183. args: [],
  55184. source: "sampleNewIndex\x0a\x09^ 5",
  55185. referencedClasses: [],
  55186. messageSends: []
  55187. }),
  55188. $globals.ArrayTest);
  55189. $core.addMethod(
  55190. $core.method({
  55191. selector: "samplesDo:",
  55192. protocol: "fixture",
  55193. fn: function (aBlock){
  55194. var self=this,$self=this;
  55195. return $core.withContext(function($ctx1) {
  55196. (
  55197. $ctx1.supercall = true,
  55198. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55199. $ctx1.supercall = false;
  55200. $recv(aBlock)._value_value_((3),(3));
  55201. return self;
  55202. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  55203. },
  55204. args: ["aBlock"],
  55205. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  55206. referencedClasses: [],
  55207. messageSends: ["samplesDo:", "value:value:"]
  55208. }),
  55209. $globals.ArrayTest);
  55210. $core.addMethod(
  55211. $core.method({
  55212. selector: "testAdd",
  55213. protocol: "tests",
  55214. fn: function (){
  55215. var self=this,$self=this;
  55216. var array;
  55217. return $core.withContext(function($ctx1) {
  55218. array=$self._collection();
  55219. $recv(array)._add_((6));
  55220. $self._assert_equals_($recv(array)._last(),(6));
  55221. return self;
  55222. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  55223. },
  55224. args: [],
  55225. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  55226. referencedClasses: [],
  55227. messageSends: ["collection", "add:", "assert:equals:", "last"]
  55228. }),
  55229. $globals.ArrayTest);
  55230. $core.addMethod(
  55231. $core.method({
  55232. selector: "testAddFirst",
  55233. protocol: "tests",
  55234. fn: function (){
  55235. var self=this,$self=this;
  55236. return $core.withContext(function($ctx1) {
  55237. var $3,$2,$1;
  55238. $3=$self._collection();
  55239. $recv($3)._addFirst_((0));
  55240. $2=$recv($3)._yourself();
  55241. $1=$recv($2)._first();
  55242. $self._assert_equals_($1,(0));
  55243. return self;
  55244. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  55245. },
  55246. args: [],
  55247. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  55248. referencedClasses: [],
  55249. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  55250. }),
  55251. $globals.ArrayTest);
  55252. $core.addMethod(
  55253. $core.method({
  55254. selector: "testPrintString",
  55255. protocol: "tests",
  55256. fn: function (){
  55257. var self=this,$self=this;
  55258. var array;
  55259. return $core.withContext(function($ctx1) {
  55260. var $1,$2,$3,$4,$5,$6,$7,$8;
  55261. array=$recv($globals.Array)._new();
  55262. $1=$recv(array)._printString();
  55263. $ctx1.sendIdx["printString"]=1;
  55264. $self._assert_equals_($1,"an Array ()");
  55265. $ctx1.sendIdx["assert:equals:"]=1;
  55266. $2=array;
  55267. $recv($2)._add_((1));
  55268. $ctx1.sendIdx["add:"]=1;
  55269. $3=$recv($2)._add_((3));
  55270. $ctx1.sendIdx["add:"]=2;
  55271. $4=$recv(array)._printString();
  55272. $ctx1.sendIdx["printString"]=2;
  55273. $self._assert_equals_($4,"an Array (1 3)");
  55274. $ctx1.sendIdx["assert:equals:"]=2;
  55275. $recv(array)._add_("foo");
  55276. $5=$recv(array)._printString();
  55277. $ctx1.sendIdx["printString"]=3;
  55278. $self._assert_equals_($5,"an Array (1 3 'foo')");
  55279. $ctx1.sendIdx["assert:equals:"]=3;
  55280. $6=array;
  55281. $recv($6)._remove_((1));
  55282. $ctx1.sendIdx["remove:"]=1;
  55283. $recv($6)._remove_((3));
  55284. $7=$recv(array)._printString();
  55285. $ctx1.sendIdx["printString"]=4;
  55286. $self._assert_equals_($7,"an Array ('foo')");
  55287. $ctx1.sendIdx["assert:equals:"]=4;
  55288. $recv(array)._addLast_((3));
  55289. $ctx1.sendIdx["addLast:"]=1;
  55290. $8=$recv(array)._printString();
  55291. $ctx1.sendIdx["printString"]=5;
  55292. $self._assert_equals_($8,"an Array ('foo' 3)");
  55293. $ctx1.sendIdx["assert:equals:"]=5;
  55294. $recv(array)._addLast_((3));
  55295. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  55296. return self;
  55297. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  55298. },
  55299. args: [],
  55300. 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)'.",
  55301. referencedClasses: ["Array"],
  55302. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  55303. }),
  55304. $globals.ArrayTest);
  55305. $core.addMethod(
  55306. $core.method({
  55307. selector: "testRemove",
  55308. protocol: "tests",
  55309. fn: function (){
  55310. var self=this,$self=this;
  55311. var array;
  55312. return $core.withContext(function($ctx1) {
  55313. array=[(1), (2), (3), (4), (5)];
  55314. $recv(array)._remove_((3));
  55315. $ctx1.sendIdx["remove:"]=1;
  55316. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  55317. $self._should_raise_((function(){
  55318. return $core.withContext(function($ctx2) {
  55319. return $recv(array)._remove_((3));
  55320. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55321. }),$globals.Error);
  55322. return self;
  55323. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  55324. },
  55325. args: [],
  55326. 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",
  55327. referencedClasses: ["Error"],
  55328. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  55329. }),
  55330. $globals.ArrayTest);
  55331. $core.addMethod(
  55332. $core.method({
  55333. selector: "testRemoveFromTo",
  55334. protocol: "tests",
  55335. fn: function (){
  55336. var self=this,$self=this;
  55337. return $core.withContext(function($ctx1) {
  55338. var $1,$2;
  55339. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  55340. $ctx1.sendIdx["removeFrom:to:"]=1;
  55341. $self._assert_equals_($1,[(4)]);
  55342. $ctx1.sendIdx["assert:equals:"]=1;
  55343. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  55344. $ctx1.sendIdx["removeFrom:to:"]=2;
  55345. $self._assert_equals_($2,[(1), (4)]);
  55346. $ctx1.sendIdx["assert:equals:"]=2;
  55347. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  55348. return self;
  55349. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  55350. },
  55351. args: [],
  55352. 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)",
  55353. referencedClasses: [],
  55354. messageSends: ["assert:equals:", "removeFrom:to:"]
  55355. }),
  55356. $globals.ArrayTest);
  55357. $core.addMethod(
  55358. $core.method({
  55359. selector: "testRemoveIndex",
  55360. protocol: "tests",
  55361. fn: function (){
  55362. var self=this,$self=this;
  55363. return $core.withContext(function($ctx1) {
  55364. var $1,$2;
  55365. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  55366. $ctx1.sendIdx["removeIndex:"]=1;
  55367. $self._assert_equals_($1,[(1), (3), (4)]);
  55368. $ctx1.sendIdx["assert:equals:"]=1;
  55369. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  55370. $ctx1.sendIdx["removeIndex:"]=2;
  55371. $self._assert_equals_($2,[(2), (3), (4)]);
  55372. $ctx1.sendIdx["assert:equals:"]=2;
  55373. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  55374. return self;
  55375. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  55376. },
  55377. args: [],
  55378. 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: #()",
  55379. referencedClasses: [],
  55380. messageSends: ["assert:equals:", "removeIndex:"]
  55381. }),
  55382. $globals.ArrayTest);
  55383. $core.addMethod(
  55384. $core.method({
  55385. selector: "testRemoveLast",
  55386. protocol: "tests",
  55387. fn: function (){
  55388. var self=this,$self=this;
  55389. var array;
  55390. return $core.withContext(function($ctx1) {
  55391. array=[(1), (2)];
  55392. $recv(array)._removeLast();
  55393. $self._assert_equals_($recv(array)._last(),(1));
  55394. return self;
  55395. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  55396. },
  55397. args: [],
  55398. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  55399. referencedClasses: [],
  55400. messageSends: ["removeLast", "assert:equals:", "last"]
  55401. }),
  55402. $globals.ArrayTest);
  55403. $core.addMethod(
  55404. $core.method({
  55405. selector: "testReversed",
  55406. protocol: "tests",
  55407. fn: function (){
  55408. var self=this,$self=this;
  55409. var array;
  55410. return $core.withContext(function($ctx1) {
  55411. array=[(5), (4), (3), (2), (1)];
  55412. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  55413. return self;
  55414. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  55415. },
  55416. args: [],
  55417. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  55418. referencedClasses: [],
  55419. messageSends: ["assert:equals:", "reversed"]
  55420. }),
  55421. $globals.ArrayTest);
  55422. $core.addMethod(
  55423. $core.method({
  55424. selector: "testSort",
  55425. protocol: "tests",
  55426. fn: function (){
  55427. var self=this,$self=this;
  55428. var array;
  55429. return $core.withContext(function($ctx1) {
  55430. array=[(10), (1), (5)];
  55431. $recv(array)._sort();
  55432. $self._assert_equals_(array,[(1), (5), (10)]);
  55433. return self;
  55434. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  55435. },
  55436. args: [],
  55437. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  55438. referencedClasses: [],
  55439. messageSends: ["sort", "assert:equals:"]
  55440. }),
  55441. $globals.ArrayTest);
  55442. $core.addMethod(
  55443. $core.method({
  55444. selector: "collectionClass",
  55445. protocol: "fixture",
  55446. fn: function (){
  55447. var self=this,$self=this;
  55448. return $globals.Array;
  55449. },
  55450. args: [],
  55451. source: "collectionClass\x0a\x09^ Array",
  55452. referencedClasses: ["Array"],
  55453. messageSends: []
  55454. }),
  55455. $globals.ArrayTest.a$cls);
  55456. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55457. $core.addMethod(
  55458. $core.method({
  55459. selector: "collection",
  55460. protocol: "fixture",
  55461. fn: function (){
  55462. var self=this,$self=this;
  55463. return "helLo";
  55464. },
  55465. args: [],
  55466. source: "collection\x0a\x09^ 'helLo'",
  55467. referencedClasses: [],
  55468. messageSends: []
  55469. }),
  55470. $globals.StringTest);
  55471. $core.addMethod(
  55472. $core.method({
  55473. selector: "collectionFirst",
  55474. protocol: "fixture",
  55475. fn: function (){
  55476. var self=this,$self=this;
  55477. return "h";
  55478. },
  55479. args: [],
  55480. source: "collectionFirst\x0a\x09^ 'h'",
  55481. referencedClasses: [],
  55482. messageSends: []
  55483. }),
  55484. $globals.StringTest);
  55485. $core.addMethod(
  55486. $core.method({
  55487. selector: "collectionFirstTwo",
  55488. protocol: "fixture",
  55489. fn: function (){
  55490. var self=this,$self=this;
  55491. return "he";
  55492. },
  55493. args: [],
  55494. source: "collectionFirstTwo\x0a\x09^ 'he'",
  55495. referencedClasses: [],
  55496. messageSends: []
  55497. }),
  55498. $globals.StringTest);
  55499. $core.addMethod(
  55500. $core.method({
  55501. selector: "collectionLast",
  55502. protocol: "fixture",
  55503. fn: function (){
  55504. var self=this,$self=this;
  55505. return "o";
  55506. },
  55507. args: [],
  55508. source: "collectionLast\x0a\x09^ 'o'",
  55509. referencedClasses: [],
  55510. messageSends: []
  55511. }),
  55512. $globals.StringTest);
  55513. $core.addMethod(
  55514. $core.method({
  55515. selector: "collectionLastTwo",
  55516. protocol: "fixture",
  55517. fn: function (){
  55518. var self=this,$self=this;
  55519. return "Lo";
  55520. },
  55521. args: [],
  55522. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  55523. referencedClasses: [],
  55524. messageSends: []
  55525. }),
  55526. $globals.StringTest);
  55527. $core.addMethod(
  55528. $core.method({
  55529. selector: "collectionOfPrintStrings",
  55530. protocol: "fixture",
  55531. fn: function (){
  55532. var self=this,$self=this;
  55533. return "'h''e''l''L''o'";
  55534. },
  55535. args: [],
  55536. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  55537. referencedClasses: [],
  55538. messageSends: []
  55539. }),
  55540. $globals.StringTest);
  55541. $core.addMethod(
  55542. $core.method({
  55543. selector: "collectionSize",
  55544. protocol: "fixture",
  55545. fn: function (){
  55546. var self=this,$self=this;
  55547. return (5);
  55548. },
  55549. args: [],
  55550. source: "collectionSize\x0a\x09^ 5",
  55551. referencedClasses: [],
  55552. messageSends: []
  55553. }),
  55554. $globals.StringTest);
  55555. $core.addMethod(
  55556. $core.method({
  55557. selector: "collectionWithDuplicates",
  55558. protocol: "fixture",
  55559. fn: function (){
  55560. var self=this,$self=this;
  55561. return "abbaerten";
  55562. },
  55563. args: [],
  55564. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  55565. referencedClasses: [],
  55566. messageSends: []
  55567. }),
  55568. $globals.StringTest);
  55569. $core.addMethod(
  55570. $core.method({
  55571. selector: "collectionWithNewValue",
  55572. protocol: "fixture",
  55573. fn: function (){
  55574. var self=this,$self=this;
  55575. return "helLoN";
  55576. },
  55577. args: [],
  55578. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  55579. referencedClasses: [],
  55580. messageSends: []
  55581. }),
  55582. $globals.StringTest);
  55583. $core.addMethod(
  55584. $core.method({
  55585. selector: "sampleNewValueAsCollection",
  55586. protocol: "fixture",
  55587. fn: function (){
  55588. var self=this,$self=this;
  55589. return "N";
  55590. },
  55591. args: [],
  55592. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  55593. referencedClasses: [],
  55594. messageSends: []
  55595. }),
  55596. $globals.StringTest);
  55597. $core.addMethod(
  55598. $core.method({
  55599. selector: "samplesDo:",
  55600. protocol: "fixture",
  55601. fn: function (aBlock){
  55602. var self=this,$self=this;
  55603. return $core.withContext(function($ctx1) {
  55604. (
  55605. $ctx1.supercall = true,
  55606. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55607. $ctx1.supercall = false;
  55608. $recv(aBlock)._value_value_((3),"l");
  55609. return self;
  55610. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  55611. },
  55612. args: ["aBlock"],
  55613. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  55614. referencedClasses: [],
  55615. messageSends: ["samplesDo:", "value:value:"]
  55616. }),
  55617. $globals.StringTest);
  55618. $core.addMethod(
  55619. $core.method({
  55620. selector: "testAddAll",
  55621. protocol: "tests",
  55622. fn: function (){
  55623. var self=this,$self=this;
  55624. return $core.withContext(function($ctx1) {
  55625. var $1;
  55626. $self._should_raise_((function(){
  55627. return $core.withContext(function($ctx2) {
  55628. $1=$self._collection();
  55629. $ctx2.sendIdx["collection"]=1;
  55630. return $recv($1)._addAll_($self._collection());
  55631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55632. }),$globals.Error);
  55633. return self;
  55634. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  55635. },
  55636. args: [],
  55637. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  55638. referencedClasses: ["Error"],
  55639. messageSends: ["should:raise:", "addAll:", "collection"]
  55640. }),
  55641. $globals.StringTest);
  55642. $core.addMethod(
  55643. $core.method({
  55644. selector: "testAddRemove",
  55645. protocol: "tests",
  55646. fn: function (){
  55647. var self=this,$self=this;
  55648. return $core.withContext(function($ctx1) {
  55649. $self._should_raise_((function(){
  55650. return $core.withContext(function($ctx2) {
  55651. return "hello"._add_("a");
  55652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55653. }),$globals.Error);
  55654. $ctx1.sendIdx["should:raise:"]=1;
  55655. $self._should_raise_((function(){
  55656. return $core.withContext(function($ctx2) {
  55657. return "hello"._remove_("h");
  55658. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55659. }),$globals.Error);
  55660. return self;
  55661. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  55662. },
  55663. args: [],
  55664. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  55665. referencedClasses: ["Error"],
  55666. messageSends: ["should:raise:", "add:", "remove:"]
  55667. }),
  55668. $globals.StringTest);
  55669. $core.addMethod(
  55670. $core.method({
  55671. selector: "testAsArray",
  55672. protocol: "tests",
  55673. fn: function (){
  55674. var self=this,$self=this;
  55675. return $core.withContext(function($ctx1) {
  55676. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  55677. return self;
  55678. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  55679. },
  55680. args: [],
  55681. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  55682. referencedClasses: [],
  55683. messageSends: ["assert:equals:", "asArray"]
  55684. }),
  55685. $globals.StringTest);
  55686. $core.addMethod(
  55687. $core.method({
  55688. selector: "testAsLowerCase",
  55689. protocol: "tests",
  55690. fn: function (){
  55691. var self=this,$self=this;
  55692. return $core.withContext(function($ctx1) {
  55693. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  55694. return self;
  55695. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  55696. },
  55697. args: [],
  55698. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  55699. referencedClasses: [],
  55700. messageSends: ["assert:equals:", "asLowercase"]
  55701. }),
  55702. $globals.StringTest);
  55703. $core.addMethod(
  55704. $core.method({
  55705. selector: "testAsNumber",
  55706. protocol: "tests",
  55707. fn: function (){
  55708. var self=this,$self=this;
  55709. return $core.withContext(function($ctx1) {
  55710. var $1,$2;
  55711. $1="3"._asNumber();
  55712. $ctx1.sendIdx["asNumber"]=1;
  55713. $self._assert_equals_($1,(3));
  55714. $ctx1.sendIdx["assert:equals:"]=1;
  55715. $2="-3"._asNumber();
  55716. $ctx1.sendIdx["asNumber"]=2;
  55717. $self._assert_equals_($2,(-3));
  55718. $ctx1.sendIdx["assert:equals:"]=2;
  55719. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  55720. return self;
  55721. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  55722. },
  55723. args: [],
  55724. 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.",
  55725. referencedClasses: [],
  55726. messageSends: ["assert:equals:", "asNumber"]
  55727. }),
  55728. $globals.StringTest);
  55729. $core.addMethod(
  55730. $core.method({
  55731. selector: "testAsUpperCase",
  55732. protocol: "tests",
  55733. fn: function (){
  55734. var self=this,$self=this;
  55735. return $core.withContext(function($ctx1) {
  55736. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  55737. return self;
  55738. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  55739. },
  55740. args: [],
  55741. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  55742. referencedClasses: [],
  55743. messageSends: ["assert:equals:", "asUppercase"]
  55744. }),
  55745. $globals.StringTest);
  55746. $core.addMethod(
  55747. $core.method({
  55748. selector: "testAsciiValue",
  55749. protocol: "tests",
  55750. fn: function (){
  55751. var self=this,$self=this;
  55752. var characterA,characterU;
  55753. return $core.withContext(function($ctx1) {
  55754. var $1;
  55755. characterA="A";
  55756. characterU="U";
  55757. $1=$recv(characterA)._asciiValue();
  55758. $ctx1.sendIdx["asciiValue"]=1;
  55759. $self._assert_equals_($1,(65));
  55760. $ctx1.sendIdx["assert:equals:"]=1;
  55761. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  55762. return self;
  55763. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  55764. },
  55765. args: [],
  55766. 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",
  55767. referencedClasses: [],
  55768. messageSends: ["assert:equals:", "asciiValue"]
  55769. }),
  55770. $globals.StringTest);
  55771. $core.addMethod(
  55772. $core.method({
  55773. selector: "testAtIfAbsentPut",
  55774. protocol: "tests",
  55775. fn: function (){
  55776. var self=this,$self=this;
  55777. return $core.withContext(function($ctx1) {
  55778. $self._should_raise_((function(){
  55779. return $core.withContext(function($ctx2) {
  55780. return "hello"._at_ifAbsentPut_((6),(function(){
  55781. return "a";
  55782. }));
  55783. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55784. }),$globals.Error);
  55785. return self;
  55786. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  55787. },
  55788. args: [],
  55789. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  55790. referencedClasses: ["Error"],
  55791. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  55792. }),
  55793. $globals.StringTest);
  55794. $core.addMethod(
  55795. $core.method({
  55796. selector: "testAtPut",
  55797. protocol: "tests",
  55798. fn: function (){
  55799. var self=this,$self=this;
  55800. return $core.withContext(function($ctx1) {
  55801. $self._should_raise_((function(){
  55802. return $core.withContext(function($ctx2) {
  55803. return "hello"._at_put_((1),"a");
  55804. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55805. }),$globals.Error);
  55806. return self;
  55807. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  55808. },
  55809. args: [],
  55810. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  55811. referencedClasses: ["Error"],
  55812. messageSends: ["should:raise:", "at:put:"]
  55813. }),
  55814. $globals.StringTest);
  55815. $core.addMethod(
  55816. $core.method({
  55817. selector: "testCapitalized",
  55818. protocol: "tests",
  55819. fn: function (){
  55820. var self=this,$self=this;
  55821. return $core.withContext(function($ctx1) {
  55822. var $1,$2,$3;
  55823. $1="test"._capitalized();
  55824. $ctx1.sendIdx["capitalized"]=1;
  55825. $self._assert_equals_($1,"Test");
  55826. $ctx1.sendIdx["assert:equals:"]=1;
  55827. $2="Test"._capitalized();
  55828. $ctx1.sendIdx["capitalized"]=2;
  55829. $self._assert_equals_($2,"Test");
  55830. $ctx1.sendIdx["assert:equals:"]=2;
  55831. $self._assert_equals_(""._capitalized(),"");
  55832. $ctx1.sendIdx["assert:equals:"]=3;
  55833. $3="Test"._isCapitalized();
  55834. $ctx1.sendIdx["isCapitalized"]=1;
  55835. $self._assert_equals_($3,true);
  55836. $ctx1.sendIdx["assert:equals:"]=4;
  55837. $self._assert_equals_("test"._isCapitalized(),false);
  55838. return self;
  55839. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  55840. },
  55841. args: [],
  55842. 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.",
  55843. referencedClasses: [],
  55844. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  55845. }),
  55846. $globals.StringTest);
  55847. $core.addMethod(
  55848. $core.method({
  55849. selector: "testCharCodeAt",
  55850. protocol: "tests",
  55851. fn: function (){
  55852. var self=this,$self=this;
  55853. return $core.withContext(function($ctx1) {
  55854. var $1,$2,$3,$4,$5;
  55855. $1="jackie"._charCodeAt_((1));
  55856. $ctx1.sendIdx["charCodeAt:"]=1;
  55857. $self._assert_equals_($1,(106));
  55858. $ctx1.sendIdx["assert:equals:"]=1;
  55859. $2="jackie"._charCodeAt_((2));
  55860. $ctx1.sendIdx["charCodeAt:"]=2;
  55861. $self._assert_equals_($2,(97));
  55862. $ctx1.sendIdx["assert:equals:"]=2;
  55863. $3="jackie"._charCodeAt_((3));
  55864. $ctx1.sendIdx["charCodeAt:"]=3;
  55865. $self._assert_equals_($3,(99));
  55866. $ctx1.sendIdx["assert:equals:"]=3;
  55867. $4="jackie"._charCodeAt_((4));
  55868. $ctx1.sendIdx["charCodeAt:"]=4;
  55869. $self._assert_equals_($4,(107));
  55870. $ctx1.sendIdx["assert:equals:"]=4;
  55871. $5="jackie"._charCodeAt_((5));
  55872. $ctx1.sendIdx["charCodeAt:"]=5;
  55873. $self._assert_equals_($5,(105));
  55874. $ctx1.sendIdx["assert:equals:"]=5;
  55875. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  55876. return self;
  55877. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  55878. },
  55879. args: [],
  55880. 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",
  55881. referencedClasses: [],
  55882. messageSends: ["assert:equals:", "charCodeAt:"]
  55883. }),
  55884. $globals.StringTest);
  55885. $core.addMethod(
  55886. $core.method({
  55887. selector: "testCopyFromTo",
  55888. protocol: "tests",
  55889. fn: function (){
  55890. var self=this,$self=this;
  55891. return $core.withContext(function($ctx1) {
  55892. var $1;
  55893. $1="jackie"._copyFrom_to_((1),(3));
  55894. $ctx1.sendIdx["copyFrom:to:"]=1;
  55895. $self._assert_equals_($1,"jac");
  55896. $ctx1.sendIdx["assert:equals:"]=1;
  55897. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  55898. return self;
  55899. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  55900. },
  55901. args: [],
  55902. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  55903. referencedClasses: [],
  55904. messageSends: ["assert:equals:", "copyFrom:to:"]
  55905. }),
  55906. $globals.StringTest);
  55907. $core.addMethod(
  55908. $core.method({
  55909. selector: "testCopySeparates",
  55910. protocol: "tests",
  55911. fn: function (){
  55912. var self=this,$self=this;
  55913. return $core.withContext(function($ctx1) {
  55914. var $3,$2,$1;
  55915. $3=$self._collection();
  55916. $ctx1.sendIdx["collection"]=1;
  55917. $2=$recv($3)._copy();
  55918. $1=$recv($2).__eq_eq($self._collection());
  55919. $self._assert_($1);
  55920. return self;
  55921. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  55922. },
  55923. args: [],
  55924. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  55925. referencedClasses: [],
  55926. messageSends: ["assert:", "==", "copy", "collection"]
  55927. }),
  55928. $globals.StringTest);
  55929. $core.addMethod(
  55930. $core.method({
  55931. selector: "testCopyWithoutAll",
  55932. protocol: "tests",
  55933. fn: function (){
  55934. var self=this,$self=this;
  55935. return $core.withContext(function($ctx1) {
  55936. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  55937. return self;
  55938. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  55939. },
  55940. args: [],
  55941. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  55942. referencedClasses: [],
  55943. messageSends: ["assert:equals:", "copyWithoutAll:"]
  55944. }),
  55945. $globals.StringTest);
  55946. $core.addMethod(
  55947. $core.method({
  55948. selector: "testEquality",
  55949. protocol: "tests",
  55950. fn: function (){
  55951. var self=this,$self=this;
  55952. return $core.withContext(function($ctx1) {
  55953. var $1,$2,$3;
  55954. $self._assert_equals_("hello","hello");
  55955. $ctx1.sendIdx["assert:equals:"]=1;
  55956. $1="hello".__eq("world");
  55957. $ctx1.sendIdx["="]=1;
  55958. $self._deny_($1);
  55959. $ctx1.sendIdx["deny:"]=1;
  55960. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  55961. })));
  55962. $ctx1.sendIdx["="]=2;
  55963. $self._deny_($2);
  55964. $ctx1.sendIdx["deny:"]=2;
  55965. $3="hello"._yourself();
  55966. $ctx1.sendIdx["yourself"]=1;
  55967. $self._assert_equals_("hello",$3);
  55968. $ctx1.sendIdx["assert:equals:"]=2;
  55969. $self._assert_equals_("hello"._yourself(),"hello");
  55970. $self._deny_("".__eq((0)));
  55971. return self;
  55972. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  55973. },
  55974. args: [],
  55975. 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",
  55976. referencedClasses: [],
  55977. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  55978. }),
  55979. $globals.StringTest);
  55980. $core.addMethod(
  55981. $core.method({
  55982. selector: "testIdentity",
  55983. protocol: "tests",
  55984. fn: function (){
  55985. var self=this,$self=this;
  55986. return $core.withContext(function($ctx1) {
  55987. var $1,$2,$4,$3,$5;
  55988. $1="hello".__eq_eq("hello");
  55989. $ctx1.sendIdx["=="]=1;
  55990. $self._assert_($1);
  55991. $ctx1.sendIdx["assert:"]=1;
  55992. $2="hello".__eq_eq("world");
  55993. $ctx1.sendIdx["=="]=2;
  55994. $self._deny_($2);
  55995. $ctx1.sendIdx["deny:"]=1;
  55996. $4="hello"._yourself();
  55997. $ctx1.sendIdx["yourself"]=1;
  55998. $3="hello".__eq_eq($4);
  55999. $ctx1.sendIdx["=="]=3;
  56000. $self._assert_($3);
  56001. $ctx1.sendIdx["assert:"]=2;
  56002. $5=$recv("hello"._yourself()).__eq_eq("hello");
  56003. $ctx1.sendIdx["=="]=4;
  56004. $self._assert_($5);
  56005. $self._deny_("".__eq_eq((0)));
  56006. return self;
  56007. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  56008. },
  56009. args: [],
  56010. 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",
  56011. referencedClasses: [],
  56012. messageSends: ["assert:", "==", "deny:", "yourself"]
  56013. }),
  56014. $globals.StringTest);
  56015. $core.addMethod(
  56016. $core.method({
  56017. selector: "testIncludesSubString",
  56018. protocol: "tests",
  56019. fn: function (){
  56020. var self=this,$self=this;
  56021. return $core.withContext(function($ctx1) {
  56022. var $1;
  56023. $1="amber"._includesSubString_("ber");
  56024. $ctx1.sendIdx["includesSubString:"]=1;
  56025. $self._assert_($1);
  56026. $self._deny_("amber"._includesSubString_("zork"));
  56027. return self;
  56028. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  56029. },
  56030. args: [],
  56031. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  56032. referencedClasses: [],
  56033. messageSends: ["assert:", "includesSubString:", "deny:"]
  56034. }),
  56035. $globals.StringTest);
  56036. $core.addMethod(
  56037. $core.method({
  56038. selector: "testIndexOfStartingAtWithNull",
  56039. protocol: "tests",
  56040. fn: function (){
  56041. var self=this,$self=this;
  56042. return self;
  56043. },
  56044. args: [],
  56045. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56046. referencedClasses: [],
  56047. messageSends: []
  56048. }),
  56049. $globals.StringTest);
  56050. $core.addMethod(
  56051. $core.method({
  56052. selector: "testIndexOfWithNull",
  56053. protocol: "tests",
  56054. fn: function (){
  56055. var self=this,$self=this;
  56056. return self;
  56057. },
  56058. args: [],
  56059. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56060. referencedClasses: [],
  56061. messageSends: []
  56062. }),
  56063. $globals.StringTest);
  56064. $core.addMethod(
  56065. $core.method({
  56066. selector: "testIsVowel",
  56067. protocol: "tests",
  56068. fn: function (){
  56069. var self=this,$self=this;
  56070. var vowel,consonant;
  56071. return $core.withContext(function($ctx1) {
  56072. var $1;
  56073. vowel="u";
  56074. consonant="z";
  56075. $1=$recv(vowel)._isVowel();
  56076. $ctx1.sendIdx["isVowel"]=1;
  56077. $self._assert_equals_($1,true);
  56078. $ctx1.sendIdx["assert:equals:"]=1;
  56079. $self._assert_equals_($recv(consonant)._isVowel(),false);
  56080. return self;
  56081. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  56082. },
  56083. args: [],
  56084. 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",
  56085. referencedClasses: [],
  56086. messageSends: ["assert:equals:", "isVowel"]
  56087. }),
  56088. $globals.StringTest);
  56089. $core.addMethod(
  56090. $core.method({
  56091. selector: "testJoin",
  56092. protocol: "tests",
  56093. fn: function (){
  56094. var self=this,$self=this;
  56095. return $core.withContext(function($ctx1) {
  56096. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  56097. return self;
  56098. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  56099. },
  56100. args: [],
  56101. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  56102. referencedClasses: [],
  56103. messageSends: ["assert:equals:", "join:"]
  56104. }),
  56105. $globals.StringTest);
  56106. $core.addMethod(
  56107. $core.method({
  56108. selector: "testRegression1224",
  56109. protocol: "tests",
  56110. fn: function (){
  56111. var self=this,$self=this;
  56112. return $core.withContext(function($ctx1) {
  56113. var $2,$1;
  56114. $self._should_raise_((function(){
  56115. return $core.withContext(function($ctx2) {
  56116. $2=$recv($self._collectionClass())._new();
  56117. $recv($2)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  56118. }));
  56119. $1=$recv($2)._yourself();
  56120. return $recv($1)._size();
  56121. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56122. }),$globals.Error);
  56123. return self;
  56124. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.StringTest)});
  56125. },
  56126. args: [],
  56127. 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",
  56128. referencedClasses: ["Error"],
  56129. messageSends: ["should:raise:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  56130. }),
  56131. $globals.StringTest);
  56132. $core.addMethod(
  56133. $core.method({
  56134. selector: "testRemoveAll",
  56135. protocol: "tests",
  56136. fn: function (){
  56137. var self=this,$self=this;
  56138. return $core.withContext(function($ctx1) {
  56139. $self._should_raise_((function(){
  56140. return $core.withContext(function($ctx2) {
  56141. return $recv($self._collection())._removeAll();
  56142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56143. }),$globals.Error);
  56144. return self;
  56145. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  56146. },
  56147. args: [],
  56148. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  56149. referencedClasses: ["Error"],
  56150. messageSends: ["should:raise:", "removeAll", "collection"]
  56151. }),
  56152. $globals.StringTest);
  56153. $core.addMethod(
  56154. $core.method({
  56155. selector: "testReversed",
  56156. protocol: "tests",
  56157. fn: function (){
  56158. var self=this,$self=this;
  56159. return $core.withContext(function($ctx1) {
  56160. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  56161. return self;
  56162. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  56163. },
  56164. args: [],
  56165. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  56166. referencedClasses: [],
  56167. messageSends: ["assert:equals:", "reversed"]
  56168. }),
  56169. $globals.StringTest);
  56170. $core.addMethod(
  56171. $core.method({
  56172. selector: "testStreamContents",
  56173. protocol: "tests",
  56174. fn: function (){
  56175. var self=this,$self=this;
  56176. return $core.withContext(function($ctx1) {
  56177. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  56178. return $core.withContext(function($ctx2) {
  56179. $recv(aStream)._nextPutAll_("hello");
  56180. $ctx2.sendIdx["nextPutAll:"]=1;
  56181. $recv(aStream)._space();
  56182. return $recv(aStream)._nextPutAll_("world");
  56183. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  56184. })),"hello world");
  56185. return self;
  56186. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  56187. },
  56188. args: [],
  56189. 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'",
  56190. referencedClasses: ["String"],
  56191. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  56192. }),
  56193. $globals.StringTest);
  56194. $core.addMethod(
  56195. $core.method({
  56196. selector: "testSubStrings",
  56197. protocol: "tests",
  56198. fn: function (){
  56199. var self=this,$self=this;
  56200. return $core.withContext(function($ctx1) {
  56201. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  56202. return self;
  56203. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  56204. },
  56205. args: [],
  56206. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  56207. referencedClasses: [],
  56208. messageSends: ["assert:equals:", "subStrings:"]
  56209. }),
  56210. $globals.StringTest);
  56211. $core.addMethod(
  56212. $core.method({
  56213. selector: "testTrim",
  56214. protocol: "tests",
  56215. fn: function (){
  56216. var self=this,$self=this;
  56217. return $core.withContext(function($ctx1) {
  56218. $self._assert_equals_(" jackie"._trimLeft(),"jackie");
  56219. $ctx1.sendIdx["assert:equals:"]=1;
  56220. $self._assert_equals_("jackie "._trimRight(),"jackie");
  56221. return self;
  56222. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  56223. },
  56224. args: [],
  56225. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  56226. referencedClasses: [],
  56227. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  56228. }),
  56229. $globals.StringTest);
  56230. $core.addMethod(
  56231. $core.method({
  56232. selector: "testValue",
  56233. protocol: "tests",
  56234. fn: function (){
  56235. var self=this,$self=this;
  56236. return $core.withContext(function($ctx1) {
  56237. $self._assert_equals_("asString"._value_((1)),"1");
  56238. $ctx1.sendIdx["assert:equals:"]=1;
  56239. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  56240. return self;
  56241. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  56242. },
  56243. args: [],
  56244. 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')",
  56245. referencedClasses: [],
  56246. messageSends: ["assert:equals:", "value:", "collect:"]
  56247. }),
  56248. $globals.StringTest);
  56249. $core.addMethod(
  56250. $core.method({
  56251. selector: "collectionClass",
  56252. protocol: "fixture",
  56253. fn: function (){
  56254. var self=this,$self=this;
  56255. return $globals.String;
  56256. },
  56257. args: [],
  56258. source: "collectionClass\x0a\x09^ String",
  56259. referencedClasses: ["String"],
  56260. messageSends: []
  56261. }),
  56262. $globals.StringTest.a$cls);
  56263. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  56264. $core.addMethod(
  56265. $core.method({
  56266. selector: "collection",
  56267. protocol: "fixture",
  56268. fn: function (){
  56269. var self=this,$self=this;
  56270. return $core.withContext(function($ctx1) {
  56271. var $1;
  56272. $1=$recv($globals.Set)._new();
  56273. $recv($1)._add_($globals.Smalltalk);
  56274. $ctx1.sendIdx["add:"]=1;
  56275. $recv($1)._add_(nil);
  56276. $ctx1.sendIdx["add:"]=2;
  56277. $recv($1)._add_((3).__at((3)));
  56278. $ctx1.sendIdx["add:"]=3;
  56279. $recv($1)._add_(false);
  56280. $ctx1.sendIdx["add:"]=4;
  56281. $recv($1)._add_($self["@sampleBlock"]);
  56282. return $recv($1)._yourself();
  56283. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  56284. },
  56285. args: [],
  56286. 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",
  56287. referencedClasses: ["Set", "Smalltalk"],
  56288. messageSends: ["add:", "new", "@", "yourself"]
  56289. }),
  56290. $globals.SetTest);
  56291. $core.addMethod(
  56292. $core.method({
  56293. selector: "collectionOfPrintStrings",
  56294. protocol: "fixture",
  56295. fn: function (){
  56296. var self=this,$self=this;
  56297. return $core.withContext(function($ctx1) {
  56298. var $1;
  56299. $1=$recv($globals.Set)._new();
  56300. $recv($1)._add_("a SmalltalkImage");
  56301. $ctx1.sendIdx["add:"]=1;
  56302. $recv($1)._add_("nil");
  56303. $ctx1.sendIdx["add:"]=2;
  56304. $recv($1)._add_("3@3");
  56305. $ctx1.sendIdx["add:"]=3;
  56306. $recv($1)._add_("false");
  56307. $ctx1.sendIdx["add:"]=4;
  56308. $recv($1)._add_("a BlockClosure");
  56309. return $recv($1)._yourself();
  56310. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  56311. },
  56312. args: [],
  56313. 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",
  56314. referencedClasses: ["Set"],
  56315. messageSends: ["add:", "new", "yourself"]
  56316. }),
  56317. $globals.SetTest);
  56318. $core.addMethod(
  56319. $core.method({
  56320. selector: "collectionSize",
  56321. protocol: "fixture",
  56322. fn: function (){
  56323. var self=this,$self=this;
  56324. return (5);
  56325. },
  56326. args: [],
  56327. source: "collectionSize\x0a\x09^ 5",
  56328. referencedClasses: [],
  56329. messageSends: []
  56330. }),
  56331. $globals.SetTest);
  56332. $core.addMethod(
  56333. $core.method({
  56334. selector: "collectionWithDuplicates",
  56335. protocol: "fixture",
  56336. fn: function (){
  56337. var self=this,$self=this;
  56338. return $core.withContext(function($ctx1) {
  56339. var $1;
  56340. $1=$self._collection();
  56341. $recv($1)._add_((0));
  56342. return $recv($1)._yourself();
  56343. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  56344. },
  56345. args: [],
  56346. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  56347. referencedClasses: [],
  56348. messageSends: ["add:", "collection", "yourself"]
  56349. }),
  56350. $globals.SetTest);
  56351. $core.addMethod(
  56352. $core.method({
  56353. selector: "collectionWithNewValue",
  56354. protocol: "fixture",
  56355. fn: function (){
  56356. var self=this,$self=this;
  56357. return $core.withContext(function($ctx1) {
  56358. var $1;
  56359. $1=$recv($globals.Set)._new();
  56360. $recv($1)._add_($globals.Smalltalk);
  56361. $ctx1.sendIdx["add:"]=1;
  56362. $recv($1)._add_(nil);
  56363. $ctx1.sendIdx["add:"]=2;
  56364. $recv($1)._add_((3).__at((3)));
  56365. $ctx1.sendIdx["add:"]=3;
  56366. $recv($1)._add_("N");
  56367. $ctx1.sendIdx["add:"]=4;
  56368. $recv($1)._add_(false);
  56369. $ctx1.sendIdx["add:"]=5;
  56370. $recv($1)._add_($self["@sampleBlock"]);
  56371. return $recv($1)._yourself();
  56372. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  56373. },
  56374. args: [],
  56375. 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",
  56376. referencedClasses: ["Set", "Smalltalk"],
  56377. messageSends: ["add:", "new", "@", "yourself"]
  56378. }),
  56379. $globals.SetTest);
  56380. $core.addMethod(
  56381. $core.method({
  56382. selector: "testAddAll",
  56383. protocol: "tests",
  56384. fn: function (){
  56385. var self=this,$self=this;
  56386. return $core.withContext(function($ctx1) {
  56387. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  56388. (
  56389. $ctx1.supercall = true,
  56390. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  56391. $ctx1.supercall = false;
  56392. $2=$self._collection();
  56393. $ctx1.sendIdx["collection"]=1;
  56394. $3=$self._collection();
  56395. $ctx1.sendIdx["collection"]=2;
  56396. $recv($2)._addAll_($3);
  56397. $ctx1.sendIdx["addAll:"]=1;
  56398. $4=$recv($2)._yourself();
  56399. $ctx1.sendIdx["yourself"]=1;
  56400. $1=$4;
  56401. $5=$self._collection();
  56402. $ctx1.sendIdx["collection"]=3;
  56403. $self._assert_equals_($1,$5);
  56404. $ctx1.sendIdx["assert:equals:"]=1;
  56405. $7=$self._collection();
  56406. $ctx1.sendIdx["collection"]=4;
  56407. $8=$self._collectionWithNewValue();
  56408. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56409. $recv($7)._addAll_($8);
  56410. $ctx1.sendIdx["addAll:"]=2;
  56411. $9=$recv($7)._yourself();
  56412. $ctx1.sendIdx["yourself"]=2;
  56413. $6=$9;
  56414. $10=$self._collectionWithNewValue();
  56415. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56416. $self._assert_equals_($6,$10);
  56417. $ctx1.sendIdx["assert:equals:"]=2;
  56418. $12=$self._collectionWithNewValue();
  56419. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56420. $recv($12)._addAll_($self._collection());
  56421. $11=$recv($12)._yourself();
  56422. $self._assert_equals_($11,$self._collectionWithNewValue());
  56423. return self;
  56424. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  56425. },
  56426. args: [],
  56427. 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",
  56428. referencedClasses: [],
  56429. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  56430. }),
  56431. $globals.SetTest);
  56432. $core.addMethod(
  56433. $core.method({
  56434. selector: "testAddRemove",
  56435. protocol: "tests",
  56436. fn: function (){
  56437. var self=this,$self=this;
  56438. var set;
  56439. return $core.withContext(function($ctx1) {
  56440. var $1,$2;
  56441. set=$recv($globals.Set)._new();
  56442. $self._assert_($recv(set)._isEmpty());
  56443. $ctx1.sendIdx["assert:"]=1;
  56444. $recv(set)._add_((3));
  56445. $ctx1.sendIdx["add:"]=1;
  56446. $1=$recv(set)._includes_((3));
  56447. $ctx1.sendIdx["includes:"]=1;
  56448. $self._assert_($1);
  56449. $ctx1.sendIdx["assert:"]=2;
  56450. $recv(set)._add_((5));
  56451. $2=$recv(set)._includes_((5));
  56452. $ctx1.sendIdx["includes:"]=2;
  56453. $self._assert_($2);
  56454. $recv(set)._remove_((3));
  56455. $self._deny_($recv(set)._includes_((3)));
  56456. return self;
  56457. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  56458. },
  56459. args: [],
  56460. 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)",
  56461. referencedClasses: ["Set"],
  56462. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  56463. }),
  56464. $globals.SetTest);
  56465. $core.addMethod(
  56466. $core.method({
  56467. selector: "testAt",
  56468. protocol: "tests",
  56469. fn: function (){
  56470. var self=this,$self=this;
  56471. return $core.withContext(function($ctx1) {
  56472. $self._should_raise_((function(){
  56473. return $core.withContext(function($ctx2) {
  56474. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  56475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56476. }),$globals.Error);
  56477. return self;
  56478. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  56479. },
  56480. args: [],
  56481. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  56482. referencedClasses: ["Set", "Error"],
  56483. messageSends: ["should:raise:", "at:put:", "new"]
  56484. }),
  56485. $globals.SetTest);
  56486. $core.addMethod(
  56487. $core.method({
  56488. selector: "testCollect",
  56489. protocol: "tests",
  56490. fn: function (){
  56491. var self=this,$self=this;
  56492. return $core.withContext(function($ctx1) {
  56493. var $2,$1;
  56494. (
  56495. $ctx1.supercall = true,
  56496. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($self, []));
  56497. $ctx1.supercall = false;
  56498. $2=[(5), (6), (8)]._asSet();
  56499. $ctx1.sendIdx["asSet"]=1;
  56500. $1=$recv($2)._collect_((function(x){
  56501. return $core.withContext(function($ctx2) {
  56502. return $recv(x).__backslash_backslash((3));
  56503. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56504. }));
  56505. $self._assert_equals_($1,[(0), (2)]._asSet());
  56506. return self;
  56507. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  56508. },
  56509. args: [],
  56510. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  56511. referencedClasses: [],
  56512. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  56513. }),
  56514. $globals.SetTest);
  56515. $core.addMethod(
  56516. $core.method({
  56517. selector: "testComma",
  56518. protocol: "tests",
  56519. fn: function (){
  56520. var self=this,$self=this;
  56521. return $core.withContext(function($ctx1) {
  56522. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  56523. (
  56524. $ctx1.supercall = true,
  56525. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  56526. $ctx1.supercall = false;
  56527. $2=$self._collection();
  56528. $ctx1.sendIdx["collection"]=1;
  56529. $3=$self._collection();
  56530. $ctx1.sendIdx["collection"]=2;
  56531. $1=$recv($2).__comma($3);
  56532. $ctx1.sendIdx[","]=1;
  56533. $4=$self._collection();
  56534. $ctx1.sendIdx["collection"]=3;
  56535. $self._assert_equals_($1,$4);
  56536. $ctx1.sendIdx["assert:equals:"]=1;
  56537. $6=$self._collection();
  56538. $ctx1.sendIdx["collection"]=4;
  56539. $7=$self._collectionWithNewValue();
  56540. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56541. $5=$recv($6).__comma($7);
  56542. $ctx1.sendIdx[","]=2;
  56543. $8=$self._collectionWithNewValue();
  56544. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56545. $self._assert_equals_($5,$8);
  56546. $ctx1.sendIdx["assert:equals:"]=2;
  56547. $10=$self._collectionWithNewValue();
  56548. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56549. $9=$recv($10).__comma($self._collection());
  56550. $self._assert_equals_($9,$self._collectionWithNewValue());
  56551. return self;
  56552. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  56553. },
  56554. args: [],
  56555. 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",
  56556. referencedClasses: [],
  56557. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  56558. }),
  56559. $globals.SetTest);
  56560. $core.addMethod(
  56561. $core.method({
  56562. selector: "testComparing",
  56563. protocol: "tests",
  56564. fn: function (){
  56565. var self=this,$self=this;
  56566. return $core.withContext(function($ctx1) {
  56567. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  56568. $1=[(0), (2)]._asSet();
  56569. $ctx1.sendIdx["asSet"]=1;
  56570. $2=[(0), (2)]._asSet();
  56571. $ctx1.sendIdx["asSet"]=2;
  56572. $self._assert_equals_($1,$2);
  56573. $ctx1.sendIdx["assert:equals:"]=1;
  56574. $3=[(2), (0)]._asSet();
  56575. $ctx1.sendIdx["asSet"]=3;
  56576. $4=[(0), (2)]._asSet();
  56577. $ctx1.sendIdx["asSet"]=4;
  56578. $self._assert_equals_($3,$4);
  56579. $6=[(0), (2), (3)]._asSet();
  56580. $ctx1.sendIdx["asSet"]=5;
  56581. $7=[(0), (2)]._asSet();
  56582. $ctx1.sendIdx["asSet"]=6;
  56583. $5=$recv($6).__eq($7);
  56584. $ctx1.sendIdx["="]=1;
  56585. $self._deny_($5);
  56586. $ctx1.sendIdx["deny:"]=1;
  56587. $9=[(1), (2)]._asSet();
  56588. $ctx1.sendIdx["asSet"]=7;
  56589. $8=$recv($9).__eq([(0), (2)]._asSet());
  56590. $self._deny_($8);
  56591. return self;
  56592. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  56593. },
  56594. args: [],
  56595. 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",
  56596. referencedClasses: [],
  56597. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  56598. }),
  56599. $globals.SetTest);
  56600. $core.addMethod(
  56601. $core.method({
  56602. selector: "testPrintString",
  56603. protocol: "tests",
  56604. fn: function (){
  56605. var self=this,$self=this;
  56606. var set;
  56607. return $core.withContext(function($ctx1) {
  56608. var $1,$2,$3,$4,$5,$6,$7,$8;
  56609. set=$recv($globals.Set)._new();
  56610. $1=$recv(set)._printString();
  56611. $ctx1.sendIdx["printString"]=1;
  56612. $self._assert_equals_($1,"a Set ()");
  56613. $ctx1.sendIdx["assert:equals:"]=1;
  56614. $2=set;
  56615. $recv($2)._add_((1));
  56616. $ctx1.sendIdx["add:"]=1;
  56617. $3=$recv($2)._add_((3));
  56618. $ctx1.sendIdx["add:"]=2;
  56619. $4=$recv(set)._printString();
  56620. $ctx1.sendIdx["printString"]=2;
  56621. $self._assert_equals_($4,"a Set (1 3)");
  56622. $ctx1.sendIdx["assert:equals:"]=2;
  56623. $recv(set)._add_("foo");
  56624. $ctx1.sendIdx["add:"]=3;
  56625. $5=$recv(set)._printString();
  56626. $ctx1.sendIdx["printString"]=3;
  56627. $self._assert_equals_($5,"a Set (1 3 'foo')");
  56628. $ctx1.sendIdx["assert:equals:"]=3;
  56629. $6=set;
  56630. $recv($6)._remove_((1));
  56631. $ctx1.sendIdx["remove:"]=1;
  56632. $recv($6)._remove_((3));
  56633. $7=$recv(set)._printString();
  56634. $ctx1.sendIdx["printString"]=4;
  56635. $self._assert_equals_($7,"a Set ('foo')");
  56636. $ctx1.sendIdx["assert:equals:"]=4;
  56637. $recv(set)._add_((3));
  56638. $ctx1.sendIdx["add:"]=4;
  56639. $8=$recv(set)._printString();
  56640. $ctx1.sendIdx["printString"]=5;
  56641. $self._assert_equals_($8,"a Set (3 'foo')");
  56642. $ctx1.sendIdx["assert:equals:"]=5;
  56643. $recv(set)._add_((3));
  56644. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  56645. return self;
  56646. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  56647. },
  56648. args: [],
  56649. 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'')'",
  56650. referencedClasses: ["Set"],
  56651. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  56652. }),
  56653. $globals.SetTest);
  56654. $core.addMethod(
  56655. $core.method({
  56656. selector: "testUnboxedObjects",
  56657. protocol: "tests",
  56658. fn: function (){
  56659. var self=this,$self=this;
  56660. return $core.withContext(function($ctx1) {
  56661. var $4,$3,$2,$1;
  56662. $4="foo"._yourself();
  56663. $ctx1.sendIdx["yourself"]=1;
  56664. $3=[$4,"foo"._yourself()];
  56665. $2=$recv($3)._asSet();
  56666. $1=$recv($2)._asArray();
  56667. $self._assert_equals_($1,["foo"]);
  56668. return self;
  56669. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  56670. },
  56671. args: [],
  56672. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  56673. referencedClasses: [],
  56674. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  56675. }),
  56676. $globals.SetTest);
  56677. $core.addMethod(
  56678. $core.method({
  56679. selector: "testUnicity",
  56680. protocol: "tests",
  56681. fn: function (){
  56682. var self=this,$self=this;
  56683. var set;
  56684. return $core.withContext(function($ctx1) {
  56685. var $1;
  56686. set=$recv($globals.Set)._new();
  56687. $recv(set)._add_((21));
  56688. $ctx1.sendIdx["add:"]=1;
  56689. $recv(set)._add_("hello");
  56690. $ctx1.sendIdx["add:"]=2;
  56691. $recv(set)._add_((21));
  56692. $ctx1.sendIdx["add:"]=3;
  56693. $1=$recv(set)._size();
  56694. $ctx1.sendIdx["size"]=1;
  56695. $self._assert_equals_($1,(2));
  56696. $ctx1.sendIdx["assert:equals:"]=1;
  56697. $recv(set)._add_("hello");
  56698. $self._assert_equals_($recv(set)._size(),(2));
  56699. $ctx1.sendIdx["assert:equals:"]=2;
  56700. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  56701. return self;
  56702. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  56703. },
  56704. args: [],
  56705. 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')",
  56706. referencedClasses: ["Set"],
  56707. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  56708. }),
  56709. $globals.SetTest);
  56710. $core.addMethod(
  56711. $core.method({
  56712. selector: "collectionClass",
  56713. protocol: "fixture",
  56714. fn: function (){
  56715. var self=this,$self=this;
  56716. return $globals.Set;
  56717. },
  56718. args: [],
  56719. source: "collectionClass\x0a\x09^ Set",
  56720. referencedClasses: ["Set"],
  56721. messageSends: []
  56722. }),
  56723. $globals.SetTest.a$cls);
  56724. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  56725. $core.addMethod(
  56726. $core.method({
  56727. selector: "testShow",
  56728. protocol: "tests",
  56729. fn: function (){
  56730. var self=this,$self=this;
  56731. var originalTranscript;
  56732. return $core.withContext(function($ctx1) {
  56733. originalTranscript=$recv($globals.Transcript)._current();
  56734. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  56735. $ctx1.sendIdx["register:"]=1;
  56736. $self._shouldnt_raise_((function(){
  56737. return $core.withContext(function($ctx2) {
  56738. return $recv($globals.Transcript)._show_("Hello console!");
  56739. $ctx2.sendIdx["show:"]=1;
  56740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56741. }),$globals.Error);
  56742. $ctx1.sendIdx["shouldnt:raise:"]=1;
  56743. $self._shouldnt_raise_((function(){
  56744. return $core.withContext(function($ctx2) {
  56745. return $recv($globals.Transcript)._show_(console);
  56746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56747. }),$globals.Error);
  56748. $recv($globals.Transcript)._register_(originalTranscript);
  56749. return self;
  56750. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  56751. },
  56752. args: [],
  56753. 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.",
  56754. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  56755. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  56756. }),
  56757. $globals.ConsoleTranscriptTest);
  56758. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  56759. $core.addMethod(
  56760. $core.method({
  56761. selector: "testEquality",
  56762. protocol: "tests",
  56763. fn: function (){
  56764. var self=this,$self=this;
  56765. var now;
  56766. return $core.withContext(function($ctx1) {
  56767. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  56768. now=$recv($globals.Date)._new();
  56769. $1=$recv(now).__eq(now);
  56770. $ctx1.sendIdx["="]=1;
  56771. $self._assert_($1);
  56772. $ctx1.sendIdx["assert:"]=1;
  56773. $3=now;
  56774. $4=$recv($globals.Date)._fromMilliseconds_((0));
  56775. $ctx1.sendIdx["fromMilliseconds:"]=1;
  56776. $2=$recv($3).__eq($4);
  56777. $ctx1.sendIdx["="]=2;
  56778. $self._deny_($2);
  56779. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  56780. $ctx1.sendIdx["fromMilliseconds:"]=2;
  56781. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  56782. $ctx1.sendIdx["fromMilliseconds:"]=3;
  56783. $5=$recv($6).__eq($7);
  56784. $ctx1.sendIdx["="]=3;
  56785. $self._assert_($5);
  56786. $ctx1.sendIdx["assert:"]=2;
  56787. $9=now;
  56788. $11=$recv(now)._asMilliseconds();
  56789. $ctx1.sendIdx["asMilliseconds"]=1;
  56790. $10=$recv($globals.Date)._fromMilliseconds_($11);
  56791. $ctx1.sendIdx["fromMilliseconds:"]=4;
  56792. $8=$recv($9).__eq($10);
  56793. $ctx1.sendIdx["="]=4;
  56794. $self._assert_($8);
  56795. $ctx1.sendIdx["assert:"]=3;
  56796. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  56797. return self;
  56798. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  56799. },
  56800. args: [],
  56801. 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",
  56802. referencedClasses: ["Date"],
  56803. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  56804. }),
  56805. $globals.DateTest);
  56806. $core.addMethod(
  56807. $core.method({
  56808. selector: "testIdentity",
  56809. protocol: "tests",
  56810. fn: function (){
  56811. var self=this,$self=this;
  56812. var now;
  56813. return $core.withContext(function($ctx1) {
  56814. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  56815. now=$recv($globals.Date)._new();
  56816. $1=$recv(now).__eq_eq(now);
  56817. $ctx1.sendIdx["=="]=1;
  56818. $self._assert_($1);
  56819. $3=now;
  56820. $4=$recv($globals.Date)._fromMilliseconds_((0));
  56821. $ctx1.sendIdx["fromMilliseconds:"]=1;
  56822. $2=$recv($3).__eq_eq($4);
  56823. $ctx1.sendIdx["=="]=2;
  56824. $self._deny_($2);
  56825. $ctx1.sendIdx["deny:"]=1;
  56826. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  56827. $ctx1.sendIdx["fromMilliseconds:"]=2;
  56828. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  56829. $ctx1.sendIdx["fromMilliseconds:"]=3;
  56830. $5=$recv($6).__eq_eq($7);
  56831. $ctx1.sendIdx["=="]=3;
  56832. $self._deny_($5);
  56833. $ctx1.sendIdx["deny:"]=2;
  56834. $9=now;
  56835. $11=$recv(now)._asMilliseconds();
  56836. $ctx1.sendIdx["asMilliseconds"]=1;
  56837. $10=$recv($globals.Date)._fromMilliseconds_($11);
  56838. $ctx1.sendIdx["fromMilliseconds:"]=4;
  56839. $8=$recv($9).__eq_eq($10);
  56840. $ctx1.sendIdx["=="]=4;
  56841. $self._deny_($8);
  56842. $ctx1.sendIdx["deny:"]=3;
  56843. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  56844. return self;
  56845. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  56846. },
  56847. args: [],
  56848. 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",
  56849. referencedClasses: ["Date"],
  56850. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  56851. }),
  56852. $globals.DateTest);
  56853. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  56854. $core.addMethod(
  56855. $core.method({
  56856. selector: "jsNull",
  56857. protocol: "accessing",
  56858. fn: function (){
  56859. var self=this,$self=this;
  56860. return $core.withContext(function($ctx1) {
  56861. return null;
  56862. return self;
  56863. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  56864. },
  56865. args: [],
  56866. source: "jsNull\x0a\x09<inlineJS: 'return null'>",
  56867. referencedClasses: [],
  56868. messageSends: []
  56869. }),
  56870. $globals.JSObjectProxyTest);
  56871. $core.addMethod(
  56872. $core.method({
  56873. selector: "jsObject",
  56874. protocol: "accessing",
  56875. fn: function (){
  56876. var self=this,$self=this;
  56877. return $core.withContext(function($ctx1) {
  56878. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  56879. return self;
  56880. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  56881. },
  56882. args: [],
  56883. 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}'>",
  56884. referencedClasses: [],
  56885. messageSends: []
  56886. }),
  56887. $globals.JSObjectProxyTest);
  56888. $core.addMethod(
  56889. $core.method({
  56890. selector: "jsUndefined",
  56891. protocol: "accessing",
  56892. fn: function (){
  56893. var self=this,$self=this;
  56894. return $core.withContext(function($ctx1) {
  56895. return;
  56896. return self;
  56897. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  56898. },
  56899. args: [],
  56900. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  56901. referencedClasses: [],
  56902. messageSends: []
  56903. }),
  56904. $globals.JSObjectProxyTest);
  56905. $core.addMethod(
  56906. $core.method({
  56907. selector: "testAtIfAbsent",
  56908. protocol: "tests",
  56909. fn: function (){
  56910. var self=this,$self=this;
  56911. var testObject;
  56912. return $core.withContext(function($ctx1) {
  56913. var $1,$2,$3;
  56914. testObject=$self._jsObject();
  56915. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  56916. return "Property does not exist";
  56917. }));
  56918. $ctx1.sendIdx["at:ifAbsent:"]=1;
  56919. $self._assert_equals_($1,"Property does not exist");
  56920. $ctx1.sendIdx["assert:equals:"]=1;
  56921. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  56922. return "Property does not exist";
  56923. }));
  56924. $ctx1.sendIdx["at:ifAbsent:"]=2;
  56925. $self._assert_equals_($2,nil);
  56926. $ctx1.sendIdx["assert:equals:"]=2;
  56927. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  56928. return "Property does not exist";
  56929. }));
  56930. $ctx1.sendIdx["at:ifAbsent:"]=3;
  56931. $self._assert_equals_($3,(1));
  56932. $ctx1.sendIdx["assert:equals:"]=3;
  56933. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  56934. return "Property does not exist";
  56935. })),nil);
  56936. return self;
  56937. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  56938. },
  56939. args: [],
  56940. 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.",
  56941. referencedClasses: [],
  56942. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  56943. }),
  56944. $globals.JSObjectProxyTest);
  56945. $core.addMethod(
  56946. $core.method({
  56947. selector: "testAtIfPresent",
  56948. protocol: "tests",
  56949. fn: function (){
  56950. var self=this,$self=this;
  56951. var testObject;
  56952. return $core.withContext(function($ctx1) {
  56953. var $2,$1,$4,$3,$6,$5;
  56954. testObject=$self._jsObject();
  56955. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  56956. return $core.withContext(function($ctx2) {
  56957. $2=$recv(x)._asString();
  56958. $ctx2.sendIdx["asString"]=1;
  56959. return "hello ".__comma($2);
  56960. $ctx2.sendIdx[","]=1;
  56961. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56962. }));
  56963. $ctx1.sendIdx["at:ifPresent:"]=1;
  56964. $self._assert_equals_($1,nil);
  56965. $ctx1.sendIdx["assert:equals:"]=1;
  56966. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  56967. return $core.withContext(function($ctx2) {
  56968. $4=$recv(x)._asString();
  56969. $ctx2.sendIdx["asString"]=2;
  56970. return "hello ".__comma($4);
  56971. $ctx2.sendIdx[","]=2;
  56972. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  56973. }));
  56974. $ctx1.sendIdx["at:ifPresent:"]=2;
  56975. $self._assert_equals_($3,"hello nil");
  56976. $ctx1.sendIdx["assert:equals:"]=2;
  56977. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  56978. return $core.withContext(function($ctx2) {
  56979. $6=$recv(x)._asString();
  56980. $ctx2.sendIdx["asString"]=3;
  56981. return "hello ".__comma($6);
  56982. $ctx2.sendIdx[","]=3;
  56983. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  56984. }));
  56985. $ctx1.sendIdx["at:ifPresent:"]=3;
  56986. $self._assert_equals_($5,"hello 1");
  56987. $ctx1.sendIdx["assert:equals:"]=3;
  56988. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  56989. return $core.withContext(function($ctx2) {
  56990. return "hello ".__comma($recv(x)._asString());
  56991. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  56992. })),"hello nil");
  56993. return self;
  56994. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  56995. },
  56996. args: [],
  56997. 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'.",
  56998. referencedClasses: [],
  56999. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  57000. }),
  57001. $globals.JSObjectProxyTest);
  57002. $core.addMethod(
  57003. $core.method({
  57004. selector: "testAtIfPresentIfAbsent",
  57005. protocol: "tests",
  57006. fn: function (){
  57007. var self=this,$self=this;
  57008. var testObject;
  57009. return $core.withContext(function($ctx1) {
  57010. var $2,$1,$4,$3,$6,$5;
  57011. testObject=$self._jsObject();
  57012. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  57013. return $core.withContext(function($ctx2) {
  57014. $2=$recv(x)._asString();
  57015. $ctx2.sendIdx["asString"]=1;
  57016. return "hello ".__comma($2);
  57017. $ctx2.sendIdx[","]=1;
  57018. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57019. }),(function(){
  57020. return "not present";
  57021. }));
  57022. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  57023. $self._assert_equals_($1,"not present");
  57024. $ctx1.sendIdx["assert:equals:"]=1;
  57025. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  57026. return $core.withContext(function($ctx2) {
  57027. $4=$recv(x)._asString();
  57028. $ctx2.sendIdx["asString"]=2;
  57029. return "hello ".__comma($4);
  57030. $ctx2.sendIdx[","]=2;
  57031. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57032. }),(function(){
  57033. return "not present";
  57034. }));
  57035. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  57036. $self._assert_equals_($3,"hello nil");
  57037. $ctx1.sendIdx["assert:equals:"]=2;
  57038. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  57039. return $core.withContext(function($ctx2) {
  57040. $6=$recv(x)._asString();
  57041. $ctx2.sendIdx["asString"]=3;
  57042. return "hello ".__comma($6);
  57043. $ctx2.sendIdx[","]=3;
  57044. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  57045. }),(function(){
  57046. return "not present";
  57047. }));
  57048. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  57049. $self._assert_equals_($5,"hello 1");
  57050. $ctx1.sendIdx["assert:equals:"]=3;
  57051. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  57052. return $core.withContext(function($ctx2) {
  57053. return "hello ".__comma($recv(x)._asString());
  57054. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  57055. }),(function(){
  57056. return "not present";
  57057. })),"hello nil");
  57058. return self;
  57059. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57060. },
  57061. args: [],
  57062. 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'.",
  57063. referencedClasses: [],
  57064. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  57065. }),
  57066. $globals.JSObjectProxyTest);
  57067. $core.addMethod(
  57068. $core.method({
  57069. selector: "testAtPut",
  57070. protocol: "tests",
  57071. fn: function (){
  57072. var self=this,$self=this;
  57073. var testObject;
  57074. return $core.withContext(function($ctx1) {
  57075. var $2,$1;
  57076. testObject=$self._jsObject();
  57077. $2=$recv(testObject)._at_("abc");
  57078. $ctx1.sendIdx["at:"]=1;
  57079. $1=$recv($2).__tild_eq("xyz");
  57080. $self._assert_($1);
  57081. $self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  57082. $ctx1.sendIdx["assert:equals:"]=1;
  57083. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  57084. return self;
  57085. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  57086. },
  57087. args: [],
  57088. 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'",
  57089. referencedClasses: [],
  57090. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  57091. }),
  57092. $globals.JSObjectProxyTest);
  57093. $core.addMethod(
  57094. $core.method({
  57095. selector: "testComparison",
  57096. protocol: "tests",
  57097. fn: function (){
  57098. var self=this,$self=this;
  57099. return $core.withContext(function($ctx1) {
  57100. var $1,$2;
  57101. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  57102. $1=$recv(console).__eq(console);
  57103. $ctx1.sendIdx["="]=1;
  57104. $self._assert_($1);
  57105. $2=$recv(console).__eq($recv($globals.Object)._new());
  57106. $ctx1.sendIdx["="]=2;
  57107. $self._deny_($2);
  57108. $ctx1.sendIdx["deny:"]=1;
  57109. $self._deny_($recv(console).__eq($self._jsObject()));
  57110. return self;
  57111. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  57112. },
  57113. args: [],
  57114. 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",
  57115. referencedClasses: ["Object"],
  57116. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  57117. }),
  57118. $globals.JSObjectProxyTest);
  57119. $core.addMethod(
  57120. $core.method({
  57121. selector: "testDNU",
  57122. protocol: "tests",
  57123. fn: function (){
  57124. var self=this,$self=this;
  57125. return $core.withContext(function($ctx1) {
  57126. $self._should_raise_((function(){
  57127. return $core.withContext(function($ctx2) {
  57128. return $recv($self._jsObject())._foo();
  57129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57130. }),$globals.MessageNotUnderstood);
  57131. return self;
  57132. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  57133. },
  57134. args: [],
  57135. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  57136. referencedClasses: ["MessageNotUnderstood"],
  57137. messageSends: ["should:raise:", "foo", "jsObject"]
  57138. }),
  57139. $globals.JSObjectProxyTest);
  57140. $core.addMethod(
  57141. $core.method({
  57142. selector: "testDNUWithAllowJavaScriptCalls",
  57143. protocol: "tests",
  57144. fn: function (){
  57145. var self=this,$self=this;
  57146. var jsObject;
  57147. return $core.withContext(function($ctx1) {
  57148. jsObject=[];
  57149. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  57150. $self._should_raise_((function(){
  57151. return $core.withContext(function($ctx2) {
  57152. return $recv(jsObject)._foo();
  57153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57154. }),$globals.MessageNotUnderstood);
  57155. return self;
  57156. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57157. },
  57158. args: [],
  57159. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  57160. referencedClasses: ["MessageNotUnderstood"],
  57161. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  57162. }),
  57163. $globals.JSObjectProxyTest);
  57164. $core.addMethod(
  57165. $core.method({
  57166. selector: "testMessageSend",
  57167. protocol: "tests",
  57168. fn: function (){
  57169. var self=this,$self=this;
  57170. return $core.withContext(function($ctx1) {
  57171. var $2,$1,$4,$3;
  57172. $2=$self._jsObject();
  57173. $ctx1.sendIdx["jsObject"]=1;
  57174. $1=$recv($2)._a();
  57175. $self._assert_equals_($1,(1));
  57176. $ctx1.sendIdx["assert:equals:"]=1;
  57177. $4=$self._jsObject();
  57178. $ctx1.sendIdx["jsObject"]=2;
  57179. $3=$recv($4)._b();
  57180. $self._assert_equals_($3,(2));
  57181. $ctx1.sendIdx["assert:equals:"]=2;
  57182. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  57183. return self;
  57184. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  57185. },
  57186. args: [],
  57187. 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",
  57188. referencedClasses: [],
  57189. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  57190. }),
  57191. $globals.JSObjectProxyTest);
  57192. $core.addMethod(
  57193. $core.method({
  57194. selector: "testMethodWithArguments",
  57195. protocol: "tests",
  57196. fn: function (){
  57197. var self=this,$self=this;
  57198. return $core.withContext(function($ctx1) {
  57199. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  57200. return self;
  57201. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  57202. },
  57203. args: [],
  57204. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  57205. referencedClasses: [],
  57206. messageSends: ["assert:equals:", "c:", "jsObject"]
  57207. }),
  57208. $globals.JSObjectProxyTest);
  57209. $core.addMethod(
  57210. $core.method({
  57211. selector: "testPrinting",
  57212. protocol: "tests",
  57213. fn: function (){
  57214. var self=this,$self=this;
  57215. return $core.withContext(function($ctx1) {
  57216. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  57217. return self;
  57218. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  57219. },
  57220. args: [],
  57221. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  57222. referencedClasses: [],
  57223. messageSends: ["assert:equals:", "printString", "jsObject"]
  57224. }),
  57225. $globals.JSObjectProxyTest);
  57226. $core.addMethod(
  57227. $core.method({
  57228. selector: "testPropertyThatReturnsEmptyString",
  57229. protocol: "tests",
  57230. fn: function (){
  57231. var self=this,$self=this;
  57232. var object;
  57233. return $core.withContext(function($ctx1) {
  57234. var $1;
  57235. object=$self._jsObject();
  57236. $1=$recv(object)._d();
  57237. $ctx1.sendIdx["d"]=1;
  57238. $self._assert_equals_($1,"");
  57239. $ctx1.sendIdx["assert:equals:"]=1;
  57240. $recv(object)._d_("hello");
  57241. $self._assert_equals_($recv(object)._d(),"hello");
  57242. return self;
  57243. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  57244. },
  57245. args: [],
  57246. 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'",
  57247. referencedClasses: [],
  57248. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  57249. }),
  57250. $globals.JSObjectProxyTest);
  57251. $core.addMethod(
  57252. $core.method({
  57253. selector: "testPropertyThatReturnsUndefined",
  57254. protocol: "tests",
  57255. fn: function (){
  57256. var self=this,$self=this;
  57257. var object;
  57258. return $core.withContext(function($ctx1) {
  57259. object=$self._jsObject();
  57260. $self._shouldnt_raise_((function(){
  57261. return $core.withContext(function($ctx2) {
  57262. return $recv(object)._e();
  57263. $ctx2.sendIdx["e"]=1;
  57264. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57265. }),$globals.MessageNotUnderstood);
  57266. $self._assert_($recv($recv(object)._e())._isNil());
  57267. return self;
  57268. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  57269. },
  57270. args: [],
  57271. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  57272. referencedClasses: ["MessageNotUnderstood"],
  57273. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  57274. }),
  57275. $globals.JSObjectProxyTest);
  57276. $core.addMethod(
  57277. $core.method({
  57278. selector: "testSetPropertyWithFalsyValue",
  57279. protocol: "tests",
  57280. fn: function (){
  57281. var self=this,$self=this;
  57282. var jsObject;
  57283. return $core.withContext(function($ctx1) {
  57284. var $1,$2,$3,$4,$5;
  57285. jsObject=$self._jsObject();
  57286. $1=$recv(jsObject)._a();
  57287. $ctx1.sendIdx["a"]=1;
  57288. $self._assert_equals_($1,(1));
  57289. $ctx1.sendIdx["assert:equals:"]=1;
  57290. $recv(jsObject)._a_($self._jsNull());
  57291. $ctx1.sendIdx["a:"]=1;
  57292. $2=$recv(jsObject)._a();
  57293. $ctx1.sendIdx["a"]=2;
  57294. $self._assert_equals_($2,nil);
  57295. $ctx1.sendIdx["assert:equals:"]=2;
  57296. $recv(jsObject)._a_((0));
  57297. $ctx1.sendIdx["a:"]=2;
  57298. $3=$recv(jsObject)._a();
  57299. $ctx1.sendIdx["a"]=3;
  57300. $self._assert_equals_($3,(0));
  57301. $ctx1.sendIdx["assert:equals:"]=3;
  57302. $recv(jsObject)._a_($self._jsUndefined());
  57303. $ctx1.sendIdx["a:"]=3;
  57304. $4=$recv(jsObject)._a();
  57305. $ctx1.sendIdx["a"]=4;
  57306. $self._assert_equals_($4,nil);
  57307. $ctx1.sendIdx["assert:equals:"]=4;
  57308. $recv(jsObject)._a_("");
  57309. $ctx1.sendIdx["a:"]=4;
  57310. $5=$recv(jsObject)._a();
  57311. $ctx1.sendIdx["a"]=5;
  57312. $self._assert_equals_($5,"");
  57313. $ctx1.sendIdx["assert:equals:"]=5;
  57314. $recv(jsObject)._a_(false);
  57315. $self._assert_equals_($recv(jsObject)._a(),false);
  57316. return self;
  57317. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57318. },
  57319. args: [],
  57320. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  57321. referencedClasses: [],
  57322. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  57323. }),
  57324. $globals.JSObjectProxyTest);
  57325. $core.addMethod(
  57326. $core.method({
  57327. selector: "testValue",
  57328. protocol: "tests",
  57329. fn: function (){
  57330. var self=this,$self=this;
  57331. var testObject;
  57332. return $core.withContext(function($ctx1) {
  57333. testObject=$self._jsObject();
  57334. $recv(testObject)._at_put_("value","aValue");
  57335. $self._assert_equals_($recv(testObject)._value(),"aValue");
  57336. return self;
  57337. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  57338. },
  57339. args: [],
  57340. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  57341. referencedClasses: [],
  57342. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  57343. }),
  57344. $globals.JSObjectProxyTest);
  57345. $core.addMethod(
  57346. $core.method({
  57347. selector: "testYourself",
  57348. protocol: "tests",
  57349. fn: function (){
  57350. var self=this,$self=this;
  57351. var object;
  57352. return $core.withContext(function($ctx1) {
  57353. var $1;
  57354. $1=$self._jsObject();
  57355. $recv($1)._d_("test");
  57356. object=$recv($1)._yourself();
  57357. $self._assert_equals_($recv(object)._d(),"test");
  57358. return self;
  57359. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  57360. },
  57361. args: [],
  57362. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  57363. referencedClasses: [],
  57364. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  57365. }),
  57366. $globals.JSObjectProxyTest);
  57367. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  57368. $core.addMethod(
  57369. $core.method({
  57370. selector: "testCatchingException",
  57371. protocol: "tests",
  57372. fn: function (){
  57373. var self=this,$self=this;
  57374. return $core.withContext(function($ctx1) {
  57375. $recv((function(){
  57376. return $core.withContext(function($ctx2) {
  57377. return $self._throwException();
  57378. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57379. }))._on_do_($globals.Error,(function(error){
  57380. return $core.withContext(function($ctx2) {
  57381. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  57382. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57383. }));
  57384. return self;
  57385. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  57386. },
  57387. args: [],
  57388. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  57389. referencedClasses: ["Error"],
  57390. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  57391. }),
  57392. $globals.JavaScriptExceptionTest);
  57393. $core.addMethod(
  57394. $core.method({
  57395. selector: "testRaisingException",
  57396. protocol: "tests",
  57397. fn: function (){
  57398. var self=this,$self=this;
  57399. return $core.withContext(function($ctx1) {
  57400. $self._should_raise_((function(){
  57401. return $core.withContext(function($ctx2) {
  57402. return $self._throwException();
  57403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57404. }),$globals.JavaScriptException);
  57405. return self;
  57406. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  57407. },
  57408. args: [],
  57409. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  57410. referencedClasses: ["JavaScriptException"],
  57411. messageSends: ["should:raise:", "throwException"]
  57412. }),
  57413. $globals.JavaScriptExceptionTest);
  57414. $core.addMethod(
  57415. $core.method({
  57416. selector: "throwException",
  57417. protocol: "helpers",
  57418. fn: function (){
  57419. var self=this,$self=this;
  57420. return $core.withContext(function($ctx1) {
  57421. throw "test";
  57422. return self;
  57423. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  57424. },
  57425. args: [],
  57426. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  57427. referencedClasses: [],
  57428. messageSends: []
  57429. }),
  57430. $globals.JavaScriptExceptionTest);
  57431. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  57432. $core.addMethod(
  57433. $core.method({
  57434. selector: "testValue",
  57435. protocol: "tests",
  57436. fn: function (){
  57437. var self=this,$self=this;
  57438. var messageSend;
  57439. return $core.withContext(function($ctx1) {
  57440. var $1;
  57441. $1=$recv($globals.MessageSend)._new();
  57442. $ctx1.sendIdx["new"]=1;
  57443. $recv($1)._receiver_($recv($globals.Object)._new());
  57444. $recv($1)._selector_("asString");
  57445. messageSend=$recv($1)._yourself();
  57446. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  57447. return self;
  57448. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  57449. },
  57450. args: [],
  57451. 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'",
  57452. referencedClasses: ["MessageSend", "Object"],
  57453. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  57454. }),
  57455. $globals.MessageSendTest);
  57456. $core.addMethod(
  57457. $core.method({
  57458. selector: "testValueWithArguments",
  57459. protocol: "tests",
  57460. fn: function (){
  57461. var self=this,$self=this;
  57462. var messageSend;
  57463. return $core.withContext(function($ctx1) {
  57464. var $1;
  57465. $1=$recv($globals.MessageSend)._new();
  57466. $recv($1)._receiver_((2));
  57467. $recv($1)._selector_("+");
  57468. messageSend=$recv($1)._yourself();
  57469. $self._assert_equals_($recv(messageSend)._value_((3)),(5));
  57470. $ctx1.sendIdx["assert:equals:"]=1;
  57471. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  57472. return self;
  57473. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  57474. },
  57475. args: [],
  57476. 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",
  57477. referencedClasses: ["MessageSend"],
  57478. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  57479. }),
  57480. $globals.MessageSendTest);
  57481. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  57482. $core.addMethod(
  57483. $core.method({
  57484. selector: "codeGeneratorClass",
  57485. protocol: "accessing",
  57486. fn: function (){
  57487. var self=this,$self=this;
  57488. return $globals.CodeGenerator;
  57489. },
  57490. args: [],
  57491. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  57492. referencedClasses: ["CodeGenerator"],
  57493. messageSends: []
  57494. }),
  57495. $globals.MethodInheritanceTest);
  57496. $core.addMethod(
  57497. $core.method({
  57498. selector: "compiler",
  57499. protocol: "factory",
  57500. fn: function (){
  57501. var self=this,$self=this;
  57502. return $core.withContext(function($ctx1) {
  57503. var $1;
  57504. $1=$recv($globals.Compiler)._new();
  57505. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  57506. return $recv($1)._yourself();
  57507. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  57508. },
  57509. args: [],
  57510. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  57511. referencedClasses: ["Compiler"],
  57512. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  57513. }),
  57514. $globals.MethodInheritanceTest);
  57515. $core.addMethod(
  57516. $core.method({
  57517. selector: "deinstallBottom",
  57518. protocol: "testing",
  57519. fn: function (){
  57520. var self=this,$self=this;
  57521. return $core.withContext(function($ctx1) {
  57522. $recv($self._targetClassBottom())._removeCompiledMethod_($self["@method"]);
  57523. return self;
  57524. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  57525. },
  57526. args: [],
  57527. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  57528. referencedClasses: [],
  57529. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  57530. }),
  57531. $globals.MethodInheritanceTest);
  57532. $core.addMethod(
  57533. $core.method({
  57534. selector: "deinstallMiddle",
  57535. protocol: "testing",
  57536. fn: function (){
  57537. var self=this,$self=this;
  57538. return $core.withContext(function($ctx1) {
  57539. $recv($self._targetClassMiddle())._removeCompiledMethod_($self["@method"]);
  57540. return self;
  57541. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  57542. },
  57543. args: [],
  57544. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  57545. referencedClasses: [],
  57546. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  57547. }),
  57548. $globals.MethodInheritanceTest);
  57549. $core.addMethod(
  57550. $core.method({
  57551. selector: "deinstallTop",
  57552. protocol: "testing",
  57553. fn: function (){
  57554. var self=this,$self=this;
  57555. return $core.withContext(function($ctx1) {
  57556. $recv($self._targetClassTop())._removeCompiledMethod_($self["@method"]);
  57557. return self;
  57558. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  57559. },
  57560. args: [],
  57561. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  57562. referencedClasses: [],
  57563. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  57564. }),
  57565. $globals.MethodInheritanceTest);
  57566. $core.addMethod(
  57567. $core.method({
  57568. selector: "installBottom:",
  57569. protocol: "testing",
  57570. fn: function (aString){
  57571. var self=this,$self=this;
  57572. return $core.withContext(function($ctx1) {
  57573. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  57574. return self;
  57575. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  57576. },
  57577. args: ["aString"],
  57578. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  57579. referencedClasses: [],
  57580. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  57581. }),
  57582. $globals.MethodInheritanceTest);
  57583. $core.addMethod(
  57584. $core.method({
  57585. selector: "installMiddle:",
  57586. protocol: "testing",
  57587. fn: function (aString){
  57588. var self=this,$self=this;
  57589. return $core.withContext(function($ctx1) {
  57590. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  57591. return self;
  57592. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  57593. },
  57594. args: ["aString"],
  57595. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  57596. referencedClasses: [],
  57597. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  57598. }),
  57599. $globals.MethodInheritanceTest);
  57600. $core.addMethod(
  57601. $core.method({
  57602. selector: "installTop:",
  57603. protocol: "testing",
  57604. fn: function (aString){
  57605. var self=this,$self=this;
  57606. return $core.withContext(function($ctx1) {
  57607. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  57608. return self;
  57609. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  57610. },
  57611. args: ["aString"],
  57612. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  57613. referencedClasses: [],
  57614. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  57615. }),
  57616. $globals.MethodInheritanceTest);
  57617. $core.addMethod(
  57618. $core.method({
  57619. selector: "setUp",
  57620. protocol: "initialization",
  57621. fn: function (){
  57622. var self=this,$self=this;
  57623. return $core.withContext(function($ctx1) {
  57624. $self["@receiverTop"]=$recv($self._targetClassTop())._new();
  57625. $ctx1.sendIdx["new"]=1;
  57626. $self["@receiverMiddle"]=$recv($self._targetClassMiddle())._new();
  57627. $ctx1.sendIdx["new"]=2;
  57628. $self["@receiverBottom"]=$recv($self._targetClassBottom())._new();
  57629. $self["@method"]=nil;
  57630. $self["@performBlock"]=(function(){
  57631. return $core.withContext(function($ctx2) {
  57632. return $self._error_("performBlock not initialized");
  57633. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57634. });
  57635. return self;
  57636. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  57637. },
  57638. args: [],
  57639. 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' ]",
  57640. referencedClasses: [],
  57641. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  57642. }),
  57643. $globals.MethodInheritanceTest);
  57644. $core.addMethod(
  57645. $core.method({
  57646. selector: "shouldMNU",
  57647. protocol: "testing",
  57648. fn: function (){
  57649. var self=this,$self=this;
  57650. return $core.withContext(function($ctx1) {
  57651. $self._shouldMNUTop();
  57652. $self._shouldMNUMiddle();
  57653. $self._shouldMNUBottom();
  57654. return self;
  57655. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  57656. },
  57657. args: [],
  57658. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  57659. referencedClasses: [],
  57660. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  57661. }),
  57662. $globals.MethodInheritanceTest);
  57663. $core.addMethod(
  57664. $core.method({
  57665. selector: "shouldMNUBottom",
  57666. protocol: "testing",
  57667. fn: function (){
  57668. var self=this,$self=this;
  57669. return $core.withContext(function($ctx1) {
  57670. $self._should_raise_((function(){
  57671. return $core.withContext(function($ctx2) {
  57672. return $recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  57673. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57674. }),$globals.MessageNotUnderstood);
  57675. return self;
  57676. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  57677. },
  57678. args: [],
  57679. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  57680. referencedClasses: ["MessageNotUnderstood"],
  57681. messageSends: ["should:raise:", "value:"]
  57682. }),
  57683. $globals.MethodInheritanceTest);
  57684. $core.addMethod(
  57685. $core.method({
  57686. selector: "shouldMNUMiddle",
  57687. protocol: "testing",
  57688. fn: function (){
  57689. var self=this,$self=this;
  57690. return $core.withContext(function($ctx1) {
  57691. $self._should_raise_((function(){
  57692. return $core.withContext(function($ctx2) {
  57693. return $recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  57694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57695. }),$globals.MessageNotUnderstood);
  57696. return self;
  57697. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  57698. },
  57699. args: [],
  57700. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  57701. referencedClasses: ["MessageNotUnderstood"],
  57702. messageSends: ["should:raise:", "value:"]
  57703. }),
  57704. $globals.MethodInheritanceTest);
  57705. $core.addMethod(
  57706. $core.method({
  57707. selector: "shouldMNUTop",
  57708. protocol: "testing",
  57709. fn: function (){
  57710. var self=this,$self=this;
  57711. return $core.withContext(function($ctx1) {
  57712. $self._should_raise_((function(){
  57713. return $core.withContext(function($ctx2) {
  57714. return $recv($self["@performBlock"])._value_($self["@receiverTop"]);
  57715. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57716. }),$globals.MessageNotUnderstood);
  57717. return self;
  57718. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  57719. },
  57720. args: [],
  57721. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  57722. referencedClasses: ["MessageNotUnderstood"],
  57723. messageSends: ["should:raise:", "value:"]
  57724. }),
  57725. $globals.MethodInheritanceTest);
  57726. $core.addMethod(
  57727. $core.method({
  57728. selector: "shouldReturn:",
  57729. protocol: "testing",
  57730. fn: function (anObject){
  57731. var self=this,$self=this;
  57732. var result;
  57733. return $core.withContext(function($ctx1) {
  57734. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  57735. $ctx1.sendIdx["value:"]=1;
  57736. $self._assert_equals_(["top",anObject],["top",result]);
  57737. $ctx1.sendIdx["assert:equals:"]=1;
  57738. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  57739. $ctx1.sendIdx["value:"]=2;
  57740. $self._assert_equals_(["middle",anObject],["middle",result]);
  57741. $ctx1.sendIdx["assert:equals:"]=2;
  57742. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  57743. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  57744. return self;
  57745. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  57746. },
  57747. args: ["anObject"],
  57748. 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 }",
  57749. referencedClasses: [],
  57750. messageSends: ["value:", "assert:equals:"]
  57751. }),
  57752. $globals.MethodInheritanceTest);
  57753. $core.addMethod(
  57754. $core.method({
  57755. selector: "shouldReturn:and:and:",
  57756. protocol: "testing",
  57757. fn: function (anObject,anObject2,anObject3){
  57758. var self=this,$self=this;
  57759. var result;
  57760. return $core.withContext(function($ctx1) {
  57761. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  57762. $ctx1.sendIdx["value:"]=1;
  57763. $self._assert_equals_(["top",anObject],["top",result]);
  57764. $ctx1.sendIdx["assert:equals:"]=1;
  57765. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  57766. $ctx1.sendIdx["value:"]=2;
  57767. $self._assert_equals_(["middle",anObject2],["middle",result]);
  57768. $ctx1.sendIdx["assert:equals:"]=2;
  57769. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  57770. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  57771. return self;
  57772. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  57773. },
  57774. args: ["anObject", "anObject2", "anObject3"],
  57775. 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 }",
  57776. referencedClasses: [],
  57777. messageSends: ["value:", "assert:equals:"]
  57778. }),
  57779. $globals.MethodInheritanceTest);
  57780. $core.addMethod(
  57781. $core.method({
  57782. selector: "targetClassBottom",
  57783. protocol: "accessing",
  57784. fn: function (){
  57785. var self=this,$self=this;
  57786. return $globals.JavaScriptException;
  57787. },
  57788. args: [],
  57789. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  57790. referencedClasses: ["JavaScriptException"],
  57791. messageSends: []
  57792. }),
  57793. $globals.MethodInheritanceTest);
  57794. $core.addMethod(
  57795. $core.method({
  57796. selector: "targetClassMiddle",
  57797. protocol: "accessing",
  57798. fn: function (){
  57799. var self=this,$self=this;
  57800. return $globals.Error;
  57801. },
  57802. args: [],
  57803. source: "targetClassMiddle\x0a\x09^ Error",
  57804. referencedClasses: ["Error"],
  57805. messageSends: []
  57806. }),
  57807. $globals.MethodInheritanceTest);
  57808. $core.addMethod(
  57809. $core.method({
  57810. selector: "targetClassTop",
  57811. protocol: "accessing",
  57812. fn: function (){
  57813. var self=this,$self=this;
  57814. return $globals.Object;
  57815. },
  57816. args: [],
  57817. source: "targetClassTop\x0a\x09^ Object",
  57818. referencedClasses: ["Object"],
  57819. messageSends: []
  57820. }),
  57821. $globals.MethodInheritanceTest);
  57822. $core.addMethod(
  57823. $core.method({
  57824. selector: "tearDown",
  57825. protocol: "initialization",
  57826. fn: function (){
  57827. var self=this,$self=this;
  57828. return $core.withContext(function($ctx1) {
  57829. $recv((function(){
  57830. return $core.withContext(function($ctx2) {
  57831. return $self._deinstallTop();
  57832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57833. }))._on_do_($globals.Error,(function(){
  57834. }));
  57835. $ctx1.sendIdx["on:do:"]=1;
  57836. $recv((function(){
  57837. return $core.withContext(function($ctx2) {
  57838. return $self._deinstallMiddle();
  57839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  57840. }))._on_do_($globals.Error,(function(){
  57841. }));
  57842. $ctx1.sendIdx["on:do:"]=2;
  57843. $recv((function(){
  57844. return $core.withContext(function($ctx2) {
  57845. return $self._deinstallBottom();
  57846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  57847. }))._on_do_($globals.Error,(function(){
  57848. }));
  57849. return self;
  57850. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  57851. },
  57852. args: [],
  57853. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  57854. referencedClasses: ["Error"],
  57855. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  57856. }),
  57857. $globals.MethodInheritanceTest);
  57858. $core.addMethod(
  57859. $core.method({
  57860. selector: "testMNU11",
  57861. protocol: "tests",
  57862. fn: function (){
  57863. var self=this,$self=this;
  57864. return $core.withContext(function($ctx1) {
  57865. $self["@performBlock"]=(function(x){
  57866. return $core.withContext(function($ctx2) {
  57867. return $recv(x)._foo();
  57868. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57869. });
  57870. $self._shouldMNU();
  57871. $ctx1.sendIdx["shouldMNU"]=1;
  57872. $self._installTop_("foo ^ false");
  57873. $ctx1.sendIdx["installTop:"]=1;
  57874. $self._installTop_("foo ^ true");
  57875. $self._deinstallTop();
  57876. $self._shouldMNU();
  57877. return self;
  57878. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  57879. },
  57880. args: [],
  57881. 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",
  57882. referencedClasses: [],
  57883. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  57884. }),
  57885. $globals.MethodInheritanceTest);
  57886. $core.addMethod(
  57887. $core.method({
  57888. selector: "testMNU22",
  57889. protocol: "tests",
  57890. fn: function (){
  57891. var self=this,$self=this;
  57892. return $core.withContext(function($ctx1) {
  57893. $self["@performBlock"]=(function(x){
  57894. return $core.withContext(function($ctx2) {
  57895. return $recv(x)._foo();
  57896. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57897. });
  57898. $self._shouldMNU();
  57899. $ctx1.sendIdx["shouldMNU"]=1;
  57900. $self._installMiddle_("foo ^ false");
  57901. $ctx1.sendIdx["installMiddle:"]=1;
  57902. $self._installMiddle_("foo ^ true");
  57903. $self._deinstallMiddle();
  57904. $self._shouldMNU();
  57905. return self;
  57906. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  57907. },
  57908. args: [],
  57909. 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",
  57910. referencedClasses: [],
  57911. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  57912. }),
  57913. $globals.MethodInheritanceTest);
  57914. $core.addMethod(
  57915. $core.method({
  57916. selector: "testReturns1",
  57917. protocol: "tests",
  57918. fn: function (){
  57919. var self=this,$self=this;
  57920. return $core.withContext(function($ctx1) {
  57921. $self["@performBlock"]=(function(x){
  57922. return $core.withContext(function($ctx2) {
  57923. return $recv(x)._foo();
  57924. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57925. });
  57926. $self._installTop_("foo ^ false");
  57927. $ctx1.sendIdx["installTop:"]=1;
  57928. $self._shouldReturn_(false);
  57929. $ctx1.sendIdx["shouldReturn:"]=1;
  57930. $self._installTop_("foo ^ true");
  57931. $self._shouldReturn_(true);
  57932. return self;
  57933. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  57934. },
  57935. args: [],
  57936. 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",
  57937. referencedClasses: [],
  57938. messageSends: ["foo", "installTop:", "shouldReturn:"]
  57939. }),
  57940. $globals.MethodInheritanceTest);
  57941. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  57942. $core.addMethod(
  57943. $core.method({
  57944. selector: "testAbs",
  57945. protocol: "tests",
  57946. fn: function (){
  57947. var self=this,$self=this;
  57948. return $core.withContext(function($ctx1) {
  57949. var $1;
  57950. $1=(4)._abs();
  57951. $ctx1.sendIdx["abs"]=1;
  57952. $self._assert_equals_($1,(4));
  57953. $ctx1.sendIdx["assert:equals:"]=1;
  57954. $self._assert_equals_((-4)._abs(),(4));
  57955. return self;
  57956. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  57957. },
  57958. args: [],
  57959. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  57960. referencedClasses: [],
  57961. messageSends: ["assert:equals:", "abs"]
  57962. }),
  57963. $globals.NumberTest);
  57964. $core.addMethod(
  57965. $core.method({
  57966. selector: "testArithmetic",
  57967. protocol: "tests",
  57968. fn: function (){
  57969. var self=this,$self=this;
  57970. return $core.withContext(function($ctx1) {
  57971. var $1,$2,$3,$5,$4;
  57972. $1=(1.5).__plus((1));
  57973. $ctx1.sendIdx["+"]=1;
  57974. $self._assert_equals_($1,(2.5));
  57975. $ctx1.sendIdx["assert:equals:"]=1;
  57976. $2=(2).__minus((1));
  57977. $ctx1.sendIdx["-"]=1;
  57978. $self._assert_equals_($2,(1));
  57979. $ctx1.sendIdx["assert:equals:"]=2;
  57980. $self._assert_equals_((-2).__minus((1)),(-3));
  57981. $ctx1.sendIdx["assert:equals:"]=3;
  57982. $self._assert_equals_((12).__slash((2)),(6));
  57983. $ctx1.sendIdx["assert:equals:"]=4;
  57984. $3=(3).__star((4));
  57985. $ctx1.sendIdx["*"]=1;
  57986. $self._assert_equals_($3,(12));
  57987. $ctx1.sendIdx["assert:equals:"]=5;
  57988. $self._assert_equals_((7).__slash_slash((2)),(3));
  57989. $ctx1.sendIdx["assert:equals:"]=6;
  57990. $self._assert_equals_((7).__backslash_backslash((2)),(1));
  57991. $ctx1.sendIdx["assert:equals:"]=7;
  57992. $5=(1).__plus((2));
  57993. $ctx1.sendIdx["+"]=2;
  57994. $4=$recv($5).__star((3));
  57995. $ctx1.sendIdx["*"]=2;
  57996. $self._assert_equals_($4,(9));
  57997. $ctx1.sendIdx["assert:equals:"]=8;
  57998. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  57999. return self;
  58000. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  58001. },
  58002. args: [],
  58003. 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",
  58004. referencedClasses: [],
  58005. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  58006. }),
  58007. $globals.NumberTest);
  58008. $core.addMethod(
  58009. $core.method({
  58010. selector: "testAsNumber",
  58011. protocol: "tests",
  58012. fn: function (){
  58013. var self=this,$self=this;
  58014. return $core.withContext(function($ctx1) {
  58015. $self._assert_equals_((3)._asNumber(),(3));
  58016. return self;
  58017. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  58018. },
  58019. args: [],
  58020. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  58021. referencedClasses: [],
  58022. messageSends: ["assert:equals:", "asNumber"]
  58023. }),
  58024. $globals.NumberTest);
  58025. $core.addMethod(
  58026. $core.method({
  58027. selector: "testBetweenAnd",
  58028. protocol: "tests",
  58029. fn: function (){
  58030. var self=this,$self=this;
  58031. return $core.withContext(function($ctx1) {
  58032. var $1,$3,$2,$5,$4;
  58033. $1=(4)._between_and_((3),(5));
  58034. $ctx1.sendIdx["between:and:"]=1;
  58035. $self._assert_($1);
  58036. $ctx1.sendIdx["assert:"]=1;
  58037. $3=(1)._between_and_((5),(6));
  58038. $ctx1.sendIdx["between:and:"]=2;
  58039. $2=$recv($3)._not();
  58040. $ctx1.sendIdx["not"]=1;
  58041. $self._assert_($2);
  58042. $ctx1.sendIdx["assert:"]=2;
  58043. $5=(90)._between_and_((67),(87));
  58044. $ctx1.sendIdx["between:and:"]=3;
  58045. $4=$recv($5)._not();
  58046. $self._assert_($4);
  58047. $ctx1.sendIdx["assert:"]=3;
  58048. $self._assert_((1)._between_and_((1),(1)));
  58049. return self;
  58050. }, function($ctx1) {$ctx1.fill(self,"testBetweenAnd",{},$globals.NumberTest)});
  58051. },
  58052. args: [],
  58053. 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).",
  58054. referencedClasses: [],
  58055. messageSends: ["assert:", "between:and:", "not"]
  58056. }),
  58057. $globals.NumberTest);
  58058. $core.addMethod(
  58059. $core.method({
  58060. selector: "testCeiling",
  58061. protocol: "tests",
  58062. fn: function (){
  58063. var self=this,$self=this;
  58064. return $core.withContext(function($ctx1) {
  58065. var $1,$2;
  58066. $1=(1.2)._ceiling();
  58067. $ctx1.sendIdx["ceiling"]=1;
  58068. $self._assert_equals_($1,(2));
  58069. $ctx1.sendIdx["assert:equals:"]=1;
  58070. $2=(-1.2)._ceiling();
  58071. $ctx1.sendIdx["ceiling"]=2;
  58072. $self._assert_equals_($2,(-1));
  58073. $ctx1.sendIdx["assert:equals:"]=2;
  58074. $self._assert_equals_((1)._ceiling(),(1));
  58075. return self;
  58076. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  58077. },
  58078. args: [],
  58079. 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.",
  58080. referencedClasses: [],
  58081. messageSends: ["assert:equals:", "ceiling"]
  58082. }),
  58083. $globals.NumberTest);
  58084. $core.addMethod(
  58085. $core.method({
  58086. selector: "testComparison",
  58087. protocol: "tests",
  58088. fn: function (){
  58089. var self=this,$self=this;
  58090. return $core.withContext(function($ctx1) {
  58091. var $1,$2,$3,$4;
  58092. $1=(3).__gt((2));
  58093. $ctx1.sendIdx[">"]=1;
  58094. $self._assert_($1);
  58095. $ctx1.sendIdx["assert:"]=1;
  58096. $2=(2).__lt((3));
  58097. $ctx1.sendIdx["<"]=1;
  58098. $self._assert_($2);
  58099. $ctx1.sendIdx["assert:"]=2;
  58100. $self._deny_((3).__lt((2)));
  58101. $ctx1.sendIdx["deny:"]=1;
  58102. $self._deny_((2).__gt((3)));
  58103. $3=(3).__gt_eq((3));
  58104. $ctx1.sendIdx[">="]=1;
  58105. $self._assert_($3);
  58106. $ctx1.sendIdx["assert:"]=3;
  58107. $self._assert_((3.1).__gt_eq((3)));
  58108. $ctx1.sendIdx["assert:"]=4;
  58109. $4=(3).__lt_eq((3));
  58110. $ctx1.sendIdx["<="]=1;
  58111. $self._assert_($4);
  58112. $ctx1.sendIdx["assert:"]=5;
  58113. $self._assert_((3).__lt_eq((3.1)));
  58114. return self;
  58115. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  58116. },
  58117. args: [],
  58118. 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",
  58119. referencedClasses: [],
  58120. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  58121. }),
  58122. $globals.NumberTest);
  58123. $core.addMethod(
  58124. $core.method({
  58125. selector: "testCopying",
  58126. protocol: "tests",
  58127. fn: function (){
  58128. var self=this,$self=this;
  58129. return $core.withContext(function($ctx1) {
  58130. var $1;
  58131. $1=$recv((1)._copy()).__eq_eq((1));
  58132. $ctx1.sendIdx["=="]=1;
  58133. $self._assert_($1);
  58134. $ctx1.sendIdx["assert:"]=1;
  58135. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  58136. return self;
  58137. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  58138. },
  58139. args: [],
  58140. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  58141. referencedClasses: [],
  58142. messageSends: ["assert:", "==", "copy", "deepCopy"]
  58143. }),
  58144. $globals.NumberTest);
  58145. $core.addMethod(
  58146. $core.method({
  58147. selector: "testDegreesToRadians",
  58148. protocol: "tests",
  58149. fn: function (){
  58150. var self=this,$self=this;
  58151. return $core.withContext(function($ctx1) {
  58152. $self._assert_($recv($recv($recv((180)._degreesToRadians()).__minus($recv($globals.Number)._pi()))._abs()).__lt_eq((0.01)));
  58153. return self;
  58154. }, function($ctx1) {$ctx1.fill(self,"testDegreesToRadians",{},$globals.NumberTest)});
  58155. },
  58156. args: [],
  58157. source: "testDegreesToRadians\x0a\x09self assert: (180 degreesToRadians - Number pi) abs <= 0.01.",
  58158. referencedClasses: ["Number"],
  58159. messageSends: ["assert:", "<=", "abs", "-", "degreesToRadians", "pi"]
  58160. }),
  58161. $globals.NumberTest);
  58162. $core.addMethod(
  58163. $core.method({
  58164. selector: "testEquality",
  58165. protocol: "tests",
  58166. fn: function (){
  58167. var self=this,$self=this;
  58168. return $core.withContext(function($ctx1) {
  58169. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  58170. $1=(1).__eq((1));
  58171. $ctx1.sendIdx["="]=1;
  58172. $self._assert_($1);
  58173. $ctx1.sendIdx["assert:"]=1;
  58174. $2=(0).__eq((0));
  58175. $ctx1.sendIdx["="]=2;
  58176. $self._assert_($2);
  58177. $ctx1.sendIdx["assert:"]=2;
  58178. $3=(1).__eq((0));
  58179. $ctx1.sendIdx["="]=3;
  58180. $self._deny_($3);
  58181. $ctx1.sendIdx["deny:"]=1;
  58182. $5=(1)._yourself();
  58183. $ctx1.sendIdx["yourself"]=1;
  58184. $4=$recv($5).__eq((1));
  58185. $ctx1.sendIdx["="]=4;
  58186. $self._assert_($4);
  58187. $ctx1.sendIdx["assert:"]=3;
  58188. $7=(1)._yourself();
  58189. $ctx1.sendIdx["yourself"]=2;
  58190. $6=(1).__eq($7);
  58191. $ctx1.sendIdx["="]=5;
  58192. $self._assert_($6);
  58193. $ctx1.sendIdx["assert:"]=4;
  58194. $9=(1)._yourself();
  58195. $ctx1.sendIdx["yourself"]=3;
  58196. $8=$recv($9).__eq((1)._yourself());
  58197. $ctx1.sendIdx["="]=6;
  58198. $self._assert_($8);
  58199. $10=(0).__eq(false);
  58200. $ctx1.sendIdx["="]=7;
  58201. $self._deny_($10);
  58202. $ctx1.sendIdx["deny:"]=2;
  58203. $11=false.__eq((0));
  58204. $ctx1.sendIdx["="]=8;
  58205. $self._deny_($11);
  58206. $ctx1.sendIdx["deny:"]=3;
  58207. $12="".__eq((0));
  58208. $ctx1.sendIdx["="]=9;
  58209. $self._deny_($12);
  58210. $ctx1.sendIdx["deny:"]=4;
  58211. $self._deny_((0).__eq(""));
  58212. return self;
  58213. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  58214. },
  58215. args: [],
  58216. 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 = ''",
  58217. referencedClasses: [],
  58218. messageSends: ["assert:", "=", "deny:", "yourself"]
  58219. }),
  58220. $globals.NumberTest);
  58221. $core.addMethod(
  58222. $core.method({
  58223. selector: "testFloor",
  58224. protocol: "tests",
  58225. fn: function (){
  58226. var self=this,$self=this;
  58227. return $core.withContext(function($ctx1) {
  58228. var $1,$2;
  58229. $1=(1.2)._floor();
  58230. $ctx1.sendIdx["floor"]=1;
  58231. $self._assert_equals_($1,(1));
  58232. $ctx1.sendIdx["assert:equals:"]=1;
  58233. $2=(-1.2)._floor();
  58234. $ctx1.sendIdx["floor"]=2;
  58235. $self._assert_equals_($2,(-2));
  58236. $ctx1.sendIdx["assert:equals:"]=2;
  58237. $self._assert_equals_((1)._floor(),(1));
  58238. return self;
  58239. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  58240. },
  58241. args: [],
  58242. 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.",
  58243. referencedClasses: [],
  58244. messageSends: ["assert:equals:", "floor"]
  58245. }),
  58246. $globals.NumberTest);
  58247. $core.addMethod(
  58248. $core.method({
  58249. selector: "testHexNumbers",
  58250. protocol: "tests",
  58251. fn: function (){
  58252. var self=this,$self=this;
  58253. return $core.withContext(function($ctx1) {
  58254. var $1,$2,$3,$4,$5;
  58255. $self._assert_equals_((9),(9));
  58256. $ctx1.sendIdx["assert:equals:"]=1;
  58257. $1=(10)._truncated();
  58258. $ctx1.sendIdx["truncated"]=1;
  58259. $self._assert_equals_($1,(10));
  58260. $ctx1.sendIdx["assert:equals:"]=2;
  58261. $2=(11)._truncated();
  58262. $ctx1.sendIdx["truncated"]=2;
  58263. $self._assert_equals_($2,(11));
  58264. $ctx1.sendIdx["assert:equals:"]=3;
  58265. $3=(12)._truncated();
  58266. $ctx1.sendIdx["truncated"]=3;
  58267. $self._assert_equals_($3,(12));
  58268. $ctx1.sendIdx["assert:equals:"]=4;
  58269. $4=(13)._truncated();
  58270. $ctx1.sendIdx["truncated"]=4;
  58271. $self._assert_equals_($4,(13));
  58272. $ctx1.sendIdx["assert:equals:"]=5;
  58273. $5=(14)._truncated();
  58274. $ctx1.sendIdx["truncated"]=5;
  58275. $self._assert_equals_($5,(14));
  58276. $ctx1.sendIdx["assert:equals:"]=6;
  58277. $self._assert_equals_((15)._truncated(),(15));
  58278. return self;
  58279. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  58280. },
  58281. args: [],
  58282. 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",
  58283. referencedClasses: [],
  58284. messageSends: ["assert:equals:", "truncated"]
  58285. }),
  58286. $globals.NumberTest);
  58287. $core.addMethod(
  58288. $core.method({
  58289. selector: "testIdentity",
  58290. protocol: "tests",
  58291. fn: function (){
  58292. var self=this,$self=this;
  58293. return $core.withContext(function($ctx1) {
  58294. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  58295. $1=(1).__eq_eq((1));
  58296. $ctx1.sendIdx["=="]=1;
  58297. $self._assert_($1);
  58298. $ctx1.sendIdx["assert:"]=1;
  58299. $2=(0).__eq_eq((0));
  58300. $ctx1.sendIdx["=="]=2;
  58301. $self._assert_($2);
  58302. $ctx1.sendIdx["assert:"]=2;
  58303. $3=(1).__eq_eq((0));
  58304. $ctx1.sendIdx["=="]=3;
  58305. $self._deny_($3);
  58306. $ctx1.sendIdx["deny:"]=1;
  58307. $5=(1)._yourself();
  58308. $ctx1.sendIdx["yourself"]=1;
  58309. $4=$recv($5).__eq_eq((1));
  58310. $ctx1.sendIdx["=="]=4;
  58311. $self._assert_($4);
  58312. $ctx1.sendIdx["assert:"]=3;
  58313. $7=(1)._yourself();
  58314. $ctx1.sendIdx["yourself"]=2;
  58315. $6=(1).__eq_eq($7);
  58316. $ctx1.sendIdx["=="]=5;
  58317. $self._assert_($6);
  58318. $ctx1.sendIdx["assert:"]=4;
  58319. $9=(1)._yourself();
  58320. $ctx1.sendIdx["yourself"]=3;
  58321. $8=$recv($9).__eq_eq((1)._yourself());
  58322. $ctx1.sendIdx["=="]=6;
  58323. $self._assert_($8);
  58324. $self._deny_((1).__eq_eq((2)));
  58325. return self;
  58326. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  58327. },
  58328. args: [],
  58329. 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",
  58330. referencedClasses: [],
  58331. messageSends: ["assert:", "==", "deny:", "yourself"]
  58332. }),
  58333. $globals.NumberTest);
  58334. $core.addMethod(
  58335. $core.method({
  58336. selector: "testInvalidHexNumbers",
  58337. protocol: "tests",
  58338. fn: function (){
  58339. var self=this,$self=this;
  58340. return $core.withContext(function($ctx1) {
  58341. $self._should_raise_((function(){
  58342. return $core.withContext(function($ctx2) {
  58343. return (16)._rG();
  58344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58345. }),$globals.MessageNotUnderstood);
  58346. $ctx1.sendIdx["should:raise:"]=1;
  58347. $self._should_raise_((function(){
  58348. return $core.withContext(function($ctx2) {
  58349. return (16)._rg();
  58350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58351. }),$globals.MessageNotUnderstood);
  58352. $ctx1.sendIdx["should:raise:"]=2;
  58353. $self._should_raise_((function(){
  58354. return $core.withContext(function($ctx2) {
  58355. return (16)._rH();
  58356. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58357. }),$globals.MessageNotUnderstood);
  58358. $ctx1.sendIdx["should:raise:"]=3;
  58359. $self._should_raise_((function(){
  58360. return $core.withContext(function($ctx2) {
  58361. return (16)._rh();
  58362. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58363. }),$globals.MessageNotUnderstood);
  58364. $ctx1.sendIdx["should:raise:"]=4;
  58365. $self._should_raise_((function(){
  58366. return $core.withContext(function($ctx2) {
  58367. return (16)._rI();
  58368. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58369. }),$globals.MessageNotUnderstood);
  58370. $ctx1.sendIdx["should:raise:"]=5;
  58371. $self._should_raise_((function(){
  58372. return $core.withContext(function($ctx2) {
  58373. return (16)._ri();
  58374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  58375. }),$globals.MessageNotUnderstood);
  58376. $ctx1.sendIdx["should:raise:"]=6;
  58377. $self._should_raise_((function(){
  58378. return $core.withContext(function($ctx2) {
  58379. return (16)._rJ();
  58380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  58381. }),$globals.MessageNotUnderstood);
  58382. $ctx1.sendIdx["should:raise:"]=7;
  58383. $self._should_raise_((function(){
  58384. return $core.withContext(function($ctx2) {
  58385. return (16)._rj();
  58386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  58387. }),$globals.MessageNotUnderstood);
  58388. $ctx1.sendIdx["should:raise:"]=8;
  58389. $self._should_raise_((function(){
  58390. return $core.withContext(function($ctx2) {
  58391. return (16)._rK();
  58392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  58393. }),$globals.MessageNotUnderstood);
  58394. $ctx1.sendIdx["should:raise:"]=9;
  58395. $self._should_raise_((function(){
  58396. return $core.withContext(function($ctx2) {
  58397. return (16)._rk();
  58398. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  58399. }),$globals.MessageNotUnderstood);
  58400. $ctx1.sendIdx["should:raise:"]=10;
  58401. $self._should_raise_((function(){
  58402. return $core.withContext(function($ctx2) {
  58403. return (16)._rL();
  58404. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  58405. }),$globals.MessageNotUnderstood);
  58406. $ctx1.sendIdx["should:raise:"]=11;
  58407. $self._should_raise_((function(){
  58408. return $core.withContext(function($ctx2) {
  58409. return (16)._rl();
  58410. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  58411. }),$globals.MessageNotUnderstood);
  58412. $ctx1.sendIdx["should:raise:"]=12;
  58413. $self._should_raise_((function(){
  58414. return $core.withContext(function($ctx2) {
  58415. return (16)._rM();
  58416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  58417. }),$globals.MessageNotUnderstood);
  58418. $ctx1.sendIdx["should:raise:"]=13;
  58419. $self._should_raise_((function(){
  58420. return $core.withContext(function($ctx2) {
  58421. return (16)._rm();
  58422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  58423. }),$globals.MessageNotUnderstood);
  58424. $ctx1.sendIdx["should:raise:"]=14;
  58425. $self._should_raise_((function(){
  58426. return $core.withContext(function($ctx2) {
  58427. return (16)._rN();
  58428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  58429. }),$globals.MessageNotUnderstood);
  58430. $ctx1.sendIdx["should:raise:"]=15;
  58431. $self._should_raise_((function(){
  58432. return $core.withContext(function($ctx2) {
  58433. return (16)._rn();
  58434. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  58435. }),$globals.MessageNotUnderstood);
  58436. $ctx1.sendIdx["should:raise:"]=16;
  58437. $self._should_raise_((function(){
  58438. return $core.withContext(function($ctx2) {
  58439. return (16)._rO();
  58440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  58441. }),$globals.MessageNotUnderstood);
  58442. $ctx1.sendIdx["should:raise:"]=17;
  58443. $self._should_raise_((function(){
  58444. return $core.withContext(function($ctx2) {
  58445. return (16)._ro();
  58446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  58447. }),$globals.MessageNotUnderstood);
  58448. $ctx1.sendIdx["should:raise:"]=18;
  58449. $self._should_raise_((function(){
  58450. return $core.withContext(function($ctx2) {
  58451. return (16)._rP();
  58452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  58453. }),$globals.MessageNotUnderstood);
  58454. $ctx1.sendIdx["should:raise:"]=19;
  58455. $self._should_raise_((function(){
  58456. return $core.withContext(function($ctx2) {
  58457. return (16)._rp();
  58458. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  58459. }),$globals.MessageNotUnderstood);
  58460. $ctx1.sendIdx["should:raise:"]=20;
  58461. $self._should_raise_((function(){
  58462. return $core.withContext(function($ctx2) {
  58463. return (16)._rQ();
  58464. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  58465. }),$globals.MessageNotUnderstood);
  58466. $ctx1.sendIdx["should:raise:"]=21;
  58467. $self._should_raise_((function(){
  58468. return $core.withContext(function($ctx2) {
  58469. return (16)._rq();
  58470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  58471. }),$globals.MessageNotUnderstood);
  58472. $ctx1.sendIdx["should:raise:"]=22;
  58473. $self._should_raise_((function(){
  58474. return $core.withContext(function($ctx2) {
  58475. return (16)._rR();
  58476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  58477. }),$globals.MessageNotUnderstood);
  58478. $ctx1.sendIdx["should:raise:"]=23;
  58479. $self._should_raise_((function(){
  58480. return $core.withContext(function($ctx2) {
  58481. return (16)._rr();
  58482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  58483. }),$globals.MessageNotUnderstood);
  58484. $ctx1.sendIdx["should:raise:"]=24;
  58485. $self._should_raise_((function(){
  58486. return $core.withContext(function($ctx2) {
  58487. return (16)._rS();
  58488. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  58489. }),$globals.MessageNotUnderstood);
  58490. $ctx1.sendIdx["should:raise:"]=25;
  58491. $self._should_raise_((function(){
  58492. return $core.withContext(function($ctx2) {
  58493. return (16)._rs();
  58494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  58495. }),$globals.MessageNotUnderstood);
  58496. $ctx1.sendIdx["should:raise:"]=26;
  58497. $self._should_raise_((function(){
  58498. return $core.withContext(function($ctx2) {
  58499. return (16)._rT();
  58500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  58501. }),$globals.MessageNotUnderstood);
  58502. $ctx1.sendIdx["should:raise:"]=27;
  58503. $self._should_raise_((function(){
  58504. return $core.withContext(function($ctx2) {
  58505. return (16)._rt();
  58506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  58507. }),$globals.MessageNotUnderstood);
  58508. $ctx1.sendIdx["should:raise:"]=28;
  58509. $self._should_raise_((function(){
  58510. return $core.withContext(function($ctx2) {
  58511. return (16)._rU();
  58512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  58513. }),$globals.MessageNotUnderstood);
  58514. $ctx1.sendIdx["should:raise:"]=29;
  58515. $self._should_raise_((function(){
  58516. return $core.withContext(function($ctx2) {
  58517. return (16)._ru();
  58518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  58519. }),$globals.MessageNotUnderstood);
  58520. $ctx1.sendIdx["should:raise:"]=30;
  58521. $self._should_raise_((function(){
  58522. return $core.withContext(function($ctx2) {
  58523. return (16)._rV();
  58524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  58525. }),$globals.MessageNotUnderstood);
  58526. $ctx1.sendIdx["should:raise:"]=31;
  58527. $self._should_raise_((function(){
  58528. return $core.withContext(function($ctx2) {
  58529. return (16)._rv();
  58530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  58531. }),$globals.MessageNotUnderstood);
  58532. $ctx1.sendIdx["should:raise:"]=32;
  58533. $self._should_raise_((function(){
  58534. return $core.withContext(function($ctx2) {
  58535. return (16)._rW();
  58536. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  58537. }),$globals.MessageNotUnderstood);
  58538. $ctx1.sendIdx["should:raise:"]=33;
  58539. $self._should_raise_((function(){
  58540. return $core.withContext(function($ctx2) {
  58541. return (16)._rw();
  58542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  58543. }),$globals.MessageNotUnderstood);
  58544. $ctx1.sendIdx["should:raise:"]=34;
  58545. $self._should_raise_((function(){
  58546. return $core.withContext(function($ctx2) {
  58547. return (16)._rX();
  58548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  58549. }),$globals.MessageNotUnderstood);
  58550. $ctx1.sendIdx["should:raise:"]=35;
  58551. $self._should_raise_((function(){
  58552. return $core.withContext(function($ctx2) {
  58553. return (16)._rx();
  58554. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  58555. }),$globals.MessageNotUnderstood);
  58556. $ctx1.sendIdx["should:raise:"]=36;
  58557. $self._should_raise_((function(){
  58558. return $core.withContext(function($ctx2) {
  58559. return (16)._rY();
  58560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  58561. }),$globals.MessageNotUnderstood);
  58562. $ctx1.sendIdx["should:raise:"]=37;
  58563. $self._should_raise_((function(){
  58564. return $core.withContext(function($ctx2) {
  58565. return (16)._ry();
  58566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  58567. }),$globals.MessageNotUnderstood);
  58568. $ctx1.sendIdx["should:raise:"]=38;
  58569. $self._should_raise_((function(){
  58570. return $core.withContext(function($ctx2) {
  58571. return (16)._rZ();
  58572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  58573. }),$globals.MessageNotUnderstood);
  58574. $ctx1.sendIdx["should:raise:"]=39;
  58575. $self._should_raise_((function(){
  58576. return $core.withContext(function($ctx2) {
  58577. return (16)._rz();
  58578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  58579. }),$globals.MessageNotUnderstood);
  58580. $ctx1.sendIdx["should:raise:"]=40;
  58581. $self._should_raise_((function(){
  58582. return $core.withContext(function($ctx2) {
  58583. return (11259375)._Z();
  58584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  58585. }),$globals.MessageNotUnderstood);
  58586. return self;
  58587. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  58588. },
  58589. args: [],
  58590. 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.",
  58591. referencedClasses: ["MessageNotUnderstood"],
  58592. 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"]
  58593. }),
  58594. $globals.NumberTest);
  58595. $core.addMethod(
  58596. $core.method({
  58597. selector: "testLog",
  58598. protocol: "tests",
  58599. fn: function (){
  58600. var self=this,$self=this;
  58601. return $core.withContext(function($ctx1) {
  58602. $self._assert_equals_((10000)._log(),(4));
  58603. $ctx1.sendIdx["assert:equals:"]=1;
  58604. $self._assert_equals_((512)._log_((2)),(9));
  58605. $ctx1.sendIdx["assert:equals:"]=2;
  58606. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  58607. return self;
  58608. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  58609. },
  58610. args: [],
  58611. 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.",
  58612. referencedClasses: ["Number"],
  58613. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  58614. }),
  58615. $globals.NumberTest);
  58616. $core.addMethod(
  58617. $core.method({
  58618. selector: "testMinMax",
  58619. protocol: "tests",
  58620. fn: function (){
  58621. var self=this,$self=this;
  58622. return $core.withContext(function($ctx1) {
  58623. var $1,$2;
  58624. $self._assert_equals_((2)._max_((5)),(5));
  58625. $ctx1.sendIdx["assert:equals:"]=1;
  58626. $self._assert_equals_((2)._min_((5)),(2));
  58627. $ctx1.sendIdx["assert:equals:"]=2;
  58628. $1=(2)._min_max_((5),(3));
  58629. $ctx1.sendIdx["min:max:"]=1;
  58630. $self._assert_equals_($1,(3));
  58631. $ctx1.sendIdx["assert:equals:"]=3;
  58632. $2=(7)._min_max_((5),(3));
  58633. $ctx1.sendIdx["min:max:"]=2;
  58634. $self._assert_equals_($2,(5));
  58635. $ctx1.sendIdx["assert:equals:"]=4;
  58636. $self._assert_equals_((4)._min_max_((5),(3)),(4));
  58637. return self;
  58638. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  58639. },
  58640. args: [],
  58641. 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.",
  58642. referencedClasses: [],
  58643. messageSends: ["assert:equals:", "max:", "min:", "min:max:"]
  58644. }),
  58645. $globals.NumberTest);
  58646. $core.addMethod(
  58647. $core.method({
  58648. selector: "testNegated",
  58649. protocol: "tests",
  58650. fn: function (){
  58651. var self=this,$self=this;
  58652. return $core.withContext(function($ctx1) {
  58653. var $1;
  58654. $1=(3)._negated();
  58655. $ctx1.sendIdx["negated"]=1;
  58656. $self._assert_equals_($1,(-3));
  58657. $ctx1.sendIdx["assert:equals:"]=1;
  58658. $self._assert_equals_((-3)._negated(),(3));
  58659. return self;
  58660. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  58661. },
  58662. args: [],
  58663. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  58664. referencedClasses: [],
  58665. messageSends: ["assert:equals:", "negated"]
  58666. }),
  58667. $globals.NumberTest);
  58668. $core.addMethod(
  58669. $core.method({
  58670. selector: "testPrintShowingDecimalPlaces",
  58671. protocol: "tests",
  58672. fn: function (){
  58673. var self=this,$self=this;
  58674. return $core.withContext(function($ctx1) {
  58675. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  58676. $1=(23)._printShowingDecimalPlaces_((2));
  58677. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  58678. $self._assert_equals_($1,"23.00");
  58679. $ctx1.sendIdx["assert:equals:"]=1;
  58680. $2=(23.5698)._printShowingDecimalPlaces_((2));
  58681. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  58682. $self._assert_equals_($2,"23.57");
  58683. $ctx1.sendIdx["assert:equals:"]=2;
  58684. $4=(234.567)._negated();
  58685. $ctx1.sendIdx["negated"]=1;
  58686. $3=$recv($4)._printShowingDecimalPlaces_((5));
  58687. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  58688. $self._assert_equals_($3,"-234.56700");
  58689. $ctx1.sendIdx["assert:equals:"]=3;
  58690. $5=(23.4567)._printShowingDecimalPlaces_((0));
  58691. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  58692. $self._assert_equals_($5,"23");
  58693. $ctx1.sendIdx["assert:equals:"]=4;
  58694. $6=(23.5567)._printShowingDecimalPlaces_((0));
  58695. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  58696. $self._assert_equals_($6,"24");
  58697. $ctx1.sendIdx["assert:equals:"]=5;
  58698. $8=(23.4567)._negated();
  58699. $ctx1.sendIdx["negated"]=2;
  58700. $7=$recv($8)._printShowingDecimalPlaces_((0));
  58701. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  58702. $self._assert_equals_($7,"-23");
  58703. $ctx1.sendIdx["assert:equals:"]=6;
  58704. $10=(23.5567)._negated();
  58705. $ctx1.sendIdx["negated"]=3;
  58706. $9=$recv($10)._printShowingDecimalPlaces_((0));
  58707. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  58708. $self._assert_equals_($9,"-24");
  58709. $ctx1.sendIdx["assert:equals:"]=7;
  58710. $11=(100000000)._printShowingDecimalPlaces_((1));
  58711. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  58712. $self._assert_equals_($11,"100000000.0");
  58713. $ctx1.sendIdx["assert:equals:"]=8;
  58714. $12=(0.98)._printShowingDecimalPlaces_((5));
  58715. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  58716. $self._assert_equals_($12,"0.98000");
  58717. $ctx1.sendIdx["assert:equals:"]=9;
  58718. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  58719. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  58720. $self._assert_equals_($13,"-0.98");
  58721. $ctx1.sendIdx["assert:equals:"]=10;
  58722. $14=(2.567)._printShowingDecimalPlaces_((2));
  58723. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  58724. $self._assert_equals_($14,"2.57");
  58725. $ctx1.sendIdx["assert:equals:"]=11;
  58726. $15=(-2.567)._printShowingDecimalPlaces_((2));
  58727. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  58728. $self._assert_equals_($15,"-2.57");
  58729. $ctx1.sendIdx["assert:equals:"]=12;
  58730. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  58731. return self;
  58732. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  58733. },
  58734. args: [],
  58735. 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'.",
  58736. referencedClasses: [],
  58737. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  58738. }),
  58739. $globals.NumberTest);
  58740. $core.addMethod(
  58741. $core.method({
  58742. selector: "testRadiansToDegrees",
  58743. protocol: "tests",
  58744. fn: function (){
  58745. var self=this,$self=this;
  58746. return $core.withContext(function($ctx1) {
  58747. $self._assert_($recv($recv($recv($recv($recv($globals.Number)._pi())._radiansToDegrees()).__minus((180)))._abs()).__lt_eq((0.01)));
  58748. return self;
  58749. }, function($ctx1) {$ctx1.fill(self,"testRadiansToDegrees",{},$globals.NumberTest)});
  58750. },
  58751. args: [],
  58752. source: "testRadiansToDegrees\x0a\x09self assert: (Number pi radiansToDegrees - 180) abs <= 0.01.",
  58753. referencedClasses: ["Number"],
  58754. messageSends: ["assert:", "<=", "abs", "-", "radiansToDegrees", "pi"]
  58755. }),
  58756. $globals.NumberTest);
  58757. $core.addMethod(
  58758. $core.method({
  58759. selector: "testRaisedTo",
  58760. protocol: "tests",
  58761. fn: function (){
  58762. var self=this,$self=this;
  58763. return $core.withContext(function($ctx1) {
  58764. var $1,$2,$3;
  58765. $1=(2)._raisedTo_((4));
  58766. $ctx1.sendIdx["raisedTo:"]=1;
  58767. $self._assert_equals_($1,(16));
  58768. $ctx1.sendIdx["assert:equals:"]=1;
  58769. $2=(2)._raisedTo_((0));
  58770. $ctx1.sendIdx["raisedTo:"]=2;
  58771. $self._assert_equals_($2,(1));
  58772. $ctx1.sendIdx["assert:equals:"]=2;
  58773. $3=(2)._raisedTo_((-3));
  58774. $ctx1.sendIdx["raisedTo:"]=3;
  58775. $self._assert_equals_($3,(0.125));
  58776. $ctx1.sendIdx["assert:equals:"]=3;
  58777. $self._assert_equals_((4)._raisedTo_((0.5)),(2));
  58778. $ctx1.sendIdx["assert:equals:"]=4;
  58779. $self._assert_equals_((2).__star_star((4)),(16));
  58780. return self;
  58781. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  58782. },
  58783. args: [],
  58784. 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.",
  58785. referencedClasses: [],
  58786. messageSends: ["assert:equals:", "raisedTo:", "**"]
  58787. }),
  58788. $globals.NumberTest);
  58789. $core.addMethod(
  58790. $core.method({
  58791. selector: "testRounded",
  58792. protocol: "tests",
  58793. fn: function (){
  58794. var self=this,$self=this;
  58795. return $core.withContext(function($ctx1) {
  58796. var $1,$2;
  58797. $1=(3)._rounded();
  58798. $ctx1.sendIdx["rounded"]=1;
  58799. $self._assert_equals_($1,(3));
  58800. $ctx1.sendIdx["assert:equals:"]=1;
  58801. $2=(3.212)._rounded();
  58802. $ctx1.sendIdx["rounded"]=2;
  58803. $self._assert_equals_($2,(3));
  58804. $ctx1.sendIdx["assert:equals:"]=2;
  58805. $self._assert_equals_((3.51)._rounded(),(4));
  58806. return self;
  58807. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  58808. },
  58809. args: [],
  58810. 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",
  58811. referencedClasses: [],
  58812. messageSends: ["assert:equals:", "rounded"]
  58813. }),
  58814. $globals.NumberTest);
  58815. $core.addMethod(
  58816. $core.method({
  58817. selector: "testSign",
  58818. protocol: "tests",
  58819. fn: function (){
  58820. var self=this,$self=this;
  58821. return $core.withContext(function($ctx1) {
  58822. var $1,$2;
  58823. $1=(5)._sign();
  58824. $ctx1.sendIdx["sign"]=1;
  58825. $self._assert_equals_($1,(1));
  58826. $ctx1.sendIdx["assert:equals:"]=1;
  58827. $2=(0)._sign();
  58828. $ctx1.sendIdx["sign"]=2;
  58829. $self._assert_equals_($2,(0));
  58830. $ctx1.sendIdx["assert:equals:"]=2;
  58831. $self._assert_equals_((-1.4)._sign(),(-1));
  58832. return self;
  58833. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  58834. },
  58835. args: [],
  58836. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  58837. referencedClasses: [],
  58838. messageSends: ["assert:equals:", "sign"]
  58839. }),
  58840. $globals.NumberTest);
  58841. $core.addMethod(
  58842. $core.method({
  58843. selector: "testSqrt",
  58844. protocol: "tests",
  58845. fn: function (){
  58846. var self=this,$self=this;
  58847. return $core.withContext(function($ctx1) {
  58848. var $1;
  58849. $1=(4)._sqrt();
  58850. $ctx1.sendIdx["sqrt"]=1;
  58851. $self._assert_equals_($1,(2));
  58852. $ctx1.sendIdx["assert:equals:"]=1;
  58853. $self._assert_equals_((16)._sqrt(),(4));
  58854. return self;
  58855. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  58856. },
  58857. args: [],
  58858. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  58859. referencedClasses: [],
  58860. messageSends: ["assert:equals:", "sqrt"]
  58861. }),
  58862. $globals.NumberTest);
  58863. $core.addMethod(
  58864. $core.method({
  58865. selector: "testSquared",
  58866. protocol: "tests",
  58867. fn: function (){
  58868. var self=this,$self=this;
  58869. return $core.withContext(function($ctx1) {
  58870. $self._assert_equals_((4)._squared(),(16));
  58871. return self;
  58872. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  58873. },
  58874. args: [],
  58875. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  58876. referencedClasses: [],
  58877. messageSends: ["assert:equals:", "squared"]
  58878. }),
  58879. $globals.NumberTest);
  58880. $core.addMethod(
  58881. $core.method({
  58882. selector: "testTimesRepeat",
  58883. protocol: "tests",
  58884. fn: function (){
  58885. var self=this,$self=this;
  58886. var i;
  58887. return $core.withContext(function($ctx1) {
  58888. i=(0);
  58889. (0)._timesRepeat_((function(){
  58890. return $core.withContext(function($ctx2) {
  58891. i=$recv(i).__plus((1));
  58892. $ctx2.sendIdx["+"]=1;
  58893. return i;
  58894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58895. }));
  58896. $ctx1.sendIdx["timesRepeat:"]=1;
  58897. $self._assert_equals_(i,(0));
  58898. $ctx1.sendIdx["assert:equals:"]=1;
  58899. (5)._timesRepeat_((function(){
  58900. return $core.withContext(function($ctx2) {
  58901. i=$recv(i).__plus((1));
  58902. return i;
  58903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58904. }));
  58905. $self._assert_equals_(i,(5));
  58906. return self;
  58907. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  58908. },
  58909. args: [],
  58910. 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",
  58911. referencedClasses: [],
  58912. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  58913. }),
  58914. $globals.NumberTest);
  58915. $core.addMethod(
  58916. $core.method({
  58917. selector: "testTo",
  58918. protocol: "tests",
  58919. fn: function (){
  58920. var self=this,$self=this;
  58921. return $core.withContext(function($ctx1) {
  58922. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  58923. return self;
  58924. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  58925. },
  58926. args: [],
  58927. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  58928. referencedClasses: [],
  58929. messageSends: ["assert:equals:", "to:"]
  58930. }),
  58931. $globals.NumberTest);
  58932. $core.addMethod(
  58933. $core.method({
  58934. selector: "testToBy",
  58935. protocol: "tests",
  58936. fn: function (){
  58937. var self=this,$self=this;
  58938. return $core.withContext(function($ctx1) {
  58939. var $1;
  58940. $1=(0)._to_by_((6),(2));
  58941. $ctx1.sendIdx["to:by:"]=1;
  58942. $self._assert_equals_($1,[(0), (2), (4), (6)]);
  58943. $self._should_raise_((function(){
  58944. return $core.withContext(function($ctx2) {
  58945. return (1)._to_by_((4),(0));
  58946. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58947. }),$globals.Error);
  58948. return self;
  58949. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  58950. },
  58951. args: [],
  58952. 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",
  58953. referencedClasses: ["Error"],
  58954. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  58955. }),
  58956. $globals.NumberTest);
  58957. $core.addMethod(
  58958. $core.method({
  58959. selector: "testTrigonometry",
  58960. protocol: "tests",
  58961. fn: function (){
  58962. var self=this,$self=this;
  58963. return $core.withContext(function($ctx1) {
  58964. var $1;
  58965. $self._assert_equals_((0)._cos(),(1));
  58966. $ctx1.sendIdx["assert:equals:"]=1;
  58967. $self._assert_equals_((0)._sin(),(0));
  58968. $ctx1.sendIdx["assert:equals:"]=2;
  58969. $self._assert_equals_((0)._tan(),(0));
  58970. $ctx1.sendIdx["assert:equals:"]=3;
  58971. $self._assert_equals_((1)._arcCos(),(0));
  58972. $ctx1.sendIdx["assert:equals:"]=4;
  58973. $self._assert_equals_((0)._arcSin(),(0));
  58974. $ctx1.sendIdx["assert:equals:"]=5;
  58975. $self._assert_equals_((0)._arcTan(),(0));
  58976. $ctx1.sendIdx["assert:equals:"]=6;
  58977. $1=(0)._arcTan_((1));
  58978. $ctx1.sendIdx["arcTan:"]=1;
  58979. $self._assert_equals_($1,(0));
  58980. $ctx1.sendIdx["assert:equals:"]=7;
  58981. $self._assert_equals_((1)._arcTan_((0)),$recv($recv($globals.Number)._pi()).__slash((2)));
  58982. return self;
  58983. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  58984. },
  58985. args: [],
  58986. 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)",
  58987. referencedClasses: ["Number"],
  58988. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan", "arcTan:", "/", "pi"]
  58989. }),
  58990. $globals.NumberTest);
  58991. $core.addMethod(
  58992. $core.method({
  58993. selector: "testTruncated",
  58994. protocol: "tests",
  58995. fn: function (){
  58996. var self=this,$self=this;
  58997. return $core.withContext(function($ctx1) {
  58998. var $1,$2;
  58999. $1=(3)._truncated();
  59000. $ctx1.sendIdx["truncated"]=1;
  59001. $self._assert_equals_($1,(3));
  59002. $ctx1.sendIdx["assert:equals:"]=1;
  59003. $2=(3.212)._truncated();
  59004. $ctx1.sendIdx["truncated"]=2;
  59005. $self._assert_equals_($2,(3));
  59006. $ctx1.sendIdx["assert:equals:"]=2;
  59007. $self._assert_equals_((3.51)._truncated(),(3));
  59008. return self;
  59009. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  59010. },
  59011. args: [],
  59012. 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",
  59013. referencedClasses: [],
  59014. messageSends: ["assert:equals:", "truncated"]
  59015. }),
  59016. $globals.NumberTest);
  59017. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  59018. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  59019. $core.addMethod(
  59020. $core.method({
  59021. selector: "foo",
  59022. protocol: "not yet classified",
  59023. fn: function (){
  59024. var self=this,$self=this;
  59025. return $self["@foo"];
  59026. },
  59027. args: [],
  59028. source: "foo\x0a\x09^ foo",
  59029. referencedClasses: [],
  59030. messageSends: []
  59031. }),
  59032. $globals.ObjectMock);
  59033. $core.addMethod(
  59034. $core.method({
  59035. selector: "foo:",
  59036. protocol: "not yet classified",
  59037. fn: function (anObject){
  59038. var self=this,$self=this;
  59039. $self["@foo"]=anObject;
  59040. return self;
  59041. },
  59042. args: ["anObject"],
  59043. source: "foo: anObject\x0a\x09foo := anObject",
  59044. referencedClasses: [],
  59045. messageSends: []
  59046. }),
  59047. $globals.ObjectMock);
  59048. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  59049. $core.addMethod(
  59050. $core.method({
  59051. selector: "notDefined",
  59052. protocol: "tests",
  59053. fn: function (){
  59054. var self=this,$self=this;
  59055. return $core.withContext(function($ctx1) {
  59056. return void 0;;
  59057. return self;
  59058. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  59059. },
  59060. args: [],
  59061. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  59062. referencedClasses: [],
  59063. messageSends: []
  59064. }),
  59065. $globals.ObjectTest);
  59066. $core.addMethod(
  59067. $core.method({
  59068. selector: "testBasicAccess",
  59069. protocol: "tests",
  59070. fn: function (){
  59071. var self=this,$self=this;
  59072. var o;
  59073. return $core.withContext(function($ctx1) {
  59074. var $1;
  59075. o=$recv($globals.Object)._new();
  59076. $recv(o)._basicAt_put_("a",(1));
  59077. $1=$recv(o)._basicAt_("a");
  59078. $ctx1.sendIdx["basicAt:"]=1;
  59079. $self._assert_equals_($1,(1));
  59080. $ctx1.sendIdx["assert:equals:"]=1;
  59081. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  59082. return self;
  59083. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  59084. },
  59085. args: [],
  59086. 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",
  59087. referencedClasses: ["Object"],
  59088. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  59089. }),
  59090. $globals.ObjectTest);
  59091. $core.addMethod(
  59092. $core.method({
  59093. selector: "testBasicPerform",
  59094. protocol: "tests",
  59095. fn: function (){
  59096. var self=this,$self=this;
  59097. var o;
  59098. return $core.withContext(function($ctx1) {
  59099. o=$recv($globals.Object)._new();
  59100. $recv(o)._basicAt_put_("func",(function(){
  59101. return "hello";
  59102. }));
  59103. $ctx1.sendIdx["basicAt:put:"]=1;
  59104. $recv(o)._basicAt_put_("func2",(function(a){
  59105. return $core.withContext(function($ctx2) {
  59106. return $recv(a).__plus((1));
  59107. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  59108. }));
  59109. $self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  59110. $ctx1.sendIdx["assert:equals:"]=1;
  59111. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  59112. return self;
  59113. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  59114. },
  59115. args: [],
  59116. 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",
  59117. referencedClasses: ["Object"],
  59118. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  59119. }),
  59120. $globals.ObjectTest);
  59121. $core.addMethod(
  59122. $core.method({
  59123. selector: "testDNU",
  59124. protocol: "tests",
  59125. fn: function (){
  59126. var self=this,$self=this;
  59127. return $core.withContext(function($ctx1) {
  59128. $self._should_raise_((function(){
  59129. return $core.withContext(function($ctx2) {
  59130. return $recv($recv($globals.Object)._new())._foo();
  59131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59132. }),$globals.MessageNotUnderstood);
  59133. return self;
  59134. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  59135. },
  59136. args: [],
  59137. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  59138. referencedClasses: ["Object", "MessageNotUnderstood"],
  59139. messageSends: ["should:raise:", "foo", "new"]
  59140. }),
  59141. $globals.ObjectTest);
  59142. $core.addMethod(
  59143. $core.method({
  59144. selector: "testEquality",
  59145. protocol: "tests",
  59146. fn: function (){
  59147. var self=this,$self=this;
  59148. var o;
  59149. return $core.withContext(function($ctx1) {
  59150. var $1,$2,$4,$3;
  59151. o=$recv($globals.Object)._new();
  59152. $ctx1.sendIdx["new"]=1;
  59153. $1=$recv(o).__eq($recv($globals.Object)._new());
  59154. $ctx1.sendIdx["="]=1;
  59155. $self._deny_($1);
  59156. $2=$recv(o).__eq(o);
  59157. $ctx1.sendIdx["="]=2;
  59158. $self._assert_($2);
  59159. $ctx1.sendIdx["assert:"]=1;
  59160. $4=$recv(o)._yourself();
  59161. $ctx1.sendIdx["yourself"]=1;
  59162. $3=$recv($4).__eq(o);
  59163. $ctx1.sendIdx["="]=3;
  59164. $self._assert_($3);
  59165. $ctx1.sendIdx["assert:"]=2;
  59166. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  59167. return self;
  59168. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  59169. },
  59170. args: [],
  59171. 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)",
  59172. referencedClasses: ["Object"],
  59173. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  59174. }),
  59175. $globals.ObjectTest);
  59176. $core.addMethod(
  59177. $core.method({
  59178. selector: "testHalt",
  59179. protocol: "tests",
  59180. fn: function (){
  59181. var self=this,$self=this;
  59182. return $core.withContext(function($ctx1) {
  59183. $self._should_raise_((function(){
  59184. return $core.withContext(function($ctx2) {
  59185. return $recv($recv($globals.Object)._new())._halt();
  59186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59187. }),$globals.Error);
  59188. return self;
  59189. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  59190. },
  59191. args: [],
  59192. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  59193. referencedClasses: ["Object", "Error"],
  59194. messageSends: ["should:raise:", "halt", "new"]
  59195. }),
  59196. $globals.ObjectTest);
  59197. $core.addMethod(
  59198. $core.method({
  59199. selector: "testIdentity",
  59200. protocol: "tests",
  59201. fn: function (){
  59202. var self=this,$self=this;
  59203. var o;
  59204. return $core.withContext(function($ctx1) {
  59205. var $1,$2,$4,$3;
  59206. o=$recv($globals.Object)._new();
  59207. $ctx1.sendIdx["new"]=1;
  59208. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  59209. $ctx1.sendIdx["=="]=1;
  59210. $self._deny_($1);
  59211. $2=$recv(o).__eq_eq(o);
  59212. $ctx1.sendIdx["=="]=2;
  59213. $self._assert_($2);
  59214. $ctx1.sendIdx["assert:"]=1;
  59215. $4=$recv(o)._yourself();
  59216. $ctx1.sendIdx["yourself"]=1;
  59217. $3=$recv($4).__eq_eq(o);
  59218. $ctx1.sendIdx["=="]=3;
  59219. $self._assert_($3);
  59220. $ctx1.sendIdx["assert:"]=2;
  59221. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  59222. return self;
  59223. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  59224. },
  59225. args: [],
  59226. 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",
  59227. referencedClasses: ["Object"],
  59228. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  59229. }),
  59230. $globals.ObjectTest);
  59231. $core.addMethod(
  59232. $core.method({
  59233. selector: "testIfNil",
  59234. protocol: "tests",
  59235. fn: function (){
  59236. var self=this,$self=this;
  59237. return $core.withContext(function($ctx1) {
  59238. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  59239. $2=$recv($globals.Object)._new();
  59240. $ctx1.sendIdx["new"]=1;
  59241. $1=$recv($2)._isNil();
  59242. $self._deny_($1);
  59243. $ctx1.sendIdx["deny:"]=1;
  59244. $5=$recv($globals.Object)._new();
  59245. $ctx1.sendIdx["new"]=2;
  59246. if(($receiver = $5) == null || $receiver.a$nil){
  59247. $4=true;
  59248. } else {
  59249. $4=$5;
  59250. }
  59251. $3=$recv($4).__eq(true);
  59252. $self._deny_($3);
  59253. $7=$recv($globals.Object)._new();
  59254. $ctx1.sendIdx["new"]=3;
  59255. if(($receiver = $7) == null || $receiver.a$nil){
  59256. $6=$7;
  59257. } else {
  59258. $6=true;
  59259. }
  59260. $self._assert_equals_($6,true);
  59261. $ctx1.sendIdx["assert:equals:"]=1;
  59262. $9=$recv($globals.Object)._new();
  59263. $ctx1.sendIdx["new"]=4;
  59264. if(($receiver = $9) == null || $receiver.a$nil){
  59265. $8=false;
  59266. } else {
  59267. $8=true;
  59268. }
  59269. $self._assert_equals_($8,true);
  59270. $ctx1.sendIdx["assert:equals:"]=2;
  59271. $11=$recv($globals.Object)._new();
  59272. if(($receiver = $11) == null || $receiver.a$nil){
  59273. $10=false;
  59274. } else {
  59275. $10=true;
  59276. }
  59277. $self._assert_equals_($10,true);
  59278. return self;
  59279. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  59280. },
  59281. args: [],
  59282. 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",
  59283. referencedClasses: ["Object"],
  59284. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  59285. }),
  59286. $globals.ObjectTest);
  59287. $core.addMethod(
  59288. $core.method({
  59289. selector: "testInstVars",
  59290. protocol: "tests",
  59291. fn: function (){
  59292. var self=this,$self=this;
  59293. var o;
  59294. return $core.withContext(function($ctx1) {
  59295. var $1,$2;
  59296. o=$recv($globals.ObjectMock)._new();
  59297. $1=$recv(o)._instVarAt_("foo");
  59298. $ctx1.sendIdx["instVarAt:"]=1;
  59299. $self._assert_equals_($1,nil);
  59300. $ctx1.sendIdx["assert:equals:"]=1;
  59301. $recv(o)._instVarAt_put_("foo",(1));
  59302. $2=$recv(o)._instVarAt_("foo");
  59303. $ctx1.sendIdx["instVarAt:"]=2;
  59304. $self._assert_equals_($2,(1));
  59305. $ctx1.sendIdx["assert:equals:"]=2;
  59306. $self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  59307. return self;
  59308. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  59309. },
  59310. args: [],
  59311. 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",
  59312. referencedClasses: ["ObjectMock"],
  59313. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  59314. }),
  59315. $globals.ObjectTest);
  59316. $core.addMethod(
  59317. $core.method({
  59318. selector: "testNilUndefined",
  59319. protocol: "tests",
  59320. fn: function (){
  59321. var self=this,$self=this;
  59322. return $core.withContext(function($ctx1) {
  59323. $self._assert_equals_($self._notDefined(),nil);
  59324. return self;
  59325. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  59326. },
  59327. args: [],
  59328. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  59329. referencedClasses: [],
  59330. messageSends: ["assert:equals:", "notDefined"]
  59331. }),
  59332. $globals.ObjectTest);
  59333. $core.addMethod(
  59334. $core.method({
  59335. selector: "testYourself",
  59336. protocol: "tests",
  59337. fn: function (){
  59338. var self=this,$self=this;
  59339. var o;
  59340. return $core.withContext(function($ctx1) {
  59341. o=$recv($globals.ObjectMock)._new();
  59342. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  59343. return self;
  59344. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  59345. },
  59346. args: [],
  59347. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  59348. referencedClasses: ["ObjectMock"],
  59349. messageSends: ["new", "assert:", "==", "yourself"]
  59350. }),
  59351. $globals.ObjectTest);
  59352. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  59353. $core.addMethod(
  59354. $core.method({
  59355. selector: "testAccessing",
  59356. protocol: "tests",
  59357. fn: function (){
  59358. var self=this,$self=this;
  59359. return $core.withContext(function($ctx1) {
  59360. var $2,$1,$3,$6,$5,$4;
  59361. $2=$recv($globals.Point)._x_y_((3),(4));
  59362. $ctx1.sendIdx["x:y:"]=1;
  59363. $1=$recv($2)._x();
  59364. $ctx1.sendIdx["x"]=1;
  59365. $self._assert_equals_($1,(3));
  59366. $ctx1.sendIdx["assert:equals:"]=1;
  59367. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  59368. $ctx1.sendIdx["y"]=1;
  59369. $self._assert_equals_($3,(4));
  59370. $ctx1.sendIdx["assert:equals:"]=2;
  59371. $6=$recv($globals.Point)._new();
  59372. $ctx1.sendIdx["new"]=1;
  59373. $5=$recv($6)._x_((3));
  59374. $4=$recv($5)._x();
  59375. $self._assert_equals_($4,(3));
  59376. $ctx1.sendIdx["assert:equals:"]=3;
  59377. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  59378. return self;
  59379. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  59380. },
  59381. args: [],
  59382. 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",
  59383. referencedClasses: ["Point"],
  59384. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  59385. }),
  59386. $globals.PointTest);
  59387. $core.addMethod(
  59388. $core.method({
  59389. selector: "testAngle",
  59390. protocol: "tests",
  59391. fn: function (){
  59392. var self=this,$self=this;
  59393. return $core.withContext(function($ctx1) {
  59394. $self._assert_equals_($recv((-1).__at((0)))._angle(),$recv($globals.Number)._pi());
  59395. return self;
  59396. }, function($ctx1) {$ctx1.fill(self,"testAngle",{},$globals.PointTest)});
  59397. },
  59398. args: [],
  59399. source: "testAngle\x0a\x09self assert: (-1@0) angle equals: Number pi",
  59400. referencedClasses: ["Number"],
  59401. messageSends: ["assert:equals:", "angle", "@", "pi"]
  59402. }),
  59403. $globals.PointTest);
  59404. $core.addMethod(
  59405. $core.method({
  59406. selector: "testArithmetic",
  59407. protocol: "tests",
  59408. fn: function (){
  59409. var self=this,$self=this;
  59410. return $core.withContext(function($ctx1) {
  59411. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  59412. $2=(3).__at((4));
  59413. $ctx1.sendIdx["@"]=1;
  59414. $3=(3).__at((4));
  59415. $ctx1.sendIdx["@"]=2;
  59416. $1=$recv($2).__star($3);
  59417. $4=$recv($globals.Point)._x_y_((9),(16));
  59418. $ctx1.sendIdx["x:y:"]=1;
  59419. $self._assert_equals_($1,$4);
  59420. $ctx1.sendIdx["assert:equals:"]=1;
  59421. $6=(3).__at((4));
  59422. $ctx1.sendIdx["@"]=3;
  59423. $7=(3).__at((4));
  59424. $ctx1.sendIdx["@"]=4;
  59425. $5=$recv($6).__plus($7);
  59426. $8=$recv($globals.Point)._x_y_((6),(8));
  59427. $ctx1.sendIdx["x:y:"]=2;
  59428. $self._assert_equals_($5,$8);
  59429. $ctx1.sendIdx["assert:equals:"]=2;
  59430. $10=(3).__at((4));
  59431. $ctx1.sendIdx["@"]=5;
  59432. $11=(3).__at((4));
  59433. $ctx1.sendIdx["@"]=6;
  59434. $9=$recv($10).__minus($11);
  59435. $12=$recv($globals.Point)._x_y_((0),(0));
  59436. $ctx1.sendIdx["x:y:"]=3;
  59437. $self._assert_equals_($9,$12);
  59438. $ctx1.sendIdx["assert:equals:"]=3;
  59439. $14=(6).__at((8));
  59440. $ctx1.sendIdx["@"]=7;
  59441. $13=$recv($14).__slash((3).__at((4)));
  59442. $self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  59443. return self;
  59444. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  59445. },
  59446. args: [],
  59447. 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)",
  59448. referencedClasses: ["Point"],
  59449. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  59450. }),
  59451. $globals.PointTest);
  59452. $core.addMethod(
  59453. $core.method({
  59454. selector: "testAt",
  59455. protocol: "tests",
  59456. fn: function (){
  59457. var self=this,$self=this;
  59458. return $core.withContext(function($ctx1) {
  59459. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  59460. return self;
  59461. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  59462. },
  59463. args: [],
  59464. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  59465. referencedClasses: ["Point"],
  59466. messageSends: ["assert:equals:", "@", "x:y:"]
  59467. }),
  59468. $globals.PointTest);
  59469. $core.addMethod(
  59470. $core.method({
  59471. selector: "testComparison",
  59472. protocol: "tests",
  59473. fn: function (){
  59474. var self=this,$self=this;
  59475. return $core.withContext(function($ctx1) {
  59476. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  59477. $2=(3).__at((4));
  59478. $ctx1.sendIdx["@"]=1;
  59479. $3=(4).__at((5));
  59480. $ctx1.sendIdx["@"]=2;
  59481. $1=$recv($2).__lt($3);
  59482. $ctx1.sendIdx["<"]=1;
  59483. $self._assert_($1);
  59484. $ctx1.sendIdx["assert:"]=1;
  59485. $5=(3).__at((4));
  59486. $ctx1.sendIdx["@"]=3;
  59487. $6=(4).__at((4));
  59488. $ctx1.sendIdx["@"]=4;
  59489. $4=$recv($5).__lt($6);
  59490. $self._deny_($4);
  59491. $ctx1.sendIdx["deny:"]=1;
  59492. $8=(4).__at((5));
  59493. $ctx1.sendIdx["@"]=5;
  59494. $9=(4).__at((5));
  59495. $ctx1.sendIdx["@"]=6;
  59496. $7=$recv($8).__lt_eq($9);
  59497. $ctx1.sendIdx["<="]=1;
  59498. $self._assert_($7);
  59499. $ctx1.sendIdx["assert:"]=2;
  59500. $11=(4).__at((5));
  59501. $ctx1.sendIdx["@"]=7;
  59502. $12=(3).__at((5));
  59503. $ctx1.sendIdx["@"]=8;
  59504. $10=$recv($11).__lt_eq($12);
  59505. $self._deny_($10);
  59506. $ctx1.sendIdx["deny:"]=2;
  59507. $14=(5).__at((6));
  59508. $ctx1.sendIdx["@"]=9;
  59509. $15=(4).__at((5));
  59510. $ctx1.sendIdx["@"]=10;
  59511. $13=$recv($14).__gt($15);
  59512. $ctx1.sendIdx[">"]=1;
  59513. $self._assert_($13);
  59514. $ctx1.sendIdx["assert:"]=3;
  59515. $17=(5).__at((6));
  59516. $ctx1.sendIdx["@"]=11;
  59517. $18=(6).__at((6));
  59518. $ctx1.sendIdx["@"]=12;
  59519. $16=$recv($17).__gt($18);
  59520. $self._deny_($16);
  59521. $ctx1.sendIdx["deny:"]=3;
  59522. $20=(4).__at((5));
  59523. $ctx1.sendIdx["@"]=13;
  59524. $21=(4).__at((5));
  59525. $ctx1.sendIdx["@"]=14;
  59526. $19=$recv($20).__gt_eq($21);
  59527. $ctx1.sendIdx[">="]=1;
  59528. $self._assert_($19);
  59529. $23=(4).__at((5));
  59530. $ctx1.sendIdx["@"]=15;
  59531. $22=$recv($23).__gt_eq((5).__at((5)));
  59532. $self._deny_($22);
  59533. return self;
  59534. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  59535. },
  59536. args: [],
  59537. 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)",
  59538. referencedClasses: [],
  59539. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  59540. }),
  59541. $globals.PointTest);
  59542. $core.addMethod(
  59543. $core.method({
  59544. selector: "testDotProduct",
  59545. protocol: "tests",
  59546. fn: function (){
  59547. var self=this,$self=this;
  59548. return $core.withContext(function($ctx1) {
  59549. var $2,$1;
  59550. $2=(2).__at((3));
  59551. $ctx1.sendIdx["@"]=1;
  59552. $1=$recv($2)._dotProduct_((3).__at((7)));
  59553. $self._assert_equals_($1,(27));
  59554. return self;
  59555. }, function($ctx1) {$ctx1.fill(self,"testDotProduct",{},$globals.PointTest)});
  59556. },
  59557. args: [],
  59558. source: "testDotProduct\x0a\x09self assert: (2@3 dotProduct: 3@7) equals: 27",
  59559. referencedClasses: [],
  59560. messageSends: ["assert:equals:", "dotProduct:", "@"]
  59561. }),
  59562. $globals.PointTest);
  59563. $core.addMethod(
  59564. $core.method({
  59565. selector: "testEgality",
  59566. protocol: "tests",
  59567. fn: function (){
  59568. var self=this,$self=this;
  59569. return $core.withContext(function($ctx1) {
  59570. var $2,$3,$1,$5,$4;
  59571. $2=(3).__at((4));
  59572. $ctx1.sendIdx["@"]=1;
  59573. $3=(3).__at((4));
  59574. $ctx1.sendIdx["@"]=2;
  59575. $1=$recv($2).__eq($3);
  59576. $ctx1.sendIdx["="]=1;
  59577. $self._assert_($1);
  59578. $5=(3).__at((5));
  59579. $ctx1.sendIdx["@"]=3;
  59580. $4=$recv($5).__eq((3).__at((6)));
  59581. $self._deny_($4);
  59582. return self;
  59583. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  59584. },
  59585. args: [],
  59586. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  59587. referencedClasses: [],
  59588. messageSends: ["assert:", "=", "@", "deny:"]
  59589. }),
  59590. $globals.PointTest);
  59591. $core.addMethod(
  59592. $core.method({
  59593. selector: "testNew",
  59594. protocol: "tests",
  59595. fn: function (){
  59596. var self=this,$self=this;
  59597. return $core.withContext(function($ctx1) {
  59598. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  59599. $3=$recv($globals.Point)._new();
  59600. $ctx1.sendIdx["new"]=1;
  59601. $2=$recv($3)._x_((3));
  59602. $ctx1.sendIdx["x:"]=1;
  59603. $1=$recv($2)._y();
  59604. $ctx1.sendIdx["y"]=1;
  59605. $self._assert_equals_($1,nil);
  59606. $ctx1.sendIdx["assert:equals:"]=1;
  59607. $7=$recv($globals.Point)._new();
  59608. $ctx1.sendIdx["new"]=2;
  59609. $6=$recv($7)._x_((3));
  59610. $5=$recv($6)._x();
  59611. $ctx1.sendIdx["x"]=1;
  59612. $4=$recv($5).__eq((0));
  59613. $ctx1.sendIdx["="]=1;
  59614. $self._deny_($4);
  59615. $ctx1.sendIdx["deny:"]=1;
  59616. $10=$recv($globals.Point)._new();
  59617. $ctx1.sendIdx["new"]=3;
  59618. $9=$recv($10)._y_((4));
  59619. $ctx1.sendIdx["y:"]=1;
  59620. $8=$recv($9)._x();
  59621. $self._assert_equals_($8,nil);
  59622. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  59623. return self;
  59624. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  59625. },
  59626. args: [],
  59627. 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",
  59628. referencedClasses: ["Point"],
  59629. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  59630. }),
  59631. $globals.PointTest);
  59632. $core.addMethod(
  59633. $core.method({
  59634. selector: "testNormal",
  59635. protocol: "tests",
  59636. fn: function (){
  59637. var self=this,$self=this;
  59638. return $core.withContext(function($ctx1) {
  59639. var $2,$1;
  59640. $2=(1).__at((0));
  59641. $ctx1.sendIdx["@"]=1;
  59642. $1=$recv($2)._normal();
  59643. $self._assert_equals_($1,(0).__at((1)));
  59644. return self;
  59645. }, function($ctx1) {$ctx1.fill(self,"testNormal",{},$globals.PointTest)});
  59646. },
  59647. args: [],
  59648. source: "testNormal\x0a\x09self assert: (1@0) normal equals: 0@1",
  59649. referencedClasses: [],
  59650. messageSends: ["assert:equals:", "normal", "@"]
  59651. }),
  59652. $globals.PointTest);
  59653. $core.addMethod(
  59654. $core.method({
  59655. selector: "testNormalized",
  59656. protocol: "tests",
  59657. fn: function (){
  59658. var self=this,$self=this;
  59659. return $core.withContext(function($ctx1) {
  59660. var $2,$1,$3,$5,$4;
  59661. $2=(0).__at((2));
  59662. $ctx1.sendIdx["@"]=1;
  59663. $1=$recv($2)._normalized();
  59664. $ctx1.sendIdx["normalized"]=1;
  59665. $3=(0).__at((1));
  59666. $ctx1.sendIdx["@"]=2;
  59667. $self._assert_equals_($1,$3);
  59668. $ctx1.sendIdx["assert:equals:"]=1;
  59669. $5=(0).__at((0));
  59670. $ctx1.sendIdx["@"]=3;
  59671. $4=$recv($5)._normalized();
  59672. $self._assert_equals_($4,(0).__at((0)));
  59673. return self;
  59674. }, function($ctx1) {$ctx1.fill(self,"testNormalized",{},$globals.PointTest)});
  59675. },
  59676. args: [],
  59677. source: "testNormalized\x0a\x09self assert: (0@2) normalized equals: 0@1.\x0a\x09self assert: (0@0) normalized equals: 0@0.",
  59678. referencedClasses: [],
  59679. messageSends: ["assert:equals:", "normalized", "@"]
  59680. }),
  59681. $globals.PointTest);
  59682. $core.addMethod(
  59683. $core.method({
  59684. selector: "testPolarCoordinates",
  59685. protocol: "tests",
  59686. fn: function (){
  59687. var self=this,$self=this;
  59688. return $core.withContext(function($ctx1) {
  59689. var $2,$1;
  59690. $2=(1).__at((0));
  59691. $ctx1.sendIdx["@"]=1;
  59692. $1=$recv($2)._r();
  59693. $ctx1.sendIdx["r"]=1;
  59694. $self._assert_equals_($1,(1));
  59695. $ctx1.sendIdx["assert:equals:"]=1;
  59696. $self._assert_equals_($recv((0).__at((0)))._r(),(0));
  59697. return self;
  59698. }, function($ctx1) {$ctx1.fill(self,"testPolarCoordinates",{},$globals.PointTest)});
  59699. },
  59700. args: [],
  59701. source: "testPolarCoordinates\x0a\x09self assert: (1@0) r equals: 1.\x0a\x09self assert: (0@0) r equals: 0.",
  59702. referencedClasses: [],
  59703. messageSends: ["assert:equals:", "r", "@"]
  59704. }),
  59705. $globals.PointTest);
  59706. $core.addMethod(
  59707. $core.method({
  59708. selector: "testRectangleCreation",
  59709. protocol: "tests",
  59710. fn: function (){
  59711. var self=this,$self=this;
  59712. return $core.withContext(function($ctx1) {
  59713. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$16;
  59714. $2=(1).__at((1));
  59715. $ctx1.sendIdx["@"]=1;
  59716. $3=(2).__at((2));
  59717. $ctx1.sendIdx["@"]=2;
  59718. $1=$recv($2)._corner_($3);
  59719. $5=(1).__at((1));
  59720. $ctx1.sendIdx["@"]=3;
  59721. $6=(2).__at((2));
  59722. $ctx1.sendIdx["@"]=4;
  59723. $4=$recv($globals.Rectangle)._origin_corner_($5,$6);
  59724. $self._assert_equals_($1,$4);
  59725. $ctx1.sendIdx["assert:equals:"]=1;
  59726. $8=(1).__at((1));
  59727. $ctx1.sendIdx["@"]=5;
  59728. $9=(2).__at((2));
  59729. $ctx1.sendIdx["@"]=6;
  59730. $7=$recv($8)._rectangle_($9);
  59731. $11=(1).__at((1));
  59732. $ctx1.sendIdx["@"]=7;
  59733. $12=(2).__at((2));
  59734. $ctx1.sendIdx["@"]=8;
  59735. $10=$recv($globals.Rectangle)._point_point_($11,$12);
  59736. $self._assert_equals_($7,$10);
  59737. $ctx1.sendIdx["assert:equals:"]=2;
  59738. $14=(1).__at((1));
  59739. $ctx1.sendIdx["@"]=9;
  59740. $15=(2).__at((2));
  59741. $ctx1.sendIdx["@"]=10;
  59742. $13=$recv($14)._extent_($15);
  59743. $17=(1).__at((1));
  59744. $ctx1.sendIdx["@"]=11;
  59745. $16=$recv($globals.Rectangle)._origin_extent_($17,(2).__at((2)));
  59746. $self._assert_equals_($13,$16);
  59747. return self;
  59748. }, function($ctx1) {$ctx1.fill(self,"testRectangleCreation",{},$globals.PointTest)});
  59749. },
  59750. args: [],
  59751. 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)",
  59752. referencedClasses: ["Rectangle"],
  59753. messageSends: ["assert:equals:", "corner:", "@", "origin:corner:", "rectangle:", "point:point:", "extent:", "origin:extent:"]
  59754. }),
  59755. $globals.PointTest);
  59756. $core.addMethod(
  59757. $core.method({
  59758. selector: "testTranslateBy",
  59759. protocol: "tests",
  59760. fn: function (){
  59761. var self=this,$self=this;
  59762. return $core.withContext(function($ctx1) {
  59763. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  59764. $2=(3).__at((3));
  59765. $ctx1.sendIdx["@"]=1;
  59766. $3=(0).__at((1));
  59767. $ctx1.sendIdx["@"]=2;
  59768. $1=$recv($2)._translateBy_($3);
  59769. $ctx1.sendIdx["translateBy:"]=1;
  59770. $4=(3).__at((4));
  59771. $ctx1.sendIdx["@"]=3;
  59772. $self._assert_equals_($1,$4);
  59773. $ctx1.sendIdx["assert:equals:"]=1;
  59774. $6=(3).__at((3));
  59775. $ctx1.sendIdx["@"]=4;
  59776. $8=(1)._negated();
  59777. $ctx1.sendIdx["negated"]=1;
  59778. $7=(0).__at($8);
  59779. $ctx1.sendIdx["@"]=5;
  59780. $5=$recv($6)._translateBy_($7);
  59781. $ctx1.sendIdx["translateBy:"]=2;
  59782. $9=(3).__at((2));
  59783. $ctx1.sendIdx["@"]=6;
  59784. $self._assert_equals_($5,$9);
  59785. $ctx1.sendIdx["assert:equals:"]=2;
  59786. $11=(3).__at((3));
  59787. $ctx1.sendIdx["@"]=7;
  59788. $12=(2).__at((3));
  59789. $ctx1.sendIdx["@"]=8;
  59790. $10=$recv($11)._translateBy_($12);
  59791. $ctx1.sendIdx["translateBy:"]=3;
  59792. $13=(5).__at((6));
  59793. $ctx1.sendIdx["@"]=9;
  59794. $self._assert_equals_($10,$13);
  59795. $ctx1.sendIdx["assert:equals:"]=3;
  59796. $15=(3).__at((3));
  59797. $ctx1.sendIdx["@"]=10;
  59798. $16=$recv((3)._negated()).__at((0));
  59799. $ctx1.sendIdx["@"]=11;
  59800. $14=$recv($15)._translateBy_($16);
  59801. $self._assert_equals_($14,(0).__at((3)));
  59802. return self;
  59803. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  59804. },
  59805. args: [],
  59806. 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.",
  59807. referencedClasses: [],
  59808. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  59809. }),
  59810. $globals.PointTest);
  59811. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  59812. $core.addMethod(
  59813. $core.method({
  59814. selector: "testNextIfAbsent",
  59815. protocol: "tests",
  59816. fn: function (){
  59817. var self=this,$self=this;
  59818. var queue;
  59819. return $core.withContext(function($ctx1) {
  59820. var $2,$1;
  59821. queue=$recv($globals.Queue)._new();
  59822. $recv(queue)._nextPut_("index1");
  59823. $2=$recv(queue)._nextIfAbsent_("empty");
  59824. $ctx1.sendIdx["nextIfAbsent:"]=1;
  59825. $1=$recv($2).__eq("index1");
  59826. $ctx1.sendIdx["="]=1;
  59827. $self._assert_($1);
  59828. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  59829. return self;
  59830. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  59831. },
  59832. args: [],
  59833. 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'",
  59834. referencedClasses: ["Queue"],
  59835. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  59836. }),
  59837. $globals.QueueTest);
  59838. $core.addMethod(
  59839. $core.method({
  59840. selector: "testQueueNext",
  59841. protocol: "tests",
  59842. fn: function (){
  59843. var self=this,$self=this;
  59844. var queue;
  59845. return $core.withContext(function($ctx1) {
  59846. var $1,$3,$2,$5,$4;
  59847. queue=$recv($globals.Queue)._new();
  59848. $1=queue;
  59849. $recv($1)._nextPut_("index1");
  59850. $ctx1.sendIdx["nextPut:"]=1;
  59851. $recv($1)._nextPut_("index2");
  59852. $3=$recv(queue)._next();
  59853. $ctx1.sendIdx["next"]=1;
  59854. $2=$recv($3).__eq("index1");
  59855. $ctx1.sendIdx["="]=1;
  59856. $self._assert_($2);
  59857. $5=$recv(queue)._next();
  59858. $ctx1.sendIdx["next"]=2;
  59859. $4=$recv($5).__eq("index");
  59860. $self._deny_($4);
  59861. $self._should_raise_((function(){
  59862. return $core.withContext(function($ctx2) {
  59863. return $recv(queue)._next();
  59864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59865. }),$globals.Error);
  59866. return self;
  59867. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  59868. },
  59869. args: [],
  59870. 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",
  59871. referencedClasses: ["Queue", "Error"],
  59872. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  59873. }),
  59874. $globals.QueueTest);
  59875. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  59876. $core.addMethod(
  59877. $core.method({
  59878. selector: "testAtRandomNumber",
  59879. protocol: "tests",
  59880. fn: function (){
  59881. var self=this,$self=this;
  59882. var val;
  59883. return $core.withContext(function($ctx1) {
  59884. (100)._timesRepeat_((function(){
  59885. return $core.withContext(function($ctx2) {
  59886. val=(10)._atRandom();
  59887. val;
  59888. $self._assert_($recv(val).__gt((0)));
  59889. $ctx2.sendIdx["assert:"]=1;
  59890. return $self._assert_($recv(val).__lt((11)));
  59891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59892. }));
  59893. return self;
  59894. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  59895. },
  59896. args: [],
  59897. 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]",
  59898. referencedClasses: [],
  59899. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  59900. }),
  59901. $globals.RandomTest);
  59902. $core.addMethod(
  59903. $core.method({
  59904. selector: "testAtRandomSequenceableCollection",
  59905. protocol: "tests",
  59906. fn: function (){
  59907. var self=this,$self=this;
  59908. var val;
  59909. return $core.withContext(function($ctx1) {
  59910. var $3,$4,$2,$1;
  59911. (100)._timesRepeat_((function(){
  59912. return $core.withContext(function($ctx2) {
  59913. val="abc"._atRandom();
  59914. val;
  59915. $3=$recv(val).__eq("a");
  59916. $ctx2.sendIdx["="]=1;
  59917. $4=$recv(val).__eq("b");
  59918. $ctx2.sendIdx["="]=2;
  59919. $2=$recv($3).__or($4);
  59920. $1=$recv($2).__or($recv(val).__eq("c"));
  59921. $ctx2.sendIdx["|"]=1;
  59922. return $self._assert_($1);
  59923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59924. }));
  59925. return self;
  59926. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  59927. },
  59928. args: [],
  59929. 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].",
  59930. referencedClasses: [],
  59931. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  59932. }),
  59933. $globals.RandomTest);
  59934. $core.addMethod(
  59935. $core.method({
  59936. selector: "textNext",
  59937. protocol: "tests",
  59938. fn: function (){
  59939. var self=this,$self=this;
  59940. return $core.withContext(function($ctx1) {
  59941. var $1;
  59942. (10000)._timesRepeat_((function(){
  59943. var current,next;
  59944. return $core.withContext(function($ctx2) {
  59945. next=$recv($recv($globals.Random)._new())._next();
  59946. next;
  59947. $self._assert_($recv(next).__gt_eq((0)));
  59948. $ctx2.sendIdx["assert:"]=1;
  59949. $self._assert_($recv(next).__lt((1)));
  59950. $1=$recv(current).__eq(next);
  59951. $ctx2.sendIdx["="]=1;
  59952. $self._deny_($1);
  59953. return $recv(next).__eq(current);
  59954. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  59955. }));
  59956. return self;
  59957. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  59958. },
  59959. args: [],
  59960. 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 ]",
  59961. referencedClasses: ["Random"],
  59962. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  59963. }),
  59964. $globals.RandomTest);
  59965. $core.addClass("RectangleTest", $globals.TestCase, [], "Kernel-Tests");
  59966. $core.addMethod(
  59967. $core.method({
  59968. selector: "testContainsPoint",
  59969. protocol: "tests",
  59970. fn: function (){
  59971. var self=this,$self=this;
  59972. var rect;
  59973. return $core.withContext(function($ctx1) {
  59974. var $1,$2,$4,$5,$3;
  59975. $1=(0).__at((0));
  59976. $ctx1.sendIdx["@"]=1;
  59977. $2=(4).__at((4));
  59978. $ctx1.sendIdx["@"]=2;
  59979. rect=$recv($globals.Rectangle)._origin_corner_($1,$2);
  59980. $4=rect;
  59981. $5=(1).__at((2));
  59982. $ctx1.sendIdx["@"]=3;
  59983. $3=$recv($4)._containsPoint_($5);
  59984. $ctx1.sendIdx["containsPoint:"]=1;
  59985. $self._assert_($3);
  59986. $ctx1.sendIdx["assert:"]=1;
  59987. $self._assert_($recv($recv(rect)._containsPoint_((5).__at((4))))._not());
  59988. return self;
  59989. }, function($ctx1) {$ctx1.fill(self,"testContainsPoint",{rect:rect},$globals.RectangleTest)});
  59990. },
  59991. args: [],
  59992. 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.",
  59993. referencedClasses: ["Rectangle"],
  59994. messageSends: ["origin:corner:", "@", "assert:", "containsPoint:", "not"]
  59995. }),
  59996. $globals.RectangleTest);
  59997. $core.addMethod(
  59998. $core.method({
  59999. selector: "testContainsRect",
  60000. protocol: "tests",
  60001. fn: function (){
  60002. var self=this,$self=this;
  60003. return $core.withContext(function($ctx1) {
  60004. var $3,$4,$2,$6,$7,$5,$1,$11,$12,$10,$14,$13,$9,$8;
  60005. $3=(0).__at((0));
  60006. $ctx1.sendIdx["@"]=1;
  60007. $4=(6).__at((6));
  60008. $ctx1.sendIdx["@"]=2;
  60009. $2=$recv($globals.Rectangle)._origin_corner_($3,$4);
  60010. $ctx1.sendIdx["origin:corner:"]=1;
  60011. $6=(1).__at((1));
  60012. $ctx1.sendIdx["@"]=3;
  60013. $7=(5).__at((5));
  60014. $ctx1.sendIdx["@"]=4;
  60015. $5=$recv($globals.Rectangle)._origin_corner_($6,$7);
  60016. $ctx1.sendIdx["origin:corner:"]=2;
  60017. $1=$recv($2)._containsRect_($5);
  60018. $ctx1.sendIdx["containsRect:"]=1;
  60019. $self._assert_($1);
  60020. $ctx1.sendIdx["assert:"]=1;
  60021. $11=(0).__at((0));
  60022. $ctx1.sendIdx["@"]=5;
  60023. $12=(6).__at((6));
  60024. $ctx1.sendIdx["@"]=6;
  60025. $10=$recv($globals.Rectangle)._origin_corner_($11,$12);
  60026. $ctx1.sendIdx["origin:corner:"]=3;
  60027. $14=(1).__at((-1));
  60028. $ctx1.sendIdx["@"]=7;
  60029. $13=$recv($globals.Rectangle)._origin_corner_($14,(5).__at((5)));
  60030. $9=$recv($10)._containsRect_($13);
  60031. $8=$recv($9)._not();
  60032. $self._assert_($8);
  60033. return self;
  60034. }, function($ctx1) {$ctx1.fill(self,"testContainsRect",{},$globals.RectangleTest)});
  60035. },
  60036. args: [],
  60037. 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.",
  60038. referencedClasses: ["Rectangle"],
  60039. messageSends: ["assert:", "containsRect:", "origin:corner:", "@", "not"]
  60040. }),
  60041. $globals.RectangleTest);
  60042. $core.addMethod(
  60043. $core.method({
  60044. selector: "testOriginExtent",
  60045. protocol: "tests",
  60046. fn: function (){
  60047. var self=this,$self=this;
  60048. var rectangle;
  60049. return $core.withContext(function($ctx1) {
  60050. var $1,$2,$3,$4;
  60051. $1=(3).__at((4));
  60052. $ctx1.sendIdx["@"]=1;
  60053. $2=(7).__at((8));
  60054. $ctx1.sendIdx["@"]=2;
  60055. rectangle=$recv($globals.Rectangle)._origin_extent_($1,$2);
  60056. $3=$recv(rectangle)._origin();
  60057. $4=(3).__at((4));
  60058. $ctx1.sendIdx["@"]=3;
  60059. $self._assert_equals_($3,$4);
  60060. $ctx1.sendIdx["assert:equals:"]=1;
  60061. $self._assert_equals_($recv(rectangle)._corner(),(10).__at((12)));
  60062. return self;
  60063. }, function($ctx1) {$ctx1.fill(self,"testOriginExtent",{rectangle:rectangle},$globals.RectangleTest)});
  60064. },
  60065. args: [],
  60066. 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.",
  60067. referencedClasses: ["Rectangle"],
  60068. messageSends: ["origin:extent:", "@", "assert:equals:", "origin", "corner"]
  60069. }),
  60070. $globals.RectangleTest);
  60071. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  60072. $core.addMethod(
  60073. $core.method({
  60074. selector: "collectionClass",
  60075. protocol: "accessing",
  60076. fn: function (){
  60077. var self=this,$self=this;
  60078. return $core.withContext(function($ctx1) {
  60079. return $recv($self._class())._collectionClass();
  60080. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  60081. },
  60082. args: [],
  60083. source: "collectionClass\x0a\x09^ self class collectionClass",
  60084. referencedClasses: [],
  60085. messageSends: ["collectionClass", "class"]
  60086. }),
  60087. $globals.StreamTest);
  60088. $core.addMethod(
  60089. $core.method({
  60090. selector: "newCollection",
  60091. protocol: "accessing",
  60092. fn: function (){
  60093. var self=this,$self=this;
  60094. return $core.withContext(function($ctx1) {
  60095. return $recv($self._collectionClass())._new();
  60096. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  60097. },
  60098. args: [],
  60099. source: "newCollection\x0a\x09^ self collectionClass new",
  60100. referencedClasses: [],
  60101. messageSends: ["new", "collectionClass"]
  60102. }),
  60103. $globals.StreamTest);
  60104. $core.addMethod(
  60105. $core.method({
  60106. selector: "newStream",
  60107. protocol: "accessing",
  60108. fn: function (){
  60109. var self=this,$self=this;
  60110. return $core.withContext(function($ctx1) {
  60111. return $recv($recv($self._collectionClass())._new())._stream();
  60112. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  60113. },
  60114. args: [],
  60115. source: "newStream\x0a\x09^ self collectionClass new stream",
  60116. referencedClasses: [],
  60117. messageSends: ["stream", "new", "collectionClass"]
  60118. }),
  60119. $globals.StreamTest);
  60120. $core.addMethod(
  60121. $core.method({
  60122. selector: "testAtStartAtEnd",
  60123. protocol: "tests",
  60124. fn: function (){
  60125. var self=this,$self=this;
  60126. var stream;
  60127. return $core.withContext(function($ctx1) {
  60128. var $1,$2,$3,$4;
  60129. stream=$self._newStream();
  60130. $1=$recv(stream)._atStart();
  60131. $ctx1.sendIdx["atStart"]=1;
  60132. $self._assert_($1);
  60133. $ctx1.sendIdx["assert:"]=1;
  60134. $2=$recv(stream)._atEnd();
  60135. $ctx1.sendIdx["atEnd"]=1;
  60136. $self._assert_($2);
  60137. $ctx1.sendIdx["assert:"]=2;
  60138. $recv(stream)._nextPutAll_($self._newCollection());
  60139. $3=$recv(stream)._atEnd();
  60140. $ctx1.sendIdx["atEnd"]=2;
  60141. $self._assert_($3);
  60142. $4=$recv(stream)._atStart();
  60143. $ctx1.sendIdx["atStart"]=2;
  60144. $self._deny_($4);
  60145. $ctx1.sendIdx["deny:"]=1;
  60146. $recv(stream)._position_((1));
  60147. $self._deny_($recv(stream)._atEnd());
  60148. $ctx1.sendIdx["deny:"]=2;
  60149. $self._deny_($recv(stream)._atStart());
  60150. return self;
  60151. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  60152. },
  60153. args: [],
  60154. 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",
  60155. referencedClasses: [],
  60156. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  60157. }),
  60158. $globals.StreamTest);
  60159. $core.addMethod(
  60160. $core.method({
  60161. selector: "testContents",
  60162. protocol: "tests",
  60163. fn: function (){
  60164. var self=this,$self=this;
  60165. var stream;
  60166. return $core.withContext(function($ctx1) {
  60167. var $1,$2;
  60168. stream=$self._newStream();
  60169. $1=stream;
  60170. $2=$self._newCollection();
  60171. $ctx1.sendIdx["newCollection"]=1;
  60172. $recv($1)._nextPutAll_($2);
  60173. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  60174. return self;
  60175. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  60176. },
  60177. args: [],
  60178. 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",
  60179. referencedClasses: [],
  60180. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  60181. }),
  60182. $globals.StreamTest);
  60183. $core.addMethod(
  60184. $core.method({
  60185. selector: "testIsEmpty",
  60186. protocol: "tests",
  60187. fn: function (){
  60188. var self=this,$self=this;
  60189. var stream;
  60190. return $core.withContext(function($ctx1) {
  60191. var $1;
  60192. stream=$self._newStream();
  60193. $1=$recv(stream)._isEmpty();
  60194. $ctx1.sendIdx["isEmpty"]=1;
  60195. $self._assert_($1);
  60196. $recv(stream)._nextPutAll_($self._newCollection());
  60197. $self._deny_($recv(stream)._isEmpty());
  60198. return self;
  60199. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  60200. },
  60201. args: [],
  60202. 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",
  60203. referencedClasses: [],
  60204. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  60205. }),
  60206. $globals.StreamTest);
  60207. $core.addMethod(
  60208. $core.method({
  60209. selector: "testPosition",
  60210. protocol: "tests",
  60211. fn: function (){
  60212. var self=this,$self=this;
  60213. var collection,stream;
  60214. return $core.withContext(function($ctx1) {
  60215. var $1,$2,$3;
  60216. collection=$self._newCollection();
  60217. stream=$self._newStream();
  60218. $recv(stream)._nextPutAll_(collection);
  60219. $1=$recv(stream)._position();
  60220. $ctx1.sendIdx["position"]=1;
  60221. $self._assert_equals_($1,$recv(collection)._size());
  60222. $ctx1.sendIdx["assert:equals:"]=1;
  60223. $recv(stream)._position_((0));
  60224. $2=$recv(stream)._position();
  60225. $ctx1.sendIdx["position"]=2;
  60226. $self._assert_equals_($2,(0));
  60227. $ctx1.sendIdx["assert:equals:"]=2;
  60228. $recv(stream)._next();
  60229. $ctx1.sendIdx["next"]=1;
  60230. $3=$recv(stream)._position();
  60231. $ctx1.sendIdx["position"]=3;
  60232. $self._assert_equals_($3,(1));
  60233. $ctx1.sendIdx["assert:equals:"]=3;
  60234. $recv(stream)._next();
  60235. $self._assert_equals_($recv(stream)._position(),(2));
  60236. return self;
  60237. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  60238. },
  60239. args: [],
  60240. 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",
  60241. referencedClasses: [],
  60242. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  60243. }),
  60244. $globals.StreamTest);
  60245. $core.addMethod(
  60246. $core.method({
  60247. selector: "testReading",
  60248. protocol: "tests",
  60249. fn: function (){
  60250. var self=this,$self=this;
  60251. var stream,collection;
  60252. return $core.withContext(function($ctx1) {
  60253. var $1,$2;
  60254. collection=$self._newCollection();
  60255. stream=$self._newStream();
  60256. $1=stream;
  60257. $recv($1)._nextPutAll_(collection);
  60258. $recv($1)._position_((0));
  60259. $recv(collection)._do_((function(each){
  60260. return $core.withContext(function($ctx2) {
  60261. $2=$recv(stream)._next();
  60262. $ctx2.sendIdx["next"]=1;
  60263. return $self._assert_equals_($2,each);
  60264. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60265. }));
  60266. $self._assert_($recv($recv(stream)._next())._isNil());
  60267. return self;
  60268. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  60269. },
  60270. args: [],
  60271. 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",
  60272. referencedClasses: [],
  60273. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  60274. }),
  60275. $globals.StreamTest);
  60276. $core.addMethod(
  60277. $core.method({
  60278. selector: "testStreamContents",
  60279. protocol: "tests",
  60280. fn: function (){
  60281. var self=this,$self=this;
  60282. return self;
  60283. },
  60284. args: [],
  60285. source: "testStreamContents",
  60286. referencedClasses: [],
  60287. messageSends: []
  60288. }),
  60289. $globals.StreamTest);
  60290. $core.addMethod(
  60291. $core.method({
  60292. selector: "testWrite",
  60293. protocol: "tests",
  60294. fn: function (){
  60295. var self=this,$self=this;
  60296. var stream,collection;
  60297. return $core.withContext(function($ctx1) {
  60298. collection=$self._newCollection();
  60299. stream=$self._newStream();
  60300. $recv(collection)._do_((function(each){
  60301. return $core.withContext(function($ctx2) {
  60302. return $recv(stream).__lt_lt(each);
  60303. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60304. }));
  60305. $self._assert_equals_($recv(stream)._contents(),collection);
  60306. return self;
  60307. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  60308. },
  60309. args: [],
  60310. 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",
  60311. referencedClasses: [],
  60312. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  60313. }),
  60314. $globals.StreamTest);
  60315. $core.addMethod(
  60316. $core.method({
  60317. selector: "testWriting",
  60318. protocol: "tests",
  60319. fn: function (){
  60320. var self=this,$self=this;
  60321. var stream,collection;
  60322. return $core.withContext(function($ctx1) {
  60323. var $1;
  60324. collection=$self._newCollection();
  60325. stream=$self._newStream();
  60326. $ctx1.sendIdx["newStream"]=1;
  60327. $recv(collection)._do_((function(each){
  60328. return $core.withContext(function($ctx2) {
  60329. return $recv(stream)._nextPut_(each);
  60330. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60331. }));
  60332. $1=$recv(stream)._contents();
  60333. $ctx1.sendIdx["contents"]=1;
  60334. $self._assert_equals_($1,collection);
  60335. $ctx1.sendIdx["assert:equals:"]=1;
  60336. stream=$self._newStream();
  60337. $recv(stream)._nextPutAll_(collection);
  60338. $self._assert_equals_($recv(stream)._contents(),collection);
  60339. return self;
  60340. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  60341. },
  60342. args: [],
  60343. 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",
  60344. referencedClasses: [],
  60345. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  60346. }),
  60347. $globals.StreamTest);
  60348. $core.addMethod(
  60349. $core.method({
  60350. selector: "collectionClass",
  60351. protocol: "accessing",
  60352. fn: function (){
  60353. var self=this,$self=this;
  60354. return nil;
  60355. },
  60356. args: [],
  60357. source: "collectionClass\x0a\x09^ nil",
  60358. referencedClasses: [],
  60359. messageSends: []
  60360. }),
  60361. $globals.StreamTest.a$cls);
  60362. $core.addMethod(
  60363. $core.method({
  60364. selector: "isAbstract",
  60365. protocol: "testing",
  60366. fn: function (){
  60367. var self=this,$self=this;
  60368. return $core.withContext(function($ctx1) {
  60369. return $recv($self._collectionClass())._isNil();
  60370. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.a$cls)});
  60371. },
  60372. args: [],
  60373. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  60374. referencedClasses: [],
  60375. messageSends: ["isNil", "collectionClass"]
  60376. }),
  60377. $globals.StreamTest.a$cls);
  60378. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  60379. $core.addMethod(
  60380. $core.method({
  60381. selector: "newCollection",
  60382. protocol: "accessing",
  60383. fn: function (){
  60384. var self=this,$self=this;
  60385. return $core.withContext(function($ctx1) {
  60386. return [true,(1),(3).__at((4)),"foo"];
  60387. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  60388. },
  60389. args: [],
  60390. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  60391. referencedClasses: [],
  60392. messageSends: ["@"]
  60393. }),
  60394. $globals.ArrayStreamTest);
  60395. $core.addMethod(
  60396. $core.method({
  60397. selector: "collectionClass",
  60398. protocol: "accessing",
  60399. fn: function (){
  60400. var self=this,$self=this;
  60401. return $globals.Array;
  60402. },
  60403. args: [],
  60404. source: "collectionClass\x0a\x09^ Array",
  60405. referencedClasses: ["Array"],
  60406. messageSends: []
  60407. }),
  60408. $globals.ArrayStreamTest.a$cls);
  60409. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  60410. $core.addMethod(
  60411. $core.method({
  60412. selector: "newCollection",
  60413. protocol: "accessing",
  60414. fn: function (){
  60415. var self=this,$self=this;
  60416. return "hello world";
  60417. },
  60418. args: [],
  60419. source: "newCollection\x0a\x09^ 'hello world'",
  60420. referencedClasses: [],
  60421. messageSends: []
  60422. }),
  60423. $globals.StringStreamTest);
  60424. $core.addMethod(
  60425. $core.method({
  60426. selector: "collectionClass",
  60427. protocol: "accessing",
  60428. fn: function (){
  60429. var self=this,$self=this;
  60430. return $globals.String;
  60431. },
  60432. args: [],
  60433. source: "collectionClass\x0a\x09^ String",
  60434. referencedClasses: ["String"],
  60435. messageSends: []
  60436. }),
  60437. $globals.StringStreamTest.a$cls);
  60438. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  60439. $core.addMethod(
  60440. $core.method({
  60441. selector: "testCopying",
  60442. protocol: "tests",
  60443. fn: function (){
  60444. var self=this,$self=this;
  60445. return $core.withContext(function($ctx1) {
  60446. $self._assert_equals_(nil._copy(),nil);
  60447. return self;
  60448. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  60449. },
  60450. args: [],
  60451. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  60452. referencedClasses: [],
  60453. messageSends: ["assert:equals:", "copy"]
  60454. }),
  60455. $globals.UndefinedTest);
  60456. $core.addMethod(
  60457. $core.method({
  60458. selector: "testDeepCopy",
  60459. protocol: "tests",
  60460. fn: function (){
  60461. var self=this,$self=this;
  60462. return $core.withContext(function($ctx1) {
  60463. $self._assert_($recv(nil._deepCopy()).__eq(nil));
  60464. return self;
  60465. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  60466. },
  60467. args: [],
  60468. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  60469. referencedClasses: [],
  60470. messageSends: ["assert:", "=", "deepCopy"]
  60471. }),
  60472. $globals.UndefinedTest);
  60473. $core.addMethod(
  60474. $core.method({
  60475. selector: "testIfNil",
  60476. protocol: "tests",
  60477. fn: function (){
  60478. var self=this,$self=this;
  60479. return $core.withContext(function($ctx1) {
  60480. var $1,$3,$2,$4,$6,$5,$receiver;
  60481. if(($receiver = nil) == null || $receiver.a$nil){
  60482. $1=true;
  60483. } else {
  60484. $1=nil;
  60485. }
  60486. $self._assert_equals_($1,true);
  60487. $ctx1.sendIdx["assert:equals:"]=1;
  60488. if(($receiver = nil) == null || $receiver.a$nil){
  60489. $3=nil;
  60490. } else {
  60491. $3=true;
  60492. }
  60493. $2=$recv($3).__eq(true);
  60494. $ctx1.sendIdx["="]=1;
  60495. $self._deny_($2);
  60496. $ctx1.sendIdx["deny:"]=1;
  60497. if(($receiver = nil) == null || $receiver.a$nil){
  60498. $4=true;
  60499. } else {
  60500. $4=false;
  60501. }
  60502. $self._assert_equals_($4,true);
  60503. if(($receiver = nil) == null || $receiver.a$nil){
  60504. $6=false;
  60505. } else {
  60506. $6=true;
  60507. }
  60508. $5=$recv($6).__eq(true);
  60509. $self._deny_($5);
  60510. return self;
  60511. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  60512. },
  60513. args: [],
  60514. 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",
  60515. referencedClasses: [],
  60516. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  60517. }),
  60518. $globals.UndefinedTest);
  60519. $core.addMethod(
  60520. $core.method({
  60521. selector: "testIsNil",
  60522. protocol: "tests",
  60523. fn: function (){
  60524. var self=this,$self=this;
  60525. return $core.withContext(function($ctx1) {
  60526. $self._assert_(nil._isNil());
  60527. $self._deny_(nil._notNil());
  60528. return self;
  60529. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  60530. },
  60531. args: [],
  60532. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  60533. referencedClasses: [],
  60534. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  60535. }),
  60536. $globals.UndefinedTest);
  60537. });
  60538. define('amber_core/Platform-DOM-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  60539. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  60540. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  60541. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  60542. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  60543. $core.addPackage("Platform-DOM-Tests");
  60544. $core.packages["Platform-DOM-Tests"].innerEval = function (expr) { return eval(expr); };
  60545. $core.packages["Platform-DOM-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  60546. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  60547. $core.addMethod(
  60548. $core.method({
  60549. selector: "testEntityConversion",
  60550. protocol: "testing",
  60551. fn: function (){
  60552. var self=this,$self=this;
  60553. return $core.withContext(function($ctx1) {
  60554. var $1;
  60555. $1=$recv($globals.PlatformDom)._isFeasible();
  60556. if($core.assert($1)){
  60557. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  60558. }
  60559. return self;
  60560. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  60561. },
  60562. args: [],
  60563. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  60564. referencedClasses: ["PlatformDom"],
  60565. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  60566. }),
  60567. $globals.PlatformDomTest);
  60568. $core.addMethod(
  60569. $core.method({
  60570. selector: "testTextContentDoesNotRunScript",
  60571. protocol: "testing",
  60572. fn: function (){
  60573. var self=this,$self=this;
  60574. return $core.withContext(function($ctx1) {
  60575. var $1;
  60576. $1=$recv($globals.PlatformDom)._isFeasible();
  60577. if($core.assert($1)){
  60578. $self._shouldnt_raise_((function(){
  60579. return $core.withContext(function($ctx2) {
  60580. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  60581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60582. }),$globals.Error);
  60583. }
  60584. return self;
  60585. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  60586. },
  60587. args: [],
  60588. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  60589. referencedClasses: ["PlatformDom", "Error"],
  60590. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  60591. }),
  60592. $globals.PlatformDomTest);
  60593. });
  60594. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  60595. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  60596. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  60597. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  60598. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  60599. $core.addPackage("SUnit-Tests");
  60600. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  60601. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  60602. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  60603. $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.";
  60604. $core.addMethod(
  60605. $core.method({
  60606. selector: "setUp",
  60607. protocol: "running",
  60608. fn: function (){
  60609. var self=this,$self=this;
  60610. return $core.withContext(function($ctx1) {
  60611. $self["@empty"]=$recv($globals.Set)._new();
  60612. $self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  60613. return self;
  60614. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  60615. },
  60616. args: [],
  60617. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  60618. referencedClasses: ["Set"],
  60619. messageSends: ["new", "with:with:"]
  60620. }),
  60621. $globals.ExampleSetTest);
  60622. $core.addMethod(
  60623. $core.method({
  60624. selector: "testAdd",
  60625. protocol: "tests",
  60626. fn: function (){
  60627. var self=this,$self=this;
  60628. return $core.withContext(function($ctx1) {
  60629. $recv($self["@empty"])._add_((5));
  60630. $self._assert_($recv($self["@empty"])._includes_((5)));
  60631. return self;
  60632. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  60633. },
  60634. args: [],
  60635. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  60636. referencedClasses: [],
  60637. messageSends: ["add:", "assert:", "includes:"]
  60638. }),
  60639. $globals.ExampleSetTest);
  60640. $core.addMethod(
  60641. $core.method({
  60642. selector: "testGrow",
  60643. protocol: "tests",
  60644. fn: function (){
  60645. var self=this,$self=this;
  60646. return $core.withContext(function($ctx1) {
  60647. $recv($self["@empty"])._addAll_((1)._to_((100)));
  60648. $self._assert_equals_($recv($self["@empty"])._size(),(100));
  60649. return self;
  60650. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  60651. },
  60652. args: [],
  60653. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  60654. referencedClasses: [],
  60655. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  60656. }),
  60657. $globals.ExampleSetTest);
  60658. $core.addMethod(
  60659. $core.method({
  60660. selector: "testIllegal",
  60661. protocol: "tests",
  60662. fn: function (){
  60663. var self=this,$self=this;
  60664. return $core.withContext(function($ctx1) {
  60665. $self._should_raise_((function(){
  60666. return $core.withContext(function($ctx2) {
  60667. return $recv($self["@empty"])._at_((5));
  60668. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60669. }),$globals.Error);
  60670. $ctx1.sendIdx["should:raise:"]=1;
  60671. $self._should_raise_((function(){
  60672. return $core.withContext(function($ctx2) {
  60673. return $recv($self["@empty"])._at_put_((5),"abc");
  60674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60675. }),$globals.Error);
  60676. return self;
  60677. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  60678. },
  60679. args: [],
  60680. 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",
  60681. referencedClasses: ["Error"],
  60682. messageSends: ["should:raise:", "at:", "at:put:"]
  60683. }),
  60684. $globals.ExampleSetTest);
  60685. $core.addMethod(
  60686. $core.method({
  60687. selector: "testIncludes",
  60688. protocol: "tests",
  60689. fn: function (){
  60690. var self=this,$self=this;
  60691. return $core.withContext(function($ctx1) {
  60692. var $1;
  60693. $1=$recv($self["@full"])._includes_((5));
  60694. $ctx1.sendIdx["includes:"]=1;
  60695. $self._assert_($1);
  60696. $ctx1.sendIdx["assert:"]=1;
  60697. $self._assert_($recv($self["@full"])._includes_("abc"));
  60698. return self;
  60699. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  60700. },
  60701. args: [],
  60702. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  60703. referencedClasses: [],
  60704. messageSends: ["assert:", "includes:"]
  60705. }),
  60706. $globals.ExampleSetTest);
  60707. $core.addMethod(
  60708. $core.method({
  60709. selector: "testOccurrences",
  60710. protocol: "tests",
  60711. fn: function (){
  60712. var self=this,$self=this;
  60713. return $core.withContext(function($ctx1) {
  60714. var $1,$2;
  60715. $1=$recv($self["@empty"])._occurrencesOf_((0));
  60716. $ctx1.sendIdx["occurrencesOf:"]=1;
  60717. $self._assert_equals_($1,(0));
  60718. $ctx1.sendIdx["assert:equals:"]=1;
  60719. $2=$recv($self["@full"])._occurrencesOf_((5));
  60720. $ctx1.sendIdx["occurrencesOf:"]=2;
  60721. $self._assert_equals_($2,(1));
  60722. $ctx1.sendIdx["assert:equals:"]=2;
  60723. $recv($self["@full"])._add_((5));
  60724. $self._assert_equals_($recv($self["@full"])._occurrencesOf_((5)),(1));
  60725. return self;
  60726. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  60727. },
  60728. args: [],
  60729. 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",
  60730. referencedClasses: [],
  60731. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  60732. }),
  60733. $globals.ExampleSetTest);
  60734. $core.addMethod(
  60735. $core.method({
  60736. selector: "testRemove",
  60737. protocol: "tests",
  60738. fn: function (){
  60739. var self=this,$self=this;
  60740. return $core.withContext(function($ctx1) {
  60741. var $1;
  60742. $recv($self["@full"])._remove_((5));
  60743. $1=$recv($self["@full"])._includes_("abc");
  60744. $ctx1.sendIdx["includes:"]=1;
  60745. $self._assert_($1);
  60746. $self._deny_($recv($self["@full"])._includes_((5)));
  60747. return self;
  60748. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  60749. },
  60750. args: [],
  60751. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  60752. referencedClasses: [],
  60753. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  60754. }),
  60755. $globals.ExampleSetTest);
  60756. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  60757. $core.addMethod(
  60758. $core.method({
  60759. selector: "fakeError",
  60760. protocol: "helpers",
  60761. fn: function (){
  60762. var self=this,$self=this;
  60763. return $core.withContext(function($ctx1) {
  60764. $self["@flag"]="bad";
  60765. $self._timeout_((30));
  60766. $self["@flag"]=$recv($self._async_((function(){
  60767. return $core.withContext(function($ctx2) {
  60768. $self["@flag"]="ok";
  60769. $self["@flag"];
  60770. return $self._error_("Intentional");
  60771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60772. })))._valueWithTimeout_((20));
  60773. return self;
  60774. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  60775. },
  60776. args: [],
  60777. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  60778. referencedClasses: [],
  60779. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  60780. }),
  60781. $globals.SUnitAsyncTest);
  60782. $core.addMethod(
  60783. $core.method({
  60784. selector: "fakeErrorFailingInTearDown",
  60785. protocol: "helpers",
  60786. fn: function (){
  60787. var self=this,$self=this;
  60788. return $core.withContext(function($ctx1) {
  60789. $self["@flag"]="bad";
  60790. $self._timeout_((30));
  60791. $self["@flag"]=$recv($self._async_((function(){
  60792. return $core.withContext(function($ctx2) {
  60793. return $self._error_("Intentional");
  60794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60795. })))._valueWithTimeout_((20));
  60796. return self;
  60797. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  60798. },
  60799. args: [],
  60800. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  60801. referencedClasses: [],
  60802. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  60803. }),
  60804. $globals.SUnitAsyncTest);
  60805. $core.addMethod(
  60806. $core.method({
  60807. selector: "fakeFailure",
  60808. protocol: "helpers",
  60809. fn: function (){
  60810. var self=this,$self=this;
  60811. return $core.withContext(function($ctx1) {
  60812. $self["@flag"]="bad";
  60813. $self._timeout_((30));
  60814. $self["@flag"]=$recv($self._async_((function(){
  60815. return $core.withContext(function($ctx2) {
  60816. $self["@flag"]="ok";
  60817. $self["@flag"];
  60818. return $self._assert_(false);
  60819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60820. })))._valueWithTimeout_((20));
  60821. return self;
  60822. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  60823. },
  60824. args: [],
  60825. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  60826. referencedClasses: [],
  60827. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  60828. }),
  60829. $globals.SUnitAsyncTest);
  60830. $core.addMethod(
  60831. $core.method({
  60832. selector: "fakeMultipleTimeoutFailing",
  60833. protocol: "helpers",
  60834. fn: function (){
  60835. var self=this,$self=this;
  60836. return $core.withContext(function($ctx1) {
  60837. var $1;
  60838. $self._timeout_((100));
  60839. $ctx1.sendIdx["timeout:"]=1;
  60840. $1=$self._async_((function(){
  60841. return $core.withContext(function($ctx2) {
  60842. $self._timeout_((20));
  60843. return $recv($self._async_((function(){
  60844. return $core.withContext(function($ctx3) {
  60845. return $self._finished();
  60846. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  60847. })))._valueWithTimeout_((30));
  60848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60849. }));
  60850. $ctx1.sendIdx["async:"]=1;
  60851. $recv($1)._valueWithTimeout_((20));
  60852. $ctx1.sendIdx["valueWithTimeout:"]=1;
  60853. return self;
  60854. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  60855. },
  60856. args: [],
  60857. 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",
  60858. referencedClasses: [],
  60859. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  60860. }),
  60861. $globals.SUnitAsyncTest);
  60862. $core.addMethod(
  60863. $core.method({
  60864. selector: "fakeMultipleTimeoutPassing",
  60865. protocol: "helpers",
  60866. fn: function (){
  60867. var self=this,$self=this;
  60868. return $core.withContext(function($ctx1) {
  60869. var $1;
  60870. $self._timeout_((20));
  60871. $ctx1.sendIdx["timeout:"]=1;
  60872. $1=$self._async_((function(){
  60873. return $core.withContext(function($ctx2) {
  60874. $self._timeout_((40));
  60875. return $recv($self._async_((function(){
  60876. return $core.withContext(function($ctx3) {
  60877. return $self._finished();
  60878. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  60879. })))._valueWithTimeout_((20));
  60880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60881. }));
  60882. $ctx1.sendIdx["async:"]=1;
  60883. $recv($1)._valueWithTimeout_((10));
  60884. $ctx1.sendIdx["valueWithTimeout:"]=1;
  60885. return self;
  60886. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  60887. },
  60888. args: [],
  60889. 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",
  60890. referencedClasses: [],
  60891. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  60892. }),
  60893. $globals.SUnitAsyncTest);
  60894. $core.addMethod(
  60895. $core.method({
  60896. selector: "fakeTimeout",
  60897. protocol: "helpers",
  60898. fn: function (){
  60899. var self=this,$self=this;
  60900. return $core.withContext(function($ctx1) {
  60901. $self._timeout_((10));
  60902. $recv($self._async_((function(){
  60903. return $core.withContext(function($ctx2) {
  60904. return $self._finished();
  60905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60906. })))._valueWithTimeout_((20));
  60907. return self;
  60908. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  60909. },
  60910. args: [],
  60911. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  60912. referencedClasses: [],
  60913. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  60914. }),
  60915. $globals.SUnitAsyncTest);
  60916. $core.addMethod(
  60917. $core.method({
  60918. selector: "selectorSetOf:",
  60919. protocol: "private",
  60920. fn: function (aCollection){
  60921. var self=this,$self=this;
  60922. return $core.withContext(function($ctx1) {
  60923. return $recv($recv(aCollection)._collect_((function(each){
  60924. return $core.withContext(function($ctx2) {
  60925. return $recv(each)._selector();
  60926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60927. })))._asSet();
  60928. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  60929. },
  60930. args: ["aCollection"],
  60931. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  60932. referencedClasses: [],
  60933. messageSends: ["asSet", "collect:", "selector"]
  60934. }),
  60935. $globals.SUnitAsyncTest);
  60936. $core.addMethod(
  60937. $core.method({
  60938. selector: "setUp",
  60939. protocol: "running",
  60940. fn: function (){
  60941. var self=this,$self=this;
  60942. $self["@flag"]="ok";
  60943. return self;
  60944. },
  60945. args: [],
  60946. source: "setUp\x0a\x09flag := 'ok'",
  60947. referencedClasses: [],
  60948. messageSends: []
  60949. }),
  60950. $globals.SUnitAsyncTest);
  60951. $core.addMethod(
  60952. $core.method({
  60953. selector: "tearDown",
  60954. protocol: "running",
  60955. fn: function (){
  60956. var self=this,$self=this;
  60957. return $core.withContext(function($ctx1) {
  60958. $self._assert_equals_("ok",$self["@flag"]);
  60959. return self;
  60960. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  60961. },
  60962. args: [],
  60963. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  60964. referencedClasses: [],
  60965. messageSends: ["assert:equals:"]
  60966. }),
  60967. $globals.SUnitAsyncTest);
  60968. $core.addMethod(
  60969. $core.method({
  60970. selector: "testAsyncErrorsAndFailures",
  60971. protocol: "tests",
  60972. fn: function (){
  60973. var self=this,$self=this;
  60974. var suite,runner,result,assertBlock;
  60975. return $core.withContext(function($ctx1) {
  60976. var $1,$2,$3,$4;
  60977. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  60978. return $core.withContext(function($ctx2) {
  60979. return $recv($self._class())._selector_(each);
  60980. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60981. }));
  60982. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  60983. $self._timeout_((200));
  60984. result=$recv(runner)._result();
  60985. $ctx1.sendIdx["result"]=1;
  60986. assertBlock=$self._async_((function(){
  60987. return $core.withContext(function($ctx2) {
  60988. $1=$self._selectorSetOf_($recv(result)._errors());
  60989. $ctx2.sendIdx["selectorSetOf:"]=1;
  60990. $2=["fakeError"]._asSet();
  60991. $ctx2.sendIdx["asSet"]=1;
  60992. $self._assert_equals_($1,$2);
  60993. $ctx2.sendIdx["assert:equals:"]=1;
  60994. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  60995. return $self._finished();
  60996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60997. }));
  60998. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  60999. return $core.withContext(function($ctx2) {
  61000. $3=$recv($recv(ann)._result()).__eq_eq(result);
  61001. if($core.assert($3)){
  61002. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61003. return $recv($4)._ifTrue_(assertBlock);
  61004. }
  61005. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61006. }));
  61007. $recv(runner)._run();
  61008. return self;
  61009. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61010. },
  61011. args: [],
  61012. 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",
  61013. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  61014. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61015. }),
  61016. $globals.SUnitAsyncTest);
  61017. $core.addMethod(
  61018. $core.method({
  61019. selector: "testAsyncNeedsTimeout",
  61020. protocol: "tests",
  61021. fn: function (){
  61022. var self=this,$self=this;
  61023. return $core.withContext(function($ctx1) {
  61024. $self._should_raise_((function(){
  61025. return $core.withContext(function($ctx2) {
  61026. return $self._async_((function(){
  61027. }));
  61028. $ctx2.sendIdx["async:"]=1;
  61029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61030. }),$globals.Error);
  61031. $self._timeout_((0));
  61032. $self._shouldnt_raise_((function(){
  61033. return $core.withContext(function($ctx2) {
  61034. return $self._async_((function(){
  61035. }));
  61036. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61037. }),$globals.Error);
  61038. $self._finished();
  61039. return self;
  61040. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61041. },
  61042. args: [],
  61043. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  61044. referencedClasses: ["Error"],
  61045. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  61046. }),
  61047. $globals.SUnitAsyncTest);
  61048. $core.addMethod(
  61049. $core.method({
  61050. selector: "testFinishedNeedsTimeout",
  61051. protocol: "tests",
  61052. fn: function (){
  61053. var self=this,$self=this;
  61054. return $core.withContext(function($ctx1) {
  61055. $self._should_raise_((function(){
  61056. return $core.withContext(function($ctx2) {
  61057. return $self._finished();
  61058. $ctx2.sendIdx["finished"]=1;
  61059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61060. }),$globals.Error);
  61061. $self._timeout_((0));
  61062. $self._shouldnt_raise_((function(){
  61063. return $core.withContext(function($ctx2) {
  61064. return $self._finished();
  61065. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61066. }),$globals.Error);
  61067. return self;
  61068. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61069. },
  61070. args: [],
  61071. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  61072. referencedClasses: ["Error"],
  61073. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  61074. }),
  61075. $globals.SUnitAsyncTest);
  61076. $core.addMethod(
  61077. $core.method({
  61078. selector: "testIsAsyncReturnsCorrectValues",
  61079. protocol: "tests",
  61080. fn: function (){
  61081. var self=this,$self=this;
  61082. return $core.withContext(function($ctx1) {
  61083. var $1,$2;
  61084. $1=$self._isAsync();
  61085. $ctx1.sendIdx["isAsync"]=1;
  61086. $self._deny_($1);
  61087. $ctx1.sendIdx["deny:"]=1;
  61088. $self._timeout_((0));
  61089. $2=$self._isAsync();
  61090. $ctx1.sendIdx["isAsync"]=2;
  61091. $self._assert_($2);
  61092. $self._finished();
  61093. $self._deny_($self._isAsync());
  61094. return self;
  61095. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  61096. },
  61097. args: [],
  61098. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  61099. referencedClasses: [],
  61100. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  61101. }),
  61102. $globals.SUnitAsyncTest);
  61103. $core.addMethod(
  61104. $core.method({
  61105. selector: "testPass",
  61106. protocol: "tests",
  61107. fn: function (){
  61108. var self=this,$self=this;
  61109. return $core.withContext(function($ctx1) {
  61110. $self["@flag"]="bad";
  61111. $self._timeout_((10));
  61112. $self["@flag"]=$recv($self._async_((function(){
  61113. return $core.withContext(function($ctx2) {
  61114. $self._assert_(true);
  61115. $self._finished();
  61116. $self["@flag"]="ok";
  61117. return $self["@flag"];
  61118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61119. })))._valueWithTimeout_((5));
  61120. return self;
  61121. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  61122. },
  61123. args: [],
  61124. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  61125. referencedClasses: [],
  61126. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  61127. }),
  61128. $globals.SUnitAsyncTest);
  61129. $core.addMethod(
  61130. $core.method({
  61131. selector: "testTimeouts",
  61132. protocol: "tests",
  61133. fn: function (){
  61134. var self=this,$self=this;
  61135. var suite,runner,result,assertBlock;
  61136. return $core.withContext(function($ctx1) {
  61137. var $1,$2,$3;
  61138. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  61139. return $core.withContext(function($ctx2) {
  61140. return $recv($self._class())._selector_(each);
  61141. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61142. }));
  61143. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61144. $self._timeout_((200));
  61145. result=$recv(runner)._result();
  61146. $ctx1.sendIdx["result"]=1;
  61147. assertBlock=$self._async_((function(){
  61148. return $core.withContext(function($ctx2) {
  61149. $1=$self._selectorSetOf_($recv(result)._errors());
  61150. $ctx2.sendIdx["selectorSetOf:"]=1;
  61151. $self._assert_equals_($1,$recv($globals.Set)._new());
  61152. $ctx2.sendIdx["assert:equals:"]=1;
  61153. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  61154. return $self._finished();
  61155. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61156. }));
  61157. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61158. return $core.withContext(function($ctx2) {
  61159. $2=$recv($recv(ann)._result()).__eq_eq(result);
  61160. if($core.assert($2)){
  61161. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61162. return $recv($3)._ifTrue_(assertBlock);
  61163. }
  61164. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61165. }));
  61166. $recv(runner)._run();
  61167. return self;
  61168. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61169. },
  61170. args: [],
  61171. 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",
  61172. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  61173. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61174. }),
  61175. $globals.SUnitAsyncTest);
  61176. $core.addMethod(
  61177. $core.method({
  61178. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  61179. protocol: "tests",
  61180. fn: function (){
  61181. var self=this,$self=this;
  61182. var x;
  61183. return $core.withContext(function($ctx1) {
  61184. var $1;
  61185. $self["@flag"]="bad";
  61186. $self._timeout_((10));
  61187. x=(0);
  61188. $1=$self._async_((function(){
  61189. return $core.withContext(function($ctx2) {
  61190. $self._finished();
  61191. $ctx2.sendIdx["finished"]=1;
  61192. $self["@flag"]="ok";
  61193. $self["@flag"];
  61194. x=$recv(x).__plus((1));
  61195. $ctx2.sendIdx["+"]=1;
  61196. x;
  61197. return $self._assert_equals_(x,(1));
  61198. $ctx2.sendIdx["assert:equals:"]=1;
  61199. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61200. }));
  61201. $ctx1.sendIdx["async:"]=1;
  61202. $self["@flag"]=$recv($1)._valueWithTimeout_((0));
  61203. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61204. $self["@flag"]=$recv($self._async_((function(){
  61205. return $core.withContext(function($ctx2) {
  61206. $self._finished();
  61207. $self["@flag"]="ok";
  61208. $self["@flag"];
  61209. x=$recv(x).__plus((1));
  61210. x;
  61211. return $self._assert_equals_(x,(1));
  61212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61213. })))._valueWithTimeout_((0));
  61214. return self;
  61215. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  61216. },
  61217. args: [],
  61218. 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.",
  61219. referencedClasses: [],
  61220. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  61221. }),
  61222. $globals.SUnitAsyncTest);
  61223. });
  61224. define('amber/devel',[
  61225. './lang',
  61226. './compatibility', // pre-fetch, dep of ./boot, TODO remove
  61227. './brikz', // pre-fetch, dep of ./boot
  61228. './kernel-checks', // pre-fetch, dep of ./boot
  61229. './kernel-fundamentals', // pre-fetch, dep of ./boot
  61230. './kernel-language', // pre-fetch, dep of ./boot
  61231. './boot', // pre-fetch, class loader
  61232. './deploy', // pre-fetch, dep of ./lang
  61233. // --- packages of the development only Amber begin here ---
  61234. 'amber_core/Platform-DOM',
  61235. 'amber_core/SUnit',
  61236. 'amber_core/Compiler-Tests',
  61237. 'amber_core/Kernel-Tests',
  61238. 'amber_core/Platform-DOM-Tests',
  61239. 'amber_core/SUnit-Tests'
  61240. // --- packages of the development only Amber end here ---
  61241. ], function (amber) {
  61242. return amber;
  61243. });
  61244. define('amber_core/Platform-Node',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61245. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  61246. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61247. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61248. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  61249. $core.addPackage("Platform-Node");
  61250. $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  61251. $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61252. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  61253. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  61254. $core.addMethod(
  61255. $core.method({
  61256. selector: "globals",
  61257. protocol: "accessing",
  61258. fn: function (){
  61259. var self=this,$self=this;
  61260. return global;
  61261. },
  61262. args: [],
  61263. source: "globals\x0a\x09^ global",
  61264. referencedClasses: [],
  61265. messageSends: []
  61266. }),
  61267. $globals.NodePlatform);
  61268. $core.addMethod(
  61269. $core.method({
  61270. selector: "newXhr",
  61271. protocol: "accessing",
  61272. fn: function (){
  61273. var self=this,$self=this;
  61274. return $core.withContext(function($ctx1) {
  61275. var $receiver;
  61276. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.a$nil){
  61277. $self._error_("XMLHttpRequest not available.");
  61278. } else {
  61279. return $recv($globals.XMLHttpRequest)._new();
  61280. }
  61281. return self;
  61282. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  61283. },
  61284. args: [],
  61285. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  61286. referencedClasses: ["XMLHttpRequest"],
  61287. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  61288. }),
  61289. $globals.NodePlatform);
  61290. $core.addMethod(
  61291. $core.method({
  61292. selector: "initialize",
  61293. protocol: "testing",
  61294. fn: function (){
  61295. var self=this,$self=this;
  61296. return $core.withContext(function($ctx1) {
  61297. var $1;
  61298. $1=$self._isFeasible();
  61299. if($core.assert($1)){
  61300. $recv($globals.Platform)._registerIfNone_($self._new());
  61301. }
  61302. return self;
  61303. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.a$cls)});
  61304. },
  61305. args: [],
  61306. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  61307. referencedClasses: ["Platform"],
  61308. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  61309. }),
  61310. $globals.NodePlatform.a$cls);
  61311. $core.addMethod(
  61312. $core.method({
  61313. selector: "isFeasible",
  61314. protocol: "testing",
  61315. fn: function (){
  61316. var self=this,$self=this;
  61317. return $core.withContext(function($ctx1) {
  61318. return typeof global !== "undefined";
  61319. return self;
  61320. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.a$cls)});
  61321. },
  61322. args: [],
  61323. source: "isFeasible\x0a<inlineJS: 'return typeof global !== \x22undefined\x22'>",
  61324. referencedClasses: [],
  61325. messageSends: []
  61326. }),
  61327. $globals.NodePlatform.a$cls);
  61328. });
  61329. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61330. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  61331. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61332. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61333. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  61334. $core.addPackage("AmberCli");
  61335. $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
  61336. $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  61337. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  61338. $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.";
  61339. $core.addMethod(
  61340. $core.method({
  61341. selector: "commandLineSwitches",
  61342. protocol: "commandline",
  61343. fn: function (){
  61344. var self=this,$self=this;
  61345. var switches;
  61346. return $core.withContext(function($ctx1) {
  61347. switches=$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  61348. return $core.withContext(function($ctx2) {
  61349. return $recv(each)._selector();
  61350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61351. }));
  61352. $ctx1.sendIdx["collect:"]=1;
  61353. switches=$recv(switches)._select_((function(each){
  61354. return $core.withContext(function($ctx2) {
  61355. return $recv(each)._match_("^[^:]*:$");
  61356. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61357. }));
  61358. switches=$recv(switches)._collect_((function(each){
  61359. return $core.withContext(function($ctx2) {
  61360. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  61361. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  61362. }));
  61363. return switches;
  61364. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.a$cls)});
  61365. },
  61366. args: [],
  61367. 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",
  61368. referencedClasses: [],
  61369. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  61370. }),
  61371. $globals.AmberCli.a$cls);
  61372. $core.addMethod(
  61373. $core.method({
  61374. selector: "config:",
  61375. protocol: "commands",
  61376. fn: function (args){
  61377. var self=this,$self=this;
  61378. return $core.withContext(function($ctx1) {
  61379. $recv($recv($globals.Configurator)._new())._start();
  61380. return self;
  61381. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.a$cls)});
  61382. },
  61383. args: ["args"],
  61384. source: "config: args\x0a\x09Configurator new start",
  61385. referencedClasses: ["Configurator"],
  61386. messageSends: ["start", "new"]
  61387. }),
  61388. $globals.AmberCli.a$cls);
  61389. $core.addMethod(
  61390. $core.method({
  61391. selector: "handleArguments:",
  61392. protocol: "commandline",
  61393. fn: function (args){
  61394. var self=this,$self=this;
  61395. var selector;
  61396. return $core.withContext(function($ctx1) {
  61397. var $1;
  61398. $1=$recv(args)._first();
  61399. $ctx1.sendIdx["first"]=1;
  61400. selector=$self._selectorForCommandLineSwitch_($1);
  61401. $recv(args)._remove_($recv(args)._first());
  61402. $self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  61403. return self;
  61404. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.a$cls)});
  61405. },
  61406. args: ["args"],
  61407. 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)",
  61408. referencedClasses: ["Array"],
  61409. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  61410. }),
  61411. $globals.AmberCli.a$cls);
  61412. $core.addMethod(
  61413. $core.method({
  61414. selector: "help:",
  61415. protocol: "commands",
  61416. fn: function (args){
  61417. var self=this,$self=this;
  61418. return $core.withContext(function($ctx1) {
  61419. $recv($globals.Transcript)._show_("Available commands");
  61420. $recv($self._commandLineSwitches())._do_((function(each){
  61421. return $core.withContext(function($ctx2) {
  61422. return $recv(console)._log_(each);
  61423. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61424. }));
  61425. return self;
  61426. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.a$cls)});
  61427. },
  61428. args: ["args"],
  61429. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  61430. referencedClasses: ["Transcript"],
  61431. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  61432. }),
  61433. $globals.AmberCli.a$cls);
  61434. $core.addMethod(
  61435. $core.method({
  61436. selector: "init:",
  61437. protocol: "commands",
  61438. fn: function (args){
  61439. var self=this,$self=this;
  61440. return $core.withContext(function($ctx1) {
  61441. $recv($recv($globals.Initer)._new())._start();
  61442. return self;
  61443. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.a$cls)});
  61444. },
  61445. args: ["args"],
  61446. source: "init: args\x0a\x09Initer new start",
  61447. referencedClasses: ["Initer"],
  61448. messageSends: ["start", "new"]
  61449. }),
  61450. $globals.AmberCli.a$cls);
  61451. $core.addMethod(
  61452. $core.method({
  61453. selector: "main",
  61454. protocol: "startup",
  61455. fn: function (){
  61456. var self=this,$self=this;
  61457. var args,packageJSON;
  61458. return $core.withContext(function($ctx1) {
  61459. var $7,$6,$5,$4,$3,$2,$1;
  61460. var $early={};
  61461. try {
  61462. packageJSON=$recv(require)._value_("../package.json");
  61463. $7=$recv(packageJSON)._version();
  61464. $ctx1.sendIdx["version"]=1;
  61465. $6="Welcome to Amber CLI version ".__comma($7);
  61466. $5=$recv($6).__comma(" (Amber ");
  61467. $ctx1.sendIdx[","]=5;
  61468. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  61469. $ctx1.sendIdx[","]=4;
  61470. $3=$recv($4).__comma(", NodeJS ");
  61471. $ctx1.sendIdx[","]=3;
  61472. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  61473. $ctx1.sendIdx[","]=2;
  61474. $1=$recv($2).__comma(").");
  61475. $ctx1.sendIdx[","]=1;
  61476. $recv($globals.Transcript)._show_($1);
  61477. args=$recv(process)._argv();
  61478. $recv(args)._removeFrom_to_((1),(2));
  61479. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  61480. return $core.withContext(function($ctx2) {
  61481. return $self._help_(nil);
  61482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61483. }),(function(){
  61484. return $core.withContext(function($ctx2) {
  61485. throw $early=[$self._handleArguments_(args)];
  61486. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61487. }));
  61488. return self;
  61489. }
  61490. catch(e) {if(e===$early)return e[0]; throw e}
  61491. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.a$cls)});
  61492. },
  61493. args: [],
  61494. 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]",
  61495. referencedClasses: ["Transcript", "Smalltalk"],
  61496. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  61497. }),
  61498. $globals.AmberCli.a$cls);
  61499. $core.addMethod(
  61500. $core.method({
  61501. selector: "repl:",
  61502. protocol: "commands",
  61503. fn: function (args){
  61504. var self=this,$self=this;
  61505. return $core.withContext(function($ctx1) {
  61506. return $recv($recv($globals.Repl)._new())._createInterface();
  61507. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.a$cls)});
  61508. },
  61509. args: ["args"],
  61510. source: "repl: args\x0a\x09^ Repl new createInterface",
  61511. referencedClasses: ["Repl"],
  61512. messageSends: ["createInterface", "new"]
  61513. }),
  61514. $globals.AmberCli.a$cls);
  61515. $core.addMethod(
  61516. $core.method({
  61517. selector: "selectorForCommandLineSwitch:",
  61518. protocol: "commandline",
  61519. fn: function (aSwitch){
  61520. var self=this,$self=this;
  61521. var command,selector;
  61522. return $core.withContext(function($ctx1) {
  61523. var $1;
  61524. $1=$recv($self._commandLineSwitches())._includes_(aSwitch);
  61525. if($core.assert($1)){
  61526. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  61527. return $core.withContext(function($ctx2) {
  61528. return $recv($recv(each)._second())._asUppercase();
  61529. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61530. }))).__comma(":");
  61531. selector;
  61532. } else {
  61533. selector="help:";
  61534. selector;
  61535. }
  61536. return selector;
  61537. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.a$cls)});
  61538. },
  61539. args: ["aSwitch"],
  61540. 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",
  61541. referencedClasses: [],
  61542. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  61543. }),
  61544. $globals.AmberCli.a$cls);
  61545. $core.addMethod(
  61546. $core.method({
  61547. selector: "serve:",
  61548. protocol: "commands",
  61549. fn: function (args){
  61550. var self=this,$self=this;
  61551. return $core.withContext(function($ctx1) {
  61552. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  61553. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.a$cls)});
  61554. },
  61555. args: ["args"],
  61556. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  61557. referencedClasses: ["FileServer"],
  61558. messageSends: ["start", "createServerWithArguments:"]
  61559. }),
  61560. $globals.AmberCli.a$cls);
  61561. $core.addMethod(
  61562. $core.method({
  61563. selector: "version:",
  61564. protocol: "commands",
  61565. fn: function (arguments_){
  61566. var self=this,$self=this;
  61567. return self;
  61568. },
  61569. args: ["arguments"],
  61570. source: "version: arguments",
  61571. referencedClasses: [],
  61572. messageSends: []
  61573. }),
  61574. $globals.AmberCli.a$cls);
  61575. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  61576. $core.addMethod(
  61577. $core.method({
  61578. selector: "dirname",
  61579. protocol: "private",
  61580. fn: function (){
  61581. var self=this,$self=this;
  61582. return $core.withContext(function($ctx1) {
  61583. return __dirname;
  61584. return self;
  61585. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  61586. },
  61587. args: [],
  61588. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  61589. referencedClasses: [],
  61590. messageSends: []
  61591. }),
  61592. $globals.BaseFileManipulator);
  61593. $core.addMethod(
  61594. $core.method({
  61595. selector: "initialize",
  61596. protocol: "initialization",
  61597. fn: function (){
  61598. var self=this,$self=this;
  61599. return $core.withContext(function($ctx1) {
  61600. (
  61601. $ctx1.supercall = true,
  61602. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  61603. $ctx1.supercall = false;
  61604. $self["@path"]=$recv(require)._value_("path");
  61605. $ctx1.sendIdx["value:"]=1;
  61606. $self["@fs"]=$recv(require)._value_("fs");
  61607. return self;
  61608. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  61609. },
  61610. args: [],
  61611. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  61612. referencedClasses: [],
  61613. messageSends: ["initialize", "value:"]
  61614. }),
  61615. $globals.BaseFileManipulator);
  61616. $core.addMethod(
  61617. $core.method({
  61618. selector: "rootDirname",
  61619. protocol: "private",
  61620. fn: function (){
  61621. var self=this,$self=this;
  61622. return $core.withContext(function($ctx1) {
  61623. return $recv($self["@path"])._join_with_($self._dirname(),"..");
  61624. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  61625. },
  61626. args: [],
  61627. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  61628. referencedClasses: [],
  61629. messageSends: ["join:with:", "dirname"]
  61630. }),
  61631. $globals.BaseFileManipulator);
  61632. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  61633. $core.addMethod(
  61634. $core.method({
  61635. selector: "initialize",
  61636. protocol: "initialization",
  61637. fn: function (){
  61638. var self=this,$self=this;
  61639. return $core.withContext(function($ctx1) {
  61640. (
  61641. $ctx1.supercall = true,
  61642. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  61643. $ctx1.supercall = false;
  61644. return self;
  61645. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  61646. },
  61647. args: [],
  61648. source: "initialize\x0a\x09super initialize",
  61649. referencedClasses: [],
  61650. messageSends: ["initialize"]
  61651. }),
  61652. $globals.Configurator);
  61653. $core.addMethod(
  61654. $core.method({
  61655. selector: "start",
  61656. protocol: "action",
  61657. fn: function (){
  61658. var self=this,$self=this;
  61659. return $core.withContext(function($ctx1) {
  61660. var $receiver;
  61661. $self._writeConfigThenDo_((function(err){
  61662. return $core.withContext(function($ctx2) {
  61663. if(($receiver = err) == null || $receiver.a$nil){
  61664. return $recv(process)._exit();
  61665. } else {
  61666. return $recv(process)._exit_((111));
  61667. }
  61668. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  61669. }));
  61670. return self;
  61671. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  61672. },
  61673. args: [],
  61674. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  61675. referencedClasses: [],
  61676. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  61677. }),
  61678. $globals.Configurator);
  61679. $core.addMethod(
  61680. $core.method({
  61681. selector: "writeConfigThenDo:",
  61682. protocol: "action",
  61683. fn: function (aBlock){
  61684. var self=this,$self=this;
  61685. return $core.withContext(function($ctx1) {
  61686. $recv($recv($recv(require)._value_("amber-dev"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  61687. return self;
  61688. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  61689. },
  61690. args: ["aBlock"],
  61691. source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  61692. referencedClasses: [],
  61693. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  61694. }),
  61695. $globals.Configurator);
  61696. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  61697. $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.";
  61698. $core.addMethod(
  61699. $core.method({
  61700. selector: "base64Decode:",
  61701. protocol: "private",
  61702. fn: function (aString){
  61703. var self=this,$self=this;
  61704. return $core.withContext(function($ctx1) {
  61705. return (new Buffer(aString, "base64").toString());
  61706. return self;
  61707. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  61708. },
  61709. args: ["aString"],
  61710. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  61711. referencedClasses: [],
  61712. messageSends: []
  61713. }),
  61714. $globals.FileServer);
  61715. $core.addMethod(
  61716. $core.method({
  61717. selector: "basePath",
  61718. protocol: "accessing",
  61719. fn: function (){
  61720. var self=this,$self=this;
  61721. return $core.withContext(function($ctx1) {
  61722. var $1,$receiver;
  61723. $1=$self["@basePath"];
  61724. if(($receiver = $1) == null || $receiver.a$nil){
  61725. return $recv($self._class())._defaultBasePath();
  61726. } else {
  61727. return $1;
  61728. }
  61729. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  61730. },
  61731. args: [],
  61732. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  61733. referencedClasses: [],
  61734. messageSends: ["ifNil:", "defaultBasePath", "class"]
  61735. }),
  61736. $globals.FileServer);
  61737. $core.addMethod(
  61738. $core.method({
  61739. selector: "basePath:",
  61740. protocol: "accessing",
  61741. fn: function (aString){
  61742. var self=this,$self=this;
  61743. return $core.withContext(function($ctx1) {
  61744. $self["@basePath"]=aString;
  61745. $self._validateBasePath();
  61746. return self;
  61747. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  61748. },
  61749. args: ["aString"],
  61750. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  61751. referencedClasses: [],
  61752. messageSends: ["validateBasePath"]
  61753. }),
  61754. $globals.FileServer);
  61755. $core.addMethod(
  61756. $core.method({
  61757. selector: "checkDirectoryLayout",
  61758. protocol: "initialization",
  61759. fn: function (){
  61760. var self=this,$self=this;
  61761. return $core.withContext(function($ctx1) {
  61762. var $1;
  61763. $1=$recv($self["@fs"])._existsSync_($self._withBasePath_("index.html"));
  61764. if(!$core.assert($1)){
  61765. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  61766. $ctx1.sendIdx["warn:"]=1;
  61767. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  61768. $ctx1.sendIdx["warn:"]=2;
  61769. $recv(console)._warn_(" You can also specify a page to be served by default,");
  61770. $ctx1.sendIdx["warn:"]=3;
  61771. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  61772. }
  61773. return self;
  61774. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  61775. },
  61776. args: [],
  61777. 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.'].",
  61778. referencedClasses: [],
  61779. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  61780. }),
  61781. $globals.FileServer);
  61782. $core.addMethod(
  61783. $core.method({
  61784. selector: "fallbackPage",
  61785. protocol: "accessing",
  61786. fn: function (){
  61787. var self=this,$self=this;
  61788. return $self["@fallbackPage"];
  61789. },
  61790. args: [],
  61791. source: "fallbackPage\x0a\x09^ fallbackPage",
  61792. referencedClasses: [],
  61793. messageSends: []
  61794. }),
  61795. $globals.FileServer);
  61796. $core.addMethod(
  61797. $core.method({
  61798. selector: "fallbackPage:",
  61799. protocol: "accessing",
  61800. fn: function (aString){
  61801. var self=this,$self=this;
  61802. $self["@fallbackPage"]=aString;
  61803. return self;
  61804. },
  61805. args: ["aString"],
  61806. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  61807. referencedClasses: [],
  61808. messageSends: []
  61809. }),
  61810. $globals.FileServer);
  61811. $core.addMethod(
  61812. $core.method({
  61813. selector: "handleGETRequest:respondTo:",
  61814. protocol: "request handling",
  61815. fn: function (aRequest,aResponse){
  61816. var self=this,$self=this;
  61817. var uri,filename;
  61818. return $core.withContext(function($ctx1) {
  61819. var $1;
  61820. uri=$recv($self["@url"])._parse_($recv(aRequest)._url());
  61821. filename=$recv($self["@path"])._join_with_($self._basePath(),$recv(uri)._pathname());
  61822. $recv($self["@fs"])._exists_do_(filename,(function(aBoolean){
  61823. return $core.withContext(function($ctx2) {
  61824. if($core.assert(aBoolean)){
  61825. $1=$recv($recv($self["@fs"])._statSync_(filename))._isDirectory();
  61826. if($core.assert($1)){
  61827. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  61828. } else {
  61829. return $self._respondFileNamed_to_(filename,aResponse);
  61830. }
  61831. } else {
  61832. return $self._respondNotFoundTo_(aResponse);
  61833. }
  61834. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  61835. }));
  61836. return self;
  61837. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  61838. },
  61839. args: ["aRequest", "aResponse"],
  61840. 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]]]",
  61841. referencedClasses: [],
  61842. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  61843. }),
  61844. $globals.FileServer);
  61845. $core.addMethod(
  61846. $core.method({
  61847. selector: "handleOPTIONSRequest:respondTo:",
  61848. protocol: "request handling",
  61849. fn: function (aRequest,aResponse){
  61850. var self=this,$self=this;
  61851. return $core.withContext(function($ctx1) {
  61852. $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)]));
  61853. $recv(aResponse)._end();
  61854. return self;
  61855. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  61856. },
  61857. args: ["aRequest", "aResponse"],
  61858. 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",
  61859. referencedClasses: [],
  61860. messageSends: ["writeHead:options:", "end"]
  61861. }),
  61862. $globals.FileServer);
  61863. $core.addMethod(
  61864. $core.method({
  61865. selector: "handlePUTRequest:respondTo:",
  61866. protocol: "request handling",
  61867. fn: function (aRequest,aResponse){
  61868. var self=this,$self=this;
  61869. var file,stream;
  61870. return $core.withContext(function($ctx1) {
  61871. var $1,$2,$3,$4;
  61872. $1=$self._isAuthenticated_(aRequest);
  61873. if(!$core.assert($1)){
  61874. $self._respondAuthenticationRequiredTo_(aResponse);
  61875. return nil;
  61876. }
  61877. file=".".__comma($recv(aRequest)._url());
  61878. $ctx1.sendIdx[","]=1;
  61879. stream=$recv($self["@fs"])._createWriteStream_(file);
  61880. $recv(stream)._on_do_("error",(function(error){
  61881. return $core.withContext(function($ctx2) {
  61882. $2=console;
  61883. $3="Error creating WriteStream for file ".__comma(file);
  61884. $ctx2.sendIdx[","]=2;
  61885. $recv($2)._warn_($3);
  61886. $ctx2.sendIdx["warn:"]=1;
  61887. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  61888. $ctx2.sendIdx["warn:"]=2;
  61889. $recv(console)._warn_(" The exact error is: ".__comma(error));
  61890. return $self._respondNotCreatedTo_(aResponse);
  61891. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  61892. }));
  61893. $ctx1.sendIdx["on:do:"]=1;
  61894. $recv(stream)._on_do_("close",(function(){
  61895. return $core.withContext(function($ctx2) {
  61896. return $self._respondCreatedTo_(aResponse);
  61897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61898. }));
  61899. $ctx1.sendIdx["on:do:"]=2;
  61900. $recv(aRequest)._setEncoding_("utf8");
  61901. $recv(aRequest)._on_do_("data",(function(data){
  61902. return $core.withContext(function($ctx2) {
  61903. return $recv(stream)._write_(data);
  61904. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  61905. }));
  61906. $ctx1.sendIdx["on:do:"]=3;
  61907. $recv(aRequest)._on_do_("end",(function(){
  61908. return $core.withContext(function($ctx2) {
  61909. $4=$recv(stream)._writable();
  61910. if($core.assert($4)){
  61911. return $recv(stream)._end();
  61912. }
  61913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  61914. }));
  61915. return self;
  61916. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  61917. },
  61918. args: ["aRequest", "aResponse"],
  61919. 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]]",
  61920. referencedClasses: [],
  61921. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  61922. }),
  61923. $globals.FileServer);
  61924. $core.addMethod(
  61925. $core.method({
  61926. selector: "handleRequest:respondTo:",
  61927. protocol: "request handling",
  61928. fn: function (aRequest,aResponse){
  61929. var self=this,$self=this;
  61930. return $core.withContext(function($ctx1) {
  61931. var $2,$1,$4,$3,$5;
  61932. $2=$recv(aRequest)._method();
  61933. $ctx1.sendIdx["method"]=1;
  61934. $1=$recv($2).__eq("PUT");
  61935. $ctx1.sendIdx["="]=1;
  61936. if($core.assert($1)){
  61937. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  61938. }
  61939. $4=$recv(aRequest)._method();
  61940. $ctx1.sendIdx["method"]=2;
  61941. $3=$recv($4).__eq("GET");
  61942. $ctx1.sendIdx["="]=2;
  61943. if($core.assert($3)){
  61944. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  61945. }
  61946. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  61947. if($core.assert($5)){
  61948. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  61949. }
  61950. return self;
  61951. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  61952. },
  61953. args: ["aRequest", "aResponse"],
  61954. 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]",
  61955. referencedClasses: [],
  61956. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  61957. }),
  61958. $globals.FileServer);
  61959. $core.addMethod(
  61960. $core.method({
  61961. selector: "host",
  61962. protocol: "accessing",
  61963. fn: function (){
  61964. var self=this,$self=this;
  61965. return $self["@host"];
  61966. },
  61967. args: [],
  61968. source: "host\x0a\x09^ host",
  61969. referencedClasses: [],
  61970. messageSends: []
  61971. }),
  61972. $globals.FileServer);
  61973. $core.addMethod(
  61974. $core.method({
  61975. selector: "host:",
  61976. protocol: "accessing",
  61977. fn: function (hostname){
  61978. var self=this,$self=this;
  61979. $self["@host"]=hostname;
  61980. return self;
  61981. },
  61982. args: ["hostname"],
  61983. source: "host: hostname\x0a\x09host := hostname",
  61984. referencedClasses: [],
  61985. messageSends: []
  61986. }),
  61987. $globals.FileServer);
  61988. $core.addMethod(
  61989. $core.method({
  61990. selector: "initialize",
  61991. protocol: "initialization",
  61992. fn: function (){
  61993. var self=this,$self=this;
  61994. return $core.withContext(function($ctx1) {
  61995. var $1;
  61996. (
  61997. $ctx1.supercall = true,
  61998. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  61999. $ctx1.supercall = false;
  62000. $self["@http"]=$self._require_("http");
  62001. $ctx1.sendIdx["require:"]=1;
  62002. $self["@util"]=$self._require_("util");
  62003. $ctx1.sendIdx["require:"]=2;
  62004. $self["@url"]=$self._require_("url");
  62005. $1=$self._class();
  62006. $ctx1.sendIdx["class"]=1;
  62007. $self["@host"]=$recv($1)._defaultHost();
  62008. $self["@port"]=$recv($self._class())._defaultPort();
  62009. $self["@username"]=nil;
  62010. $self["@password"]=nil;
  62011. $self["@fallbackPage"]=nil;
  62012. return self;
  62013. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  62014. },
  62015. args: [],
  62016. 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.",
  62017. referencedClasses: [],
  62018. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  62019. }),
  62020. $globals.FileServer);
  62021. $core.addMethod(
  62022. $core.method({
  62023. selector: "isAuthenticated:",
  62024. protocol: "private",
  62025. fn: function (aRequest){
  62026. var self=this,$self=this;
  62027. var header,token,auth,parts;
  62028. return $core.withContext(function($ctx1) {
  62029. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  62030. var $early={};
  62031. try {
  62032. $2=$recv($self["@username"])._isNil();
  62033. $ctx1.sendIdx["isNil"]=1;
  62034. $1=$recv($2)._and_((function(){
  62035. return $core.withContext(function($ctx2) {
  62036. return $recv($self["@password"])._isNil();
  62037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62038. }));
  62039. $ctx1.sendIdx["and:"]=1;
  62040. if($core.assert($1)){
  62041. return true;
  62042. }
  62043. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  62044. $ctx1.sendIdx["at:"]=1;
  62045. if(($receiver = $3) == null || $receiver.a$nil){
  62046. header="";
  62047. } else {
  62048. header=$3;
  62049. }
  62050. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  62051. throw $early=[false];
  62052. }),(function(){
  62053. return $core.withContext(function($ctx2) {
  62054. $4=$recv(header)._tokenize_(" ");
  62055. $ctx2.sendIdx["tokenize:"]=1;
  62056. if(($receiver = $4) == null || $receiver.a$nil){
  62057. token="";
  62058. } else {
  62059. token=$4;
  62060. }
  62061. token;
  62062. $5=$recv(token)._at_((2));
  62063. $ctx2.sendIdx["at:"]=2;
  62064. auth=$self._base64Decode_($5);
  62065. auth;
  62066. parts=$recv(auth)._tokenize_(":");
  62067. parts;
  62068. $8=$self["@username"];
  62069. $9=$recv(parts)._at_((1));
  62070. $ctx2.sendIdx["at:"]=3;
  62071. $7=$recv($8).__eq($9);
  62072. $ctx2.sendIdx["="]=1;
  62073. $6=$recv($7)._and_((function(){
  62074. return $core.withContext(function($ctx3) {
  62075. return $recv($self["@password"]).__eq($recv(parts)._at_((2)));
  62076. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  62077. }));
  62078. if($core.assert($6)){
  62079. throw $early=[true];
  62080. } else {
  62081. throw $early=[false];
  62082. }
  62083. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62084. }));
  62085. return self;
  62086. }
  62087. catch(e) {if(e===$early)return e[0]; throw e}
  62088. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  62089. },
  62090. args: ["aRequest"],
  62091. 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].",
  62092. referencedClasses: [],
  62093. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  62094. }),
  62095. $globals.FileServer);
  62096. $core.addMethod(
  62097. $core.method({
  62098. selector: "password:",
  62099. protocol: "accessing",
  62100. fn: function (aPassword){
  62101. var self=this,$self=this;
  62102. $self["@password"]=aPassword;
  62103. return self;
  62104. },
  62105. args: ["aPassword"],
  62106. source: "password: aPassword\x0a\x09password := aPassword.",
  62107. referencedClasses: [],
  62108. messageSends: []
  62109. }),
  62110. $globals.FileServer);
  62111. $core.addMethod(
  62112. $core.method({
  62113. selector: "port",
  62114. protocol: "accessing",
  62115. fn: function (){
  62116. var self=this,$self=this;
  62117. return $self["@port"];
  62118. },
  62119. args: [],
  62120. source: "port\x0a\x09^ port",
  62121. referencedClasses: [],
  62122. messageSends: []
  62123. }),
  62124. $globals.FileServer);
  62125. $core.addMethod(
  62126. $core.method({
  62127. selector: "port:",
  62128. protocol: "accessing",
  62129. fn: function (aNumber){
  62130. var self=this,$self=this;
  62131. $self["@port"]=aNumber;
  62132. return self;
  62133. },
  62134. args: ["aNumber"],
  62135. source: "port: aNumber\x0a\x09port := aNumber",
  62136. referencedClasses: [],
  62137. messageSends: []
  62138. }),
  62139. $globals.FileServer);
  62140. $core.addMethod(
  62141. $core.method({
  62142. selector: "require:",
  62143. protocol: "private",
  62144. fn: function (aModuleString){
  62145. var self=this,$self=this;
  62146. return $core.withContext(function($ctx1) {
  62147. return $recv(require)._value_(aModuleString);
  62148. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  62149. },
  62150. args: ["aModuleString"],
  62151. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  62152. referencedClasses: [],
  62153. messageSends: ["value:"]
  62154. }),
  62155. $globals.FileServer);
  62156. $core.addMethod(
  62157. $core.method({
  62158. selector: "respondAuthenticationRequiredTo:",
  62159. protocol: "request handling",
  62160. fn: function (aResponse){
  62161. var self=this,$self=this;
  62162. return $core.withContext(function($ctx1) {
  62163. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  62164. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  62165. $recv(aResponse)._end();
  62166. return self;
  62167. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  62168. },
  62169. args: ["aResponse"],
  62170. 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.",
  62171. referencedClasses: [],
  62172. messageSends: ["writeHead:options:", "write:", "end"]
  62173. }),
  62174. $globals.FileServer);
  62175. $core.addMethod(
  62176. $core.method({
  62177. selector: "respondCreatedTo:",
  62178. protocol: "request handling",
  62179. fn: function (aResponse){
  62180. var self=this,$self=this;
  62181. return $core.withContext(function($ctx1) {
  62182. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62183. $recv(aResponse)._end();
  62184. return self;
  62185. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62186. },
  62187. args: ["aResponse"],
  62188. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62189. referencedClasses: [],
  62190. messageSends: ["writeHead:options:", "end"]
  62191. }),
  62192. $globals.FileServer);
  62193. $core.addMethod(
  62194. $core.method({
  62195. selector: "respondDirectoryNamed:from:to:",
  62196. protocol: "request handling",
  62197. fn: function (aDirname,aUrl,aResponse){
  62198. var self=this,$self=this;
  62199. return $core.withContext(function($ctx1) {
  62200. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  62201. $2=$recv(aUrl)._pathname();
  62202. $ctx1.sendIdx["pathname"]=1;
  62203. $1=$recv($2)._endsWith_("/");
  62204. if($core.assert($1)){
  62205. $3=$recv(aDirname).__comma("index.html");
  62206. $ctx1.sendIdx[","]=1;
  62207. $self._respondFileNamed_to_($3,aResponse);
  62208. } else {
  62209. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  62210. $7=$recv(aUrl)._search();
  62211. if(($receiver = $7) == null || $receiver.a$nil){
  62212. $6="";
  62213. } else {
  62214. $6=$7;
  62215. }
  62216. $4=$recv($5).__comma($6);
  62217. $ctx1.sendIdx[","]=2;
  62218. $self._respondRedirect_to_($4,aResponse);
  62219. }
  62220. return self;
  62221. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  62222. },
  62223. args: ["aDirname", "aUrl", "aResponse"],
  62224. 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]",
  62225. referencedClasses: [],
  62226. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  62227. }),
  62228. $globals.FileServer);
  62229. $core.addMethod(
  62230. $core.method({
  62231. selector: "respondFileNamed:to:",
  62232. protocol: "request handling",
  62233. fn: function (aFilename,aResponse){
  62234. var self=this,$self=this;
  62235. var type,filename;
  62236. return $core.withContext(function($ctx1) {
  62237. var $1,$2,$3,$4;
  62238. filename=aFilename;
  62239. $recv($self["@fs"])._readFile_do_(filename,(function(ex,file){
  62240. return $core.withContext(function($ctx2) {
  62241. $1=$recv(ex)._notNil();
  62242. if($core.assert($1)){
  62243. $2=console;
  62244. $3=$recv(filename).__comma(" does not exist");
  62245. $ctx2.sendIdx[","]=1;
  62246. $recv($2)._log_($3);
  62247. return $self._respondNotFoundTo_(aResponse);
  62248. } else {
  62249. type=$recv($self._class())._mimeTypeFor_(filename);
  62250. type;
  62251. $4=$recv(type).__eq("application/javascript");
  62252. if($core.assert($4)){
  62253. type=$recv(type).__comma(";charset=utf-8");
  62254. type;
  62255. }
  62256. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  62257. $recv(aResponse)._write_encoding_(file,"binary");
  62258. return $recv(aResponse)._end();
  62259. }
  62260. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  62261. }));
  62262. return self;
  62263. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  62264. },
  62265. args: ["aFilename", "aResponse"],
  62266. 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]]",
  62267. referencedClasses: [],
  62268. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  62269. }),
  62270. $globals.FileServer);
  62271. $core.addMethod(
  62272. $core.method({
  62273. selector: "respondInternalErrorTo:",
  62274. protocol: "request handling",
  62275. fn: function (aResponse){
  62276. var self=this,$self=this;
  62277. return $core.withContext(function($ctx1) {
  62278. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62279. $recv(aResponse)._write_("500 Internal server error");
  62280. $recv(aResponse)._end();
  62281. return self;
  62282. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  62283. },
  62284. args: ["aResponse"],
  62285. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  62286. referencedClasses: [],
  62287. messageSends: ["writeHead:options:", "write:", "end"]
  62288. }),
  62289. $globals.FileServer);
  62290. $core.addMethod(
  62291. $core.method({
  62292. selector: "respondNotCreatedTo:",
  62293. protocol: "request handling",
  62294. fn: function (aResponse){
  62295. var self=this,$self=this;
  62296. return $core.withContext(function($ctx1) {
  62297. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62298. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  62299. $recv(aResponse)._end();
  62300. return self;
  62301. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62302. },
  62303. args: ["aResponse"],
  62304. 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.",
  62305. referencedClasses: [],
  62306. messageSends: ["writeHead:options:", "write:", "end"]
  62307. }),
  62308. $globals.FileServer);
  62309. $core.addMethod(
  62310. $core.method({
  62311. selector: "respondNotFoundTo:",
  62312. protocol: "request handling",
  62313. fn: function (aResponse){
  62314. var self=this,$self=this;
  62315. return $core.withContext(function($ctx1) {
  62316. var $2,$1;
  62317. $2=$self._fallbackPage();
  62318. $ctx1.sendIdx["fallbackPage"]=1;
  62319. $1=$recv($2)._isNil();
  62320. if(!$core.assert($1)){
  62321. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  62322. }
  62323. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  62324. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  62325. $ctx1.sendIdx["write:"]=1;
  62326. $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>");
  62327. $ctx1.sendIdx["write:"]=2;
  62328. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  62329. $ctx1.sendIdx["write:"]=3;
  62330. $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>");
  62331. $ctx1.sendIdx["write:"]=4;
  62332. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  62333. $ctx1.sendIdx["write:"]=5;
  62334. $recv(aResponse)._write_("</ul></p></body></html>");
  62335. $recv(aResponse)._end();
  62336. return self;
  62337. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  62338. },
  62339. args: ["aResponse"],
  62340. 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",
  62341. referencedClasses: [],
  62342. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  62343. }),
  62344. $globals.FileServer);
  62345. $core.addMethod(
  62346. $core.method({
  62347. selector: "respondOKTo:",
  62348. protocol: "request handling",
  62349. fn: function (aResponse){
  62350. var self=this,$self=this;
  62351. return $core.withContext(function($ctx1) {
  62352. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62353. $recv(aResponse)._end();
  62354. return self;
  62355. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  62356. },
  62357. args: ["aResponse"],
  62358. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62359. referencedClasses: [],
  62360. messageSends: ["writeHead:options:", "end"]
  62361. }),
  62362. $globals.FileServer);
  62363. $core.addMethod(
  62364. $core.method({
  62365. selector: "respondRedirect:to:",
  62366. protocol: "request handling",
  62367. fn: function (aString,aResponse){
  62368. var self=this,$self=this;
  62369. return $core.withContext(function($ctx1) {
  62370. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  62371. $recv(aResponse)._end();
  62372. return self;
  62373. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  62374. },
  62375. args: ["aString", "aResponse"],
  62376. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  62377. referencedClasses: [],
  62378. messageSends: ["writeHead:options:", "end"]
  62379. }),
  62380. $globals.FileServer);
  62381. $core.addMethod(
  62382. $core.method({
  62383. selector: "start",
  62384. protocol: "starting",
  62385. fn: function (){
  62386. var self=this,$self=this;
  62387. return $core.withContext(function($ctx1) {
  62388. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  62389. $self._checkDirectoryLayout();
  62390. $1=$recv($self["@http"])._createServer_((function(request,response){
  62391. return $core.withContext(function($ctx2) {
  62392. return $self._handleRequest_respondTo_(request,response);
  62393. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  62394. }));
  62395. $recv($1)._on_do_("error",(function(error){
  62396. return $core.withContext(function($ctx2) {
  62397. $2=console;
  62398. $3="Error starting server: ".__comma(error);
  62399. $ctx2.sendIdx[","]=1;
  62400. return $recv($2)._log_($3);
  62401. $ctx2.sendIdx["log:"]=1;
  62402. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62403. }));
  62404. $ctx1.sendIdx["on:do:"]=1;
  62405. $recv($1)._on_do_("listening",(function(){
  62406. return $core.withContext(function($ctx2) {
  62407. $4=console;
  62408. $8=$self._host();
  62409. $ctx2.sendIdx["host"]=1;
  62410. $7="Starting file server on http://".__comma($8);
  62411. $6=$recv($7).__comma(":");
  62412. $ctx2.sendIdx[","]=3;
  62413. $10=$self._port();
  62414. $ctx2.sendIdx["port"]=1;
  62415. $9=$recv($10)._asString();
  62416. $5=$recv($6).__comma($9);
  62417. $ctx2.sendIdx[","]=2;
  62418. return $recv($4)._log_($5);
  62419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62420. }));
  62421. $recv($1)._listen_host_($self._port(),$self._host());
  62422. return self;
  62423. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  62424. },
  62425. args: [],
  62426. 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.",
  62427. referencedClasses: [],
  62428. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  62429. }),
  62430. $globals.FileServer);
  62431. $core.addMethod(
  62432. $core.method({
  62433. selector: "startOn:",
  62434. protocol: "starting",
  62435. fn: function (aPort){
  62436. var self=this,$self=this;
  62437. return $core.withContext(function($ctx1) {
  62438. $self._port_(aPort);
  62439. $self._start();
  62440. return self;
  62441. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  62442. },
  62443. args: ["aPort"],
  62444. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  62445. referencedClasses: [],
  62446. messageSends: ["port:", "start"]
  62447. }),
  62448. $globals.FileServer);
  62449. $core.addMethod(
  62450. $core.method({
  62451. selector: "username:",
  62452. protocol: "accessing",
  62453. fn: function (aUsername){
  62454. var self=this,$self=this;
  62455. $self["@username"]=aUsername;
  62456. return self;
  62457. },
  62458. args: ["aUsername"],
  62459. source: "username: aUsername\x0a\x09username := aUsername.",
  62460. referencedClasses: [],
  62461. messageSends: []
  62462. }),
  62463. $globals.FileServer);
  62464. $core.addMethod(
  62465. $core.method({
  62466. selector: "validateBasePath",
  62467. protocol: "private",
  62468. fn: function (){
  62469. var self=this,$self=this;
  62470. return $core.withContext(function($ctx1) {
  62471. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  62472. $1=$self["@fs"];
  62473. $2=$self._basePath();
  62474. $ctx1.sendIdx["basePath"]=1;
  62475. $recv($1)._stat_then_($2,(function(err,stat){
  62476. return $core.withContext(function($ctx2) {
  62477. if(($receiver = err) == null || $receiver.a$nil){
  62478. $3=$recv(stat)._isDirectory();
  62479. if(!$core.assert($3)){
  62480. $4=console;
  62481. $7=$self._basePath();
  62482. $ctx2.sendIdx["basePath"]=2;
  62483. $6="Warning: --base-path parameter ".__comma($7);
  62484. $ctx2.sendIdx[","]=2;
  62485. $5=$recv($6).__comma(" is not a directory.");
  62486. $ctx2.sendIdx[","]=1;
  62487. return $recv($4)._warn_($5);
  62488. $ctx2.sendIdx["warn:"]=1;
  62489. }
  62490. } else {
  62491. $8=console;
  62492. $9=$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.");
  62493. $ctx2.sendIdx[","]=3;
  62494. return $recv($8)._warn_($9);
  62495. }
  62496. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  62497. }));
  62498. return self;
  62499. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  62500. },
  62501. args: [],
  62502. 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.' ]].",
  62503. referencedClasses: [],
  62504. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  62505. }),
  62506. $globals.FileServer);
  62507. $core.addMethod(
  62508. $core.method({
  62509. selector: "withBasePath:",
  62510. protocol: "private",
  62511. fn: function (aBaseRelativePath){
  62512. var self=this,$self=this;
  62513. return $core.withContext(function($ctx1) {
  62514. return $recv($self["@path"])._join_with_($self._basePath(),aBaseRelativePath);
  62515. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  62516. },
  62517. args: ["aBaseRelativePath"],
  62518. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  62519. referencedClasses: [],
  62520. messageSends: ["join:with:", "basePath"]
  62521. }),
  62522. $globals.FileServer);
  62523. $core.addMethod(
  62524. $core.method({
  62525. selector: "writeData:toFileNamed:",
  62526. protocol: "private",
  62527. fn: function (data,aFilename){
  62528. var self=this,$self=this;
  62529. return $core.withContext(function($ctx1) {
  62530. $recv(console)._log_(aFilename);
  62531. return self;
  62532. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  62533. },
  62534. args: ["data", "aFilename"],
  62535. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  62536. referencedClasses: [],
  62537. messageSends: ["log:"]
  62538. }),
  62539. $globals.FileServer);
  62540. $globals.FileServer.a$cls.iVarNames = ["mimeTypes"];
  62541. $core.addMethod(
  62542. $core.method({
  62543. selector: "commandLineSwitches",
  62544. protocol: "accessing",
  62545. fn: function (){
  62546. var self=this,$self=this;
  62547. var switches;
  62548. return $core.withContext(function($ctx1) {
  62549. switches=$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  62550. return $core.withContext(function($ctx2) {
  62551. return $recv(each)._selector();
  62552. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62553. }));
  62554. $ctx1.sendIdx["collect:"]=1;
  62555. switches=$recv(switches)._select_((function(each){
  62556. return $core.withContext(function($ctx2) {
  62557. return $recv(each)._match_("^[^:]*:$");
  62558. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  62559. }));
  62560. switches=$recv(switches)._collect_((function(each){
  62561. return $core.withContext(function($ctx2) {
  62562. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  62563. $ctx2.sendIdx["replace:with:"]=1;
  62564. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  62565. }));
  62566. return switches;
  62567. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.a$cls)});
  62568. },
  62569. args: [],
  62570. 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",
  62571. referencedClasses: [],
  62572. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  62573. }),
  62574. $globals.FileServer.a$cls);
  62575. $core.addMethod(
  62576. $core.method({
  62577. selector: "createServerWithArguments:",
  62578. protocol: "initialization",
  62579. fn: function (options){
  62580. var self=this,$self=this;
  62581. var server,popFront,front,optionName,optionValue,switches;
  62582. return $core.withContext(function($ctx1) {
  62583. var $1,$2,$3,$4,$5,$6,$7,$8;
  62584. var $early={};
  62585. try {
  62586. switches=$self._commandLineSwitches();
  62587. server=$self._new();
  62588. $recv(options)._ifEmpty_((function(){
  62589. throw $early=[server];
  62590. }));
  62591. $1=$recv($recv(options)._size())._even();
  62592. if(!$core.assert($1)){
  62593. $recv(console)._log_("Using default parameters.");
  62594. $ctx1.sendIdx["log:"]=1;
  62595. $2=console;
  62596. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  62597. $ctx1.sendIdx[","]=1;
  62598. $recv($2)._log_($3);
  62599. $ctx1.sendIdx["log:"]=2;
  62600. $4=console;
  62601. $5="Use any of the following ones: ".__comma(switches);
  62602. $ctx1.sendIdx[","]=2;
  62603. $recv($4)._log_($5);
  62604. $ctx1.sendIdx["log:"]=3;
  62605. return server;
  62606. }
  62607. popFront=(function(args){
  62608. return $core.withContext(function($ctx2) {
  62609. front=$recv(args)._first();
  62610. front;
  62611. $recv(args)._remove_(front);
  62612. return front;
  62613. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  62614. });
  62615. $recv((function(){
  62616. return $core.withContext(function($ctx2) {
  62617. return $recv(options)._notEmpty();
  62618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  62619. }))._whileTrue_((function(){
  62620. return $core.withContext(function($ctx2) {
  62621. optionName=$recv(popFront)._value_(options);
  62622. $ctx2.sendIdx["value:"]=1;
  62623. optionName;
  62624. optionValue=$recv(popFront)._value_(options);
  62625. optionValue;
  62626. $6=$recv(switches)._includes_(optionName);
  62627. if($core.assert($6)){
  62628. optionName=$self._selectorForCommandLineSwitch_(optionName);
  62629. optionName;
  62630. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  62631. } else {
  62632. $7=console;
  62633. $8=$recv(optionName).__comma(" is not a valid commandline option");
  62634. $ctx2.sendIdx[","]=3;
  62635. $recv($7)._log_($8);
  62636. $ctx2.sendIdx["log:"]=4;
  62637. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  62638. }
  62639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62640. }));
  62641. return server;
  62642. }
  62643. catch(e) {if(e===$early)return e[0]; throw e}
  62644. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.a$cls)});
  62645. },
  62646. args: ["options"],
  62647. 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.",
  62648. referencedClasses: ["Array"],
  62649. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  62650. }),
  62651. $globals.FileServer.a$cls);
  62652. $core.addMethod(
  62653. $core.method({
  62654. selector: "defaultBasePath",
  62655. protocol: "accessing",
  62656. fn: function (){
  62657. var self=this,$self=this;
  62658. return "./";
  62659. },
  62660. args: [],
  62661. source: "defaultBasePath\x0a\x09^ './'",
  62662. referencedClasses: [],
  62663. messageSends: []
  62664. }),
  62665. $globals.FileServer.a$cls);
  62666. $core.addMethod(
  62667. $core.method({
  62668. selector: "defaultHost",
  62669. protocol: "accessing",
  62670. fn: function (){
  62671. var self=this,$self=this;
  62672. return "127.0.0.1";
  62673. },
  62674. args: [],
  62675. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  62676. referencedClasses: [],
  62677. messageSends: []
  62678. }),
  62679. $globals.FileServer.a$cls);
  62680. $core.addMethod(
  62681. $core.method({
  62682. selector: "defaultMimeTypes",
  62683. protocol: "accessing",
  62684. fn: function (){
  62685. var self=this,$self=this;
  62686. 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"]);
  62687. },
  62688. args: [],
  62689. 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}",
  62690. referencedClasses: [],
  62691. messageSends: []
  62692. }),
  62693. $globals.FileServer.a$cls);
  62694. $core.addMethod(
  62695. $core.method({
  62696. selector: "defaultPort",
  62697. protocol: "accessing",
  62698. fn: function (){
  62699. var self=this,$self=this;
  62700. return (4000);
  62701. },
  62702. args: [],
  62703. source: "defaultPort\x0a\x09^ 4000",
  62704. referencedClasses: [],
  62705. messageSends: []
  62706. }),
  62707. $globals.FileServer.a$cls);
  62708. $core.addMethod(
  62709. $core.method({
  62710. selector: "main",
  62711. protocol: "initialization",
  62712. fn: function (){
  62713. var self=this,$self=this;
  62714. var fileServer,args;
  62715. return $core.withContext(function($ctx1) {
  62716. var $1;
  62717. var $early={};
  62718. try {
  62719. args=$recv(process)._argv();
  62720. $recv(args)._removeFrom_to_((1),(3));
  62721. $recv(args)._detect_ifNone_((function(each){
  62722. return $core.withContext(function($ctx2) {
  62723. $1=$recv(each).__eq("--help");
  62724. if($core.assert($1)){
  62725. return $recv($globals.FileServer)._printHelp();
  62726. }
  62727. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62728. }),(function(){
  62729. return $core.withContext(function($ctx2) {
  62730. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  62731. fileServer;
  62732. throw $early=[$recv(fileServer)._start()];
  62733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62734. }));
  62735. return self;
  62736. }
  62737. catch(e) {if(e===$early)return e[0]; throw e}
  62738. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.a$cls)});
  62739. },
  62740. args: [],
  62741. 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]",
  62742. referencedClasses: ["FileServer"],
  62743. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  62744. }),
  62745. $globals.FileServer.a$cls);
  62746. $core.addMethod(
  62747. $core.method({
  62748. selector: "mimeTypeFor:",
  62749. protocol: "accessing",
  62750. fn: function (aString){
  62751. var self=this,$self=this;
  62752. return $core.withContext(function($ctx1) {
  62753. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  62754. return "text/plain";
  62755. }));
  62756. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.a$cls)});
  62757. },
  62758. args: ["aString"],
  62759. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  62760. referencedClasses: [],
  62761. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  62762. }),
  62763. $globals.FileServer.a$cls);
  62764. $core.addMethod(
  62765. $core.method({
  62766. selector: "mimeTypes",
  62767. protocol: "accessing",
  62768. fn: function (){
  62769. var self=this,$self=this;
  62770. return $core.withContext(function($ctx1) {
  62771. var $1,$receiver;
  62772. $1=$self["@mimeTypes"];
  62773. if(($receiver = $1) == null || $receiver.a$nil){
  62774. $self["@mimeTypes"]=$self._defaultMimeTypes();
  62775. return $self["@mimeTypes"];
  62776. } else {
  62777. return $1;
  62778. }
  62779. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.a$cls)});
  62780. },
  62781. args: [],
  62782. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  62783. referencedClasses: [],
  62784. messageSends: ["ifNil:", "defaultMimeTypes"]
  62785. }),
  62786. $globals.FileServer.a$cls);
  62787. $core.addMethod(
  62788. $core.method({
  62789. selector: "printHelp",
  62790. protocol: "accessing",
  62791. fn: function (){
  62792. var self=this,$self=this;
  62793. return $core.withContext(function($ctx1) {
  62794. $recv(console)._log_("Available commandline options are:");
  62795. $ctx1.sendIdx["log:"]=1;
  62796. $recv(console)._log_("--help");
  62797. $ctx1.sendIdx["log:"]=2;
  62798. $recv($self._commandLineSwitches())._do_((function(each){
  62799. return $core.withContext(function($ctx2) {
  62800. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  62801. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62802. }));
  62803. return self;
  62804. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.a$cls)});
  62805. },
  62806. args: [],
  62807. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  62808. referencedClasses: [],
  62809. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  62810. }),
  62811. $globals.FileServer.a$cls);
  62812. $core.addMethod(
  62813. $core.method({
  62814. selector: "selectorForCommandLineSwitch:",
  62815. protocol: "accessing",
  62816. fn: function (aSwitch){
  62817. var self=this,$self=this;
  62818. return $core.withContext(function($ctx1) {
  62819. var $1;
  62820. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  62821. return $core.withContext(function($ctx2) {
  62822. return $recv($recv(each)._second())._asUppercase();
  62823. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62824. }));
  62825. $ctx1.sendIdx["replace:with:"]=1;
  62826. return $recv($1).__comma(":");
  62827. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.a$cls)});
  62828. },
  62829. args: ["aSwitch"],
  62830. 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 ]), ':'",
  62831. referencedClasses: [],
  62832. messageSends: [",", "replace:with:", "asUppercase", "second"]
  62833. }),
  62834. $globals.FileServer.a$cls);
  62835. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  62836. $core.addMethod(
  62837. $core.method({
  62838. selector: "bowerInstallThenDo:",
  62839. protocol: "action",
  62840. fn: function (aBlock){
  62841. var self=this,$self=this;
  62842. var child;
  62843. return $core.withContext(function($ctx1) {
  62844. var $1,$3,$2;
  62845. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("bower","bower"),["install"]);
  62846. $1=child;
  62847. $recv($1)._on_do_("error",aBlock);
  62848. $ctx1.sendIdx["on:do:"]=1;
  62849. $recv($1)._on_do_("close",(function(code){
  62850. return $core.withContext(function($ctx2) {
  62851. $3=$recv(code).__eq((0));
  62852. if($core.assert($3)){
  62853. $2=nil;
  62854. } else {
  62855. $2=code;
  62856. }
  62857. return $recv(aBlock)._value_($2);
  62858. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  62859. }));
  62860. return self;
  62861. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  62862. },
  62863. args: ["aBlock"],
  62864. source: "bowerInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'bower' named: 'bower')\x0a\x09\x09args: #('install').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  62865. referencedClasses: [],
  62866. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  62867. }),
  62868. $globals.Initer);
  62869. $core.addMethod(
  62870. $core.method({
  62871. selector: "finishMessage",
  62872. protocol: "action",
  62873. fn: function (){
  62874. var self=this,$self=this;
  62875. return $core.withContext(function($ctx1) {
  62876. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  62877. $recv((function(){
  62878. }))._valueWithTimeout_((600));
  62879. return self;
  62880. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  62881. },
  62882. args: [],
  62883. 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",
  62884. referencedClasses: ["String"],
  62885. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  62886. }),
  62887. $globals.Initer);
  62888. $core.addMethod(
  62889. $core.method({
  62890. selector: "gruntInitThenDo:",
  62891. protocol: "action",
  62892. fn: function (aBlock){
  62893. var self=this,$self=this;
  62894. var child,sanitizedTemplatePath;
  62895. return $core.withContext(function($ctx1) {
  62896. var $1,$3,$2;
  62897. sanitizedTemplatePath=$recv($recv($recv($self["@path"])._join_with_($self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  62898. $ctx1.sendIdx["replace:with:"]=1;
  62899. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  62900. $1=child;
  62901. $recv($1)._on_do_("error",aBlock);
  62902. $ctx1.sendIdx["on:do:"]=1;
  62903. $recv($1)._on_do_("close",(function(code){
  62904. return $core.withContext(function($ctx2) {
  62905. $3=$recv(code).__eq((0));
  62906. if($core.assert($3)){
  62907. $2=nil;
  62908. } else {
  62909. $2=code;
  62910. }
  62911. return $recv(aBlock)._value_($2);
  62912. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  62913. }));
  62914. return self;
  62915. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  62916. },
  62917. args: ["aBlock"],
  62918. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: 'grunt-init-amber')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  62919. referencedClasses: [],
  62920. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  62921. }),
  62922. $globals.Initer);
  62923. $core.addMethod(
  62924. $core.method({
  62925. selector: "gruntThenDo:",
  62926. protocol: "action",
  62927. fn: function (aBlock){
  62928. var self=this,$self=this;
  62929. var child;
  62930. return $core.withContext(function($ctx1) {
  62931. var $1,$3,$2;
  62932. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  62933. $1=child;
  62934. $recv($1)._on_do_("error",aBlock);
  62935. $ctx1.sendIdx["on:do:"]=1;
  62936. $recv($1)._on_do_("close",(function(code){
  62937. return $core.withContext(function($ctx2) {
  62938. $3=$recv(code).__eq((0));
  62939. if($core.assert($3)){
  62940. $2=nil;
  62941. } else {
  62942. $2=code;
  62943. }
  62944. return $recv(aBlock)._value_($2);
  62945. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  62946. }));
  62947. return self;
  62948. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  62949. },
  62950. args: ["aBlock"],
  62951. source: "gruntThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-cli' named: 'grunt')\x0a\x09\x09args: #('default' 'devel').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  62952. referencedClasses: [],
  62953. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  62954. }),
  62955. $globals.Initer);
  62956. $core.addMethod(
  62957. $core.method({
  62958. selector: "initialize",
  62959. protocol: "initialization",
  62960. fn: function (){
  62961. var self=this,$self=this;
  62962. return $core.withContext(function($ctx1) {
  62963. (
  62964. $ctx1.supercall = true,
  62965. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62966. $ctx1.supercall = false;
  62967. $self["@childProcess"]=$recv(require)._value_("child_process");
  62968. $self["@nmPath"]=$recv($self["@path"])._join_with_($self._rootDirname(),"node_modules");
  62969. return self;
  62970. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  62971. },
  62972. args: [],
  62973. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  62974. referencedClasses: [],
  62975. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  62976. }),
  62977. $globals.Initer);
  62978. $core.addMethod(
  62979. $core.method({
  62980. selector: "npmInstallThenDo:",
  62981. protocol: "action",
  62982. fn: function (aBlock){
  62983. var self=this,$self=this;
  62984. var child;
  62985. return $core.withContext(function($ctx1) {
  62986. var $1;
  62987. child=$recv($self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  62988. $1=$recv(child)._stdout();
  62989. $ctx1.sendIdx["stdout"]=1;
  62990. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  62991. return self;
  62992. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  62993. },
  62994. args: ["aBlock"],
  62995. source: "npmInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: 'npm install'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  62996. referencedClasses: [],
  62997. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  62998. }),
  62999. $globals.Initer);
  63000. $core.addMethod(
  63001. $core.method({
  63002. selector: "npmScriptForModule:named:",
  63003. protocol: "npm",
  63004. fn: function (aString,anotherString){
  63005. var self=this,$self=this;
  63006. var modulePath,packageJson,binSection,scriptPath;
  63007. return $core.withContext(function($ctx1) {
  63008. var $1,$3,$4,$2,$5;
  63009. $1=$self["@path"];
  63010. $3=$recv($globals.JSObjectProxy)._on_(require);
  63011. $4=$recv(aString).__comma("/package.json");
  63012. $ctx1.sendIdx[","]=1;
  63013. $2=$recv($3)._resolve_($4);
  63014. modulePath=$recv($1)._dirname_($2);
  63015. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  63016. binSection=$recv(packageJson)._at_("bin");
  63017. $ctx1.sendIdx["at:"]=1;
  63018. $5=$recv(binSection)._isString();
  63019. if($core.assert($5)){
  63020. scriptPath=binSection;
  63021. } else {
  63022. scriptPath=$recv(binSection)._at_(anotherString);
  63023. }
  63024. return $recv($self["@path"])._join_with_(modulePath,scriptPath);
  63025. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  63026. },
  63027. args: ["aString", "anotherString"],
  63028. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09(JSObjectProxy on: require)\x0a\x09\x09\x09resolve: aString, '/package.json').\x0a\x09packageJson := Smalltalk readJSObject: (\x0a\x09\x09require value: aString, '/package.json').\x0a\x09binSection := packageJson at: 'bin'.\x0a\x09scriptPath := binSection isString\x0a\x09\x09ifTrue: [ binSection ]\x0a\x09\x09ifFalse: [ binSection at: anotherString ].\x0a\x09^ path join: modulePath with: scriptPath",
  63029. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  63030. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  63031. }),
  63032. $globals.Initer);
  63033. $core.addMethod(
  63034. $core.method({
  63035. selector: "start",
  63036. protocol: "action",
  63037. fn: function (){
  63038. var self=this,$self=this;
  63039. return $core.withContext(function($ctx1) {
  63040. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  63041. $self._gruntInitThenDo_((function(error){
  63042. return $core.withContext(function($ctx2) {
  63043. if(($receiver = error) == null || $receiver.a$nil){
  63044. return $self._bowerInstallThenDo_((function(error2){
  63045. return $core.withContext(function($ctx3) {
  63046. if(($receiver = error2) == null || $receiver.a$nil){
  63047. return $self._npmInstallThenDo_((function(error3){
  63048. return $core.withContext(function($ctx4) {
  63049. if(($receiver = error3) == null || $receiver.a$nil){
  63050. return $self._gruntThenDo_((function(error4){
  63051. return $core.withContext(function($ctx5) {
  63052. if(($receiver = error4) == null || $receiver.a$nil){
  63053. $self._finishMessage();
  63054. return $recv(process)._exit();
  63055. } else {
  63056. $7=console;
  63057. $recv($7)._log_("grunt exec error:");
  63058. $ctx5.sendIdx["log:"]=7;
  63059. $recv($7)._log_(error4);
  63060. return $recv(process)._exit_((104));
  63061. }
  63062. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  63063. }));
  63064. } else {
  63065. $5=console;
  63066. $recv($5)._log_("npm install exec error:");
  63067. $ctx4.sendIdx["log:"]=5;
  63068. $6=$recv($5)._log_(error3);
  63069. $ctx4.sendIdx["log:"]=6;
  63070. $6;
  63071. return $recv(process)._exit_((103));
  63072. $ctx4.sendIdx["exit:"]=3;
  63073. }
  63074. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  63075. }));
  63076. } else {
  63077. $3=console;
  63078. $recv($3)._log_("bower install exec error:");
  63079. $ctx3.sendIdx["log:"]=3;
  63080. $4=$recv($3)._log_(error2);
  63081. $ctx3.sendIdx["log:"]=4;
  63082. $4;
  63083. return $recv(process)._exit_((102));
  63084. $ctx3.sendIdx["exit:"]=2;
  63085. }
  63086. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  63087. }));
  63088. } else {
  63089. $1=console;
  63090. $recv($1)._log_("grunt-init exec error:");
  63091. $ctx2.sendIdx["log:"]=1;
  63092. $2=$recv($1)._log_(error);
  63093. $ctx2.sendIdx["log:"]=2;
  63094. $2;
  63095. return $recv(process)._exit_((101));
  63096. $ctx2.sendIdx["exit:"]=1;
  63097. }
  63098. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  63099. }));
  63100. return self;
  63101. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  63102. },
  63103. args: [],
  63104. source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit: 101 ]\x0a\x09ifNil: [\x0a\x0a\x09self bowerInstallThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'bower install exec error:'; log: error2.\x0a\x09\x09process exit: 102 ]\x0a\x09ifNil: [\x0a\x0a\x09self npmInstallThenDo: [ :error3 | error3\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm install exec error:'; log: error3.\x0a\x09\x09process exit: 103 ]\x0a\x09ifNil: [\x0a\x0a\x09self gruntThenDo: [ :error4 | error4\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt exec error:'; log: error4.\x0a\x09\x09process exit: 104 ]\x0a\x09ifNil: [\x0a\x0a\x09self finishMessage.\x0a\x09process exit ]]]]]]]]",
  63105. referencedClasses: [],
  63106. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  63107. }),
  63108. $globals.Initer);
  63109. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  63110. $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.";
  63111. $core.addMethod(
  63112. $core.method({
  63113. selector: "addVariableNamed:to:",
  63114. protocol: "private",
  63115. fn: function (aString,anObject){
  63116. var self=this,$self=this;
  63117. var newClass,newObject;
  63118. return $core.withContext(function($ctx1) {
  63119. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  63120. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  63121. newObject=$recv(newClass)._new();
  63122. $self._setPreviousVariablesFor_from_(newObject,anObject);
  63123. return newObject;
  63124. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  63125. },
  63126. args: ["aString", "anObject"],
  63127. 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",
  63128. referencedClasses: [],
  63129. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  63130. }),
  63131. $globals.Repl);
  63132. $core.addMethod(
  63133. $core.method({
  63134. selector: "assignNewVariable:do:",
  63135. protocol: "private",
  63136. fn: function (buffer,aBlock){
  63137. var self=this,$self=this;
  63138. return $core.withContext(function($ctx1) {
  63139. var $2,$3,$1,$receiver;
  63140. return $self._parseAssignment_do_(buffer,(function(name,expr){
  63141. var varName,value;
  63142. return $core.withContext(function($ctx2) {
  63143. if(($receiver = name) == null || $receiver.a$nil){
  63144. varName=$self._nextResultName();
  63145. } else {
  63146. varName=name;
  63147. }
  63148. varName;
  63149. $self["@session"]=$self._addVariableNamed_to_(varName,$self["@session"]);
  63150. $self["@session"];
  63151. $recv((function(){
  63152. return $core.withContext(function($ctx3) {
  63153. $2=$recv(varName).__comma(" := ");
  63154. if(($receiver = expr) == null || $receiver.a$nil){
  63155. $3=buffer;
  63156. } else {
  63157. $3=expr;
  63158. }
  63159. $1=$recv($2).__comma($3);
  63160. $ctx3.sendIdx[","]=1;
  63161. value=$self._eval_on_($1,$self["@session"]);
  63162. return value;
  63163. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63164. }))._on_do_($globals.Error,(function(e){
  63165. return $core.withContext(function($ctx3) {
  63166. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  63167. value=nil;
  63168. return value;
  63169. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  63170. }));
  63171. return $recv(aBlock)._value_value_(varName,value);
  63172. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  63173. }));
  63174. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  63175. },
  63176. args: ["buffer", "aBlock"],
  63177. 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]",
  63178. referencedClasses: ["Error", "ConsoleErrorHandler"],
  63179. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  63180. }),
  63181. $globals.Repl);
  63182. $core.addMethod(
  63183. $core.method({
  63184. selector: "clearScreen",
  63185. protocol: "actions",
  63186. fn: function (){
  63187. var self=this,$self=this;
  63188. var esc,cls;
  63189. return $core.withContext(function($ctx1) {
  63190. var $1;
  63191. esc=$recv($globals.String)._fromCharCode_((27));
  63192. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  63193. $ctx1.sendIdx[","]=2;
  63194. cls=$recv($1).__comma("[0;0f");
  63195. $ctx1.sendIdx[","]=1;
  63196. $recv($recv(process)._stdout())._write_(cls);
  63197. $recv($self["@interface"])._prompt();
  63198. return self;
  63199. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  63200. },
  63201. args: [],
  63202. 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",
  63203. referencedClasses: ["String"],
  63204. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  63205. }),
  63206. $globals.Repl);
  63207. $core.addMethod(
  63208. $core.method({
  63209. selector: "close",
  63210. protocol: "actions",
  63211. fn: function (){
  63212. var self=this,$self=this;
  63213. return $core.withContext(function($ctx1) {
  63214. $recv($recv(process)._stdin())._destroy();
  63215. return self;
  63216. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  63217. },
  63218. args: [],
  63219. source: "close\x0a\x09process stdin destroy",
  63220. referencedClasses: [],
  63221. messageSends: ["destroy", "stdin"]
  63222. }),
  63223. $globals.Repl);
  63224. $core.addMethod(
  63225. $core.method({
  63226. selector: "commands",
  63227. protocol: "accessing",
  63228. fn: function (){
  63229. var self=this,$self=this;
  63230. return $self["@commands"];
  63231. },
  63232. args: [],
  63233. source: "commands\x0a\x09^ commands",
  63234. referencedClasses: [],
  63235. messageSends: []
  63236. }),
  63237. $globals.Repl);
  63238. $core.addMethod(
  63239. $core.method({
  63240. selector: "createInterface",
  63241. protocol: "actions",
  63242. fn: function (){
  63243. var self=this,$self=this;
  63244. return $core.withContext(function($ctx1) {
  63245. $self["@interface"]=$recv($self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  63246. $recv($self["@interface"])._on_do_("line",(function(buffer){
  63247. return $core.withContext(function($ctx2) {
  63248. return $self._processLine_(buffer);
  63249. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  63250. }));
  63251. $ctx1.sendIdx["on:do:"]=1;
  63252. $recv($self["@interface"])._on_do_("close",(function(){
  63253. return $core.withContext(function($ctx2) {
  63254. return $self._close();
  63255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63256. }));
  63257. $self._printWelcome();
  63258. $self._setupHotkeys();
  63259. $self._setPrompt();
  63260. $recv($self["@interface"])._prompt();
  63261. return self;
  63262. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  63263. },
  63264. args: [],
  63265. 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",
  63266. referencedClasses: [],
  63267. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  63268. }),
  63269. $globals.Repl);
  63270. $core.addMethod(
  63271. $core.method({
  63272. selector: "encapsulateVariable:withValue:in:",
  63273. protocol: "private",
  63274. fn: function (aString,anObject,aClass){
  63275. var self=this,$self=this;
  63276. var compiler;
  63277. return $core.withContext(function($ctx1) {
  63278. var $1,$4,$3,$2,$5,$6;
  63279. compiler=$recv($globals.Compiler)._new();
  63280. $1=compiler;
  63281. $4=$recv(aString).__comma(": anObject ^ ");
  63282. $ctx1.sendIdx[","]=3;
  63283. $3=$recv($4).__comma(aString);
  63284. $ctx1.sendIdx[","]=2;
  63285. $2=$recv($3).__comma(" := anObject");
  63286. $ctx1.sendIdx[","]=1;
  63287. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  63288. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  63289. $5=compiler;
  63290. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  63291. $ctx1.sendIdx[","]=4;
  63292. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  63293. return self;
  63294. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  63295. },
  63296. args: ["aString", "anObject", "aClass"],
  63297. 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'.",
  63298. referencedClasses: ["Compiler"],
  63299. messageSends: ["new", "install:forClass:protocol:", ","]
  63300. }),
  63301. $globals.Repl);
  63302. $core.addMethod(
  63303. $core.method({
  63304. selector: "eval:",
  63305. protocol: "actions",
  63306. fn: function (buffer){
  63307. var self=this,$self=this;
  63308. return $core.withContext(function($ctx1) {
  63309. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  63310. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  63311. },
  63312. args: ["buffer"],
  63313. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  63314. referencedClasses: ["DoIt"],
  63315. messageSends: ["eval:on:", "new"]
  63316. }),
  63317. $globals.Repl);
  63318. $core.addMethod(
  63319. $core.method({
  63320. selector: "eval:on:",
  63321. protocol: "actions",
  63322. fn: function (buffer,anObject){
  63323. var self=this,$self=this;
  63324. var result;
  63325. return $core.withContext(function($ctx1) {
  63326. var $1;
  63327. $recv(buffer)._ifNotEmpty_((function(){
  63328. return $core.withContext(function($ctx2) {
  63329. return $recv((function(){
  63330. return $core.withContext(function($ctx3) {
  63331. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  63332. return result;
  63333. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63334. }))._tryCatch_((function(e){
  63335. return $core.withContext(function($ctx3) {
  63336. $1=$recv(e)._isSmalltalkError();
  63337. if($core.assert($1)){
  63338. return $recv(e)._resignal();
  63339. } else {
  63340. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  63341. }
  63342. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  63343. }));
  63344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63345. }));
  63346. return result;
  63347. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  63348. },
  63349. args: ["buffer", "anObject"],
  63350. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer ifNotEmpty: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09\x09ifTrue: [ e resignal ]\x0a\x09\x09\x09\x09\x09ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  63351. referencedClasses: ["Compiler"],
  63352. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  63353. }),
  63354. $globals.Repl);
  63355. $core.addMethod(
  63356. $core.method({
  63357. selector: "executeCommand:",
  63358. protocol: "private",
  63359. fn: function (aString){
  63360. var self=this,$self=this;
  63361. return $core.withContext(function($ctx1) {
  63362. var $1;
  63363. var $early={};
  63364. try {
  63365. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  63366. return $core.withContext(function($ctx2) {
  63367. $1=$recv(names)._includes_(aString);
  63368. if($core.assert($1)){
  63369. $recv(cmd)._value();
  63370. throw $early=[true];
  63371. }
  63372. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  63373. }));
  63374. return false;
  63375. }
  63376. catch(e) {if(e===$early)return e[0]; throw e}
  63377. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  63378. },
  63379. args: ["aString"],
  63380. 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",
  63381. referencedClasses: [],
  63382. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  63383. }),
  63384. $globals.Repl);
  63385. $core.addMethod(
  63386. $core.method({
  63387. selector: "initialize",
  63388. protocol: "initialization",
  63389. fn: function (){
  63390. var self=this,$self=this;
  63391. return $core.withContext(function($ctx1) {
  63392. (
  63393. $ctx1.supercall = true,
  63394. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63395. $ctx1.supercall = false;
  63396. $self["@session"]=$recv($globals.DoIt)._new();
  63397. $self["@readline"]=$recv(require)._value_("readline");
  63398. $ctx1.sendIdx["value:"]=1;
  63399. $self["@util"]=$recv(require)._value_("util");
  63400. $self._setupCommands();
  63401. return self;
  63402. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  63403. },
  63404. args: [],
  63405. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  63406. referencedClasses: ["DoIt"],
  63407. messageSends: ["initialize", "new", "value:", "setupCommands"]
  63408. }),
  63409. $globals.Repl);
  63410. $core.addMethod(
  63411. $core.method({
  63412. selector: "instanceVariableNamesFor:",
  63413. protocol: "private",
  63414. fn: function (aClass){
  63415. var self=this,$self=this;
  63416. return $core.withContext(function($ctx1) {
  63417. var $1,$2,$receiver;
  63418. $1=$recv(aClass)._superclass();
  63419. $ctx1.sendIdx["superclass"]=1;
  63420. if(($receiver = $1) == null || $receiver.a$nil){
  63421. return $recv(aClass)._instanceVariableNames();
  63422. } else {
  63423. $2=$recv(aClass)._instanceVariableNames();
  63424. $ctx1.sendIdx["instanceVariableNames"]=1;
  63425. return $recv($2)._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  63426. }
  63427. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  63428. },
  63429. args: ["aClass"],
  63430. 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]",
  63431. referencedClasses: [],
  63432. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  63433. }),
  63434. $globals.Repl);
  63435. $core.addMethod(
  63436. $core.method({
  63437. selector: "isIdentifier:",
  63438. protocol: "private",
  63439. fn: function (aString){
  63440. var self=this,$self=this;
  63441. return $core.withContext(function($ctx1) {
  63442. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  63443. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  63444. },
  63445. args: ["aString"],
  63446. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  63447. referencedClasses: [],
  63448. messageSends: ["match:", "asRegexp"]
  63449. }),
  63450. $globals.Repl);
  63451. $core.addMethod(
  63452. $core.method({
  63453. selector: "isVariableDefined:",
  63454. protocol: "private",
  63455. fn: function (aString){
  63456. var self=this,$self=this;
  63457. return $core.withContext(function($ctx1) {
  63458. return $recv($self._instanceVariableNamesFor_($recv($self["@session"])._class()))._includes_(aString);
  63459. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  63460. },
  63461. args: ["aString"],
  63462. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  63463. referencedClasses: [],
  63464. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  63465. }),
  63466. $globals.Repl);
  63467. $core.addMethod(
  63468. $core.method({
  63469. selector: "nextResultName",
  63470. protocol: "private",
  63471. fn: function (){
  63472. var self=this,$self=this;
  63473. return $core.withContext(function($ctx1) {
  63474. var $1,$receiver;
  63475. $1=$self["@resultCount"];
  63476. if(($receiver = $1) == null || $receiver.a$nil){
  63477. $self["@resultCount"]=(1);
  63478. } else {
  63479. $self["@resultCount"]=$recv($self["@resultCount"]).__plus((1));
  63480. }
  63481. return "res".__comma($recv($self["@resultCount"])._asString());
  63482. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  63483. },
  63484. args: [],
  63485. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  63486. referencedClasses: [],
  63487. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  63488. }),
  63489. $globals.Repl);
  63490. $core.addMethod(
  63491. $core.method({
  63492. selector: "onKeyPress:",
  63493. protocol: "private",
  63494. fn: function (key){
  63495. var self=this,$self=this;
  63496. return $core.withContext(function($ctx1) {
  63497. var $1;
  63498. $1=$recv($recv(key)._ctrl())._and_((function(){
  63499. return $core.withContext(function($ctx2) {
  63500. return $recv($recv(key)._name()).__eq("l");
  63501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63502. }));
  63503. if($core.assert($1)){
  63504. $self._clearScreen();
  63505. }
  63506. return self;
  63507. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  63508. },
  63509. args: ["key"],
  63510. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  63511. referencedClasses: [],
  63512. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  63513. }),
  63514. $globals.Repl);
  63515. $core.addMethod(
  63516. $core.method({
  63517. selector: "parseAssignment:do:",
  63518. protocol: "private",
  63519. fn: function (aString,aBlock){
  63520. var self=this,$self=this;
  63521. var assignment;
  63522. return $core.withContext(function($ctx1) {
  63523. var $2,$1;
  63524. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  63525. return $core.withContext(function($ctx2) {
  63526. return $recv(s)._trimBoth();
  63527. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  63528. }));
  63529. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  63530. return $core.withContext(function($ctx2) {
  63531. $2=$recv(assignment)._first();
  63532. $ctx2.sendIdx["first"]=1;
  63533. return $self._isIdentifier_($2);
  63534. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63535. }));
  63536. if($core.assert($1)){
  63537. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  63538. $ctx1.sendIdx["value:value:"]=1;
  63539. } else {
  63540. return $recv(aBlock)._value_value_(nil,nil);
  63541. }
  63542. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  63543. },
  63544. args: ["aString", "aBlock"],
  63545. 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 ]",
  63546. referencedClasses: [],
  63547. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  63548. }),
  63549. $globals.Repl);
  63550. $core.addMethod(
  63551. $core.method({
  63552. selector: "presentResultNamed:withValue:",
  63553. protocol: "private",
  63554. fn: function (varName,value){
  63555. var self=this,$self=this;
  63556. return $core.withContext(function($ctx1) {
  63557. var $3,$2,$1;
  63558. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  63559. $ctx1.sendIdx[","]=3;
  63560. $2=$recv($3).__comma(" = ");
  63561. $ctx1.sendIdx[","]=2;
  63562. $1=$recv($2).__comma($recv(value)._asString());
  63563. $ctx1.sendIdx[","]=1;
  63564. $recv($globals.Transcript)._show_($1);
  63565. $recv($globals.Transcript)._cr();
  63566. $recv($self["@interface"])._prompt();
  63567. return self;
  63568. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  63569. },
  63570. args: ["varName", "value"],
  63571. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  63572. referencedClasses: ["Transcript"],
  63573. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  63574. }),
  63575. $globals.Repl);
  63576. $core.addMethod(
  63577. $core.method({
  63578. selector: "printWelcome",
  63579. protocol: "actions",
  63580. fn: function (){
  63581. var self=this,$self=this;
  63582. return $core.withContext(function($ctx1) {
  63583. $recv($globals.Transcript)._show_("Type :q to exit.");
  63584. $recv($globals.Transcript)._cr();
  63585. return self;
  63586. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  63587. },
  63588. args: [],
  63589. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  63590. referencedClasses: ["Transcript"],
  63591. messageSends: ["show:", "cr"]
  63592. }),
  63593. $globals.Repl);
  63594. $core.addMethod(
  63595. $core.method({
  63596. selector: "processLine:",
  63597. protocol: "private",
  63598. fn: function (buffer){
  63599. var self=this,$self=this;
  63600. var show;
  63601. return $core.withContext(function($ctx1) {
  63602. var $1,$2;
  63603. show=(function(varName,value){
  63604. return $core.withContext(function($ctx2) {
  63605. return $self._presentResultNamed_withValue_(varName,value);
  63606. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  63607. });
  63608. $1=$self._executeCommand_(buffer);
  63609. if(!$core.assert($1)){
  63610. $2=$self._isVariableDefined_(buffer);
  63611. if($core.assert($2)){
  63612. $recv(show)._value_value_(buffer,$recv($self["@session"])._perform_(buffer));
  63613. } else {
  63614. $self._assignNewVariable_do_(buffer,show);
  63615. }
  63616. }
  63617. return self;
  63618. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  63619. },
  63620. args: ["buffer"],
  63621. 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]]",
  63622. referencedClasses: [],
  63623. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  63624. }),
  63625. $globals.Repl);
  63626. $core.addMethod(
  63627. $core.method({
  63628. selector: "prompt",
  63629. protocol: "accessing",
  63630. fn: function (){
  63631. var self=this,$self=this;
  63632. return "amber >> ";
  63633. },
  63634. args: [],
  63635. source: "prompt\x0a\x09^ 'amber >> '",
  63636. referencedClasses: [],
  63637. messageSends: []
  63638. }),
  63639. $globals.Repl);
  63640. $core.addMethod(
  63641. $core.method({
  63642. selector: "setPreviousVariablesFor:from:",
  63643. protocol: "private",
  63644. fn: function (newObject,oldObject){
  63645. var self=this,$self=this;
  63646. return $core.withContext(function($ctx1) {
  63647. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  63648. return $core.withContext(function($ctx2) {
  63649. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  63650. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63651. }));
  63652. return self;
  63653. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  63654. },
  63655. args: ["newObject", "oldObject"],
  63656. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  63657. referencedClasses: [],
  63658. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  63659. }),
  63660. $globals.Repl);
  63661. $core.addMethod(
  63662. $core.method({
  63663. selector: "setPrompt",
  63664. protocol: "actions",
  63665. fn: function (){
  63666. var self=this,$self=this;
  63667. return $core.withContext(function($ctx1) {
  63668. $recv($self["@interface"])._setPrompt_($self._prompt());
  63669. return self;
  63670. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  63671. },
  63672. args: [],
  63673. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  63674. referencedClasses: [],
  63675. messageSends: ["setPrompt:", "prompt"]
  63676. }),
  63677. $globals.Repl);
  63678. $core.addMethod(
  63679. $core.method({
  63680. selector: "setupCommands",
  63681. protocol: "initialization",
  63682. fn: function (){
  63683. var self=this,$self=this;
  63684. return $core.withContext(function($ctx1) {
  63685. var $2,$1;
  63686. $2=$recv([":q"]).__minus_gt((function(){
  63687. return $core.withContext(function($ctx2) {
  63688. return $recv(process)._exit();
  63689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63690. }));
  63691. $ctx1.sendIdx["->"]=1;
  63692. $1=[$2,$recv([""]).__minus_gt((function(){
  63693. return $core.withContext(function($ctx2) {
  63694. return $recv($self["@interface"])._prompt();
  63695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63696. }))];
  63697. $self["@commands"]=$recv($globals.Dictionary)._from_($1);
  63698. return self;
  63699. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  63700. },
  63701. args: [],
  63702. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  63703. referencedClasses: ["Dictionary"],
  63704. messageSends: ["from:", "->", "exit", "prompt"]
  63705. }),
  63706. $globals.Repl);
  63707. $core.addMethod(
  63708. $core.method({
  63709. selector: "setupHotkeys",
  63710. protocol: "initialization",
  63711. fn: function (){
  63712. var self=this,$self=this;
  63713. return $core.withContext(function($ctx1) {
  63714. var $receiver;
  63715. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  63716. return $core.withContext(function($ctx2) {
  63717. if(($receiver = key) == null || $receiver.a$nil){
  63718. return key;
  63719. } else {
  63720. return $self._onKeyPress_(key);
  63721. }
  63722. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  63723. }));
  63724. return self;
  63725. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  63726. },
  63727. args: [],
  63728. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  63729. referencedClasses: [],
  63730. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  63731. }),
  63732. $globals.Repl);
  63733. $core.addMethod(
  63734. $core.method({
  63735. selector: "subclass:withVariable:",
  63736. protocol: "private",
  63737. fn: function (aClass,varName){
  63738. var self=this,$self=this;
  63739. return $core.withContext(function($ctx1) {
  63740. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  63741. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  63742. },
  63743. args: ["aClass", "varName"],
  63744. 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'",
  63745. referencedClasses: ["ClassBuilder"],
  63746. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  63747. }),
  63748. $globals.Repl);
  63749. $core.addMethod(
  63750. $core.method({
  63751. selector: "subclassNameFor:",
  63752. protocol: "private",
  63753. fn: function (aClass){
  63754. var self=this,$self=this;
  63755. return $core.withContext(function($ctx1) {
  63756. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  63757. $2=$recv(aClass)._name();
  63758. $ctx1.sendIdx["name"]=1;
  63759. $1=$recv($2)._matchesOf_("\x5cd+$");
  63760. $ctx1.sendIdx["matchesOf:"]=1;
  63761. if(($receiver = $1) == null || $receiver.a$nil){
  63762. return $recv($recv(aClass)._name()).__comma("2");
  63763. } else {
  63764. var counter;
  63765. $6=$recv(aClass)._name();
  63766. $ctx1.sendIdx["name"]=2;
  63767. $5=$recv($6)._matchesOf_("\x5cd+$");
  63768. $4=$recv($5)._first();
  63769. $3=$recv($4)._asNumber();
  63770. counter=$recv($3).__plus((1));
  63771. counter;
  63772. $7=$recv(aClass)._name();
  63773. $ctx1.sendIdx["name"]=3;
  63774. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  63775. }
  63776. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  63777. },
  63778. args: ["aClass"],
  63779. 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'].",
  63780. referencedClasses: [],
  63781. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  63782. }),
  63783. $globals.Repl);
  63784. $core.addMethod(
  63785. $core.method({
  63786. selector: "main",
  63787. protocol: "initialization",
  63788. fn: function (){
  63789. var self=this,$self=this;
  63790. return $core.withContext(function($ctx1) {
  63791. $recv($self._new())._createInterface();
  63792. return self;
  63793. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.a$cls)});
  63794. },
  63795. args: [],
  63796. source: "main\x0a\x09self new createInterface",
  63797. referencedClasses: [],
  63798. messageSends: ["createInterface", "new"]
  63799. }),
  63800. $globals.Repl.a$cls);
  63801. });
  63802. (function () {
  63803. define('__app__',["amber/devel", "amber_core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
  63804. amber.initialize().then(function () {
  63805. amber.globals.AmberCli._main();
  63806. });
  63807. });
  63808. }());
  63809. require(["app"]);
  63810. });
  63811. define.require('__wrap__');
  63812. }((function amdefine(module, requireFn) {
  63813. 'use strict';
  63814. var defineCache = {},
  63815. loaderCache = {},
  63816. alreadyCalled = false,
  63817. path = require('path'),
  63818. makeRequire, stringRequire;
  63819. /**
  63820. * Trims the . and .. from an array of path segments.
  63821. * It will keep a leading path segment if a .. will become
  63822. * the first path segment, to help with module name lookups,
  63823. * which act like paths, but can be remapped. But the end result,
  63824. * all paths that use this function should look normalized.
  63825. * NOTE: this method MODIFIES the input array.
  63826. * @param {Array} ary the array of path segments.
  63827. */
  63828. function trimDots(ary) {
  63829. var i, part;
  63830. for (i = 0; ary[i]; i+= 1) {
  63831. part = ary[i];
  63832. if (part === '.') {
  63833. ary.splice(i, 1);
  63834. i -= 1;
  63835. } else if (part === '..') {
  63836. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  63837. //End of the line. Keep at least one non-dot
  63838. //path segment at the front so it can be mapped
  63839. //correctly to disk. Otherwise, there is likely
  63840. //no path mapping for a path starting with '..'.
  63841. //This can still fail, but catches the most reasonable
  63842. //uses of ..
  63843. break;
  63844. } else if (i > 0) {
  63845. ary.splice(i - 1, 2);
  63846. i -= 2;
  63847. }
  63848. }
  63849. }
  63850. }
  63851. function normalize(name, baseName) {
  63852. var baseParts;
  63853. //Adjust any relative paths.
  63854. if (name && name.charAt(0) === '.') {
  63855. //If have a base name, try to normalize against it,
  63856. //otherwise, assume it is a top-level require that will
  63857. //be relative to baseUrl in the end.
  63858. if (baseName) {
  63859. baseParts = baseName.split('/');
  63860. baseParts = baseParts.slice(0, baseParts.length - 1);
  63861. baseParts = baseParts.concat(name.split('/'));
  63862. trimDots(baseParts);
  63863. name = baseParts.join('/');
  63864. }
  63865. }
  63866. return name;
  63867. }
  63868. /**
  63869. * Create the normalize() function passed to a loader plugin's
  63870. * normalize method.
  63871. */
  63872. function makeNormalize(relName) {
  63873. return function (name) {
  63874. return normalize(name, relName);
  63875. };
  63876. }
  63877. function makeLoad(id) {
  63878. function load(value) {
  63879. loaderCache[id] = value;
  63880. }
  63881. load.fromText = function (id, text) {
  63882. //This one is difficult because the text can/probably uses
  63883. //define, and any relative paths and requires should be relative
  63884. //to that id was it would be found on disk. But this would require
  63885. //bootstrapping a module/require fairly deeply from node core.
  63886. //Not sure how best to go about that yet.
  63887. throw new Error('amdefine does not implement load.fromText');
  63888. };
  63889. return load;
  63890. }
  63891. makeRequire = function (systemRequire, exports, module, relId) {
  63892. function amdRequire(deps, callback) {
  63893. if (typeof deps === 'string') {
  63894. //Synchronous, single module require('')
  63895. return stringRequire(systemRequire, exports, module, deps, relId);
  63896. } else {
  63897. //Array of dependencies with a callback.
  63898. //Convert the dependencies to modules.
  63899. deps = deps.map(function (depName) {
  63900. return stringRequire(systemRequire, exports, module, depName, relId);
  63901. });
  63902. //Wait for next tick to call back the require call.
  63903. if (callback) {
  63904. process.nextTick(function () {
  63905. callback.apply(null, deps);
  63906. });
  63907. }
  63908. }
  63909. }
  63910. amdRequire.toUrl = function (filePath) {
  63911. if (filePath.indexOf('.') === 0) {
  63912. return normalize(filePath, path.dirname(module.filename));
  63913. } else {
  63914. return filePath;
  63915. }
  63916. };
  63917. return amdRequire;
  63918. };
  63919. //Favor explicit value, passed in if the module wants to support Node 0.4.
  63920. requireFn = requireFn || function req() {
  63921. return module.require.apply(module, arguments);
  63922. };
  63923. function runFactory(id, deps, factory) {
  63924. var r, e, m, result;
  63925. if (id) {
  63926. e = loaderCache[id] = {};
  63927. m = {
  63928. id: id,
  63929. uri: __filename,
  63930. exports: e
  63931. };
  63932. r = makeRequire(requireFn, e, m, id);
  63933. } else {
  63934. //Only support one define call per file
  63935. if (alreadyCalled) {
  63936. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  63937. }
  63938. alreadyCalled = true;
  63939. //Use the real variables from node
  63940. //Use module.exports for exports, since
  63941. //the exports in here is amdefine exports.
  63942. e = module.exports;
  63943. m = module;
  63944. r = makeRequire(requireFn, e, m, module.id);
  63945. }
  63946. //If there are dependencies, they are strings, so need
  63947. //to convert them to dependency values.
  63948. if (deps) {
  63949. deps = deps.map(function (depName) {
  63950. return r(depName);
  63951. });
  63952. }
  63953. //Call the factory with the right dependencies.
  63954. if (typeof factory === 'function') {
  63955. result = factory.apply(m.exports, deps);
  63956. } else {
  63957. result = factory;
  63958. }
  63959. if (result !== undefined) {
  63960. m.exports = result;
  63961. if (id) {
  63962. loaderCache[id] = m.exports;
  63963. }
  63964. }
  63965. }
  63966. stringRequire = function (systemRequire, exports, module, id, relId) {
  63967. //Split the ID by a ! so that
  63968. var index = id.indexOf('!'),
  63969. originalId = id,
  63970. prefix, plugin;
  63971. if (index === -1) {
  63972. id = normalize(id, relId);
  63973. //Straight module lookup. If it is one of the special dependencies,
  63974. //deal with it, otherwise, delegate to node.
  63975. if (id === 'require') {
  63976. return makeRequire(systemRequire, exports, module, relId);
  63977. } else if (id === 'exports') {
  63978. return exports;
  63979. } else if (id === 'module') {
  63980. return module;
  63981. } else if (loaderCache.hasOwnProperty(id)) {
  63982. return loaderCache[id];
  63983. } else if (defineCache[id]) {
  63984. runFactory.apply(null, defineCache[id]);
  63985. return loaderCache[id];
  63986. } else {
  63987. if(systemRequire) {
  63988. return systemRequire(originalId);
  63989. } else {
  63990. throw new Error('No module with ID: ' + id);
  63991. }
  63992. }
  63993. } else {
  63994. //There is a plugin in play.
  63995. prefix = id.substring(0, index);
  63996. id = id.substring(index + 1, id.length);
  63997. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  63998. if (plugin.normalize) {
  63999. id = plugin.normalize(id, makeNormalize(relId));
  64000. } else {
  64001. //Normalize the ID normally.
  64002. id = normalize(id, relId);
  64003. }
  64004. if (loaderCache[id]) {
  64005. return loaderCache[id];
  64006. } else {
  64007. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  64008. return loaderCache[id];
  64009. }
  64010. }
  64011. };
  64012. //Create a define function specific to the module asking for amdefine.
  64013. function define(id, deps, factory) {
  64014. if (Array.isArray(id)) {
  64015. factory = deps;
  64016. deps = id;
  64017. id = undefined;
  64018. } else if (typeof id !== 'string') {
  64019. factory = id;
  64020. id = deps = undefined;
  64021. }
  64022. if (deps && !Array.isArray(deps)) {
  64023. factory = deps;
  64024. deps = undefined;
  64025. }
  64026. if (!deps) {
  64027. deps = ['require', 'exports', 'module'];
  64028. }
  64029. //Set up properties for this module. If an ID, then use
  64030. //internal cache. If no ID, then use the external variables
  64031. //for this node module.
  64032. if (id) {
  64033. //Put the module in deep freeze until there is a
  64034. //require call for it.
  64035. defineCache[id] = [id, deps, factory];
  64036. } else {
  64037. runFactory(id, deps, factory);
  64038. }
  64039. }
  64040. //define.require, which has access to all the values in the
  64041. //cache. Useful for AMD modules that all have IDs in the file,
  64042. //but need to finally export a value to node based on one of those
  64043. //IDs.
  64044. define.require = function (id) {
  64045. if (loaderCache[id]) {
  64046. return loaderCache[id];
  64047. }
  64048. if (defineCache[id]) {
  64049. runFactory.apply(null, defineCache[id]);
  64050. return loaderCache[id];
  64051. }
  64052. };
  64053. define.amd = {};
  64054. return define;
  64055. }(module)), require));